[skip ci] undo formatting in di

Godwin Asuquo committed Dec 5, 2022 at 20:14 UTC c156691e09139a36688d992911873ff9efb92b7c
2 files changed +233 -181
lib/di.dart
+215 -179
@@ -194,7 +194,8 @@ Future setup(
194 _unspentCoinsInfoSource = unspentCoinsInfoSource;
195
196 if (!_isSetupFinished) {
197 - getIt.registerSingletonAsync<SharedPreferences>(() => SharedPreferences.getInstance());
197 + getIt.registerSingletonAsync<SharedPreferences>(
198 + () => SharedPreferences.getInstance());
199 }
200
201 final isBitcoinBuyEnabled = (secrets.wyreSecretKey?.isNotEmpty ?? false) &&
@@ -220,64 +221,73 @@ Future setup(
221 walletList: getIt.get<WalletListStore>(),
222 settingsStore: getIt.get<SettingsStore>(),
223 nodeListStore: getIt.get<NodeListStore>()));
223 - getIt.registerSingleton<TradesStore>(
224 - TradesStore(tradesSource: _tradesSource, settingsStore: getIt.get<SettingsStore>()));
225 - getIt.registerSingleton<OrdersStore>(
226 - OrdersStore(ordersSource: _ordersSource, settingsStore: getIt.get<SettingsStore>()));
224 + getIt.registerSingleton<TradesStore>(TradesStore(
225 + tradesSource: _tradesSource, settingsStore: getIt.get<SettingsStore>()));
226 + getIt.registerSingleton<OrdersStore>(OrdersStore(
227 + ordersSource: _ordersSource, settingsStore: getIt.get<SettingsStore>()));
228 getIt.registerSingleton<TradeFilterStore>(TradeFilterStore());
229 getIt.registerSingleton<TransactionFilterStore>(TransactionFilterStore());
230 getIt.registerSingleton<FiatConversionStore>(FiatConversionStore());
230 - getIt.registerSingleton<SendTemplateStore>(SendTemplateStore(templateSource: _templates));
231 + getIt.registerSingleton<SendTemplateStore>(
232 + SendTemplateStore(templateSource: _templates));
233 getIt.registerSingleton<ExchangeTemplateStore>(
234 ExchangeTemplateStore(templateSource: _exchangeTemplates));
233 - getIt.registerSingleton<YatStore>(
234 - YatStore(appStore: getIt.get<AppStore>(), secureStorage: getIt.get<FlutterSecureStorage>())
235 - ..init());
235 + getIt.registerSingleton<YatStore>(YatStore(
236 + appStore: getIt.get<AppStore>(),
237 + secureStorage: getIt.get<FlutterSecureStorage>())
238 + ..init());
239
237 - final secretStore = await SecretStoreBase.load(getIt.get<FlutterSecureStorage>());
240 + final secretStore =
241 + await SecretStoreBase.load(getIt.get<FlutterSecureStorage>());
242
243 getIt.registerSingleton<SecretStore>(secretStore);
244
241 - getIt.registerFactory<KeyService>(() => KeyService(getIt.get<FlutterSecureStorage>()));
245 + getIt.registerFactory<KeyService>(
246 + () => KeyService(getIt.get<FlutterSecureStorage>()));
247
243 - getIt.registerFactoryParam<WalletCreationService, WalletType, void>((type, _) =>
244 - WalletCreationService(
248 + getIt.registerFactoryParam<WalletCreationService, WalletType, void>(
249 + (type, _) => WalletCreationService(
250 initialType: type,
251 keyService: getIt.get<KeyService>(),
252 secureStorage: getIt.get<FlutterSecureStorage>(),
253 sharedPreferences: getIt.get<SharedPreferences>(),
254 walletInfoSource: _walletInfoSource));
255
251 - getIt.registerFactory<WalletLoadingService>(() => WalletLoadingService(
256 + getIt.registerFactory<WalletLoadingService>(
257 + () => WalletLoadingService(
258 getIt.get<SharedPreferences>(),
259 getIt.get<KeyService>(),
260 (WalletType type) => getIt.get<WalletService>(param1: type)));
261
256 - getIt.registerFactoryParam<WalletNewVM, WalletType, void>((type, _) => WalletNewVM(
257 - getIt.get<AppStore>(), getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
258 - type: type));
262 + getIt.registerFactoryParam<WalletNewVM, WalletType, void>((type, _) =>
263 + WalletNewVM(getIt.get<AppStore>(),
264 + getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
265 + type: type));
266
260 - getIt.registerFactoryParam<WalletRestorationFromSeedVM, List, void>((args, _) {
267 + getIt
268 + .registerFactoryParam<WalletRestorationFromSeedVM, List, void>((args, _) {
269 final type = args.first as WalletType;
270 final language = args[1] as String;
271 final mnemonic = args[2] as String;
272
265 - return WalletRestorationFromSeedVM(
266 - getIt.get<AppStore>(), getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
273 + return WalletRestorationFromSeedVM(getIt.get<AppStore>(),
274 + getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
275 type: type, language: language, seed: mnemonic);
276 });
277
270 - getIt.registerFactoryParam<WalletRestorationFromKeysVM, List, void>((args, _) {
278 + getIt
279 + .registerFactoryParam<WalletRestorationFromKeysVM, List, void>((args, _) {
280 final type = args.first as WalletType;
281 final language = args[1] as String;
282
274 - return WalletRestorationFromKeysVM(
275 - getIt.get<AppStore>(), getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
283 + return WalletRestorationFromKeysVM(getIt.get<AppStore>(),
284 + getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
285 type: type, language: language);
286 });
287
288 getIt.registerFactory<WalletAddressListViewModel>(() =>
280 - WalletAddressListViewModel(appStore: getIt.get<AppStore>(), yatStore: getIt.get<YatStore>()));
289 + WalletAddressListViewModel(
290 + appStore: getIt.get<AppStore>(), yatStore: getIt.get<YatStore>()));
291
292 getIt.registerFactory(() => BalanceViewModel(
293 appStore: getIt.get<AppStore>(),
@@ -298,12 +308,15 @@ Future setup(
308 secureStorage: getIt.get<FlutterSecureStorage>(),
309 sharedPreferences: getIt.get<SharedPreferences>()));
310
301 - getIt.registerFactory<AuthViewModel>(() => AuthViewModel(getIt.get<AuthService>(),
302 - getIt.get<SharedPreferences>(), getIt.get<SettingsStore>(), BiometricAuth()));
311 + getIt.registerFactory<AuthViewModel>(() => AuthViewModel(
312 + getIt.get<AuthService>(),
313 + getIt.get<SharedPreferences>(),
314 + getIt.get<SettingsStore>(),
315 + BiometricAuth()));
316
317 getIt.registerFactory<AuthPage>(
305 - () => AuthPage(getIt.get<AuthViewModel>(),
306 - onAuthenticationFinished: (isAuthenticated, AuthPageState authPageState) {
318 + () => AuthPage(getIt.get<AuthViewModel>(), onAuthenticationFinished:
319 + (isAuthenticated, AuthPageState authPageState) {
320 if (!isAuthenticated) {
321 return;
322 }
@@ -318,7 +331,8 @@ Future setup(
331 authPageState.changeProcessText('Loading the wallet');
332
333 if (loginError != null) {
321 - authPageState.changeProcessText('ERROR: ${loginError.toString()}');
334 + authPageState
335 + .changeProcessText('ERROR: ${loginError.toString()}');
336 }
337
338 ReactionDisposer? _reaction;
@@ -329,29 +343,28 @@ Future setup(
343 }, closable: false),
344 instanceName: 'login');
345
332 - getIt.registerFactoryParam<AuthPage, void Function(bool, AuthPageState), bool>(
333 - (onAuthFinished, closable) => AuthPage(getIt.get<AuthViewModel>(),
334 - onAuthenticationFinished: onAuthFinished, closable: closable ?? false));
346 + getIt
347 + .registerFactoryParam<AuthPage, void Function(bool, AuthPageState), bool>(
348 + (onAuthFinished, closable) => AuthPage(getIt.get<AuthViewModel>(),
349 + onAuthenticationFinished: onAuthFinished,
350 + closable: closable ?? false));
351
336 - getIt.registerFactory(() => BalancePage(
337 - dashboardViewModel: getIt.get<DashboardViewModel>(),
338 - settingsStore: getIt.get<SettingsStore>()));
352 + getIt.registerFactory(() =>
353 + BalancePage(dashboardViewModel: getIt.get<DashboardViewModel>(), settingsStore: getIt.get<SettingsStore>()));
354
340 - getIt.registerFactory<DashboardPage>(() => DashboardPage(
341 - balancePage: getIt.get<BalancePage>(),
342 - walletViewModel: getIt.get<DashboardViewModel>(),
355 + getIt.registerFactory<DashboardPage>(() => DashboardPage( balancePage: getIt.get<BalancePage>(), walletViewModel: getIt.get<DashboardViewModel>(), addressListViewModel: getIt.get<WalletAddressListViewModel>()));
356 + getIt.registerFactory<ReceivePage>(() => ReceivePage(
357 addressListViewModel: getIt.get<WalletAddressListViewModel>()));
344 - getIt.registerFactory<ReceivePage>(
345 - () => ReceivePage(addressListViewModel: getIt.get<WalletAddressListViewModel>()));
358 getIt.registerFactory<AddressPage>(() => AddressPage(
359 addressListViewModel: getIt.get<WalletAddressListViewModel>(),
360 walletViewModel: getIt.get<DashboardViewModel>()));
361
350 - getIt.registerFactoryParam<WalletAddressEditOrCreateViewModel, dynamic, void>((dynamic item, _) =>
351 - WalletAddressEditOrCreateViewModel(wallet: getIt.get<AppStore>().wallet!, item: item));
362 + getIt.registerFactoryParam<WalletAddressEditOrCreateViewModel, dynamic, void>(
363 + (dynamic item, _) => WalletAddressEditOrCreateViewModel(
364 + wallet: getIt.get<AppStore>().wallet!, item: item));
365
353 - getIt.registerFactoryParam<AddressEditOrCreatePage, dynamic, void>((dynamic item, _) =>
354 - AddressEditOrCreatePage(
366 + getIt.registerFactoryParam<AddressEditOrCreatePage, dynamic, void>(
367 + (dynamic item, _) => AddressEditOrCreatePage(
368 addressEditOrCreateViewModel:
369 getIt.get<WalletAddressEditOrCreateViewModel>(param1: item)));
370
@@ -369,16 +382,19 @@ Future setup(
382 getIt.get<BalanceViewModel>(),
383 _transactionDescriptionBox));
384
372 - getIt.registerFactory(() => SendPage(sendViewModel: getIt.get<SendViewModel>()));
373 -
385 getIt.registerFactory(
375 - () => SendTemplatePage(sendTemplateViewModel: getIt.get<SendTemplateViewModel>()));
386 + () => SendPage(sendViewModel: getIt.get<SendViewModel>()));
387 +
388 + getIt.registerFactory(() => SendTemplatePage(
389 + sendTemplateViewModel: getIt.get<SendTemplateViewModel>()));
390
391 getIt.registerFactory(() => WalletListViewModel(
378 - _walletInfoSource, getIt.get<AppStore>(), getIt.get<WalletLoadingService>()));
392 + _walletInfoSource,
393 + getIt.get<AppStore>(),
394 + getIt.get<WalletLoadingService>()));
395
380 - getIt
381 - .registerFactory(() => WalletListPage(walletListViewModel: getIt.get<WalletListViewModel>()));
396 + getIt.registerFactory(() =>
397 + WalletListPage(walletListViewModel: getIt.get<WalletListViewModel>()));
398
399 getIt.registerFactory(() {
400 final wallet = getIt.get<AppStore>().wallet!;
@@ -387,12 +403,11 @@ Future setup(
403 return MoneroAccountListViewModel(wallet);
404 }
405
390 - throw Exception(
391 - 'Unexpected wallet type: ${wallet.type} for generate MoneroAccountListViewModel');
406 + throw Exception('Unexpected wallet type: ${wallet.type} for generate MoneroAccountListViewModel');
407 });
408
394 - getIt.registerFactory(
395 - () => MoneroAccountListPage(accountListViewModel: getIt.get<MoneroAccountListViewModel>()));
409 + getIt.registerFactory(() => MoneroAccountListPage(
410 + accountListViewModel: getIt.get<MoneroAccountListViewModel>()));
411
412 /*getIt.registerFactory(() {
413 final wallet = getIt.get<AppStore>().wallet;
@@ -409,14 +424,16 @@ Future setup(
424 moneroAccountCreationViewModel:
425 getIt.get<MoneroAccountEditOrCreateViewModel>()));*/
426
412 - getIt.registerFactoryParam<MoneroAccountEditOrCreateViewModel, AccountListItem?, void>(
427 + getIt.registerFactoryParam<MoneroAccountEditOrCreateViewModel,
428 + AccountListItem?, void>(
429 (AccountListItem? account, _) => MoneroAccountEditOrCreateViewModel(
430 monero!.getAccountList(getIt.get<AppStore>().wallet!),
431 haven?.getAccountList(getIt.get<AppStore>().wallet!),
432 wallet: getIt.get<AppStore>().wallet!,
433 accountListItem: account));
434
419 - getIt.registerFactoryParam<MoneroAccountEditOrCreatePage, AccountListItem?, void>(
435 + getIt.registerFactoryParam<MoneroAccountEditOrCreatePage, AccountListItem?,
436 + void>(
437 (AccountListItem? account, _) => MoneroAccountEditOrCreatePage(
438 moneroAccountCreationViewModel:
439 getIt.get<MoneroAccountEditOrCreateViewModel>(param1: account)));
@@ -434,36 +451,44 @@ Future setup(
451 });
452
453 getIt.registerFactory(() {
437 - return SecuritySettingsViewModel(getIt.get<SettingsStore>());
454 + return SecuritySettingsViewModel(getIt.get<SettingsStore>(), getIt.get<AuthService>());
455 });
456
440 - getIt.registerFactory(() => WalletSeedViewModel(getIt.get<AppStore>().wallet!));
457 + getIt
458 + .registerFactory(() => WalletSeedViewModel(getIt.get<AppStore>().wallet!));
459
442 - getIt.registerFactoryParam<WalletSeedPage, bool, void>((bool isWalletCreated, _) =>
443 - WalletSeedPage(getIt.get<WalletSeedViewModel>(), isNewWalletCreated: isWalletCreated));
460 + getIt.registerFactoryParam<WalletSeedPage, bool, void>(
461 + (bool isWalletCreated, _) => WalletSeedPage(
462 + getIt.get<WalletSeedViewModel>(),
463 + isNewWalletCreated: isWalletCreated));
464
445 - getIt.registerFactory(() => WalletKeysViewModel(getIt.get<AppStore>().wallet!));
465 + getIt
466 + .registerFactory(() => WalletKeysViewModel(getIt.get<AppStore>().wallet!));
467
468 getIt.registerFactory(() => WalletKeysPage(getIt.get<WalletKeysViewModel>()));
469
470 getIt.registerFactoryParam<ContactViewModel, ContactRecord?, void>(
450 - (ContactRecord? contact, _) => ContactViewModel(_contactSource, contact: contact));
471 + (ContactRecord? contact, _) =>
472 + ContactViewModel(_contactSource, contact: contact));
473
452 - getIt.registerFactory(() => ContactListViewModel(_contactSource, _walletInfoSource));
474 + getIt.registerFactory(
475 + () => ContactListViewModel(_contactSource, _walletInfoSource));
476
454 - getIt.registerFactoryParam<ContactListPage, bool, void>((bool isEditable, _) =>
455 - ContactListPage(getIt.get<ContactListViewModel>(), isEditable: isEditable));
477 + getIt.registerFactoryParam<ContactListPage, bool, void>(
478 + (bool isEditable, _) => ContactListPage(getIt.get<ContactListViewModel>(),
479 + isEditable: isEditable));
480
481 getIt.registerFactoryParam<ContactPage, ContactRecord?, void>(
458 - (ContactRecord? contact, _) => ContactPage(getIt.get<ContactViewModel>(param1: contact)));
482 + (ContactRecord? contact, _) =>
483 + ContactPage(getIt.get<ContactViewModel>(param1: contact)));
484
485 getIt.registerFactory(() {
486 final appStore = getIt.get<AppStore>();
462 - return NodeListViewModel(_nodeSource, appStore.wallet!, appStore.settingsStore);
487 + return NodeListViewModel(
488 + _nodeSource, appStore.wallet!, appStore.settingsStore);
489 });
490
465 - getIt.registerFactory(
466 - () => ConnectionSyncPage(getIt.get<NodeListViewModel>(), getIt.get<DashboardViewModel>()));
491 + getIt.registerFactory(() => ConnectionSyncPage(getIt.get<NodeListViewModel>(), getIt.get<DashboardViewModel>()));
492
493 getIt.registerFactory(() => SecurityBackupPage(getIt.get<SecuritySettingsViewModel>()));
494
@@ -473,22 +498,24 @@ Future setup(
498
499 getIt.registerFactory(() => OtherSettingsPage(getIt.get<OtherSettingsViewModel>()));
500
476 - getIt
477 - .registerFactory(() => NodeCreateOrEditViewModel(_nodeSource, getIt.get<AppStore>().wallet!));
501 + getIt.registerFactory(() =>
502 + NodeCreateOrEditViewModel(_nodeSource, getIt.get<AppStore>().wallet!));
503
479 - getIt.registerFactory(() => NodeCreateOrEditPage(getIt.get<NodeCreateOrEditViewModel>()));
504 + getIt.registerFactory(
505 + () => NodeCreateOrEditPage(getIt.get<NodeCreateOrEditViewModel>()));
506
507 getIt.registerFactory(() => OnRamperPage(
482 - settingsStore: getIt.get<AppStore>().settingsStore, wallet: getIt.get<AppStore>().wallet!));
508 + settingsStore: getIt.get<AppStore>().settingsStore,
509 + wallet: getIt.get<AppStore>().wallet!));
510
511 getIt.registerFactory(() => ExchangeViewModel(
485 - getIt.get<AppStore>().wallet!,
486 - _tradesSource,
487 - getIt.get<ExchangeTemplateStore>(),
488 - getIt.get<TradesStore>(),
489 - getIt.get<AppStore>().settingsStore,
490 - getIt.get<SharedPreferences>(),
491 - ));
512 + getIt.get<AppStore>().wallet!,
513 + _tradesSource,
514 + getIt.get<ExchangeTemplateStore>(),
515 + getIt.get<TradesStore>(),
516 + getIt.get<AppStore>().settingsStore,
517 + getIt.get<SharedPreferences>(),
518 + ));
519
520 getIt.registerFactory(() => ExchangeTradeViewModel(
521 wallet: getIt.get<AppStore>().wallet!,
@@ -498,34 +525,40 @@ Future setup(
525
526 getIt.registerFactory(() => ExchangePage(getIt.get<ExchangeViewModel>()));
527
501 - getIt.registerFactory(() => ExchangeConfirmPage(tradesStore: getIt.get<TradesStore>()));
502 -
528 getIt.registerFactory(
504 - () => ExchangeTradePage(exchangeTradeViewModel: getIt.get<ExchangeTradeViewModel>()));
529 + () => ExchangeConfirmPage(tradesStore: getIt.get<TradesStore>()));
530
506 - getIt.registerFactory(() => ExchangeTemplatePage(getIt.get<ExchangeViewModel>()));
531 + getIt.registerFactory(() => ExchangeTradePage(
532 + exchangeTradeViewModel: getIt.get<ExchangeTradeViewModel>()));
533
508 - getIt.registerFactoryParam<WalletService, WalletType, void>((WalletType param1, __) {
534 + getIt.registerFactory(
535 + () => ExchangeTemplatePage(getIt.get<ExchangeViewModel>()));
536 +
537 + getIt.registerFactoryParam<WalletService, WalletType, void>(
538 + (WalletType param1, __) {
539 switch (param1) {
540 case WalletType.haven:
541 return haven!.createHavenWalletService(_walletInfoSource);
542 case WalletType.monero:
543 return monero!.createMoneroWalletService(_walletInfoSource);
544 case WalletType.bitcoin:
515 - return bitcoin!.createBitcoinWalletService(_walletInfoSource, _unspentCoinsInfoSource!);
545 + return bitcoin!.createBitcoinWalletService(
546 + _walletInfoSource, _unspentCoinsInfoSource!);
547 case WalletType.litecoin:
517 - return bitcoin!.createLitecoinWalletService(_walletInfoSource, _unspentCoinsInfoSource!);
548 + return bitcoin!.createLitecoinWalletService(
549 + _walletInfoSource, _unspentCoinsInfoSource!);
550 default:
551 throw Exception('Unexpected token: ${param1.toString()} for generating of WalletService');
552 }
553 });
554
523 - getIt.registerFactory<SetupPinCodeViewModel>(
524 - () => SetupPinCodeViewModel(getIt.get<AuthService>(), getIt.get<SettingsStore>()));
555 + getIt.registerFactory<SetupPinCodeViewModel>(() => SetupPinCodeViewModel(
556 + getIt.get<AuthService>(), getIt.get<SettingsStore>()));
557
526 - getIt.registerFactoryParam<SetupPinCodePage, void Function(PinCodeState<PinCodeWidget>, String),
527 - void>(
528 - (onSuccessfulPinSetup, _) => SetupPinCodePage(getIt.get<SetupPinCodeViewModel>(),
558 + getIt.registerFactoryParam<SetupPinCodePage,
559 + void Function(PinCodeState<PinCodeWidget>, String), void>(
560 + (onSuccessfulPinSetup, _) => SetupPinCodePage(
561 + getIt.get<SetupPinCodeViewModel>(),
562 onSuccessfulPinSetup: onSuccessfulPinSetup));
563
564 getIt.registerFactory(() => RescanViewModel(getIt.get<AppStore>().wallet!));
@@ -534,16 +567,17 @@ Future setup(
567
568 getIt.registerFactory(() => FaqPage(getIt.get<SettingsStore>()));
569
537 - getIt.registerFactoryParam<WalletRestoreViewModel, WalletType, void>((type, _) =>
538 - WalletRestoreViewModel(
539 - getIt.get<AppStore>(), getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
570 + getIt.registerFactoryParam<WalletRestoreViewModel, WalletType, void>(
571 + (type, _) => WalletRestoreViewModel(getIt.get<AppStore>(),
572 + getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
573 type: type));
574
542 - getIt.registerFactoryParam<WalletRestorePage, WalletType, void>(
543 - (type, _) => WalletRestorePage(getIt.get<WalletRestoreViewModel>(param1: type)));
575 + getIt.registerFactoryParam<WalletRestorePage, WalletType, void>((type, _) =>
576 + WalletRestorePage(getIt.get<WalletRestoreViewModel>(param1: type)));
577
545 - getIt.registerFactoryParam<TransactionDetailsViewModel, TransactionInfo, void>(
546 - (TransactionInfo transactionInfo, _) {
578 + getIt
579 + .registerFactoryParam<TransactionDetailsViewModel, TransactionInfo, void>(
580 + (TransactionInfo transactionInfo, _) {
581 final wallet = getIt.get<AppStore>().wallet!;
582 return TransactionDetailsViewModel(
583 transactionInfo: transactionInfo,
@@ -557,47 +591,52 @@ Future setup(
591 transactionDetailsViewModel:
592 getIt.get<TransactionDetailsViewModel>(param1: transactionInfo)));
593
560 - getIt.registerFactoryParam<NewWalletTypePage, void Function(BuildContext, WalletType), void>(
594 + getIt.registerFactoryParam<NewWalletTypePage,
595 + void Function(BuildContext, WalletType), void>(
596 (param1, _) => NewWalletTypePage(onTypeSelected: param1));
597
598 getIt.registerFactoryParam<PreSeedPage, WalletType, void>(
599 (WalletType type, _) => PreSeedPage(type));
600
601 getIt.registerFactoryParam<TradeDetailsViewModel, Trade, void>((trade, _) =>
567 - TradeDetailsViewModel(
568 - tradeForDetails: trade,
569 - trades: _tradesSource,
602 + TradeDetailsViewModel(tradeForDetails: trade, trades: _tradesSource,
603 settingsStore: getIt.get<SettingsStore>()));
604
572 - getIt.registerFactory(() => BackupService(getIt.get<FlutterSecureStorage>(), _walletInfoSource,
573 - getIt.get<KeyService>(), getIt.get<SharedPreferences>()));
605 + getIt.registerFactory(() => BackupService(
606 + getIt.get<FlutterSecureStorage>(),
607 + _walletInfoSource,
608 + getIt.get<KeyService>(),
609 + getIt.get<SharedPreferences>()));
610
575 - getIt.registerFactory(() => BackupViewModel(
576 - getIt.get<FlutterSecureStorage>(), getIt.get<SecretStore>(), getIt.get<BackupService>()));
611 + getIt.registerFactory(() => BackupViewModel(getIt.get<FlutterSecureStorage>(),
612 + getIt.get<SecretStore>(), getIt.get<BackupService>()));
613
614 getIt.registerFactory(() => BackupPage(getIt.get<BackupViewModel>()));
615
580 - getIt.registerFactory(() =>
581 - EditBackupPasswordViewModel(getIt.get<FlutterSecureStorage>(), getIt.get<SecretStore>()));
616 + getIt.registerFactory(
617 + () => EditBackupPasswordViewModel(getIt.get<FlutterSecureStorage>(), getIt.get<SecretStore>()));
618
583 - getIt.registerFactory(() => EditBackupPasswordPage(getIt.get<EditBackupPasswordViewModel>()));
619 + getIt.registerFactory(
620 + () => EditBackupPasswordPage(getIt.get<EditBackupPasswordViewModel>()));
621
622 getIt.registerFactory(() => RestoreOptionsPage());
623
587 - getIt.registerFactory(() => RestoreFromBackupViewModel(getIt.get<BackupService>()));
624 + getIt.registerFactory(
625 + () => RestoreFromBackupViewModel(getIt.get<BackupService>()));
626
589 - getIt.registerFactory(() => RestoreFromBackupPage(getIt.get<RestoreFromBackupViewModel>()));
627 + getIt.registerFactory(
628 + () => RestoreFromBackupPage(getIt.get<RestoreFromBackupViewModel>()));
629
591 - getIt.registerFactoryParam<TradeDetailsPage, Trade, void>(
592 - (Trade trade, _) => TradeDetailsPage(getIt.get<TradeDetailsViewModel>(param1: trade)));
630 + getIt.registerFactoryParam<TradeDetailsPage, Trade, void>((Trade trade, _) =>
631 + TradeDetailsPage(getIt.get<TradeDetailsViewModel>(param1: trade)));
632
633 getIt.registerFactory(() => BuyAmountViewModel());
634
635 getIt.registerFactory(() {
636 final wallet = getIt.get<AppStore>().wallet;
637
599 - return BuyViewModel(_ordersSource, getIt.get<OrdersStore>(), getIt.get<SettingsStore>(),
600 - getIt.get<BuyAmountViewModel>(),
638 + return BuyViewModel(_ordersSource, getIt.get<OrdersStore>(),
639 + getIt.get<SettingsStore>(), getIt.get<BuyAmountViewModel>(),
640 wallet: wallet!);
641 });
642
@@ -609,8 +648,7 @@ Future setup(
648 final url = args.first as String;
649 final buyViewModel = args[1] as BuyViewModel;
650
612 - return BuyWebViewPage(
613 - buyViewModel: buyViewModel, ordersStore: getIt.get<OrdersStore>(), url: url);
651 + return BuyWebViewPage(buyViewModel: buyViewModel, ordersStore: getIt.get<OrdersStore>(), url: url);
652 });
653
654 getIt.registerFactoryParam<OrderDetailsViewModel, Order, void>((order, _) {
@@ -619,8 +657,8 @@ Future setup(
657 return OrderDetailsViewModel(wallet: wallet!, orderForDetails: order);
658 });
659
622 - getIt.registerFactoryParam<OrderDetailsPage, Order, void>(
623 - (Order order, _) => OrderDetailsPage(getIt.get<OrderDetailsViewModel>(param1: order)));
660 + getIt.registerFactoryParam<OrderDetailsPage, Order, void>((Order order, _) =>
661 + OrderDetailsPage(getIt.get<OrderDetailsViewModel>(param1: order)));
662
663 getIt.registerFactory(() => SupportViewModel());
664
@@ -629,18 +667,20 @@ Future setup(
667 getIt.registerFactory(() {
668 final wallet = getIt.get<AppStore>().wallet;
669
632 - return UnspentCoinsListViewModel(wallet: wallet!, unspentCoinsInfo: _unspentCoinsInfoSource!);
670 + return UnspentCoinsListViewModel(
671 + wallet: wallet!, unspentCoinsInfo: _unspentCoinsInfoSource!);
672 });
673
635 - getIt.registerFactory(() =>
636 - UnspentCoinsListPage(unspentCoinsListViewModel: getIt.get<UnspentCoinsListViewModel>()));
674 + getIt.registerFactory(() => UnspentCoinsListPage(
675 + unspentCoinsListViewModel: getIt.get<UnspentCoinsListViewModel>()));
676
677 getIt.registerFactoryParam<UnspentCoinsDetailsViewModel, UnspentCoinsItem,
678 UnspentCoinsListViewModel>(
640 - (item, model) =>
641 - UnspentCoinsDetailsViewModel(unspentCoinsItem: item, unspentCoinsListViewModel: model));
679 + (item, model) => UnspentCoinsDetailsViewModel(
680 + unspentCoinsItem: item, unspentCoinsListViewModel: model));
681
643 - getIt.registerFactoryParam<UnspentCoinsDetailsPage, List, void>((List args, _) {
682 + getIt.registerFactoryParam<UnspentCoinsDetailsPage, List, void>(
683 + (List args, _) {
684 final item = args.first as UnspentCoinsItem;
685 final unspentCoinsListViewModel = args[1] as UnspentCoinsListViewModel;
686
@@ -653,15 +693,12 @@ Future setup(
693
694 getIt.registerFactory(() => YatService());
695
656 - getIt.registerFactory(() => AddressResolver(
657 - yatService: getIt.get<YatService>(), walletType: getIt.get<AppStore>().wallet!.type));
696 + getIt.registerFactory(() => AddressResolver(yatService: getIt.get<YatService>(),
697 + walletType: getIt.get<AppStore>().wallet!.type));
698
699 getIt.registerFactoryParam<FullscreenQRPage, String, bool>(
660 - (String qrData, bool isLight) => FullscreenQRPage(
661 - qrData: qrData,
662 - isLight: isLight,
663 - ));
664 -
700 + (String qrData, bool isLight) => FullscreenQRPage(qrData: qrData, isLight: isLight,));
701 +
702 getIt.registerFactory(() => IoniaApi());
703
704 getIt.registerFactory(() => AnyPayApi());
@@ -669,24 +706,26 @@ Future setup(
706 getIt.registerFactory<IoniaService>(
707 () => IoniaService(getIt.get<FlutterSecureStorage>(), getIt.get<IoniaApi>()));
708
672 - getIt.registerFactory<IoniaAnyPay>(() => IoniaAnyPay(
673 - getIt.get<IoniaService>(), getIt.get<AnyPayApi>(), getIt.get<AppStore>().wallet!));
709 + getIt.registerFactory<IoniaAnyPay>(
710 + () => IoniaAnyPay(
711 + getIt.get<IoniaService>(),
712 + getIt.get<AnyPayApi>(),
713 + getIt.get<AppStore>().wallet!));
714
715 getIt.registerFactory(() => IoniaGiftCardsListViewModel(ioniaService: getIt.get<IoniaService>()));
716
717 getIt.registerFactory(() => IoniaAuthViewModel(ioniaService: getIt.get<IoniaService>()));
718
679 - getIt.registerFactoryParam<IoniaMerchPurchaseViewModel, double, IoniaMerchant>(
680 - (double amount, merchant) {
719 + getIt.registerFactoryParam<IoniaMerchPurchaseViewModel, double, IoniaMerchant>((double amount, merchant) {
720 return IoniaMerchPurchaseViewModel(
682 - ioniaAnyPayService: getIt.get<IoniaAnyPay>(),
683 - amount: amount,
684 - ioniaMerchant: merchant,
685 - sendViewModel: getIt.get<SendViewModel>());
721 + ioniaAnyPayService: getIt.get<IoniaAnyPay>(),
722 + amount: amount,
723 + ioniaMerchant: merchant,
724 + sendViewModel: getIt.get<SendViewModel>()
725 + );
726 });
727
688 - getIt.registerFactoryParam<IoniaBuyCardViewModel, IoniaMerchant, void>(
689 - (IoniaMerchant merchant, _) {
728 + getIt.registerFactoryParam<IoniaBuyCardViewModel, IoniaMerchant, void>((IoniaMerchant merchant, _) {
729 return IoniaBuyCardViewModel(ioniaMerchant: merchant);
730 });
731
@@ -714,44 +753,42 @@ Future setup(
753 getIt.registerFactoryParam<IoniaBuyGiftCardDetailPage, List, void>((List args, _) {
754 final amount = args.first as double;
755 final merchant = args.last as IoniaMerchant;
717 - return IoniaBuyGiftCardDetailPage(
718 - getIt.get<IoniaMerchPurchaseViewModel>(param1: amount, param2: merchant));
756 + return IoniaBuyGiftCardDetailPage(getIt.get<IoniaMerchPurchaseViewModel>(param1: amount, param2: merchant));
757 });
758
721 - getIt.registerFactoryParam<IoniaGiftCardDetailsViewModel, IoniaGiftCard, void>(
722 - (IoniaGiftCard giftCard, _) {
723 - return IoniaGiftCardDetailsViewModel(
724 - ioniaService: getIt.get<IoniaService>(), giftCard: giftCard);
759 + getIt.registerFactoryParam<IoniaGiftCardDetailsViewModel, IoniaGiftCard, void>((IoniaGiftCard giftCard, _) {
760 + return IoniaGiftCardDetailsViewModel(
761 + ioniaService: getIt.get<IoniaService>(),
762 + giftCard: giftCard);
763 });
726 -
727 - getIt.registerFactoryParam<IoniaCustomTipViewModel, List, void>((List args, _) {
728 - final amount = args[0] as double;
729 - final merchant = args[1] as IoniaMerchant;
730 - final tip = args[2] as IoniaTip;
731 -
732 - return IoniaCustomTipViewModel(amount: amount, tip: tip, ioniaMerchant: merchant);
764 +
765 + getIt.registerFactoryParam<IoniaCustomTipViewModel, List, void>((List args, _) {
766 + final amount = args[0] as double;
767 + final merchant = args[1] as IoniaMerchant;
768 + final tip = args[2] as IoniaTip;
769 +
770 + return IoniaCustomTipViewModel(amount: amount, tip: tip, ioniaMerchant: merchant);
771 });
734 -
735 - getIt.registerFactoryParam<IoniaGiftCardDetailPage, IoniaGiftCard, void>(
736 - (IoniaGiftCard giftCard, _) {
737 - return IoniaGiftCardDetailPage(getIt.get<IoniaGiftCardDetailsViewModel>(param1: giftCard));
772 +
773 + getIt.registerFactoryParam<IoniaGiftCardDetailPage, IoniaGiftCard, void>((IoniaGiftCard giftCard, _) {
774 + return IoniaGiftCardDetailPage(getIt.get<IoniaGiftCardDetailsViewModel>(param1: giftCard));
775 });
776
740 - getIt.registerFactoryParam<IoniaMoreOptionsPage, List, void>((List args, _) {
777 + getIt.registerFactoryParam<IoniaMoreOptionsPage, List, void>((List args, _){
778 final giftCard = args.first as IoniaGiftCard;
742 -
743 - return IoniaMoreOptionsPage(giftCard);
779 +
780 + return IoniaMoreOptionsPage(giftCard);
781 });
782
746 - getIt.registerFactoryParam<IoniaCustomRedeemViewModel, IoniaGiftCard, void>(
747 - (IoniaGiftCard giftCard, _) => IoniaCustomRedeemViewModel(giftCard));
783 + getIt.registerFactoryParam<IoniaCustomRedeemViewModel, IoniaGiftCard, void>((IoniaGiftCard giftCard, _) => IoniaCustomRedeemViewModel(giftCard));
784
749 - getIt.registerFactoryParam<IoniaCustomRedeemPage, List, void>((List args, _) {
785 + getIt.registerFactoryParam<IoniaCustomRedeemPage, List, void>((List args, _){
786 final giftCard = args.first as IoniaGiftCard;
751 -
752 - return IoniaCustomRedeemPage(getIt.get<IoniaCustomRedeemViewModel>(param1: giftCard));
787 +
788 + return IoniaCustomRedeemPage(getIt.get<IoniaCustomRedeemViewModel>(param1: giftCard) );
789 });
790
791 +
792 getIt.registerFactoryParam<IoniaCustomTipPage, List, void>((List args, _) {
793 return IoniaCustomTipPage(getIt.get<IoniaCustomTipViewModel>(param1: args));
794 });
@@ -766,17 +803,16 @@ Future setup(
803
804 getIt.registerFactory(() => IoniaAccountCardsPage(getIt.get<IoniaAccountViewModel>()));
805
769 - getIt.registerFactoryParam<IoniaPaymentStatusViewModel, IoniaAnyPayPaymentInfo,
770 - AnyPayPaymentCommittedInfo>(
771 - (IoniaAnyPayPaymentInfo paymentInfo, AnyPayPaymentCommittedInfo committedInfo) =>
772 - IoniaPaymentStatusViewModel(getIt.get<IoniaService>(),
773 - paymentInfo: paymentInfo, committedInfo: committedInfo));
806 + getIt.registerFactoryParam<IoniaPaymentStatusViewModel, IoniaAnyPayPaymentInfo, AnyPayPaymentCommittedInfo>(
807 + (IoniaAnyPayPaymentInfo paymentInfo, AnyPayPaymentCommittedInfo committedInfo)
808 + => IoniaPaymentStatusViewModel(
809 + getIt.get<IoniaService>(),
810 + paymentInfo: paymentInfo,
811 + committedInfo: committedInfo));
812
775 - getIt.registerFactoryParam<IoniaPaymentStatusPage, IoniaAnyPayPaymentInfo,
776 - AnyPayPaymentCommittedInfo>(
777 - (IoniaAnyPayPaymentInfo paymentInfo, AnyPayPaymentCommittedInfo committedInfo) =>
778 - IoniaPaymentStatusPage(
779 - getIt.get<IoniaPaymentStatusViewModel>(param1: paymentInfo, param2: committedInfo)));
813 + getIt.registerFactoryParam<IoniaPaymentStatusPage, IoniaAnyPayPaymentInfo, AnyPayPaymentCommittedInfo>(
814 + (IoniaAnyPayPaymentInfo paymentInfo, AnyPayPaymentCommittedInfo committedInfo)
815 + => IoniaPaymentStatusPage(getIt.get<IoniaPaymentStatusViewModel>(param1: paymentInfo, param2: committedInfo)));
816
817 _isSetupFinished = true;
782 -}
818 +}
\ No newline at end of file
lib/view_model/settings/security_settings_view_model.dart
+18 -2
@@ -1,4 +1,6 @@
1 +import 'package:cake_wallet/core/auth_service.dart';
2 import 'package:cake_wallet/entities/biometric_auth.dart';
3 +import 'package:cake_wallet/entities/pin_code_required_duration.dart';
4 import 'package:cake_wallet/store/settings_store.dart';
5 import 'package:mobx/mobx.dart';
6
@@ -7,19 +9,33 @@ part 'security_settings_view_model.g.dart';
9 class SecuritySettingsViewModel = SecuritySettingsViewModelBase with _$SecuritySettingsViewModel;
10
11 abstract class SecuritySettingsViewModelBase with Store {
10 - SecuritySettingsViewModelBase(this._settingsStore) : _biometricAuth = BiometricAuth();
12 + SecuritySettingsViewModelBase(
13 + this._settingsStore,
14 + this._authService,
15 + ) : _biometricAuth = BiometricAuth();
16
17 final BiometricAuth _biometricAuth;
18 final SettingsStore _settingsStore;
19 + final AuthService _authService;
20
21 @computed
22 bool get allowBiometricalAuthentication => _settingsStore.allowBiometricalAuthentication;
23
24 + @computed
25 + PinCodeRequiredDuration get pinCodeRequiredDuration => _settingsStore.pinTimeOutDuration;
26 +
27 @action
28 Future<bool> biometricAuthenticated() async {
29 return await _biometricAuth.canCheckBiometrics() && await _biometricAuth.isAuthenticated();
30 }
31
32 @action
24 - void setAllowBiometricalAuthentication(bool value) => _settingsStore.allowBiometricalAuthentication = value;
33 + void setAllowBiometricalAuthentication(bool value) =>
34 + _settingsStore.allowBiometricalAuthentication = value;
35 +
36 + @action
37 + setPinCodeRequiredDuration(PinCodeRequiredDuration duration) =>
38 + _settingsStore.pinTimeOutDuration = duration;
39 +
40 + bool checkPinCodeRiquired() => _authService.requireAuth();
41 }