mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-10 16:00:28 -07:00
feat: Android TV support (#503)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
7ab8c015b9
commit
c299492d6d
168 changed files with 12019 additions and 3073 deletions
|
|
@ -55,10 +55,30 @@ class SharedUtility {
|
|||
}
|
||||
|
||||
Future<bool?> addAccount(AccountModel account) async {
|
||||
return await saveAccounts(getAccounts()
|
||||
..add(account.copyWith(
|
||||
lastUsed: DateTime.now(),
|
||||
)));
|
||||
final newAccount = account.copyWith(
|
||||
lastUsed: DateTime.now(),
|
||||
);
|
||||
|
||||
List<AccountModel> accounts = getAccounts().toList();
|
||||
if (accounts.any((element) => element.sameIdentity(newAccount))) {
|
||||
accounts = accounts
|
||||
.map(
|
||||
(e) => e.sameIdentity(newAccount)
|
||||
? e.copyWith(
|
||||
credentials: newAccount.credentials,
|
||||
lastUsed: newAccount.lastUsed,
|
||||
)
|
||||
: e,
|
||||
)
|
||||
.toList();
|
||||
} else {
|
||||
accounts = [
|
||||
...accounts,
|
||||
newAccount,
|
||||
];
|
||||
}
|
||||
|
||||
return await saveAccounts(accounts);
|
||||
}
|
||||
|
||||
Future<bool?> removeAccount(AccountModel? account) async {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue