mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-25 23:14:18 +03:00
don't add duplicated credentials
This commit is contained in:
parent
b3403a2d17
commit
5eff51645d
@ -185,13 +185,8 @@ class _AndroidCredentialListNotifier extends OathCredentialListNotifier {
|
||||
if (mounted) {
|
||||
final newState = state!.toList();
|
||||
|
||||
// this should not happen when adding a new credential
|
||||
// but if we
|
||||
final index = newState.indexWhere((e) => e.credential == newCredential);
|
||||
if (index > 0) {
|
||||
newState.removeAt(index);
|
||||
}
|
||||
|
||||
/// remove any duplicates to our new credential
|
||||
newState.removeWhere((e) => e.credential == newCredential);
|
||||
newState.add(pair);
|
||||
state = newState;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user