mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-10 21:04:53 +00:00
[skip ci] undo formatting in di
This commit is contained in:
parent
e4576fe699
commit
c156691e09
2 changed files with 235 additions and 183 deletions
336
lib/di.dart
336
lib/di.dart
|
@ -194,7 +194,8 @@ Future setup(
|
||||||
_unspentCoinsInfoSource = unspentCoinsInfoSource;
|
_unspentCoinsInfoSource = unspentCoinsInfoSource;
|
||||||
|
|
||||||
if (!_isSetupFinished) {
|
if (!_isSetupFinished) {
|
||||||
getIt.registerSingletonAsync<SharedPreferences>(() => SharedPreferences.getInstance());
|
getIt.registerSingletonAsync<SharedPreferences>(
|
||||||
|
() => SharedPreferences.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
final isBitcoinBuyEnabled = (secrets.wyreSecretKey?.isNotEmpty ?? false) &&
|
final isBitcoinBuyEnabled = (secrets.wyreSecretKey?.isNotEmpty ?? false) &&
|
||||||
|
@ -220,64 +221,73 @@ Future setup(
|
||||||
walletList: getIt.get<WalletListStore>(),
|
walletList: getIt.get<WalletListStore>(),
|
||||||
settingsStore: getIt.get<SettingsStore>(),
|
settingsStore: getIt.get<SettingsStore>(),
|
||||||
nodeListStore: getIt.get<NodeListStore>()));
|
nodeListStore: getIt.get<NodeListStore>()));
|
||||||
getIt.registerSingleton<TradesStore>(
|
getIt.registerSingleton<TradesStore>(TradesStore(
|
||||||
TradesStore(tradesSource: _tradesSource, settingsStore: getIt.get<SettingsStore>()));
|
tradesSource: _tradesSource, settingsStore: getIt.get<SettingsStore>()));
|
||||||
getIt.registerSingleton<OrdersStore>(
|
getIt.registerSingleton<OrdersStore>(OrdersStore(
|
||||||
OrdersStore(ordersSource: _ordersSource, settingsStore: getIt.get<SettingsStore>()));
|
ordersSource: _ordersSource, settingsStore: getIt.get<SettingsStore>()));
|
||||||
getIt.registerSingleton<TradeFilterStore>(TradeFilterStore());
|
getIt.registerSingleton<TradeFilterStore>(TradeFilterStore());
|
||||||
getIt.registerSingleton<TransactionFilterStore>(TransactionFilterStore());
|
getIt.registerSingleton<TransactionFilterStore>(TransactionFilterStore());
|
||||||
getIt.registerSingleton<FiatConversionStore>(FiatConversionStore());
|
getIt.registerSingleton<FiatConversionStore>(FiatConversionStore());
|
||||||
getIt.registerSingleton<SendTemplateStore>(SendTemplateStore(templateSource: _templates));
|
getIt.registerSingleton<SendTemplateStore>(
|
||||||
|
SendTemplateStore(templateSource: _templates));
|
||||||
getIt.registerSingleton<ExchangeTemplateStore>(
|
getIt.registerSingleton<ExchangeTemplateStore>(
|
||||||
ExchangeTemplateStore(templateSource: _exchangeTemplates));
|
ExchangeTemplateStore(templateSource: _exchangeTemplates));
|
||||||
getIt.registerSingleton<YatStore>(
|
getIt.registerSingleton<YatStore>(YatStore(
|
||||||
YatStore(appStore: getIt.get<AppStore>(), secureStorage: getIt.get<FlutterSecureStorage>())
|
appStore: getIt.get<AppStore>(),
|
||||||
|
secureStorage: getIt.get<FlutterSecureStorage>())
|
||||||
..init());
|
..init());
|
||||||
|
|
||||||
final secretStore = await SecretStoreBase.load(getIt.get<FlutterSecureStorage>());
|
final secretStore =
|
||||||
|
await SecretStoreBase.load(getIt.get<FlutterSecureStorage>());
|
||||||
|
|
||||||
getIt.registerSingleton<SecretStore>(secretStore);
|
getIt.registerSingleton<SecretStore>(secretStore);
|
||||||
|
|
||||||
getIt.registerFactory<KeyService>(() => KeyService(getIt.get<FlutterSecureStorage>()));
|
getIt.registerFactory<KeyService>(
|
||||||
|
() => KeyService(getIt.get<FlutterSecureStorage>()));
|
||||||
|
|
||||||
getIt.registerFactoryParam<WalletCreationService, WalletType, void>((type, _) =>
|
getIt.registerFactoryParam<WalletCreationService, WalletType, void>(
|
||||||
WalletCreationService(
|
(type, _) => WalletCreationService(
|
||||||
initialType: type,
|
initialType: type,
|
||||||
keyService: getIt.get<KeyService>(),
|
keyService: getIt.get<KeyService>(),
|
||||||
secureStorage: getIt.get<FlutterSecureStorage>(),
|
secureStorage: getIt.get<FlutterSecureStorage>(),
|
||||||
sharedPreferences: getIt.get<SharedPreferences>(),
|
sharedPreferences: getIt.get<SharedPreferences>(),
|
||||||
walletInfoSource: _walletInfoSource));
|
walletInfoSource: _walletInfoSource));
|
||||||
|
|
||||||
getIt.registerFactory<WalletLoadingService>(() => WalletLoadingService(
|
getIt.registerFactory<WalletLoadingService>(
|
||||||
|
() => WalletLoadingService(
|
||||||
getIt.get<SharedPreferences>(),
|
getIt.get<SharedPreferences>(),
|
||||||
getIt.get<KeyService>(),
|
getIt.get<KeyService>(),
|
||||||
(WalletType type) => getIt.get<WalletService>(param1: type)));
|
(WalletType type) => getIt.get<WalletService>(param1: type)));
|
||||||
|
|
||||||
getIt.registerFactoryParam<WalletNewVM, WalletType, void>((type, _) => WalletNewVM(
|
getIt.registerFactoryParam<WalletNewVM, WalletType, void>((type, _) =>
|
||||||
getIt.get<AppStore>(), getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
|
WalletNewVM(getIt.get<AppStore>(),
|
||||||
|
getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
|
||||||
type: type));
|
type: type));
|
||||||
|
|
||||||
getIt.registerFactoryParam<WalletRestorationFromSeedVM, List, void>((args, _) {
|
getIt
|
||||||
|
.registerFactoryParam<WalletRestorationFromSeedVM, List, void>((args, _) {
|
||||||
final type = args.first as WalletType;
|
final type = args.first as WalletType;
|
||||||
final language = args[1] as String;
|
final language = args[1] as String;
|
||||||
final mnemonic = args[2] as String;
|
final mnemonic = args[2] as String;
|
||||||
|
|
||||||
return WalletRestorationFromSeedVM(
|
return WalletRestorationFromSeedVM(getIt.get<AppStore>(),
|
||||||
getIt.get<AppStore>(), getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
|
getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
|
||||||
type: type, language: language, seed: mnemonic);
|
type: type, language: language, seed: mnemonic);
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactoryParam<WalletRestorationFromKeysVM, List, void>((args, _) {
|
getIt
|
||||||
|
.registerFactoryParam<WalletRestorationFromKeysVM, List, void>((args, _) {
|
||||||
final type = args.first as WalletType;
|
final type = args.first as WalletType;
|
||||||
final language = args[1] as String;
|
final language = args[1] as String;
|
||||||
|
|
||||||
return WalletRestorationFromKeysVM(
|
return WalletRestorationFromKeysVM(getIt.get<AppStore>(),
|
||||||
getIt.get<AppStore>(), getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
|
getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
|
||||||
type: type, language: language);
|
type: type, language: language);
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactory<WalletAddressListViewModel>(() =>
|
getIt.registerFactory<WalletAddressListViewModel>(() =>
|
||||||
WalletAddressListViewModel(appStore: getIt.get<AppStore>(), yatStore: getIt.get<YatStore>()));
|
WalletAddressListViewModel(
|
||||||
|
appStore: getIt.get<AppStore>(), yatStore: getIt.get<YatStore>()));
|
||||||
|
|
||||||
getIt.registerFactory(() => BalanceViewModel(
|
getIt.registerFactory(() => BalanceViewModel(
|
||||||
appStore: getIt.get<AppStore>(),
|
appStore: getIt.get<AppStore>(),
|
||||||
|
@ -298,12 +308,15 @@ Future setup(
|
||||||
secureStorage: getIt.get<FlutterSecureStorage>(),
|
secureStorage: getIt.get<FlutterSecureStorage>(),
|
||||||
sharedPreferences: getIt.get<SharedPreferences>()));
|
sharedPreferences: getIt.get<SharedPreferences>()));
|
||||||
|
|
||||||
getIt.registerFactory<AuthViewModel>(() => AuthViewModel(getIt.get<AuthService>(),
|
getIt.registerFactory<AuthViewModel>(() => AuthViewModel(
|
||||||
getIt.get<SharedPreferences>(), getIt.get<SettingsStore>(), BiometricAuth()));
|
getIt.get<AuthService>(),
|
||||||
|
getIt.get<SharedPreferences>(),
|
||||||
|
getIt.get<SettingsStore>(),
|
||||||
|
BiometricAuth()));
|
||||||
|
|
||||||
getIt.registerFactory<AuthPage>(
|
getIt.registerFactory<AuthPage>(
|
||||||
() => AuthPage(getIt.get<AuthViewModel>(),
|
() => AuthPage(getIt.get<AuthViewModel>(), onAuthenticationFinished:
|
||||||
onAuthenticationFinished: (isAuthenticated, AuthPageState authPageState) {
|
(isAuthenticated, AuthPageState authPageState) {
|
||||||
if (!isAuthenticated) {
|
if (!isAuthenticated) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -318,7 +331,8 @@ Future setup(
|
||||||
authPageState.changeProcessText('Loading the wallet');
|
authPageState.changeProcessText('Loading the wallet');
|
||||||
|
|
||||||
if (loginError != null) {
|
if (loginError != null) {
|
||||||
authPageState.changeProcessText('ERROR: ${loginError.toString()}');
|
authPageState
|
||||||
|
.changeProcessText('ERROR: ${loginError.toString()}');
|
||||||
}
|
}
|
||||||
|
|
||||||
ReactionDisposer? _reaction;
|
ReactionDisposer? _reaction;
|
||||||
|
@ -329,29 +343,28 @@ Future setup(
|
||||||
}, closable: false),
|
}, closable: false),
|
||||||
instanceName: 'login');
|
instanceName: 'login');
|
||||||
|
|
||||||
getIt.registerFactoryParam<AuthPage, void Function(bool, AuthPageState), bool>(
|
getIt
|
||||||
|
.registerFactoryParam<AuthPage, void Function(bool, AuthPageState), bool>(
|
||||||
(onAuthFinished, closable) => AuthPage(getIt.get<AuthViewModel>(),
|
(onAuthFinished, closable) => AuthPage(getIt.get<AuthViewModel>(),
|
||||||
onAuthenticationFinished: onAuthFinished, closable: closable ?? false));
|
onAuthenticationFinished: onAuthFinished,
|
||||||
|
closable: closable ?? false));
|
||||||
|
|
||||||
getIt.registerFactory(() => BalancePage(
|
getIt.registerFactory(() =>
|
||||||
dashboardViewModel: getIt.get<DashboardViewModel>(),
|
BalancePage(dashboardViewModel: getIt.get<DashboardViewModel>(), settingsStore: getIt.get<SettingsStore>()));
|
||||||
settingsStore: getIt.get<SettingsStore>()));
|
|
||||||
|
|
||||||
getIt.registerFactory<DashboardPage>(() => DashboardPage(
|
getIt.registerFactory<DashboardPage>(() => DashboardPage( balancePage: getIt.get<BalancePage>(), walletViewModel: getIt.get<DashboardViewModel>(), addressListViewModel: getIt.get<WalletAddressListViewModel>()));
|
||||||
balancePage: getIt.get<BalancePage>(),
|
getIt.registerFactory<ReceivePage>(() => ReceivePage(
|
||||||
walletViewModel: getIt.get<DashboardViewModel>(),
|
|
||||||
addressListViewModel: getIt.get<WalletAddressListViewModel>()));
|
addressListViewModel: getIt.get<WalletAddressListViewModel>()));
|
||||||
getIt.registerFactory<ReceivePage>(
|
|
||||||
() => ReceivePage(addressListViewModel: getIt.get<WalletAddressListViewModel>()));
|
|
||||||
getIt.registerFactory<AddressPage>(() => AddressPage(
|
getIt.registerFactory<AddressPage>(() => AddressPage(
|
||||||
addressListViewModel: getIt.get<WalletAddressListViewModel>(),
|
addressListViewModel: getIt.get<WalletAddressListViewModel>(),
|
||||||
walletViewModel: getIt.get<DashboardViewModel>()));
|
walletViewModel: getIt.get<DashboardViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactoryParam<WalletAddressEditOrCreateViewModel, dynamic, void>((dynamic item, _) =>
|
getIt.registerFactoryParam<WalletAddressEditOrCreateViewModel, dynamic, void>(
|
||||||
WalletAddressEditOrCreateViewModel(wallet: getIt.get<AppStore>().wallet!, item: item));
|
(dynamic item, _) => WalletAddressEditOrCreateViewModel(
|
||||||
|
wallet: getIt.get<AppStore>().wallet!, item: item));
|
||||||
|
|
||||||
getIt.registerFactoryParam<AddressEditOrCreatePage, dynamic, void>((dynamic item, _) =>
|
getIt.registerFactoryParam<AddressEditOrCreatePage, dynamic, void>(
|
||||||
AddressEditOrCreatePage(
|
(dynamic item, _) => AddressEditOrCreatePage(
|
||||||
addressEditOrCreateViewModel:
|
addressEditOrCreateViewModel:
|
||||||
getIt.get<WalletAddressEditOrCreateViewModel>(param1: item)));
|
getIt.get<WalletAddressEditOrCreateViewModel>(param1: item)));
|
||||||
|
|
||||||
|
@ -369,16 +382,19 @@ Future setup(
|
||||||
getIt.get<BalanceViewModel>(),
|
getIt.get<BalanceViewModel>(),
|
||||||
_transactionDescriptionBox));
|
_transactionDescriptionBox));
|
||||||
|
|
||||||
getIt.registerFactory(() => SendPage(sendViewModel: getIt.get<SendViewModel>()));
|
|
||||||
|
|
||||||
getIt.registerFactory(
|
getIt.registerFactory(
|
||||||
() => SendTemplatePage(sendTemplateViewModel: getIt.get<SendTemplateViewModel>()));
|
() => SendPage(sendViewModel: getIt.get<SendViewModel>()));
|
||||||
|
|
||||||
|
getIt.registerFactory(() => SendTemplatePage(
|
||||||
|
sendTemplateViewModel: getIt.get<SendTemplateViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactory(() => WalletListViewModel(
|
getIt.registerFactory(() => WalletListViewModel(
|
||||||
_walletInfoSource, getIt.get<AppStore>(), getIt.get<WalletLoadingService>()));
|
_walletInfoSource,
|
||||||
|
getIt.get<AppStore>(),
|
||||||
|
getIt.get<WalletLoadingService>()));
|
||||||
|
|
||||||
getIt
|
getIt.registerFactory(() =>
|
||||||
.registerFactory(() => WalletListPage(walletListViewModel: getIt.get<WalletListViewModel>()));
|
WalletListPage(walletListViewModel: getIt.get<WalletListViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactory(() {
|
getIt.registerFactory(() {
|
||||||
final wallet = getIt.get<AppStore>().wallet!;
|
final wallet = getIt.get<AppStore>().wallet!;
|
||||||
|
@ -387,12 +403,11 @@ Future setup(
|
||||||
return MoneroAccountListViewModel(wallet);
|
return MoneroAccountListViewModel(wallet);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw Exception(
|
throw Exception('Unexpected wallet type: ${wallet.type} for generate MoneroAccountListViewModel');
|
||||||
'Unexpected wallet type: ${wallet.type} for generate MoneroAccountListViewModel');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactory(
|
getIt.registerFactory(() => MoneroAccountListPage(
|
||||||
() => MoneroAccountListPage(accountListViewModel: getIt.get<MoneroAccountListViewModel>()));
|
accountListViewModel: getIt.get<MoneroAccountListViewModel>()));
|
||||||
|
|
||||||
/*getIt.registerFactory(() {
|
/*getIt.registerFactory(() {
|
||||||
final wallet = getIt.get<AppStore>().wallet;
|
final wallet = getIt.get<AppStore>().wallet;
|
||||||
|
@ -409,14 +424,16 @@ Future setup(
|
||||||
moneroAccountCreationViewModel:
|
moneroAccountCreationViewModel:
|
||||||
getIt.get<MoneroAccountEditOrCreateViewModel>()));*/
|
getIt.get<MoneroAccountEditOrCreateViewModel>()));*/
|
||||||
|
|
||||||
getIt.registerFactoryParam<MoneroAccountEditOrCreateViewModel, AccountListItem?, void>(
|
getIt.registerFactoryParam<MoneroAccountEditOrCreateViewModel,
|
||||||
|
AccountListItem?, void>(
|
||||||
(AccountListItem? account, _) => MoneroAccountEditOrCreateViewModel(
|
(AccountListItem? account, _) => MoneroAccountEditOrCreateViewModel(
|
||||||
monero!.getAccountList(getIt.get<AppStore>().wallet!),
|
monero!.getAccountList(getIt.get<AppStore>().wallet!),
|
||||||
haven?.getAccountList(getIt.get<AppStore>().wallet!),
|
haven?.getAccountList(getIt.get<AppStore>().wallet!),
|
||||||
wallet: getIt.get<AppStore>().wallet!,
|
wallet: getIt.get<AppStore>().wallet!,
|
||||||
accountListItem: account));
|
accountListItem: account));
|
||||||
|
|
||||||
getIt.registerFactoryParam<MoneroAccountEditOrCreatePage, AccountListItem?, void>(
|
getIt.registerFactoryParam<MoneroAccountEditOrCreatePage, AccountListItem?,
|
||||||
|
void>(
|
||||||
(AccountListItem? account, _) => MoneroAccountEditOrCreatePage(
|
(AccountListItem? account, _) => MoneroAccountEditOrCreatePage(
|
||||||
moneroAccountCreationViewModel:
|
moneroAccountCreationViewModel:
|
||||||
getIt.get<MoneroAccountEditOrCreateViewModel>(param1: account)));
|
getIt.get<MoneroAccountEditOrCreateViewModel>(param1: account)));
|
||||||
|
@ -434,36 +451,44 @@ Future setup(
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactory(() {
|
getIt.registerFactory(() {
|
||||||
return SecuritySettingsViewModel(getIt.get<SettingsStore>());
|
return SecuritySettingsViewModel(getIt.get<SettingsStore>(), getIt.get<AuthService>());
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactory(() => WalletSeedViewModel(getIt.get<AppStore>().wallet!));
|
getIt
|
||||||
|
.registerFactory(() => WalletSeedViewModel(getIt.get<AppStore>().wallet!));
|
||||||
|
|
||||||
getIt.registerFactoryParam<WalletSeedPage, bool, void>((bool isWalletCreated, _) =>
|
getIt.registerFactoryParam<WalletSeedPage, bool, void>(
|
||||||
WalletSeedPage(getIt.get<WalletSeedViewModel>(), isNewWalletCreated: isWalletCreated));
|
(bool isWalletCreated, _) => WalletSeedPage(
|
||||||
|
getIt.get<WalletSeedViewModel>(),
|
||||||
|
isNewWalletCreated: isWalletCreated));
|
||||||
|
|
||||||
getIt.registerFactory(() => WalletKeysViewModel(getIt.get<AppStore>().wallet!));
|
getIt
|
||||||
|
.registerFactory(() => WalletKeysViewModel(getIt.get<AppStore>().wallet!));
|
||||||
|
|
||||||
getIt.registerFactory(() => WalletKeysPage(getIt.get<WalletKeysViewModel>()));
|
getIt.registerFactory(() => WalletKeysPage(getIt.get<WalletKeysViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactoryParam<ContactViewModel, ContactRecord?, void>(
|
getIt.registerFactoryParam<ContactViewModel, ContactRecord?, void>(
|
||||||
(ContactRecord? contact, _) => ContactViewModel(_contactSource, contact: contact));
|
(ContactRecord? contact, _) =>
|
||||||
|
ContactViewModel(_contactSource, contact: contact));
|
||||||
|
|
||||||
getIt.registerFactory(() => ContactListViewModel(_contactSource, _walletInfoSource));
|
getIt.registerFactory(
|
||||||
|
() => ContactListViewModel(_contactSource, _walletInfoSource));
|
||||||
|
|
||||||
getIt.registerFactoryParam<ContactListPage, bool, void>((bool isEditable, _) =>
|
getIt.registerFactoryParam<ContactListPage, bool, void>(
|
||||||
ContactListPage(getIt.get<ContactListViewModel>(), isEditable: isEditable));
|
(bool isEditable, _) => ContactListPage(getIt.get<ContactListViewModel>(),
|
||||||
|
isEditable: isEditable));
|
||||||
|
|
||||||
getIt.registerFactoryParam<ContactPage, ContactRecord?, void>(
|
getIt.registerFactoryParam<ContactPage, ContactRecord?, void>(
|
||||||
(ContactRecord? contact, _) => ContactPage(getIt.get<ContactViewModel>(param1: contact)));
|
(ContactRecord? contact, _) =>
|
||||||
|
ContactPage(getIt.get<ContactViewModel>(param1: contact)));
|
||||||
|
|
||||||
getIt.registerFactory(() {
|
getIt.registerFactory(() {
|
||||||
final appStore = getIt.get<AppStore>();
|
final appStore = getIt.get<AppStore>();
|
||||||
return NodeListViewModel(_nodeSource, appStore.wallet!, appStore.settingsStore);
|
return NodeListViewModel(
|
||||||
|
_nodeSource, appStore.wallet!, appStore.settingsStore);
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactory(
|
getIt.registerFactory(() => ConnectionSyncPage(getIt.get<NodeListViewModel>(), getIt.get<DashboardViewModel>()));
|
||||||
() => ConnectionSyncPage(getIt.get<NodeListViewModel>(), getIt.get<DashboardViewModel>()));
|
|
||||||
|
|
||||||
getIt.registerFactory(() => SecurityBackupPage(getIt.get<SecuritySettingsViewModel>()));
|
getIt.registerFactory(() => SecurityBackupPage(getIt.get<SecuritySettingsViewModel>()));
|
||||||
|
|
||||||
|
@ -473,13 +498,15 @@ Future setup(
|
||||||
|
|
||||||
getIt.registerFactory(() => OtherSettingsPage(getIt.get<OtherSettingsViewModel>()));
|
getIt.registerFactory(() => OtherSettingsPage(getIt.get<OtherSettingsViewModel>()));
|
||||||
|
|
||||||
getIt
|
getIt.registerFactory(() =>
|
||||||
.registerFactory(() => NodeCreateOrEditViewModel(_nodeSource, getIt.get<AppStore>().wallet!));
|
NodeCreateOrEditViewModel(_nodeSource, getIt.get<AppStore>().wallet!));
|
||||||
|
|
||||||
getIt.registerFactory(() => NodeCreateOrEditPage(getIt.get<NodeCreateOrEditViewModel>()));
|
getIt.registerFactory(
|
||||||
|
() => NodeCreateOrEditPage(getIt.get<NodeCreateOrEditViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactory(() => OnRamperPage(
|
getIt.registerFactory(() => OnRamperPage(
|
||||||
settingsStore: getIt.get<AppStore>().settingsStore, wallet: getIt.get<AppStore>().wallet!));
|
settingsStore: getIt.get<AppStore>().settingsStore,
|
||||||
|
wallet: getIt.get<AppStore>().wallet!));
|
||||||
|
|
||||||
getIt.registerFactory(() => ExchangeViewModel(
|
getIt.registerFactory(() => ExchangeViewModel(
|
||||||
getIt.get<AppStore>().wallet!,
|
getIt.get<AppStore>().wallet!,
|
||||||
|
@ -498,34 +525,40 @@ Future setup(
|
||||||
|
|
||||||
getIt.registerFactory(() => ExchangePage(getIt.get<ExchangeViewModel>()));
|
getIt.registerFactory(() => ExchangePage(getIt.get<ExchangeViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactory(() => ExchangeConfirmPage(tradesStore: getIt.get<TradesStore>()));
|
getIt.registerFactory(
|
||||||
|
() => ExchangeConfirmPage(tradesStore: getIt.get<TradesStore>()));
|
||||||
|
|
||||||
|
getIt.registerFactory(() => ExchangeTradePage(
|
||||||
|
exchangeTradeViewModel: getIt.get<ExchangeTradeViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactory(
|
getIt.registerFactory(
|
||||||
() => ExchangeTradePage(exchangeTradeViewModel: getIt.get<ExchangeTradeViewModel>()));
|
() => ExchangeTemplatePage(getIt.get<ExchangeViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactory(() => ExchangeTemplatePage(getIt.get<ExchangeViewModel>()));
|
getIt.registerFactoryParam<WalletService, WalletType, void>(
|
||||||
|
(WalletType param1, __) {
|
||||||
getIt.registerFactoryParam<WalletService, WalletType, void>((WalletType param1, __) {
|
|
||||||
switch (param1) {
|
switch (param1) {
|
||||||
case WalletType.haven:
|
case WalletType.haven:
|
||||||
return haven!.createHavenWalletService(_walletInfoSource);
|
return haven!.createHavenWalletService(_walletInfoSource);
|
||||||
case WalletType.monero:
|
case WalletType.monero:
|
||||||
return monero!.createMoneroWalletService(_walletInfoSource);
|
return monero!.createMoneroWalletService(_walletInfoSource);
|
||||||
case WalletType.bitcoin:
|
case WalletType.bitcoin:
|
||||||
return bitcoin!.createBitcoinWalletService(_walletInfoSource, _unspentCoinsInfoSource!);
|
return bitcoin!.createBitcoinWalletService(
|
||||||
|
_walletInfoSource, _unspentCoinsInfoSource!);
|
||||||
case WalletType.litecoin:
|
case WalletType.litecoin:
|
||||||
return bitcoin!.createLitecoinWalletService(_walletInfoSource, _unspentCoinsInfoSource!);
|
return bitcoin!.createLitecoinWalletService(
|
||||||
|
_walletInfoSource, _unspentCoinsInfoSource!);
|
||||||
default:
|
default:
|
||||||
throw Exception('Unexpected token: ${param1.toString()} for generating of WalletService');
|
throw Exception('Unexpected token: ${param1.toString()} for generating of WalletService');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactory<SetupPinCodeViewModel>(
|
getIt.registerFactory<SetupPinCodeViewModel>(() => SetupPinCodeViewModel(
|
||||||
() => SetupPinCodeViewModel(getIt.get<AuthService>(), getIt.get<SettingsStore>()));
|
getIt.get<AuthService>(), getIt.get<SettingsStore>()));
|
||||||
|
|
||||||
getIt.registerFactoryParam<SetupPinCodePage, void Function(PinCodeState<PinCodeWidget>, String),
|
getIt.registerFactoryParam<SetupPinCodePage,
|
||||||
void>(
|
void Function(PinCodeState<PinCodeWidget>, String), void>(
|
||||||
(onSuccessfulPinSetup, _) => SetupPinCodePage(getIt.get<SetupPinCodeViewModel>(),
|
(onSuccessfulPinSetup, _) => SetupPinCodePage(
|
||||||
|
getIt.get<SetupPinCodeViewModel>(),
|
||||||
onSuccessfulPinSetup: onSuccessfulPinSetup));
|
onSuccessfulPinSetup: onSuccessfulPinSetup));
|
||||||
|
|
||||||
getIt.registerFactory(() => RescanViewModel(getIt.get<AppStore>().wallet!));
|
getIt.registerFactory(() => RescanViewModel(getIt.get<AppStore>().wallet!));
|
||||||
|
@ -534,15 +567,16 @@ Future setup(
|
||||||
|
|
||||||
getIt.registerFactory(() => FaqPage(getIt.get<SettingsStore>()));
|
getIt.registerFactory(() => FaqPage(getIt.get<SettingsStore>()));
|
||||||
|
|
||||||
getIt.registerFactoryParam<WalletRestoreViewModel, WalletType, void>((type, _) =>
|
getIt.registerFactoryParam<WalletRestoreViewModel, WalletType, void>(
|
||||||
WalletRestoreViewModel(
|
(type, _) => WalletRestoreViewModel(getIt.get<AppStore>(),
|
||||||
getIt.get<AppStore>(), getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
|
getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
|
||||||
type: type));
|
type: type));
|
||||||
|
|
||||||
getIt.registerFactoryParam<WalletRestorePage, WalletType, void>(
|
getIt.registerFactoryParam<WalletRestorePage, WalletType, void>((type, _) =>
|
||||||
(type, _) => WalletRestorePage(getIt.get<WalletRestoreViewModel>(param1: type)));
|
WalletRestorePage(getIt.get<WalletRestoreViewModel>(param1: type)));
|
||||||
|
|
||||||
getIt.registerFactoryParam<TransactionDetailsViewModel, TransactionInfo, void>(
|
getIt
|
||||||
|
.registerFactoryParam<TransactionDetailsViewModel, TransactionInfo, void>(
|
||||||
(TransactionInfo transactionInfo, _) {
|
(TransactionInfo transactionInfo, _) {
|
||||||
final wallet = getIt.get<AppStore>().wallet!;
|
final wallet = getIt.get<AppStore>().wallet!;
|
||||||
return TransactionDetailsViewModel(
|
return TransactionDetailsViewModel(
|
||||||
|
@ -557,47 +591,52 @@ Future setup(
|
||||||
transactionDetailsViewModel:
|
transactionDetailsViewModel:
|
||||||
getIt.get<TransactionDetailsViewModel>(param1: transactionInfo)));
|
getIt.get<TransactionDetailsViewModel>(param1: transactionInfo)));
|
||||||
|
|
||||||
getIt.registerFactoryParam<NewWalletTypePage, void Function(BuildContext, WalletType), void>(
|
getIt.registerFactoryParam<NewWalletTypePage,
|
||||||
|
void Function(BuildContext, WalletType), void>(
|
||||||
(param1, _) => NewWalletTypePage(onTypeSelected: param1));
|
(param1, _) => NewWalletTypePage(onTypeSelected: param1));
|
||||||
|
|
||||||
getIt.registerFactoryParam<PreSeedPage, WalletType, void>(
|
getIt.registerFactoryParam<PreSeedPage, WalletType, void>(
|
||||||
(WalletType type, _) => PreSeedPage(type));
|
(WalletType type, _) => PreSeedPage(type));
|
||||||
|
|
||||||
getIt.registerFactoryParam<TradeDetailsViewModel, Trade, void>((trade, _) =>
|
getIt.registerFactoryParam<TradeDetailsViewModel, Trade, void>((trade, _) =>
|
||||||
TradeDetailsViewModel(
|
TradeDetailsViewModel(tradeForDetails: trade, trades: _tradesSource,
|
||||||
tradeForDetails: trade,
|
|
||||||
trades: _tradesSource,
|
|
||||||
settingsStore: getIt.get<SettingsStore>()));
|
settingsStore: getIt.get<SettingsStore>()));
|
||||||
|
|
||||||
getIt.registerFactory(() => BackupService(getIt.get<FlutterSecureStorage>(), _walletInfoSource,
|
getIt.registerFactory(() => BackupService(
|
||||||
getIt.get<KeyService>(), getIt.get<SharedPreferences>()));
|
getIt.get<FlutterSecureStorage>(),
|
||||||
|
_walletInfoSource,
|
||||||
|
getIt.get<KeyService>(),
|
||||||
|
getIt.get<SharedPreferences>()));
|
||||||
|
|
||||||
getIt.registerFactory(() => BackupViewModel(
|
getIt.registerFactory(() => BackupViewModel(getIt.get<FlutterSecureStorage>(),
|
||||||
getIt.get<FlutterSecureStorage>(), getIt.get<SecretStore>(), getIt.get<BackupService>()));
|
getIt.get<SecretStore>(), getIt.get<BackupService>()));
|
||||||
|
|
||||||
getIt.registerFactory(() => BackupPage(getIt.get<BackupViewModel>()));
|
getIt.registerFactory(() => BackupPage(getIt.get<BackupViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactory(() =>
|
getIt.registerFactory(
|
||||||
EditBackupPasswordViewModel(getIt.get<FlutterSecureStorage>(), getIt.get<SecretStore>()));
|
() => EditBackupPasswordViewModel(getIt.get<FlutterSecureStorage>(), getIt.get<SecretStore>()));
|
||||||
|
|
||||||
getIt.registerFactory(() => EditBackupPasswordPage(getIt.get<EditBackupPasswordViewModel>()));
|
getIt.registerFactory(
|
||||||
|
() => EditBackupPasswordPage(getIt.get<EditBackupPasswordViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactory(() => RestoreOptionsPage());
|
getIt.registerFactory(() => RestoreOptionsPage());
|
||||||
|
|
||||||
getIt.registerFactory(() => RestoreFromBackupViewModel(getIt.get<BackupService>()));
|
getIt.registerFactory(
|
||||||
|
() => RestoreFromBackupViewModel(getIt.get<BackupService>()));
|
||||||
|
|
||||||
getIt.registerFactory(() => RestoreFromBackupPage(getIt.get<RestoreFromBackupViewModel>()));
|
getIt.registerFactory(
|
||||||
|
() => RestoreFromBackupPage(getIt.get<RestoreFromBackupViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactoryParam<TradeDetailsPage, Trade, void>(
|
getIt.registerFactoryParam<TradeDetailsPage, Trade, void>((Trade trade, _) =>
|
||||||
(Trade trade, _) => TradeDetailsPage(getIt.get<TradeDetailsViewModel>(param1: trade)));
|
TradeDetailsPage(getIt.get<TradeDetailsViewModel>(param1: trade)));
|
||||||
|
|
||||||
getIt.registerFactory(() => BuyAmountViewModel());
|
getIt.registerFactory(() => BuyAmountViewModel());
|
||||||
|
|
||||||
getIt.registerFactory(() {
|
getIt.registerFactory(() {
|
||||||
final wallet = getIt.get<AppStore>().wallet;
|
final wallet = getIt.get<AppStore>().wallet;
|
||||||
|
|
||||||
return BuyViewModel(_ordersSource, getIt.get<OrdersStore>(), getIt.get<SettingsStore>(),
|
return BuyViewModel(_ordersSource, getIt.get<OrdersStore>(),
|
||||||
getIt.get<BuyAmountViewModel>(),
|
getIt.get<SettingsStore>(), getIt.get<BuyAmountViewModel>(),
|
||||||
wallet: wallet!);
|
wallet: wallet!);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -609,8 +648,7 @@ Future setup(
|
||||||
final url = args.first as String;
|
final url = args.first as String;
|
||||||
final buyViewModel = args[1] as BuyViewModel;
|
final buyViewModel = args[1] as BuyViewModel;
|
||||||
|
|
||||||
return BuyWebViewPage(
|
return BuyWebViewPage(buyViewModel: buyViewModel, ordersStore: getIt.get<OrdersStore>(), url: url);
|
||||||
buyViewModel: buyViewModel, ordersStore: getIt.get<OrdersStore>(), url: url);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactoryParam<OrderDetailsViewModel, Order, void>((order, _) {
|
getIt.registerFactoryParam<OrderDetailsViewModel, Order, void>((order, _) {
|
||||||
|
@ -619,8 +657,8 @@ Future setup(
|
||||||
return OrderDetailsViewModel(wallet: wallet!, orderForDetails: order);
|
return OrderDetailsViewModel(wallet: wallet!, orderForDetails: order);
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactoryParam<OrderDetailsPage, Order, void>(
|
getIt.registerFactoryParam<OrderDetailsPage, Order, void>((Order order, _) =>
|
||||||
(Order order, _) => OrderDetailsPage(getIt.get<OrderDetailsViewModel>(param1: order)));
|
OrderDetailsPage(getIt.get<OrderDetailsViewModel>(param1: order)));
|
||||||
|
|
||||||
getIt.registerFactory(() => SupportViewModel());
|
getIt.registerFactory(() => SupportViewModel());
|
||||||
|
|
||||||
|
@ -629,18 +667,20 @@ Future setup(
|
||||||
getIt.registerFactory(() {
|
getIt.registerFactory(() {
|
||||||
final wallet = getIt.get<AppStore>().wallet;
|
final wallet = getIt.get<AppStore>().wallet;
|
||||||
|
|
||||||
return UnspentCoinsListViewModel(wallet: wallet!, unspentCoinsInfo: _unspentCoinsInfoSource!);
|
return UnspentCoinsListViewModel(
|
||||||
|
wallet: wallet!, unspentCoinsInfo: _unspentCoinsInfoSource!);
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactory(() =>
|
getIt.registerFactory(() => UnspentCoinsListPage(
|
||||||
UnspentCoinsListPage(unspentCoinsListViewModel: getIt.get<UnspentCoinsListViewModel>()));
|
unspentCoinsListViewModel: getIt.get<UnspentCoinsListViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactoryParam<UnspentCoinsDetailsViewModel, UnspentCoinsItem,
|
getIt.registerFactoryParam<UnspentCoinsDetailsViewModel, UnspentCoinsItem,
|
||||||
UnspentCoinsListViewModel>(
|
UnspentCoinsListViewModel>(
|
||||||
(item, model) =>
|
(item, model) => UnspentCoinsDetailsViewModel(
|
||||||
UnspentCoinsDetailsViewModel(unspentCoinsItem: item, unspentCoinsListViewModel: model));
|
unspentCoinsItem: item, unspentCoinsListViewModel: model));
|
||||||
|
|
||||||
getIt.registerFactoryParam<UnspentCoinsDetailsPage, List, void>((List args, _) {
|
getIt.registerFactoryParam<UnspentCoinsDetailsPage, List, void>(
|
||||||
|
(List args, _) {
|
||||||
final item = args.first as UnspentCoinsItem;
|
final item = args.first as UnspentCoinsItem;
|
||||||
final unspentCoinsListViewModel = args[1] as UnspentCoinsListViewModel;
|
final unspentCoinsListViewModel = args[1] as UnspentCoinsListViewModel;
|
||||||
|
|
||||||
|
@ -653,14 +693,11 @@ Future setup(
|
||||||
|
|
||||||
getIt.registerFactory(() => YatService());
|
getIt.registerFactory(() => YatService());
|
||||||
|
|
||||||
getIt.registerFactory(() => AddressResolver(
|
getIt.registerFactory(() => AddressResolver(yatService: getIt.get<YatService>(),
|
||||||
yatService: getIt.get<YatService>(), walletType: getIt.get<AppStore>().wallet!.type));
|
walletType: getIt.get<AppStore>().wallet!.type));
|
||||||
|
|
||||||
getIt.registerFactoryParam<FullscreenQRPage, String, bool>(
|
getIt.registerFactoryParam<FullscreenQRPage, String, bool>(
|
||||||
(String qrData, bool isLight) => FullscreenQRPage(
|
(String qrData, bool isLight) => FullscreenQRPage(qrData: qrData, isLight: isLight,));
|
||||||
qrData: qrData,
|
|
||||||
isLight: isLight,
|
|
||||||
));
|
|
||||||
|
|
||||||
getIt.registerFactory(() => IoniaApi());
|
getIt.registerFactory(() => IoniaApi());
|
||||||
|
|
||||||
|
@ -669,24 +706,26 @@ Future setup(
|
||||||
getIt.registerFactory<IoniaService>(
|
getIt.registerFactory<IoniaService>(
|
||||||
() => IoniaService(getIt.get<FlutterSecureStorage>(), getIt.get<IoniaApi>()));
|
() => IoniaService(getIt.get<FlutterSecureStorage>(), getIt.get<IoniaApi>()));
|
||||||
|
|
||||||
getIt.registerFactory<IoniaAnyPay>(() => IoniaAnyPay(
|
getIt.registerFactory<IoniaAnyPay>(
|
||||||
getIt.get<IoniaService>(), getIt.get<AnyPayApi>(), getIt.get<AppStore>().wallet!));
|
() => IoniaAnyPay(
|
||||||
|
getIt.get<IoniaService>(),
|
||||||
|
getIt.get<AnyPayApi>(),
|
||||||
|
getIt.get<AppStore>().wallet!));
|
||||||
|
|
||||||
getIt.registerFactory(() => IoniaGiftCardsListViewModel(ioniaService: getIt.get<IoniaService>()));
|
getIt.registerFactory(() => IoniaGiftCardsListViewModel(ioniaService: getIt.get<IoniaService>()));
|
||||||
|
|
||||||
getIt.registerFactory(() => IoniaAuthViewModel(ioniaService: getIt.get<IoniaService>()));
|
getIt.registerFactory(() => IoniaAuthViewModel(ioniaService: getIt.get<IoniaService>()));
|
||||||
|
|
||||||
getIt.registerFactoryParam<IoniaMerchPurchaseViewModel, double, IoniaMerchant>(
|
getIt.registerFactoryParam<IoniaMerchPurchaseViewModel, double, IoniaMerchant>((double amount, merchant) {
|
||||||
(double amount, merchant) {
|
|
||||||
return IoniaMerchPurchaseViewModel(
|
return IoniaMerchPurchaseViewModel(
|
||||||
ioniaAnyPayService: getIt.get<IoniaAnyPay>(),
|
ioniaAnyPayService: getIt.get<IoniaAnyPay>(),
|
||||||
amount: amount,
|
amount: amount,
|
||||||
ioniaMerchant: merchant,
|
ioniaMerchant: merchant,
|
||||||
sendViewModel: getIt.get<SendViewModel>());
|
sendViewModel: getIt.get<SendViewModel>()
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactoryParam<IoniaBuyCardViewModel, IoniaMerchant, void>(
|
getIt.registerFactoryParam<IoniaBuyCardViewModel, IoniaMerchant, void>((IoniaMerchant merchant, _) {
|
||||||
(IoniaMerchant merchant, _) {
|
|
||||||
return IoniaBuyCardViewModel(ioniaMerchant: merchant);
|
return IoniaBuyCardViewModel(ioniaMerchant: merchant);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -714,14 +753,13 @@ Future setup(
|
||||||
getIt.registerFactoryParam<IoniaBuyGiftCardDetailPage, List, void>((List args, _) {
|
getIt.registerFactoryParam<IoniaBuyGiftCardDetailPage, List, void>((List args, _) {
|
||||||
final amount = args.first as double;
|
final amount = args.first as double;
|
||||||
final merchant = args.last as IoniaMerchant;
|
final merchant = args.last as IoniaMerchant;
|
||||||
return IoniaBuyGiftCardDetailPage(
|
return IoniaBuyGiftCardDetailPage(getIt.get<IoniaMerchPurchaseViewModel>(param1: amount, param2: merchant));
|
||||||
getIt.get<IoniaMerchPurchaseViewModel>(param1: amount, param2: merchant));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactoryParam<IoniaGiftCardDetailsViewModel, IoniaGiftCard, void>(
|
getIt.registerFactoryParam<IoniaGiftCardDetailsViewModel, IoniaGiftCard, void>((IoniaGiftCard giftCard, _) {
|
||||||
(IoniaGiftCard giftCard, _) {
|
|
||||||
return IoniaGiftCardDetailsViewModel(
|
return IoniaGiftCardDetailsViewModel(
|
||||||
ioniaService: getIt.get<IoniaService>(), giftCard: giftCard);
|
ioniaService: getIt.get<IoniaService>(),
|
||||||
|
giftCard: giftCard);
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactoryParam<IoniaCustomTipViewModel, List, void>((List args, _) {
|
getIt.registerFactoryParam<IoniaCustomTipViewModel, List, void>((List args, _) {
|
||||||
|
@ -732,26 +770,25 @@ Future setup(
|
||||||
return IoniaCustomTipViewModel(amount: amount, tip: tip, ioniaMerchant: merchant);
|
return IoniaCustomTipViewModel(amount: amount, tip: tip, ioniaMerchant: merchant);
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactoryParam<IoniaGiftCardDetailPage, IoniaGiftCard, void>(
|
getIt.registerFactoryParam<IoniaGiftCardDetailPage, IoniaGiftCard, void>((IoniaGiftCard giftCard, _) {
|
||||||
(IoniaGiftCard giftCard, _) {
|
|
||||||
return IoniaGiftCardDetailPage(getIt.get<IoniaGiftCardDetailsViewModel>(param1: giftCard));
|
return IoniaGiftCardDetailPage(getIt.get<IoniaGiftCardDetailsViewModel>(param1: giftCard));
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactoryParam<IoniaMoreOptionsPage, List, void>((List args, _) {
|
getIt.registerFactoryParam<IoniaMoreOptionsPage, List, void>((List args, _){
|
||||||
final giftCard = args.first as IoniaGiftCard;
|
final giftCard = args.first as IoniaGiftCard;
|
||||||
|
|
||||||
return IoniaMoreOptionsPage(giftCard);
|
return IoniaMoreOptionsPage(giftCard);
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactoryParam<IoniaCustomRedeemViewModel, IoniaGiftCard, void>(
|
getIt.registerFactoryParam<IoniaCustomRedeemViewModel, IoniaGiftCard, void>((IoniaGiftCard giftCard, _) => IoniaCustomRedeemViewModel(giftCard));
|
||||||
(IoniaGiftCard giftCard, _) => IoniaCustomRedeemViewModel(giftCard));
|
|
||||||
|
|
||||||
getIt.registerFactoryParam<IoniaCustomRedeemPage, List, void>((List args, _) {
|
getIt.registerFactoryParam<IoniaCustomRedeemPage, List, void>((List args, _){
|
||||||
final giftCard = args.first as IoniaGiftCard;
|
final giftCard = args.first as IoniaGiftCard;
|
||||||
|
|
||||||
return IoniaCustomRedeemPage(getIt.get<IoniaCustomRedeemViewModel>(param1: giftCard));
|
return IoniaCustomRedeemPage(getIt.get<IoniaCustomRedeemViewModel>(param1: giftCard) );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
getIt.registerFactoryParam<IoniaCustomTipPage, List, void>((List args, _) {
|
getIt.registerFactoryParam<IoniaCustomTipPage, List, void>((List args, _) {
|
||||||
return IoniaCustomTipPage(getIt.get<IoniaCustomTipViewModel>(param1: args));
|
return IoniaCustomTipPage(getIt.get<IoniaCustomTipViewModel>(param1: args));
|
||||||
});
|
});
|
||||||
|
@ -766,17 +803,16 @@ Future setup(
|
||||||
|
|
||||||
getIt.registerFactory(() => IoniaAccountCardsPage(getIt.get<IoniaAccountViewModel>()));
|
getIt.registerFactory(() => IoniaAccountCardsPage(getIt.get<IoniaAccountViewModel>()));
|
||||||
|
|
||||||
getIt.registerFactoryParam<IoniaPaymentStatusViewModel, IoniaAnyPayPaymentInfo,
|
getIt.registerFactoryParam<IoniaPaymentStatusViewModel, IoniaAnyPayPaymentInfo, AnyPayPaymentCommittedInfo>(
|
||||||
AnyPayPaymentCommittedInfo>(
|
(IoniaAnyPayPaymentInfo paymentInfo, AnyPayPaymentCommittedInfo committedInfo)
|
||||||
(IoniaAnyPayPaymentInfo paymentInfo, AnyPayPaymentCommittedInfo committedInfo) =>
|
=> IoniaPaymentStatusViewModel(
|
||||||
IoniaPaymentStatusViewModel(getIt.get<IoniaService>(),
|
getIt.get<IoniaService>(),
|
||||||
paymentInfo: paymentInfo, committedInfo: committedInfo));
|
paymentInfo: paymentInfo,
|
||||||
|
committedInfo: committedInfo));
|
||||||
|
|
||||||
getIt.registerFactoryParam<IoniaPaymentStatusPage, IoniaAnyPayPaymentInfo,
|
getIt.registerFactoryParam<IoniaPaymentStatusPage, IoniaAnyPayPaymentInfo, AnyPayPaymentCommittedInfo>(
|
||||||
AnyPayPaymentCommittedInfo>(
|
(IoniaAnyPayPaymentInfo paymentInfo, AnyPayPaymentCommittedInfo committedInfo)
|
||||||
(IoniaAnyPayPaymentInfo paymentInfo, AnyPayPaymentCommittedInfo committedInfo) =>
|
=> IoniaPaymentStatusPage(getIt.get<IoniaPaymentStatusViewModel>(param1: paymentInfo, param2: committedInfo)));
|
||||||
IoniaPaymentStatusPage(
|
|
||||||
getIt.get<IoniaPaymentStatusViewModel>(param1: paymentInfo, param2: committedInfo)));
|
|
||||||
|
|
||||||
_isSetupFinished = true;
|
_isSetupFinished = true;
|
||||||
}
|
}
|
|
@ -1,4 +1,6 @@
|
||||||
|
import 'package:cake_wallet/core/auth_service.dart';
|
||||||
import 'package:cake_wallet/entities/biometric_auth.dart';
|
import 'package:cake_wallet/entities/biometric_auth.dart';
|
||||||
|
import 'package:cake_wallet/entities/pin_code_required_duration.dart';
|
||||||
import 'package:cake_wallet/store/settings_store.dart';
|
import 'package:cake_wallet/store/settings_store.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
|
|
||||||
|
@ -7,19 +9,33 @@ part 'security_settings_view_model.g.dart';
|
||||||
class SecuritySettingsViewModel = SecuritySettingsViewModelBase with _$SecuritySettingsViewModel;
|
class SecuritySettingsViewModel = SecuritySettingsViewModelBase with _$SecuritySettingsViewModel;
|
||||||
|
|
||||||
abstract class SecuritySettingsViewModelBase with Store {
|
abstract class SecuritySettingsViewModelBase with Store {
|
||||||
SecuritySettingsViewModelBase(this._settingsStore) : _biometricAuth = BiometricAuth();
|
SecuritySettingsViewModelBase(
|
||||||
|
this._settingsStore,
|
||||||
|
this._authService,
|
||||||
|
) : _biometricAuth = BiometricAuth();
|
||||||
|
|
||||||
final BiometricAuth _biometricAuth;
|
final BiometricAuth _biometricAuth;
|
||||||
final SettingsStore _settingsStore;
|
final SettingsStore _settingsStore;
|
||||||
|
final AuthService _authService;
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
bool get allowBiometricalAuthentication => _settingsStore.allowBiometricalAuthentication;
|
bool get allowBiometricalAuthentication => _settingsStore.allowBiometricalAuthentication;
|
||||||
|
|
||||||
|
@computed
|
||||||
|
PinCodeRequiredDuration get pinCodeRequiredDuration => _settingsStore.pinTimeOutDuration;
|
||||||
|
|
||||||
@action
|
@action
|
||||||
Future<bool> biometricAuthenticated() async {
|
Future<bool> biometricAuthenticated() async {
|
||||||
return await _biometricAuth.canCheckBiometrics() && await _biometricAuth.isAuthenticated();
|
return await _biometricAuth.canCheckBiometrics() && await _biometricAuth.isAuthenticated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void setAllowBiometricalAuthentication(bool value) => _settingsStore.allowBiometricalAuthentication = value;
|
void setAllowBiometricalAuthentication(bool value) =>
|
||||||
|
_settingsStore.allowBiometricalAuthentication = value;
|
||||||
|
|
||||||
|
@action
|
||||||
|
setPinCodeRequiredDuration(PinCodeRequiredDuration duration) =>
|
||||||
|
_settingsStore.pinTimeOutDuration = duration;
|
||||||
|
|
||||||
|
bool checkPinCodeRiquired() => _authService.requireAuth();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue