YADESK-715 add new credentials to Oath cred list

This commit is contained in:
Adam Velebil 2022-06-10 09:19:11 +02:00
parent 6d5931956c
commit 55dd6ba27f
No known key found for this signature in database
GPG Key ID: AC6D6B9D715FC084

View File

@ -179,8 +179,24 @@ class _AndroidCredentialListNotifier extends OathCredentialListNotifier {
await _api.addAccount(credentialUri.toString(), requireTouch);
var result = jsonDecode(resultString);
var addedCredential = OathCredential.fromJson(result['credential']);
var addedCredCode = OathCode.fromJson(result['code']);
if (mounted) {
final newState = state!.toList();
final index = newState.indexWhere((e) => e.credential == addedCredential);
if (index > -1) {
newState.removeAt(index);
}
newState.add(OathPair(
addedCredential,
addedCredCode,
));
state = newState;
}
refresh();
return OathCredential.fromJson(result['credential']);
return addedCredential;
}
@override