TF-1317 Update authentication account to store AccountId

This commit is contained in:
dab246
2023-01-04 19:00:53 +07:00
committed by Dat H. Pham
parent eadc0c4ddc
commit 6566372337
21 changed files with 193 additions and 71 deletions
@@ -1,3 +1,5 @@
import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:jmap_dart_client/jmap/core/id.dart';
import 'package:model/account/account.dart';
import 'package:model/account/authentication_type.dart';
import 'package:tmail_ui_user/features/login/data/model/account_cache.dart';
@@ -15,6 +17,12 @@ extension AccountCacheExtension on AccountCache {
Account toAccount() {
final authenticationType = fromAuthenticationTypeString();
return Account(id, authenticationType, isSelected: isSelected);
return Account(
id,
authenticationType,
isSelected: isSelected,
accountId: accountId != null ? AccountId(Id(accountId!)) : null,
apiUrl: apiUrl
);
}
}
@@ -4,6 +4,12 @@ import 'package:tmail_ui_user/features/login/data/model/account_cache.dart';
extension AccountExtensions on Account {
AccountCache toCache() {
return AccountCache(id, authenticationType.asString(), isSelected: isSelected);
return AccountCache(
id,
authenticationType.asString(),
isSelected: isSelected,
accountId: accountId?.id.value,
apiUrl: apiUrl
);
}
}