Support document and audio albums in push notifications.

GitOrigin-RevId: afeefd5ae91bbcf44dc18ad0815afa9c23cea613
This commit is contained in:
levlam 2020-10-20 13:21:09 +03:00
parent 44b9ce89b8
commit ec61ef8093
4 changed files with 22 additions and 4 deletions

View File

@ -2587,7 +2587,8 @@ pushMessageContentChatJoinByLink = PushMessageContent;
pushMessageContentMessageForwards total_count:int32 = PushMessageContent;
//@description A media album @total_count Number of messages in the album @has_photos True, if the album has at least one photo @has_videos True, if the album has at least one video
pushMessageContentMediaAlbum total_count:int32 has_photos:Bool has_videos:Bool = PushMessageContent;
//@has_audios True, if the album has at least one audio file @has_documents True, if the album has at least one document
pushMessageContentMediaAlbum total_count:int32 has_photos:Bool has_videos:Bool has_audios:Bool has_documents:Bool = PushMessageContent;
//@class NotificationType @description Contains detailed information about a notification

Binary file not shown.

View File

@ -2722,6 +2722,9 @@ string NotificationManager::convert_loc_key(const string &loc_key) {
if (loc_key == "MESSAGE_DOC") {
return "MESSAGE_DOCUMENT";
}
if (loc_key == "MESSAGE_DOCS") {
return "MESSAGE_DOCUMENTS";
}
if (loc_key == "ENCRYPTED_MESSAGE") {
return "MESSAGE";
}
@ -2829,6 +2832,9 @@ string NotificationManager::convert_loc_key(const string &loc_key) {
if (loc_key == "MESSAGE_PHOTO_SECRET") {
return "MESSAGE_SECRET_PHOTO";
}
if (loc_key == "MESSAGE_PLAYLIST") {
return "MESSAGE_AUDIOS";
}
if (loc_key == "MESSAGE_POLL") {
return "MESSAGE_POLL";
}

View File

@ -156,7 +156,8 @@ class NotificationTypePushMessage : public NotificationType {
return td_api::make_object<td_api::pushMessageContentHidden>(is_pinned);
}
if (key == "MESSAGES") {
return td_api::make_object<td_api::pushMessageContentMediaAlbum>(to_integer<int32>(arg), true, true);
return td_api::make_object<td_api::pushMessageContentMediaAlbum>(to_integer<int32>(arg), true, true, false,
false);
}
CHECK(key.size() > 8);
switch (key[8]) {
@ -171,6 +172,10 @@ class NotificationTypePushMessage : public NotificationType {
return td_api::make_object<td_api::pushMessageContentAudio>(
audios_manager->get_audio_object(document.file_id), is_pinned);
}
if (key == "MESSAGE_AUDIOS") {
return td_api::make_object<td_api::pushMessageContentMediaAlbum>(to_integer<int32>(arg), false, false, true,
false);
}
break;
case 'B':
if (key == "MESSAGE_BASIC_GROUP_CHAT_CREATE") {
@ -218,6 +223,10 @@ class NotificationTypePushMessage : public NotificationType {
return td_api::make_object<td_api::pushMessageContentDocument>(
documents_manager->get_document_object(document.file_id, PhotoFormat::Jpeg), is_pinned);
}
if (key == "MESSAGE_DOCUMENTS") {
return td_api::make_object<td_api::pushMessageContentMediaAlbum>(to_integer<int32>(arg), false, false, false,
true);
}
break;
case 'F':
if (key == "MESSAGE_FORWARDS") {
@ -259,7 +268,8 @@ class NotificationTypePushMessage : public NotificationType {
is_pinned);
}
if (key == "MESSAGE_PHOTOS") {
return td_api::make_object<td_api::pushMessageContentMediaAlbum>(to_integer<int32>(arg), true, false);
return td_api::make_object<td_api::pushMessageContentMediaAlbum>(to_integer<int32>(arg), true, false, false,
false);
}
if (key == "MESSAGE_POLL") {
return td_api::make_object<td_api::pushMessageContentPoll>(arg, true, is_pinned);
@ -303,7 +313,8 @@ class NotificationTypePushMessage : public NotificationType {
video_notes_manager->get_video_note_object(document.file_id), is_pinned);
}
if (key == "MESSAGE_VIDEOS") {
return td_api::make_object<td_api::pushMessageContentMediaAlbum>(to_integer<int32>(arg), false, true);
return td_api::make_object<td_api::pushMessageContentMediaAlbum>(to_integer<int32>(arg), false, true, false,
false);
}
if (key == "MESSAGE_VOICE_NOTE") {
auto voice_notes_manager = G()->td().get_actor_unsafe()->voice_notes_manager_.get();