TF-571 Implement AccountRepository with HiveAccountDataSource
This commit is contained in:
committed by
Dat H. Pham
parent
f8e7429751
commit
ff6e6d8878
@@ -0,0 +1,20 @@
|
||||
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';
|
||||
|
||||
extension AccountCacheExtension on AccountCache {
|
||||
AuthenticationType fromAuthenticationTypeString() {
|
||||
if (authenticationType == 'basic') {
|
||||
return AuthenticationType.basic;
|
||||
} else if (authenticationType == 'oidc') {
|
||||
return AuthenticationType.oidc;
|
||||
} else {
|
||||
return AuthenticationType.none;
|
||||
}
|
||||
}
|
||||
|
||||
Account toAccount() {
|
||||
final authenticationType = fromAuthenticationTypeString();
|
||||
return Account(id, authenticationType, isSelected: isSelected);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
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';
|
||||
|
||||
extension AccountExtensions on Account {
|
||||
AccountCache toCache() {
|
||||
return AccountCache(id, authenticationType.asString(), isSelected: isSelected);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user