diff --git a/Telegram/Resources/tl/api.tl b/Telegram/Resources/tl/api.tl index 96cd9f2f3..625964343 100644 --- a/Telegram/Resources/tl/api.tl +++ b/Telegram/Resources/tl/api.tl @@ -214,6 +214,7 @@ peerNotifySettings#af509d20 flags:# show_previews:flags.0?Bool silent:flags.1?Bo peerSettings#818426cd flags:# report_spam:flags.0?true add_contact:flags.1?true block_contact:flags.2?true share_contact:flags.3?true need_contacts_exception:flags.4?true report_geo:flags.5?true = PeerSettings; wallPaper#a437c3ed id:long flags:# creator:flags.0?true default:flags.1?true pattern:flags.3?true dark:flags.4?true access_hash:long slug:string document:Document settings:flags.2?WallPaperSettings = WallPaper; +wallPaperNoFile#8af40b25 flags:# default:flags.1?true dark:flags.4?true settings:flags.2?WallPaperSettings = WallPaper; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; @@ -1030,15 +1031,16 @@ chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags inputWallPaper#e630b979 id:long access_hash:long = InputWallPaper; inputWallPaperSlug#72091c80 slug:string = InputWallPaper; +inputWallPaperNoFile#8427bbac = InputWallPaper; account.wallPapersNotModified#1c199183 = account.WallPapers; account.wallPapers#702b65a9 hash:int wallpapers:Vector = account.WallPapers; codeSettings#debebe83 flags:# allow_flashcall:flags.0?true current_number:flags.1?true allow_app_hash:flags.4?true = CodeSettings; -wallPaperSettings#a12f40b8 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int intensity:flags.3?int = WallPaperSettings; +wallPaperSettings#5086cf8 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int second_background_color:flags.4?int intensity:flags.3?int rotation:flags.4?int = WallPaperSettings; -autoDownloadSettings#d246fd47 flags:# disabled:flags.0?true video_preload_large:flags.1?true audio_preload_next:flags.2?true phonecalls_less_data:flags.3?true photo_size_max:int video_size_max:int file_size_max:int = AutoDownloadSettings; +autoDownloadSettings#e04232f3 flags:# disabled:flags.0?true video_preload_large:flags.1?true audio_preload_next:flags.2?true phonecalls_less_data:flags.3?true photo_size_max:int video_size_max:int file_size_max:int video_upload_maxbitrate:int = AutoDownloadSettings; account.autoDownloadSettings#63cacf26 low:AutoDownloadSettings medium:AutoDownloadSettings high:AutoDownloadSettings = account.AutoDownloadSettings; @@ -1076,7 +1078,7 @@ inputTheme#3c5693e9 id:long access_hash:long = InputTheme; inputThemeSlug#f5890df1 slug:string = InputTheme; themeDocumentNotModified#483d270c = Theme; -theme#f7d90ce0 flags:# creator:flags.0?true default:flags.1?true id:long access_hash:long slug:string title:string document:flags.2?Document installs_count:int = Theme; +theme#28f1114 flags:# creator:flags.0?true default:flags.1?true id:long access_hash:long slug:string title:string document:flags.2?Document settings:flags.3?ThemeSettings installs_count:int = Theme; account.themesNotModified#f41eb622 = account.Themes; account.themes#7f676421 hash:int themes:Vector = account.Themes; @@ -1089,10 +1091,20 @@ auth.loginToken#629f1980 expires:int token:bytes = auth.LoginToken; auth.loginTokenMigrateTo#68e9916 dc_id:int token:bytes = auth.LoginToken; auth.loginTokenSuccess#390d5c5e authorization:auth.Authorization = auth.LoginToken; -auth.loginTokenInfo#5203303a dc_id:int auth_key_id:long device_model:string platform:string system_version:string api_id:int app_name:string app_version:string ip:string region:string = auth.LoginTokenInfo; - account.contentSettings#57e28221 flags:# sensitive_enabled:flags.0?true sensitive_can_change:flags.1?true = account.ContentSettings; +messages.inactiveChats#a927fec5 dates:Vector chats:Vector users:Vector = messages.InactiveChats; + +baseThemeClassic#c3a12462 = BaseTheme; +baseThemeDay#fbd81688 = BaseTheme; +baseThemeNight#b7b31ea8 = BaseTheme; +baseThemeTinted#6d5f77ee = BaseTheme; +baseThemeArctic#5b11125a = BaseTheme; + +inputThemeSettings#bd507cd1 flags:# base_theme:BaseTheme accent_color:int message_top_color:flags.0?int message_bottom_color:flags.0?int wallpaper:flags.1?InputWallPaper wallpaper_settings:flags.1?WallPaperSettings = InputThemeSettings; + +themeSettings#9c14984a flags:# base_theme:BaseTheme accent_color:int message_top_color:flags.0?int message_bottom_color:flags.0?int wallpaper:flags.1?WallPaper = ThemeSettings; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -1120,8 +1132,7 @@ auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector = Bool; auth.exportLoginToken#b1b41517 api_id:int api_hash:string except_ids:Vector = auth.LoginToken; auth.importLoginToken#95ac5ce4 token:bytes = auth.LoginToken; -auth.acceptLoginToken#42e731b9 token:bytes = Updates; -auth.checkLoginToken#7d4fd4b0 token:bytes = auth.LoginTokenInfo; +auth.acceptLoginToken#e894ad4d token:bytes = Authorization; account.registerDevice#68976c6f flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector = Bool; account.unregisterDevice#3076c4bf token_type:int token:string other_uids:Vector = Bool; @@ -1179,14 +1190,15 @@ account.resetWallPapers#bb3b9804 = Bool; account.getAutoDownloadSettings#56da0b3f = account.AutoDownloadSettings; account.saveAutoDownloadSettings#76f36233 flags:# low:flags.0?true high:flags.1?true settings:AutoDownloadSettings = Bool; account.uploadTheme#1c3db333 flags:# file:InputFile thumb:flags.0?InputFile file_name:string mime_type:string = Document; -account.createTheme#2b7ffd7f slug:string title:string document:InputDocument = Theme; -account.updateTheme#3b8ea202 flags:# format:string theme:InputTheme slug:flags.0?string title:flags.1?string document:flags.2?InputDocument = Theme; +account.createTheme#8432c21f flags:# slug:string title:string document:flags.2?InputDocument settings:flags.3?InputThemeSettings = Theme; +account.updateTheme#5cb367d5 flags:# format:string theme:InputTheme slug:flags.0?string title:flags.1?string document:flags.2?InputDocument settings:flags.3?InputThemeSettings = Theme; account.saveTheme#f257106c theme:InputTheme unsave:Bool = Bool; account.installTheme#7ae43737 flags:# dark:flags.0?true format:flags.1?string theme:flags.1?InputTheme = Bool; account.getTheme#8d9d742b format:string theme:InputTheme document_id:long = Theme; account.getThemes#285946f8 format:string hash:int = account.Themes; account.setContentSettings#b574b16b flags:# sensitive_enabled:flags.0?true = Bool; account.getContentSettings#8b9b4dae = account.ContentSettings; +account.getMultiWallPapers#65ad71dc wallpapers:Vector = Vector; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; @@ -1402,6 +1414,7 @@ channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = channels.editCreator#8f38cd1f channel:InputChannel user_id:InputUser password:InputCheckPasswordSRP = Updates; channels.editLocation#58e63f6d channel:InputChannel geo_point:InputGeoPoint address:string = Bool; channels.toggleSlowMode#edd49ef0 channel:InputChannel seconds:int = Updates; +channels.getInactiveChannels#11e831ee = messages.InactiveChats; bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON; bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool; diff --git a/Telegram/SourceFiles/boxes/background_preview_box.cpp b/Telegram/SourceFiles/boxes/background_preview_box.cpp index 61c3a1c05..e72908a01 100644 --- a/Telegram/SourceFiles/boxes/background_preview_box.cpp +++ b/Telegram/SourceFiles/boxes/background_preview_box.cpp @@ -716,6 +716,9 @@ void BackgroundPreviewBox::checkLoadedDocument() { return; } const auto generateCallback = [=](QImage &&image) { + if (image.isNull()) { + return; + } crl::async([ this, image = std::move(image), diff --git a/Telegram/SourceFiles/data/data_document.cpp b/Telegram/SourceFiles/data/data_document.cpp index 59bc935e0..7aeb0d124 100644 --- a/Telegram/SourceFiles/data/data_document.cpp +++ b/Telegram/SourceFiles/data/data_document.cpp @@ -587,8 +587,9 @@ bool DocumentData::checkWallPaperProperties() { || !dimensions.height() || dimensions.width() > Storage::kMaxWallPaperDimension || dimensions.height() > Storage::kMaxWallPaperDimension - || size > Storage::kMaxWallPaperInMemory) { - return false; + || size > Storage::kMaxWallPaperInMemory + || mimeString() == qstr("application/x-tgwallpattern")) { + return false; // #TODO themes support svg patterns } type = WallPaperDocument; validateGoodThumbnail(); diff --git a/Telegram/SourceFiles/data/data_file_origin.cpp b/Telegram/SourceFiles/data/data_file_origin.cpp index 05ccf3f5e..cab02c365 100644 --- a/Telegram/SourceFiles/data/data_file_origin.cpp +++ b/Telegram/SourceFiles/data/data_file_origin.cpp @@ -42,6 +42,7 @@ struct FileReferenceAccumulator { void push(const MTPWallPaper &data) { data.match([&](const MTPDwallPaper &data) { push(data.vdocument()); + }, [&](const MTPDwallPaperNoFile &data) { }); } void push(const MTPTheme &data) { diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 5816833a9..2fe40d28f 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -3721,11 +3721,9 @@ void Session::setWallpapers(const QVector &data, int32 hash) { QByteArray(), "JPG"))); for (const auto &paper : data) { - paper.match([&](const MTPDwallPaper &paper) { - if (const auto parsed = Data::WallPaper::Create(paper)) { - _wallpapers.push_back(*parsed); - } - }); + if (const auto parsed = Data::WallPaper::Create(paper)) { + _wallpapers.push_back(*parsed); + } } const auto defaultFound = ranges::find_if( _wallpapers, diff --git a/Telegram/SourceFiles/data/data_wall_paper.cpp b/Telegram/SourceFiles/data/data_wall_paper.cpp index 18a497997..334ec8fbf 100644 --- a/Telegram/SourceFiles/data/data_wall_paper.cpp +++ b/Telegram/SourceFiles/data/data_wall_paper.cpp @@ -216,7 +216,10 @@ MTPWallPaperSettings WallPaper::mtpSettings() const { (_backgroundColor ? MTP_int(SerializeMaybeColor(_backgroundColor)) : MTP_int(0)), - MTP_int(_intensity)); + MTP_int(0), // second_background_color + MTP_int(_intensity), + MTP_int(0) // rotation + ); } WallPaper WallPaper::withUrlParams( @@ -309,6 +312,8 @@ WallPaper WallPaper::withoutImageData() const { std::optional WallPaper::Create(const MTPWallPaper &data) { return data.match([](const MTPDwallPaper &data) { return Create(data); + }, [](const MTPDwallPaperNoFile &data) { + return std::optional(); // #TODO themes }); } diff --git a/Telegram/SourceFiles/window/themes/window_theme.cpp b/Telegram/SourceFiles/window/themes/window_theme.cpp index 11409f74e..584bf8a9f 100644 --- a/Telegram/SourceFiles/window/themes/window_theme.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme.cpp @@ -593,6 +593,9 @@ void ChatBackground::checkUploadWallPaper() { _session->data().documentConvert( _session->data().document(documentId), data.vdocument()); + }, [&](const MTPDwallPaperNoFile &data) { + LOG(("API Error: " + "Got wallPaperNoFile after account.UploadWallPaper.")); }); if (const auto paper = Data::WallPaper::Create(result)) { setPaper(*paper); diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp index 3fae3e864..fb92f0d32 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor_box.cpp @@ -533,9 +533,11 @@ Fn SavePreparedTheme( const auto createTheme = [=](const MTPDocument &data) { const auto document = session->data().processDocument(data); state->requestId = api->request(MTPaccount_CreateTheme( + MTP_flags(MTPaccount_CreateTheme::Flag::f_document), MTP_string(fields.slug), MTP_string(fields.title), - document->mtpInput() + document->mtpInput(), + MTPInputThemeSettings() )).done([=](const MTPTheme &result) { finish(result); }).fail([=](const RPCError &error) { @@ -557,7 +559,8 @@ Fn SavePreparedTheme( MTP_inputTheme(MTP_long(fields.id), MTP_long(fields.accessHash)), MTP_string(fields.slug), MTP_string(fields.title), - document->mtpInput() + document->mtpInput(), + MTPInputThemeSettings() )).done([=](const MTPTheme &result) { finish(result); }).fail([=](const RPCError &error) { @@ -617,9 +620,11 @@ Fn SavePreparedTheme( const auto checkFields = [=] { state->requestId = api->request(MTPaccount_CreateTheme( + MTP_flags(MTPaccount_CreateTheme::Flag::f_document), MTP_string(fields.slug), MTP_string(fields.title), - MTP_inputDocumentEmpty() + MTP_inputDocumentEmpty(), + MTPInputThemeSettings() )).done([=](const MTPTheme &result) { save(); }).fail([=](const RPCError &error) {