mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
If only selfie is missing use special phrases.
This commit is contained in:
@@ -264,6 +264,17 @@ ScopeRow ComputeScopeRow(const Scope &scope) {
|
||||
ranges::for_each(scope.documents, addValueErrors);
|
||||
addValueErrors(scope.fields);
|
||||
row.error = errors.join('\n');
|
||||
if (row.error.isEmpty()
|
||||
&& row.ready.isEmpty()
|
||||
&& scope.type == Scope::Type::Identity
|
||||
&& scope.selfieRequired) {
|
||||
auto noSelfieScope = scope;
|
||||
noSelfieScope.selfieRequired = false;
|
||||
if (!ComputeScopeRowReadyString(noSelfieScope).isEmpty()) {
|
||||
// Only selfie is missing.
|
||||
row.description = lang(lng_passport_identity_selfie);
|
||||
}
|
||||
}
|
||||
return row;
|
||||
};
|
||||
switch (scope.type) {
|
||||
|
||||
@@ -813,6 +813,15 @@ int PanelController::findNonEmptyDocumentIndex(const Scope &scope) const {
|
||||
if (i != end(documents)) {
|
||||
return (i - begin(documents));
|
||||
}
|
||||
// If we have a document where only selfie is not filled - return it.
|
||||
const auto j = ranges::find_if(
|
||||
documents,
|
||||
[&](not_null<const Value*> document) {
|
||||
return document->scansAreFilled(false);
|
||||
});
|
||||
if (j != end(documents)) {
|
||||
return (j - begin(documents));
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user