fix refresh after addCredential

This commit is contained in:
Adam Velebil 2022-05-12 14:04:07 +02:00
parent a644ce9804
commit bddf5d9074
No known key found for this signature in database
GPG Key ID: AC6D6B9D715FC084

View File

@ -179,21 +179,8 @@ class _AndroidCredentialListNotifier extends OathCredentialListNotifier {
await _api.addAccount(credentialUri.toString(), requireTouch);
var result = jsonDecode(resultString);
final newCredential = OathCredential.fromJson(result['credential']);
final newCode =
result['code'] != null ? OathCode.fromJson(result['code']) : null;
final pair = OathPair(newCredential, newCode);
if (mounted) {
final newState = state!.toList();
/// remove any duplicates to our new credential
newState.removeWhere((e) => e.credential == newCredential);
newState.add(pair);
state = newState;
}
return pair.credential;
refresh();
return OathCredential.fromJson(result['credential']);
}
@override