diff --git a/Telegram/Resources/scheme.tl b/Telegram/Resources/scheme.tl index 119721014..62b9e7cc8 100644 --- a/Telegram/Resources/scheme.tl +++ b/Telegram/Resources/scheme.tl @@ -1064,7 +1064,6 @@ account.resetWebAuthorizations#682d2594 = Bool; account.getSecureValue#73665bc2 types:Vector = Vector; account.saveSecureValue#899fe31d value:InputSecureValue secure_secret_id:long = SecureValue; account.deleteSecureValue#b880bc4b types:Vector = Bool; -account.setSecureValueErrors#d0093ce4 user_id:InputUser errors: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; @@ -1074,6 +1073,7 @@ account.verifyEmail#ecba39db email:string code:string = Bool; users.getUsers#d91a548 id:Vector = Vector; users.getFullUser#ca30a5b1 id:InputUser = UserFull; +users.setSecureValueErrors#90c894b5 id:InputUser errors:Vector = Bool; contacts.getStatuses#c4a353ee = Vector; contacts.getContacts#c023849f hash:int = contacts.Contacts; diff --git a/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py b/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py index 20698fa8e..ae17c8c23 100644 --- a/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py +++ b/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py @@ -115,6 +115,7 @@ for line in lines: if (not nametype): if (not re.match(r'vector#1cb5c415 \{t:Type\} # \[ t \] = Vector t;', line)): print('Bad line found: ' + line); + sys.exit(1); continue; name = nametype.group(1); @@ -161,7 +162,7 @@ for line in lines: vectemplate = templ.group(2); if (re.match(r'^[A-Z]', vectemplate) or re.match(r'^[a-zA-Z0-9]+_[A-Z]', vectemplate)): restype = templ.group(1) + 'MTP' + vectemplate.replace('.', '_') + '>'; - elif (vectemplate == 'int' or vectemplate == 'long' or vectemplate == 'string'): + elif (vectemplate == 'int' or vectemplate == 'long' or vectemplate == 'string' or vectemplate == 'bytes'): restype = templ.group(1) + 'MTP' + vectemplate.replace('.', '_') + '>'; else: foundmeta = ''; @@ -176,10 +177,10 @@ for line in lines: ptype = templ.group(1) + 'MTP' + foundmeta.replace('.', '_') + '>'; else: print('Bad vector param: ' + vectemplate); - continue; + sys.exit(1); else: print('Bad template type: ' + restype); - continue; + sys.exit(1); resType = restype.replace('.', '_'); if (restype.find('.') >= 0): parts = re.match(r'([a-z]+)\.([A-Z][A-Za-z0-9<>\._]+)', restype) @@ -187,13 +188,13 @@ for line in lines: restype = parts.group(1) + '_' + parts.group(2)[0:1].lower() + parts.group(2)[1:]; else: print('Bad result type name with dot: ' + restype); - continue; + sys.exit(1); else: if (re.match(r'^[A-Z]', restype)): restype = restype[:1].lower() + restype[1:]; else: print('Bad result type name: ' + restype); - continue; + sys.exit(1); boxed[resType] = restype; boxed[Name] = name; @@ -217,7 +218,7 @@ for line in lines: pnametype = re.match(r'([a-z_][a-z0-9_]*):([A-Za-z0-9<>\._]+|![a-zA-Z]+|\#|[a-z_][a-z0-9_]*\.[0-9]+\?[A-Za-z0-9<>\._]+)$', param); if (not pnametype): print('Bad param found: "' + param + '" in line: ' + line); - continue; + sys.exit(1); pname = pnametype.group(1); ptypewide = pnametype.group(2); if (re.match(r'^!([a-zA-Z]+)$', ptypewide)): @@ -226,7 +227,7 @@ for line in lines: ptype = 'TQueryType'; else: print('Bad template param name: "' + param + '" in line: ' + line); - continue; + sys.exit(1); elif (ptypewide == '#'): hasFlags = pname; if funcsNow: @@ -239,7 +240,7 @@ for line in lines: pmasktype = re.match(r'([a-z_][a-z0-9_]*)\.([0-9]+)\?([A-Za-z0-9<>\._]+)', ptype); if (not pmasktype or pmasktype.group(1) != hasFlags): print('Bad param found: "' + param + '" in line: ' + line); - continue; + sys.exit(1); ptype = pmasktype.group(3); if (ptype.find('<') >= 0): templ = re.match(r'^([vV]ector<)([A-Za-z0-9\._]+)>$', ptype); @@ -247,7 +248,7 @@ for line in lines: vectemplate = templ.group(2); if (re.match(r'^[A-Z]', vectemplate) or re.match(r'^[a-zA-Z0-9]+_[A-Z]', vectemplate)): ptype = templ.group(1) + 'MTP' + vectemplate.replace('.', '_') + '>'; - elif (vectemplate == 'int' or vectemplate == 'long' or vectemplate == 'string'): + elif (vectemplate == 'int' or vectemplate == 'long' or vectemplate == 'string' or vectemplate == 'bytes'): ptype = templ.group(1) + 'MTP' + vectemplate.replace('.', '_') + '>'; else: foundmeta = ''; @@ -262,10 +263,10 @@ for line in lines: ptype = templ.group(1) + 'MTP' + foundmeta.replace('.', '_') + '>'; else: print('Bad vector param: ' + vectemplate); - continue; + sys.exit(1); else: print('Bad template type: ' + ptype); - continue; + sys.exit(1); if (not pname in conditions): conditionsList.append(pname); conditions[pname] = pmasktype.group(2); @@ -277,7 +278,7 @@ for line in lines: vectemplate = templ.group(2); if (re.match(r'^[A-Z]', vectemplate) or re.match(r'^[a-zA-Z0-9]+_[A-Z]', vectemplate)): ptype = templ.group(1) + 'MTP' + vectemplate.replace('.', '_') + '>'; - elif (vectemplate == 'int' or vectemplate == 'long' or vectemplate == 'string'): + elif (vectemplate == 'int' or vectemplate == 'long' or vectemplate == 'string' or vectemplate == 'bytes'): ptype = templ.group(1) + 'MTP' + vectemplate.replace('.', '_') + '>'; else: foundmeta = ''; @@ -292,16 +293,16 @@ for line in lines: ptype = templ.group(1) + 'MTP' + foundmeta.replace('.', '_') + '>'; else: print('Bad vector param: ' + vectemplate); - continue; + sys.exit(1); else: print('Bad template type: ' + ptype); - continue; + sys.exit(1); prmsList.append(pname); prms[pname] = ptype.replace('.', '_'); if (isTemplate == '' and resType == 'X'): print('Bad response type "X" in "' + name +'" in line: ' + line); - continue; + sys.exit(1); if funcsNow: methodBodies = '' @@ -851,12 +852,12 @@ for childName in parentFlagsList: # # if (not flag in parentFlagsCheck[parentName]): # print('Flag ' + flag + ' not found in ' + parentName + ' which should be a flags-parent of ' + childName); -# error +# sys.exit(1); # if (flag in parentFlagsCheck[parentName]): if (parentFlagsCheck[childName][flag] != parentFlagsCheck[parentName][flag]): print('Flag ' + flag + ' has different value in ' + parentName + ' which should be a flags-parent of ' + childName); - error + sys.exit(1); else: parentFlagsCheck[parentName][flag] = parentFlagsCheck[childName][flag]; flagOperators += 'inline ' + parentName + '::Flags mtpCastFlags(' + childName + '::Flags flags) { return static_cast<' + parentName + '::Flag>(flags.value()); }\n'; diff --git a/Telegram/SourceFiles/passport/passport_panel_edit_scans.cpp b/Telegram/SourceFiles/passport/passport_panel_edit_scans.cpp index 7af720736..a4e131866 100644 --- a/Telegram/SourceFiles/passport/passport_panel_edit_scans.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_edit_scans.cpp @@ -229,10 +229,11 @@ base::optional EditScans::validateGetErrorTop() { [](const ScanInfo &file) { return !file.error.isEmpty(); } ) != end(_files); + auto result = base::optional(); if (!exists || ((errorExists || _uploadMoreError) && !uploadedSomeMore())) { toggleError(true); - return (_files.size() > 5) ? _upload->y() : _header->y(); + result = (_files.size() > 5) ? _upload->y() : _header->y(); } const auto nonDeletedErrorIt = ranges::find_if( @@ -243,16 +244,20 @@ base::optional EditScans::validateGetErrorTop() { if (nonDeletedErrorIt != end(_files)) { const auto index = (nonDeletedErrorIt - begin(_files)); toggleError(true); - return _rows[index]->y(); + if (!result) { + result = _rows[index]->y(); + } } if (_selfie && (!_selfie->key.id || _selfie->deleted || !_selfie->error.isEmpty())) { toggleSelfieError(true); - return _selfieHeader->y(); + if (!result) { + result = _selfieHeader->y(); + } } - return base::none; + return result; } void EditScans::setupContent(const QString &header) {