From e10c928207189b6554295e5662c23dfc1e5450da Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 28 Jan 2019 12:58:53 +0300 Subject: [PATCH] Update API scheme to layer 95. --- Telegram/Resources/scheme.tl | 23 +++++++++++-------- .../SourceFiles/boxes/change_phone_box.cpp | 18 +++++++++++---- .../SourceFiles/boxes/confirm_phone_box.cpp | 9 +++++++- Telegram/SourceFiles/data/data_chat.h | 2 -- Telegram/SourceFiles/data/data_session.cpp | 3 +++ Telegram/SourceFiles/intro/introphone.cpp | 7 +++--- .../passport/passport_form_controller.cpp | 5 ++-- 7 files changed, 45 insertions(+), 22 deletions(-) diff --git a/Telegram/Resources/scheme.tl b/Telegram/Resources/scheme.tl index 660df99d0..0ffdab97e 100644 --- a/Telegram/Resources/scheme.tl +++ b/Telegram/Resources/scheme.tl @@ -318,7 +318,7 @@ peerNotifySettings#af509d20 flags:# show_previews:flags.0?Bool silent:flags.1?Bo peerSettings#818426cd flags:# report_spam:flags.0?true = PeerSettings; -wallPaper#f04f91ec id:long flags:# creator:flags.0?true default:flags.1?true access_hash:long slug:string document:Document = WallPaper; +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; inputReportReasonSpam#58dbcab8 = ReportReason; inputReportReasonViolence#1e22c78d = ReportReason; @@ -1112,6 +1112,10 @@ inputWallPaperSlug#72091c80 slug:string = InputWallPaper; account.wallPapersNotModified#1c199183 = account.WallPapers; account.wallPapers#702b65a9 hash:int wallpapers:Vector = account.WallPapers; +codeSettings#302f59f3 flags:# allow_flashcall:flags.0?true current_number:flags.1?true app_hash_persistent:flags.2?true app_hash:flags.3?string = CodeSettings; + +wallPaperSettings#a12f40b8 flags:# blur:flags.1?true motion:flags.2?true background_color:flags.0?int intensity:flags.3?int = WallPaperSettings; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -1122,7 +1126,7 @@ invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; invokeWithMessagesRange#365275f2 {X:Type} range:MessageRange query:!X = X; invokeWithTakeout#aca9fd2e {X:Type} takeout_id:long query:!X = X; -auth.sendCode#86aef0ec flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string = auth.SentCode; +auth.sendCode#a677244f phone_number:string api_id:int api_hash:string settings:CodeSettings = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; @@ -1154,7 +1158,7 @@ account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; -account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; +account.sendChangePhoneCode#82574ae5 phone_number:string settings:CodeSettings = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; @@ -1162,7 +1166,7 @@ account.resetAuthorization#df77f3bc hash:long = Bool; account.getPassword#548a30f5 = account.Password; account.getPasswordSettings#9cd4eaf9 password:InputCheckPasswordSRP = account.PasswordSettings; account.updatePasswordSettings#a59b102f password:InputCheckPasswordSRP new_settings:account.PasswordInputSettings = Bool; -account.sendConfirmPhoneCode#1516d7bd flags:# allow_flashcall:flags.0?true hash:string current_number:flags.0?Bool = auth.SentCode; +account.sendConfirmPhoneCode#1b3faa88 hash:string settings:CodeSettings = auth.SentCode; account.confirmPhone#5f2178c3 phone_code_hash:string phone_code:string = Bool; account.getTmpPassword#449e0b51 password:InputCheckPasswordSRP period:int = account.TmpPassword; account.getWebAuthorizations#182e6d6f = account.WebAuthorizations; @@ -1174,7 +1178,7 @@ account.saveSecureValue#899fe31d value:InputSecureValue secure_secret_id:long = account.deleteSecureValue#b880bc4b types:Vector = Bool; account.getAuthorizationForm#b86ba8e1 bot_id:int scope:string public_key:string = account.AuthorizationForm; account.acceptAuthorization#e7027c94 bot_id:int scope:string public_key:string value_hashes:Vector credentials:SecureCredentialsEncrypted = Bool; -account.sendVerifyPhoneCode#823380b4 flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; +account.sendVerifyPhoneCode#a5a356f9 phone_number:string settings:CodeSettings = auth.SentCode; account.verifyPhone#4dd3a7f6 phone_number:string phone_code_hash:string phone_code:string = Bool; account.sendVerifyEmailCode#7011509f email:string = account.SentEmailCode; account.verifyEmail#ecba39db email:string code:string = Bool; @@ -1186,10 +1190,11 @@ account.cancelPasswordEmail#c1cbd5b6 = Bool; account.getContactSignUpNotification#9f07c728 = Bool; account.setContactSignUpNotification#cff43f61 silent:Bool = Bool; account.getNotifyExceptions#53577479 flags:# compare_sound:flags.1?true peer:flags.0?InputNotifyPeer = Updates; -account.uploadWallPaper#c7ba9b4d file:InputFile mime_type:string = WallPaper; account.getWallPaper#fc8ddbea wallpaper:InputWallPaper = WallPaper; -account.saveWallPaper#189581b3 wallpaper:InputWallPaper unsave:Bool = Bool; -account.installWallPaper#4a0378ce wallpaper:InputWallPaper = Bool; +account.uploadWallPaper#dd853661 file:InputFile mime_type:string settings:WallPaperSettings = WallPaper; +account.saveWallPaper#6c5a5b37 wallpaper:InputWallPaper unsave:Bool settings:WallPaperSettings = Bool; +account.installWallPaper#feed5769 wallpaper:InputWallPaper settings:WallPaperSettings = Bool; +account.resetWallPapers#bb3b9804 = Bool; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; @@ -1418,4 +1423,4 @@ langpack.getDifference#9d51e814 lang_code:string from_version:int = LangPackDiff langpack.getLanguages#42c6978f lang_pack:string = Vector; langpack.getLanguage#6a596502 lang_pack:string lang_code:string = LangPackLanguage; -// LAYER 93 +// LAYER 95 diff --git a/Telegram/SourceFiles/boxes/change_phone_box.cpp b/Telegram/SourceFiles/boxes/change_phone_box.cpp index 02c318333..52049527d 100644 --- a/Telegram/SourceFiles/boxes/change_phone_box.cpp +++ b/Telegram/SourceFiles/boxes/change_phone_box.cpp @@ -146,11 +146,19 @@ void ChangePhoneBox::EnterPhone::submit() { hideError(); auto phoneNumber = _phone->getLastText().trimmed(); - _requestId = MTP::send(MTPaccount_SendChangePhoneCode(MTP_flags(0), MTP_string(phoneNumber), MTP_bool(false)), rpcDone(crl::guard(this, [this, phoneNumber](const MTPauth_SentCode &result) { - return sendPhoneDone(phoneNumber, result); - })), rpcFail(crl::guard(this, [this, phoneNumber](const RPCError &error) { - return sendPhoneFail(phoneNumber, error); - }))); + _requestId = MTP::send( + MTPaccount_SendChangePhoneCode( + MTP_string(phoneNumber), + MTP_codeSettings( + MTP_flags(0), + MTPstring())), + rpcDone(crl::guard(this, [=]( + const MTPauth_SentCode &result) { + return sendPhoneDone(phoneNumber, result); + })), rpcFail(crl::guard(this, [=]( + const RPCError &error) { + return sendPhoneFail(phoneNumber, error); + }))); } void ChangePhoneBox::EnterPhone::sendPhoneDone(const QString &phoneNumber, const MTPauth_SentCode &result) { diff --git a/Telegram/SourceFiles/boxes/confirm_phone_box.cpp b/Telegram/SourceFiles/boxes/confirm_phone_box.cpp index 2315bd05f..36dd58c6c 100644 --- a/Telegram/SourceFiles/boxes/confirm_phone_box.cpp +++ b/Telegram/SourceFiles/boxes/confirm_phone_box.cpp @@ -170,7 +170,14 @@ void ConfirmPhoneBox::checkPhoneAndHash() { if (_sendCodeRequestId) { return; } - _sendCodeRequestId = MTP::send(MTPaccount_SendConfirmPhoneCode(MTP_flags(0), MTP_string(_hash), MTPBool()), rpcDone(&ConfirmPhoneBox::sendCodeDone), rpcFail(&ConfirmPhoneBox::sendCodeFail)); + _sendCodeRequestId = MTP::send( + MTPaccount_SendConfirmPhoneCode( + MTP_string(_hash), + MTP_codeSettings( + MTP_flags(0), + MTPstring())), + rpcDone(&ConfirmPhoneBox::sendCodeDone), + rpcFail(&ConfirmPhoneBox::sendCodeFail)); } void ConfirmPhoneBox::sendCodeDone(const MTPauth_SentCode &result) { diff --git a/Telegram/SourceFiles/data/data_chat.h b/Telegram/SourceFiles/data/data_chat.h index 7dfc047cb..58919e642 100644 --- a/Telegram/SourceFiles/data/data_chat.h +++ b/Telegram/SourceFiles/data/data_chat.h @@ -178,8 +178,6 @@ public: // ImagePtr photoFull; private: - [[nodiscard]] bool actionsUnavailable() const; - Flags _flags; FullFlags _fullFlags; QString _inviteLink; diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 7d01c9c56..02d7b1710 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -3092,6 +3092,9 @@ void Session::setWallpapers(const QVector &data, int32 hash) { } for (const auto &paper : data) { paper.match([&](const MTPDwallPaper &paper) { + if (paper.is_pattern()) { + return; + } const auto document = processDocument(paper.vdocument); if (document->checkWallPaperProperties()) { _wallpapers.push_back({ diff --git a/Telegram/SourceFiles/intro/introphone.cpp b/Telegram/SourceFiles/intro/introphone.cpp index 2f64118e8..fdbe7c4ab 100644 --- a/Telegram/SourceFiles/intro/introphone.cpp +++ b/Telegram/SourceFiles/intro/introphone.cpp @@ -160,11 +160,12 @@ void PhoneWidget::submit() { //_sentRequest = MTP::send(MTPauth_CheckPhone(MTP_string(_sentPhone)), rpcDone(&PhoneWidget::phoneCheckDone), rpcFail(&PhoneWidget::phoneSubmitFail)); _sentRequest = MTP::send( MTPauth_SendCode( - MTP_flags(0), MTP_string(_sentPhone), - MTPBool(), MTP_int(ApiId), - MTP_string(ApiHash)), + MTP_string(ApiHash), + MTP_codeSettings( + MTP_flags(0), + MTPstring())), rpcDone(&PhoneWidget::phoneSubmitDone), rpcFail(&PhoneWidget::phoneSubmitFail)); } diff --git a/Telegram/SourceFiles/passport/passport_form_controller.cpp b/Telegram/SourceFiles/passport/passport_form_controller.cpp index 27c684fd3..cc669e03a 100644 --- a/Telegram/SourceFiles/passport/passport_form_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_form_controller.cpp @@ -2082,9 +2082,10 @@ QString FormController::getPlainTextFromValue( void FormController::startPhoneVerification(not_null value) { value->verification.requestId = request(MTPaccount_SendVerifyPhoneCode( - MTP_flags(MTPaccount_SendVerifyPhoneCode::Flag(0)), MTP_string(getPhoneFromValue(value)), - MTPBool() + MTP_codeSettings( + MTP_flags(0), + MTPstring()) )).done([=](const MTPauth_SentCode &result) { Expects(result.type() == mtpc_auth_sentCode);