mirror of
https://github.com/pd4d10/git-touch.git
synced 2026-04-28 10:28:58 -05:00
improvement: keep duplicated accounts
This commit is contained in:
@@ -50,16 +50,7 @@ class AuthModel with ChangeNotifier {
|
||||
String get token => activeAccount.token;
|
||||
|
||||
_addAccount(Account account) async {
|
||||
// Remove previous if duplicated
|
||||
List<Account> newAccounts = [];
|
||||
for (var a in _accounts) {
|
||||
if (!account.equals(a)) {
|
||||
newAccounts.add(a);
|
||||
}
|
||||
}
|
||||
newAccounts.add(account);
|
||||
_accounts = newAccounts;
|
||||
|
||||
_accounts = [...accounts, account];
|
||||
// Save
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setString(StorageKeys.accounts, json.encode(_accounts));
|
||||
|
||||
Reference in New Issue
Block a user