Preserve explicit model and provider architecture (#30)
This commit is contained in:
1 parent
54f50ad6b7
commit
8b0662e340
10 files changed
+104
-7
No files matched your search
@@ -204,7 +204,7 @@ class DummyWalletService implements WalletService {
|
||||
@override
|
||||
Future<AccountProfile> profile() async {
|
||||
await _wait();
|
||||
return WalletMapper.profile(_locale);
|
||||
return WalletMapper.profile(ProfileDTO(_locale));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -213,7 +213,7 @@ class DummyWalletService implements WalletService {
|
||||
if (!['en', 'ru'].contains(locale))
|
||||
throw const WalletException(WalletError.unsupported);
|
||||
_locale = locale;
|
||||
return WalletMapper.profile(_locale);
|
||||
return WalletMapper.profile(ProfileDTO(_locale));
|
||||
}
|
||||
|
||||
// Kept separate from wallet fetch because LimitsService has a different result.
|
||||
|
||||
@@ -53,6 +53,11 @@ class OperationDTO {
|
||||
final bool fail;
|
||||
}
|
||||
|
||||
class ProfileDTO {
|
||||
const ProfileDTO(this.locale);
|
||||
final String locale;
|
||||
}
|
||||
|
||||
abstract final class WalletMapper {
|
||||
static CurrencyAccount account(AccountDTO d) => CurrencyAccount(
|
||||
id: d.id,
|
||||
@@ -85,5 +90,5 @@ abstract final class WalletMapper {
|
||||
status: OperationStatus.values.byName(d.status),
|
||||
createdAt: d.created,
|
||||
);
|
||||
static AccountProfile profile(String locale) => AccountProfile(locale);
|
||||
static AccountProfile profile(ProfileDTO dto) => AccountProfile(dto.locale);
|
||||
}
|
||||
Reference in new issue
Block a user