Pass correct peer to venue search.

This commit is contained in:
John Preston 2024-07-12 17:00:16 +02:00
parent 8aac07b3c0
commit b83b403b75
4 changed files with 21 additions and 24 deletions

View file

@ -1428,21 +1428,6 @@ pickLocationWindow: size(364px, 680px);
pickLocationMapHeight: 220px;
pickLocationCollapsedHeight: 92px;
pickLocationRowHeight: 52px;
pickLocationVenue: PeerListItem(defaultPeerListItem) {
height: pickLocationRowHeight;
photoSize: 42px;
photoPosition: point(18px, 5px);
namePosition: point(70px, 9px);
statusPosition: point(70px, 29px);
button: OutlineButton(defaultPeerListButton) {
textBg: contactsBg;
textBgOver: contactsBgOver;
ripple: defaultRippleAnimation;
}
statusFg: contactsStatusFg;
statusFgOver: contactsStatusFgOver;
statusFgActive: contactsStatusFgOnline;
}
pickLocationButton: FlatButton {
height: pickLocationRowHeight;
bgColor: contactsBg;
@ -1451,25 +1436,33 @@ pickLocationButton: FlatButton {
}
pickLocationButtonText: FlatLabel(defaultFlatLabel) {
minWidth: 128px;
maxHeight: 20px;
style: semiboldTextStyle;
textFg: windowBoldFg;
}
pickLocationButtonStatus: FlatLabel(defaultFlatLabel) {
minWidth: 128px;
maxHeight: 20px;
textFg: windowSubTextFg;
}
pickLocationButtonSkip: 6px;
pickLocationSendIcon: icon{{ "chat/filled_location", windowFgActive }};
pickLocationVenueItem: PeerListItem(defaultPeerListItem) {
button: OutlineButton(defaultPeerListButton) {
font: normalFont;
padding: margins(11px, 5px, 11px, 5px);
}
height: 52px;
height: pickLocationRowHeight;
photoSize: 42px;
photoPosition: point(18px, 5px);
namePosition: point(70px, 7px);
statusPosition: point(70px, 27px);
photoSize: 42px;
button: OutlineButton(defaultPeerListButton) {
textBg: contactsBg;
textBgOver: contactsBgOver;
font: normalFont;
padding: margins(11px, 5px, 11px, 5px);
ripple: defaultRippleAnimation;
}
statusFg: contactsStatusFg;
statusFgOver: contactsStatusFgOver;
statusFgActive: contactsStatusFgOnline;
}
pickLocationVenueList: PeerList(defaultPeerList) {
item: pickLocationVenueItem;

View file

@ -1822,6 +1822,7 @@ void ChooseAndSendLocation(
Ui::LocationPicker::Show({
.parent = controller->widget(),
.config = config,
.recipient = action.history->peer,
.session = &controller->session(),
.callback = crl::guard(controller, callback),
.quit = [] { Shortcuts::Launch(Shortcuts::Command::Quit); },

View file

@ -409,7 +409,7 @@ void VenuesController::rowPaintIcon(
st::pickLocationButton);
const auto raw = result.data();
const auto st = &st::pickLocationVenue;
const auto st = &st::pickLocationVenueItem;
const auto icon = CreateChild<RpWidget>(raw);
icon->setGeometry(
st->photoPosition.x(),
@ -628,7 +628,8 @@ LocationPicker::LocationPicker(Descriptor &&descriptor)
venuesRequest(*_venuesSearchLocation, *_venuesSearchQuery);
})
, _api(&_session->mtp()) {
, _api(&_session->mtp())
, _venueRecipient(descriptor.recipient) {
std::move(
descriptor.closeRequests
) | rpl::start_with_next([=] {
@ -1002,7 +1003,7 @@ void LocationPicker::venuesSendRequest() {
_venuesRequestId = _api.request(MTPmessages_GetInlineBotResults(
MTP_flags(MTPmessages_GetInlineBotResults::Flag::f_geo_point),
_venuesBot->inputUser,
MTP_inputPeerEmpty(),
(_venueRecipient ? _venueRecipient->input : MTP_inputPeerEmpty()),
MTP_inputGeoPoint(
MTP_flags(0),
MTP_double(_venuesRequestLocation.point.x()),

View file

@ -80,6 +80,7 @@ public:
struct Descriptor {
RpWidget *parent = nullptr;
LocationPickerConfig config;
PeerData *recipient = nullptr;
not_null<Main::Session*> session;
Fn<void(Data::InputVenue)> callback;
Fn<void()> quit;
@ -145,6 +146,7 @@ private:
std::optional<QString> _venuesSearchQuery;
base::Timer _venuesSearchDebounceTimer;
MTP::Sender _api;
PeerData *_venueRecipient = nullptr;
UserData *_venuesBot = nullptr;
mtpRequestId _venuesBotRequestId = 0;
mtpRequestId _venuesRequestId = 0;