Update API scheme on layer 107.

This commit is contained in:
John Preston 2019-12-29 14:41:10 +03:00
parent d47c138f23
commit 66204bae95
8 changed files with 49 additions and 20 deletions

View File

@ -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<WallPaper> = 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<Theme> = 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<int> chats:Vector<Chat> users:Vector<User> = 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<long> = Bool;
auth.exportLoginToken#b1b41517 api_id:int api_hash:string except_ids:Vector<int> = 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<int> = Bool;
account.unregisterDevice#3076c4bf token_type:int token:string other_uids:Vector<int> = 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<InputWallPaper> = Vector<WallPaper>;
users.getUsers#d91a548 id:Vector<InputUser> = Vector<User>;
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;

View File

@ -716,6 +716,9 @@ void BackgroundPreviewBox::checkLoadedDocument() {
return;
}
const auto generateCallback = [=](QImage &&image) {
if (image.isNull()) {
return;
}
crl::async([
this,
image = std::move(image),

View File

@ -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();

View File

@ -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) {

View File

@ -3721,11 +3721,9 @@ void Session::setWallpapers(const QVector<MTPWallPaper> &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,

View File

@ -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> WallPaper::Create(const MTPWallPaper &data) {
return data.match([](const MTPDwallPaper &data) {
return Create(data);
}, [](const MTPDwallPaperNoFile &data) {
return std::optional<WallPaper>(); // #TODO themes
});
}

View File

@ -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);

View File

@ -533,9 +533,11 @@ Fn<void()> 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<void()> 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<void()> 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) {