Add notificationTypeNewPushMessage.is_outgoing.
GitOrigin-RevId: c7ef758bef2b49cd08cab73520c2814e039e2154
This commit is contained in:
parent
44b31537aa
commit
c0c87e5560
@ -2303,8 +2303,9 @@ notificationTypeNewCall call_id:int32 = NotificationType;
|
|||||||
//@message_id The message identifier. The message will not be available in the chat history, but the ID can be used in viewMessages and as reply_to_message_id
|
//@message_id The message identifier. The message will not be available in the chat history, but the ID can be used in viewMessages and as reply_to_message_id
|
||||||
//@sender_user_id Sender of the message; 0 if unknown. Corresponding user may be inaccessible
|
//@sender_user_id Sender of the message; 0 if unknown. Corresponding user may be inaccessible
|
||||||
//@sender_name Name of the sender; can be different from the name of the sender user
|
//@sender_name Name of the sender; can be different from the name of the sender user
|
||||||
|
//@is_outgoing True, if the message is outgoing
|
||||||
//@content Push message content
|
//@content Push message content
|
||||||
notificationTypeNewPushMessage message_id:int53 sender_user_id:int32 sender_name:string content:PushMessageContent = NotificationType;
|
notificationTypeNewPushMessage message_id:int53 sender_user_id:int32 sender_name:string is_outgoing:Bool content:PushMessageContent = NotificationType;
|
||||||
|
|
||||||
|
|
||||||
//@class NotificationGroupType @description Describes the type of notifications in a notification group
|
//@class NotificationGroupType @description Describes the type of notifications in a notification group
|
||||||
|
Binary file not shown.
@ -3592,11 +3592,13 @@ void NotificationManager::add_message_push_notification(
|
|||||||
auto group_id = info.group_id;
|
auto group_id = info.group_id;
|
||||||
CHECK(group_id.is_valid());
|
CHECK(group_id.is_valid());
|
||||||
|
|
||||||
|
bool is_outgoing =
|
||||||
|
sender_user_id.is_valid() ? td_->contacts_manager_->get_my_id() == sender_user_id : is_from_scheduled;
|
||||||
if (logevent_id != 0) {
|
if (logevent_id != 0) {
|
||||||
VLOG(notifications) << "Register temporary " << notification_id << " with logevent " << logevent_id;
|
VLOG(notifications) << "Register temporary " << notification_id << " with logevent " << logevent_id;
|
||||||
temporary_notification_logevent_ids_[notification_id] = logevent_id;
|
temporary_notification_logevent_ids_[notification_id] = logevent_id;
|
||||||
temporary_notifications_[FullMessageId(dialog_id, message_id)] = {group_id, notification_id, sender_user_id,
|
temporary_notifications_[FullMessageId(dialog_id, message_id)] = {group_id, notification_id, sender_user_id,
|
||||||
sender_name};
|
sender_name, is_outgoing};
|
||||||
temporary_notification_message_ids_[notification_id] = FullMessageId(dialog_id, message_id);
|
temporary_notification_message_ids_[notification_id] = FullMessageId(dialog_id, message_id);
|
||||||
}
|
}
|
||||||
push_notification_promises_[notification_id].push_back(std::move(promise));
|
push_notification_promises_[notification_id].push_back(std::move(promise));
|
||||||
@ -3609,11 +3611,11 @@ void NotificationManager::add_message_push_notification(
|
|||||||
<< " and document " << document << " to " << group_id << " of type " << group_type
|
<< " and document " << document << " to " << group_id << " of type " << group_type
|
||||||
<< " with settings from " << settings_dialog_id;
|
<< " with settings from " << settings_dialog_id;
|
||||||
|
|
||||||
add_notification(group_id, group_type, dialog_id, date, settings_dialog_id, initial_is_silent, is_silent, 0,
|
add_notification(
|
||||||
notification_id,
|
group_id, group_type, dialog_id, date, settings_dialog_id, initial_is_silent, is_silent, 0, notification_id,
|
||||||
create_new_push_message_notification(sender_user_id, sender_name, message_id, std::move(loc_key),
|
create_new_push_message_notification(sender_user_id, sender_name, is_outgoing, message_id, std::move(loc_key),
|
||||||
std::move(arg), std::move(photo), std::move(document)),
|
std::move(arg), std::move(photo), std::move(document)),
|
||||||
"add_message_push_notification");
|
"add_message_push_notification");
|
||||||
}
|
}
|
||||||
|
|
||||||
class NotificationManager::EditMessagePushNotificationLogEvent {
|
class NotificationManager::EditMessagePushNotificationLogEvent {
|
||||||
@ -3706,6 +3708,7 @@ void NotificationManager::edit_message_push_notification(DialogId dialog_id, Mes
|
|||||||
auto notification_id = it->second.notification_id;
|
auto notification_id = it->second.notification_id;
|
||||||
auto sender_user_id = it->second.sender_user_id;
|
auto sender_user_id = it->second.sender_user_id;
|
||||||
auto sender_name = it->second.sender_name;
|
auto sender_name = it->second.sender_name;
|
||||||
|
auto is_outgoing = it->second.is_outgoing;
|
||||||
CHECK(group_id.is_valid());
|
CHECK(group_id.is_valid());
|
||||||
CHECK(notification_id.is_valid());
|
CHECK(notification_id.is_valid());
|
||||||
|
|
||||||
@ -3732,8 +3735,8 @@ void NotificationManager::edit_message_push_notification(DialogId dialog_id, Mes
|
|||||||
|
|
||||||
edit_notification(
|
edit_notification(
|
||||||
group_id, notification_id,
|
group_id, notification_id,
|
||||||
create_new_push_message_notification(sender_user_id, std::move(sender_name), message_id, std::move(loc_key),
|
create_new_push_message_notification(sender_user_id, std::move(sender_name), is_outgoing, message_id,
|
||||||
std::move(arg), std::move(photo), std::move(document)));
|
std::move(loc_key), std::move(arg), std::move(photo), std::move(document)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int64> NotificationManager::get_push_receiver_id(string payload) {
|
Result<int64> NotificationManager::get_push_receiver_id(string payload) {
|
||||||
|
@ -389,6 +389,7 @@ class NotificationManager : public Actor {
|
|||||||
NotificationId notification_id;
|
NotificationId notification_id;
|
||||||
UserId sender_user_id;
|
UserId sender_user_id;
|
||||||
string sender_name;
|
string sender_name;
|
||||||
|
bool is_outgoing;
|
||||||
};
|
};
|
||||||
std::unordered_map<FullMessageId, TemporaryNotification, FullMessageIdHash> temporary_notifications_;
|
std::unordered_map<FullMessageId, TemporaryNotification, FullMessageIdHash> temporary_notifications_;
|
||||||
std::unordered_map<NotificationId, FullMessageId, NotificationIdHash> temporary_notification_message_ids_;
|
std::unordered_map<NotificationId, FullMessageId, NotificationIdHash> temporary_notification_message_ids_;
|
||||||
|
@ -321,7 +321,7 @@ class NotificationTypePushMessage : public NotificationType {
|
|||||||
auto sender_user_id = G()->td().get_actor_unsafe()->contacts_manager_->get_user_id_object(
|
auto sender_user_id = G()->td().get_actor_unsafe()->contacts_manager_->get_user_id_object(
|
||||||
sender_user_id_, "get_notification_type_object");
|
sender_user_id_, "get_notification_type_object");
|
||||||
return td_api::make_object<td_api::notificationTypeNewPushMessage>(
|
return td_api::make_object<td_api::notificationTypeNewPushMessage>(
|
||||||
message_id_.get(), sender_user_id, sender_name_,
|
message_id_.get(), sender_user_id, sender_name_, is_outgoing_,
|
||||||
get_push_message_content_object(key_, arg_, photo_, document_));
|
get_push_message_content_object(key_, arg_, photo_, document_));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,17 +337,19 @@ class NotificationTypePushMessage : public NotificationType {
|
|||||||
string arg_;
|
string arg_;
|
||||||
Photo photo_;
|
Photo photo_;
|
||||||
Document document_;
|
Document document_;
|
||||||
|
bool is_outgoing_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NotificationTypePushMessage(UserId sender_user_id, string sender_name, MessageId message_id, string key, string arg,
|
NotificationTypePushMessage(UserId sender_user_id, string sender_name, bool is_outgoing, MessageId message_id,
|
||||||
Photo photo, Document document)
|
string key, string arg, Photo photo, Document document)
|
||||||
: sender_user_id_(std::move(sender_user_id))
|
: sender_user_id_(std::move(sender_user_id))
|
||||||
, message_id_(message_id)
|
, message_id_(message_id)
|
||||||
, sender_name_(std::move(sender_name))
|
, sender_name_(std::move(sender_name))
|
||||||
, key_(std::move(key))
|
, key_(std::move(key))
|
||||||
, arg_(std::move(arg))
|
, arg_(std::move(arg))
|
||||||
, photo_(std::move(photo))
|
, photo_(std::move(photo))
|
||||||
, document_(std::move(document)) {
|
, document_(std::move(document))
|
||||||
|
, is_outgoing_(is_outgoing) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -364,9 +366,9 @@ unique_ptr<NotificationType> create_new_call_notification(CallId call_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unique_ptr<NotificationType> create_new_push_message_notification(UserId sender_user_id, string sender_name,
|
unique_ptr<NotificationType> create_new_push_message_notification(UserId sender_user_id, string sender_name,
|
||||||
MessageId message_id, string key, string arg,
|
bool is_outgoing, MessageId message_id, string key,
|
||||||
Photo photo, Document document) {
|
string arg, Photo photo, Document document) {
|
||||||
return td::make_unique<NotificationTypePushMessage>(sender_user_id, std::move(sender_name), message_id,
|
return td::make_unique<NotificationTypePushMessage>(sender_user_id, std::move(sender_name), is_outgoing, message_id,
|
||||||
std::move(key), std::move(arg), std::move(photo),
|
std::move(key), std::move(arg), std::move(photo),
|
||||||
std::move(document));
|
std::move(document));
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ unique_ptr<NotificationType> create_new_secret_chat_notification();
|
|||||||
unique_ptr<NotificationType> create_new_call_notification(CallId call_id);
|
unique_ptr<NotificationType> create_new_call_notification(CallId call_id);
|
||||||
|
|
||||||
unique_ptr<NotificationType> create_new_push_message_notification(UserId sender_user_id, string sender_name,
|
unique_ptr<NotificationType> create_new_push_message_notification(UserId sender_user_id, string sender_name,
|
||||||
MessageId message_id, string key, string arg,
|
bool is_outgoing, MessageId message_id, string key,
|
||||||
Photo photo, Document document);
|
string arg, Photo photo, Document document);
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
Reference in New Issue
Block a user