diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 08368d748..fc725ff1d 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -3199,6 +3199,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_maps_places_in_area" = "Places in this area"; "lng_maps_no_places" = "No places found"; "lng_maps_choose_to_search" = "Choose location to see places nearby."; +"lng_maps_venues_source" = "Powered by Foursquare"; "lng_live_location" = "Live Location"; "lng_live_location_now" = "updated just now"; "lng_live_location_minutes#one" = "updated {count} minute ago"; diff --git a/Telegram/SourceFiles/chat_helpers/chat_helpers.style b/Telegram/SourceFiles/chat_helpers/chat_helpers.style index a40d1e0ad..9b92f4815 100644 --- a/Telegram/SourceFiles/chat_helpers/chat_helpers.style +++ b/Telegram/SourceFiles/chat_helpers/chat_helpers.style @@ -1474,3 +1474,4 @@ pickLocationLoading: InfiniteRadialAnimation(defaultInfiniteRadialAnimation) { color: windowSubTextFg; thickness: 4px; } +pickLocationPromoHeight: 32px; diff --git a/Telegram/SourceFiles/ui/controls/location_picker.cpp b/Telegram/SourceFiles/ui/controls/location_picker.cpp index 5438d00d4..b461a902b 100644 --- a/Telegram/SourceFiles/ui/controls/location_picker.cpp +++ b/Telegram/SourceFiles/ui/controls/location_picker.cpp @@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/text/text_utilities.h" #include "ui/widgets/scroll_area.h" #include "ui/widgets/separate_panel.h" +#include "ui/widgets/shadow.h" #include "ui/widgets/buttons.h" #include "ui/wrap/slide_wrap.h" #include "ui/wrap/vertical_layout.h" @@ -182,6 +183,27 @@ private: return query.trimmed().toLower(); } +[[nodiscard]] object_ptr MakeFoursquarePromo() { + auto result = object_ptr((QWidget*)nullptr); + const auto raw = result.data(); + raw->resize(0, st::pickLocationPromoHeight); + const auto shadow = CreateChild(raw); + raw->widthValue() | rpl::start_with_next([=](int width) { + shadow->setGeometry(0, 0, width, st::lineWidth); + }, raw->lifetime()); + raw->paintRequest() | rpl::start_with_next([=](QRect clip) { + auto p = QPainter(raw); + p.fillRect(clip, st::windowBg); + p.setPen(st::windowSubTextFg); + p.setFont(st::normalFont); + p.drawText( + raw->rect(), + tr::lng_maps_venues_source(tr::now), + style::al_center); + }, raw->lifetime()); + return result; +} + VenuesController::VenuesController( not_null session, rpl::producer> content, @@ -214,6 +236,11 @@ void VenuesController::rebuild(const std::vector &rows) { delegate()->peerListRemoveRow(delegate()->peerListRowAt(i)); --count; } + if (i > 0) { + delegate()->peerListSetBelowWidget(MakeFoursquarePromo()); + } else { + delegate()->peerListSetBelowWidget({ nullptr }); + } delegate()->peerListRefreshRows(); }