Better support for GEO_LIVE_PENDING push notifications.
GitOrigin-RevId: 7fb392ec0e6471a09a3b325db48531700204c039
This commit is contained in:
parent
1dd4e1a767
commit
fa04e668f6
@ -5701,15 +5701,34 @@ void MessagesManager::on_update_live_location_viewed(FullMessageId full_message_
|
||||
return;
|
||||
}
|
||||
|
||||
auto active_live_locations = get_active_live_location_messages(Auto());
|
||||
if (!td::contains(active_live_locations, full_message_id)) {
|
||||
LOG(DEBUG) << "Can't find " << full_message_id << " in " << active_live_locations;
|
||||
auto active_live_location_message_ids = get_active_live_location_messages(Auto());
|
||||
if (!td::contains(active_live_location_message_ids, full_message_id)) {
|
||||
LOG(DEBUG) << "Can't find " << full_message_id << " in " << active_live_location_message_ids;
|
||||
return;
|
||||
}
|
||||
|
||||
send_update_message_live_location_viewed(full_message_id);
|
||||
}
|
||||
|
||||
void MessagesManager::on_update_some_live_location_viewed(Promise<Unit> &&promise) {
|
||||
LOG(DEBUG) << "Some live location was viewed";
|
||||
if (!are_active_live_location_messages_loaded_) {
|
||||
get_active_live_location_messages(
|
||||
PromiseCreator::lambda([actor_id = actor_id(this), promise = std::move(promise)](Unit result) mutable {
|
||||
send_closure(actor_id, &MessagesManager::on_update_some_live_location_viewed, std::move(promise));
|
||||
}));
|
||||
return;
|
||||
}
|
||||
|
||||
// update all live locations, because it is unknown, which exactly was viewed
|
||||
auto active_live_location_message_ids = get_active_live_location_messages(Auto());
|
||||
for (auto full_message_id : active_live_location_message_ids) {
|
||||
send_update_message_live_location_viewed(full_message_id);
|
||||
}
|
||||
|
||||
promise.set_value(Unit());
|
||||
}
|
||||
|
||||
void MessagesManager::on_update_message_content(FullMessageId full_message_id) {
|
||||
const Dialog *d = get_dialog(full_message_id.get_dialog_id());
|
||||
CHECK(d != nullptr);
|
||||
|
@ -313,6 +313,8 @@ class MessagesManager : public Actor {
|
||||
|
||||
void on_update_live_location_viewed(FullMessageId full_message_id);
|
||||
|
||||
void on_update_some_live_location_viewed(Promise<Unit> &&promise);
|
||||
|
||||
void on_update_message_content(FullMessageId full_message_id);
|
||||
|
||||
void on_read_channel_inbox(ChannelId channel_id, MessageId max_message_id, int32 server_unread_count, int32 pts,
|
||||
|
@ -3017,7 +3017,8 @@ Status NotificationManager::process_push_notification_payload(string payload, bo
|
||||
}
|
||||
|
||||
if (loc_key == "GEO_LIVE_PENDING") {
|
||||
return Status::Error(406, "Need update live location");
|
||||
td_->messages_manager_->on_update_some_live_location_viewed(std::move(promise));
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
if (loc_key == "AUTH_REGION" || loc_key == "AUTH_UNKNOWN") {
|
||||
|
Loading…
Reference in New Issue
Block a user