2022-01-21 13:02:00 +00:00
|
|
|
import 'package:cake_wallet/entities/wake_lock.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cake_wallet/monero/monero.dart';
|
|
|
|
import 'package:cake_wallet/bitcoin/bitcoin.dart';
|
|
|
|
import 'package:cw_core/unspent_coins_info.dart';
|
2021-01-15 17:41:30 +00:00
|
|
|
import 'package:cake_wallet/core/backup_service.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cw_core/wallet_service.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/entities/biometric_auth.dart';
|
2020-09-26 19:17:31 +00:00
|
|
|
import 'package:cake_wallet/entities/contact_record.dart';
|
2021-04-12 18:22:22 +00:00
|
|
|
import 'package:cake_wallet/buy/order.dart';
|
2020-11-06 18:54:00 +00:00
|
|
|
import 'package:cake_wallet/entities/transaction_description.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cw_core/transaction_info.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/entities/contact.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cw_core/node.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/exchange/trade.dart';
|
2020-11-12 20:02:37 +00:00
|
|
|
import 'package:cake_wallet/reactions/on_authentication_state_change.dart';
|
2021-01-13 16:43:34 +00:00
|
|
|
import 'package:cake_wallet/src/screens/backup/backup_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/backup/edit_backup_password_page.dart';
|
2021-04-13 18:40:44 +00:00
|
|
|
import 'package:cake_wallet/src/screens/buy/buy_webview_page.dart';
|
2021-04-12 18:22:22 +00:00
|
|
|
import 'package:cake_wallet/src/screens/buy/pre_order_page.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/src/screens/contact/contact_list_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/contact/contact_page.dart';
|
2020-08-26 17:31:23 +00:00
|
|
|
import 'package:cake_wallet/src/screens/exchange_trade/exchange_confirm_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/exchange_trade/exchange_trade_page.dart';
|
2020-09-28 15:47:43 +00:00
|
|
|
import 'package:cake_wallet/src/screens/faq/faq_page.dart';
|
2020-11-12 16:31:53 +00:00
|
|
|
import 'package:cake_wallet/src/screens/new_wallet/new_wallet_type_page.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/src/screens/nodes/node_create_or_edit_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/nodes/nodes_list_page.dart';
|
2021-03-12 19:04:37 +00:00
|
|
|
import 'package:cake_wallet/src/screens/order_details/order_details_page.dart';
|
2020-10-22 18:24:24 +00:00
|
|
|
import 'package:cake_wallet/src/screens/pin_code/pin_code_widget.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/src/screens/rescan/rescan_page.dart';
|
2021-01-13 16:43:34 +00:00
|
|
|
import 'package:cake_wallet/src/screens/restore/restore_from_backup_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/restore/restore_options_page.dart';
|
2020-10-13 21:11:04 +00:00
|
|
|
import 'package:cake_wallet/src/screens/restore/wallet_restore_page.dart';
|
2020-11-27 11:08:17 +00:00
|
|
|
import 'package:cake_wallet/src/screens/seed/pre_seed_page.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/src/screens/seed/wallet_seed_page.dart';
|
2020-07-29 16:55:42 +00:00
|
|
|
import 'package:cake_wallet/src/screens/send/send_template_page.dart';
|
2020-09-28 15:47:43 +00:00
|
|
|
import 'package:cake_wallet/src/screens/settings/change_language.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/src/screens/settings/settings.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/src/screens/setup_pin_code/setup_pin_code.dart';
|
2021-02-25 18:25:52 +00:00
|
|
|
import 'package:cake_wallet/src/screens/support/support_page.dart';
|
2020-12-18 12:42:53 +00:00
|
|
|
import 'package:cake_wallet/src/screens/trade_details/trade_details_page.dart';
|
2020-11-06 18:54:00 +00:00
|
|
|
import 'package:cake_wallet/src/screens/transaction_details/transaction_details_page.dart';
|
2021-05-27 17:57:51 +00:00
|
|
|
import 'package:cake_wallet/src/screens/unspent_coins/unspent_coins_details_page.dart';
|
2021-05-25 17:32:36 +00:00
|
|
|
import 'package:cake_wallet/src/screens/unspent_coins/unspent_coins_list_page.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/src/screens/wallet_keys/wallet_keys_page.dart';
|
2020-07-31 15:29:21 +00:00
|
|
|
import 'package:cake_wallet/src/screens/exchange/exchange_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/exchange/exchange_template_page.dart';
|
2021-03-12 19:04:37 +00:00
|
|
|
import 'package:cake_wallet/store/dashboard/orders_store.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/store/node_list_store.dart';
|
2021-01-13 16:43:34 +00:00
|
|
|
import 'package:cake_wallet/store/secret_store.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/store/settings_store.dart';
|
2020-06-20 07:10:00 +00:00
|
|
|
import 'package:cake_wallet/core/auth_service.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/core/key_service.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cw_core/wallet_info.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/src/screens/monero_accounts/monero_account_list_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/monero_accounts/monero_account_edit_or_create_page.dart';
|
2020-06-20 07:10:00 +00:00
|
|
|
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/dashboard/dashboard_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/receive/receive_page.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/src/screens/send/send_page.dart';
|
2020-06-20 07:10:00 +00:00
|
|
|
import 'package:cake_wallet/src/screens/subaddress/address_edit_or_create_page.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/src/screens/wallet_list/wallet_list_page.dart';
|
|
|
|
import 'package:cake_wallet/store/wallet_list_store.dart';
|
2021-10-01 15:13:10 +00:00
|
|
|
import 'package:cake_wallet/store/yat/yat_store.dart';
|
2021-01-13 16:43:34 +00:00
|
|
|
import 'package:cake_wallet/view_model/backup_view_model.dart';
|
2021-04-12 18:22:22 +00:00
|
|
|
import 'package:cake_wallet/view_model/buy/buy_amount_view_model.dart';
|
|
|
|
import 'package:cake_wallet/view_model/buy/buy_view_model.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/view_model/contact_list/contact_list_view_model.dart';
|
|
|
|
import 'package:cake_wallet/view_model/contact_list/contact_view_model.dart';
|
2021-01-13 16:43:34 +00:00
|
|
|
import 'package:cake_wallet/view_model/edit_backup_password_view_model.dart';
|
2020-08-26 17:31:23 +00:00
|
|
|
import 'package:cake_wallet/view_model/exchange/exchange_trade_view_model.dart';
|
2020-11-17 18:16:58 +00:00
|
|
|
import 'package:cake_wallet/view_model/monero_account_list/account_list_item.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/view_model/node_list/node_list_view_model.dart';
|
|
|
|
import 'package:cake_wallet/view_model/node_list/node_create_or_edit_view_model.dart';
|
2021-03-12 19:04:37 +00:00
|
|
|
import 'package:cake_wallet/view_model/order_details_view_model.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/view_model/rescan_view_model.dart';
|
2021-01-13 16:43:34 +00:00
|
|
|
import 'package:cake_wallet/view_model/restore_from_backup_view_model.dart';
|
2021-07-16 09:32:36 +00:00
|
|
|
import 'package:cake_wallet/view_model/send/send_template_view_model.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/view_model/setup_pin_code_view_model.dart';
|
2021-02-25 18:25:52 +00:00
|
|
|
import 'package:cake_wallet/view_model/support_view_model.dart';
|
2020-12-22 18:42:30 +00:00
|
|
|
import 'package:cake_wallet/view_model/transaction_details_view_model.dart';
|
2020-12-18 12:42:53 +00:00
|
|
|
import 'package:cake_wallet/view_model/trade_details_view_model.dart';
|
2021-05-27 17:57:51 +00:00
|
|
|
import 'package:cake_wallet/view_model/unspent_coins/unspent_coins_details_view_model.dart';
|
|
|
|
import 'package:cake_wallet/view_model/unspent_coins/unspent_coins_item.dart';
|
2021-05-25 17:32:36 +00:00
|
|
|
import 'package:cake_wallet/view_model/unspent_coins/unspent_coins_list_view_model.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_edit_or_create_view_model.dart';
|
2020-06-20 07:10:00 +00:00
|
|
|
import 'package:cake_wallet/view_model/auth_view_model.dart';
|
2020-07-23 12:20:52 +00:00
|
|
|
import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart';
|
|
|
|
import 'package:cake_wallet/view_model/dashboard/balance_view_model.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
|
|
|
|
import 'package:cake_wallet/view_model/monero_account_list/monero_account_edit_or_create_view_model.dart';
|
|
|
|
import 'package:cake_wallet/view_model/monero_account_list/monero_account_list_view_model.dart';
|
2020-08-25 16:32:40 +00:00
|
|
|
import 'package:cake_wallet/view_model/send/send_view_model.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/view_model/settings/settings_view_model.dart';
|
|
|
|
import 'package:cake_wallet/view_model/wallet_keys_view_model.dart';
|
|
|
|
import 'package:cake_wallet/view_model/wallet_list/wallet_list_view_model.dart';
|
2020-10-13 21:11:04 +00:00
|
|
|
import 'package:cake_wallet/view_model/wallet_restore_view_model.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/view_model/wallet_seed_view_model.dart';
|
2020-07-31 15:29:21 +00:00
|
|
|
import 'package:cake_wallet/view_model/exchange/exchange_view_model.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:flutter/widgets.dart';
|
2020-06-20 07:10:00 +00:00
|
|
|
import 'package:get_it/get_it.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:hive/hive.dart';
|
2020-10-01 16:46:23 +00:00
|
|
|
import 'package:mobx/mobx.dart';
|
2020-06-20 07:10:00 +00:00
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|
|
|
import 'package:cake_wallet/view_model/wallet_restoration_from_seed_vm.dart';
|
2020-09-04 10:40:28 +00:00
|
|
|
import 'package:cake_wallet/view_model/wallet_restoration_from_keys_vm.dart';
|
2020-06-20 07:10:00 +00:00
|
|
|
import 'package:cake_wallet/core/wallet_creation_service.dart';
|
|
|
|
import 'package:cake_wallet/store/app_store.dart';
|
2021-12-24 12:37:24 +00:00
|
|
|
import 'package:cw_core/wallet_type.dart';
|
2020-06-20 07:10:00 +00:00
|
|
|
import 'package:cake_wallet/view_model/wallet_new_vm.dart';
|
|
|
|
import 'package:cake_wallet/store/authentication_store.dart';
|
2020-07-23 12:20:52 +00:00
|
|
|
import 'package:cake_wallet/store/dashboard/trades_store.dart';
|
|
|
|
import 'package:cake_wallet/store/dashboard/trade_filter_store.dart';
|
|
|
|
import 'package:cake_wallet/store/dashboard/transaction_filter_store.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart';
|
2020-07-29 16:55:42 +00:00
|
|
|
import 'package:cake_wallet/store/templates/send_template_store.dart';
|
|
|
|
import 'package:cake_wallet/store/templates/exchange_template_store.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/entities/template.dart';
|
|
|
|
import 'package:cake_wallet/exchange/exchange_template.dart';
|
2021-03-16 13:20:46 +00:00
|
|
|
import 'package:cake_wallet/.secrets.g.dart' as secrets;
|
2020-06-20 07:10:00 +00:00
|
|
|
|
|
|
|
final getIt = GetIt.instance;
|
|
|
|
|
2021-01-15 17:41:30 +00:00
|
|
|
var _isSetupFinished = false;
|
|
|
|
Box<WalletInfo> _walletInfoSource;
|
|
|
|
Box<Node> _nodeSource;
|
|
|
|
Box<Contact> _contactSource;
|
|
|
|
Box<Trade> _tradesSource;
|
|
|
|
Box<Template> _templates;
|
|
|
|
Box<ExchangeTemplate> _exchangeTemplates;
|
|
|
|
Box<TransactionDescription> _transactionDescriptionBox;
|
2021-03-12 19:04:37 +00:00
|
|
|
Box<Order> _ordersSource;
|
2021-07-05 13:52:24 +00:00
|
|
|
Box<UnspentCoinsInfo> _unspentCoinsInfoSource;
|
2021-01-15 17:41:30 +00:00
|
|
|
|
2020-07-06 20:09:03 +00:00
|
|
|
Future setup(
|
|
|
|
{Box<WalletInfo> walletInfoSource,
|
|
|
|
Box<Node> nodeSource,
|
2020-07-23 12:20:52 +00:00
|
|
|
Box<Contact> contactSource,
|
2020-07-29 16:55:42 +00:00
|
|
|
Box<Trade> tradesSource,
|
|
|
|
Box<Template> templates,
|
2020-11-06 18:54:00 +00:00
|
|
|
Box<ExchangeTemplate> exchangeTemplates,
|
2021-03-12 19:04:37 +00:00
|
|
|
Box<TransactionDescription> transactionDescriptionBox,
|
2021-07-05 13:52:24 +00:00
|
|
|
Box<Order> ordersSource,
|
|
|
|
Box<UnspentCoinsInfo> unspentCoinsInfoSource}) async {
|
2021-01-15 17:41:30 +00:00
|
|
|
_walletInfoSource = walletInfoSource;
|
|
|
|
_nodeSource = nodeSource;
|
|
|
|
_contactSource = contactSource;
|
|
|
|
_tradesSource = tradesSource;
|
|
|
|
_templates = templates;
|
|
|
|
_exchangeTemplates = exchangeTemplates;
|
|
|
|
_transactionDescriptionBox = transactionDescriptionBox;
|
2021-03-12 19:04:37 +00:00
|
|
|
_ordersSource = ordersSource;
|
2021-07-05 13:52:24 +00:00
|
|
|
_unspentCoinsInfoSource = unspentCoinsInfoSource;
|
2021-01-15 17:41:30 +00:00
|
|
|
|
|
|
|
if (!_isSetupFinished) {
|
|
|
|
getIt.registerSingletonAsync<SharedPreferences>(
|
2021-03-16 13:20:46 +00:00
|
|
|
() => SharedPreferences.getInstance());
|
2021-01-15 17:41:30 +00:00
|
|
|
}
|
|
|
|
|
2021-03-16 13:20:46 +00:00
|
|
|
final isBitcoinBuyEnabled = (secrets.wyreSecretKey?.isNotEmpty ?? false) &&
|
|
|
|
(secrets.wyreApiKey?.isNotEmpty ?? false) &&
|
|
|
|
(secrets.wyreAccountId?.isNotEmpty ?? false);
|
2021-06-01 18:03:35 +00:00
|
|
|
|
2021-03-16 13:20:46 +00:00
|
|
|
final settingsStore = await SettingsStoreBase.load(
|
2021-06-07 13:40:25 +00:00
|
|
|
nodeSource: _nodeSource, isBitcoinBuyEnabled: isBitcoinBuyEnabled);
|
2020-07-06 20:09:03 +00:00
|
|
|
|
2021-01-15 17:41:30 +00:00
|
|
|
if (_isSetupFinished) {
|
|
|
|
return;
|
|
|
|
}
|
2020-07-06 20:09:03 +00:00
|
|
|
|
2021-01-15 17:41:30 +00:00
|
|
|
getIt.registerFactory<Box<Node>>(() => _nodeSource);
|
2020-09-21 11:50:26 +00:00
|
|
|
|
2020-07-06 20:09:03 +00:00
|
|
|
getIt.registerSingleton<FlutterSecureStorage>(FlutterSecureStorage());
|
|
|
|
getIt.registerSingleton(AuthenticationStore());
|
|
|
|
getIt.registerSingleton<WalletListStore>(WalletListStore());
|
2020-09-21 11:50:26 +00:00
|
|
|
getIt.registerSingleton(NodeListStoreBase.instance);
|
2020-07-06 20:09:03 +00:00
|
|
|
getIt.registerSingleton<SettingsStore>(settingsStore);
|
|
|
|
getIt.registerSingleton<AppStore>(AppStore(
|
|
|
|
authenticationStore: getIt.get<AuthenticationStore>(),
|
|
|
|
walletList: getIt.get<WalletListStore>(),
|
|
|
|
settingsStore: getIt.get<SettingsStore>(),
|
|
|
|
nodeListStore: getIt.get<NodeListStore>()));
|
2020-07-23 12:20:52 +00:00
|
|
|
getIt.registerSingleton<TradesStore>(TradesStore(
|
2021-01-15 17:41:30 +00:00
|
|
|
tradesSource: _tradesSource, settingsStore: getIt.get<SettingsStore>()));
|
2021-03-12 19:04:37 +00:00
|
|
|
getIt.registerSingleton<OrdersStore>(OrdersStore(
|
|
|
|
ordersSource: _ordersSource, settingsStore: getIt.get<SettingsStore>()));
|
2020-08-26 17:31:23 +00:00
|
|
|
getIt.registerSingleton<TradeFilterStore>(TradeFilterStore());
|
2020-07-23 12:20:52 +00:00
|
|
|
getIt.registerSingleton<TransactionFilterStore>(TransactionFilterStore());
|
2020-09-21 11:50:26 +00:00
|
|
|
getIt.registerSingleton<FiatConversionStore>(FiatConversionStore());
|
2020-07-29 16:55:42 +00:00
|
|
|
getIt.registerSingleton<SendTemplateStore>(
|
2021-01-15 17:41:30 +00:00
|
|
|
SendTemplateStore(templateSource: _templates));
|
2020-07-29 16:55:42 +00:00
|
|
|
getIt.registerSingleton<ExchangeTemplateStore>(
|
2021-01-15 17:41:30 +00:00
|
|
|
ExchangeTemplateStore(templateSource: _exchangeTemplates));
|
2021-10-01 15:13:10 +00:00
|
|
|
getIt.registerSingleton<YatStore>(YatStore(
|
2022-01-21 13:02:00 +00:00
|
|
|
appStore: getIt.get<AppStore>(),
|
|
|
|
secureStorage: getIt.get<FlutterSecureStorage>())
|
2021-12-08 11:09:38 +00:00
|
|
|
..init());
|
2020-07-23 12:20:52 +00:00
|
|
|
|
2021-01-13 16:43:34 +00:00
|
|
|
final secretStore =
|
|
|
|
await SecretStoreBase.load(getIt.get<FlutterSecureStorage>());
|
|
|
|
|
|
|
|
getIt.registerSingleton<SecretStore>(secretStore);
|
|
|
|
|
2020-07-06 20:09:03 +00:00
|
|
|
getIt.registerFactory<KeyService>(
|
|
|
|
() => KeyService(getIt.get<FlutterSecureStorage>()));
|
|
|
|
|
2020-06-20 07:10:00 +00:00
|
|
|
getIt.registerFactoryParam<WalletCreationService, WalletType, void>(
|
|
|
|
(type, _) => WalletCreationService(
|
|
|
|
initialType: type,
|
2020-07-06 20:09:03 +00:00
|
|
|
keyService: getIt.get<KeyService>(),
|
2020-06-20 07:10:00 +00:00
|
|
|
secureStorage: getIt.get<FlutterSecureStorage>(),
|
|
|
|
sharedPreferences: getIt.get<SharedPreferences>()));
|
|
|
|
|
|
|
|
getIt.registerFactoryParam<WalletNewVM, WalletType, void>((type, _) =>
|
2020-09-21 11:50:26 +00:00
|
|
|
WalletNewVM(getIt.get<AppStore>(),
|
2021-01-15 17:41:30 +00:00
|
|
|
getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
|
2020-07-06 20:09:03 +00:00
|
|
|
type: type));
|
2020-06-20 07:10:00 +00:00
|
|
|
|
|
|
|
getIt
|
|
|
|
.registerFactoryParam<WalletRestorationFromSeedVM, List, void>((args, _) {
|
|
|
|
final type = args.first as WalletType;
|
|
|
|
final language = args[1] as String;
|
|
|
|
final mnemonic = args[2] as String;
|
|
|
|
|
2020-09-21 11:50:26 +00:00
|
|
|
return WalletRestorationFromSeedVM(getIt.get<AppStore>(),
|
2021-01-15 17:41:30 +00:00
|
|
|
getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
|
2020-07-06 20:09:03 +00:00
|
|
|
type: type, language: language, seed: mnemonic);
|
2020-06-20 07:10:00 +00:00
|
|
|
});
|
|
|
|
|
2020-09-04 10:40:28 +00:00
|
|
|
getIt
|
|
|
|
.registerFactoryParam<WalletRestorationFromKeysVM, List, void>((args, _) {
|
|
|
|
final type = args.first as WalletType;
|
|
|
|
final language = args[1] as String;
|
|
|
|
|
2020-09-21 11:50:26 +00:00
|
|
|
return WalletRestorationFromKeysVM(getIt.get<AppStore>(),
|
2021-01-15 17:41:30 +00:00
|
|
|
getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
|
2020-09-04 10:40:28 +00:00
|
|
|
type: type, language: language);
|
|
|
|
});
|
|
|
|
|
2022-01-21 13:02:00 +00:00
|
|
|
getIt.registerFactory<WalletAddressListViewModel>(() =>
|
|
|
|
WalletAddressListViewModel(
|
|
|
|
appStore: getIt.get<AppStore>(), yatStore: getIt.get<YatStore>()));
|
2020-06-20 07:10:00 +00:00
|
|
|
|
2020-08-25 16:32:40 +00:00
|
|
|
getIt.registerFactory(() => BalanceViewModel(
|
2020-09-24 09:16:13 +00:00
|
|
|
appStore: getIt.get<AppStore>(),
|
2020-08-25 16:32:40 +00:00
|
|
|
settingsStore: getIt.get<SettingsStore>(),
|
2020-09-21 11:50:26 +00:00
|
|
|
fiatConvertationStore: getIt.get<FiatConversionStore>()));
|
2020-07-23 12:20:52 +00:00
|
|
|
|
2020-08-25 16:32:40 +00:00
|
|
|
getIt.registerFactory(() => DashboardViewModel(
|
|
|
|
balanceViewModel: getIt.get<BalanceViewModel>(),
|
|
|
|
appStore: getIt.get<AppStore>(),
|
|
|
|
tradesStore: getIt.get<TradesStore>(),
|
|
|
|
tradeFilterStore: getIt.get<TradeFilterStore>(),
|
2021-03-16 13:20:46 +00:00
|
|
|
transactionFilterStore: getIt.get<TransactionFilterStore>(),
|
2021-03-24 10:22:42 +00:00
|
|
|
settingsStore: settingsStore,
|
2021-10-01 15:13:10 +00:00
|
|
|
yatStore: getIt.get<YatStore>(),
|
2021-08-16 14:44:38 +00:00
|
|
|
ordersStore: getIt.get<OrdersStore>()));
|
2020-06-20 07:10:00 +00:00
|
|
|
|
|
|
|
getIt.registerFactory<AuthService>(() => AuthService(
|
|
|
|
secureStorage: getIt.get<FlutterSecureStorage>(),
|
|
|
|
sharedPreferences: getIt.get<SharedPreferences>()));
|
|
|
|
|
|
|
|
getIt.registerFactory<AuthViewModel>(() => AuthViewModel(
|
2020-09-21 11:50:26 +00:00
|
|
|
getIt.get<AuthService>(),
|
|
|
|
getIt.get<SharedPreferences>(),
|
|
|
|
getIt.get<SettingsStore>(),
|
|
|
|
BiometricAuth()));
|
2020-06-20 07:10:00 +00:00
|
|
|
|
2020-07-06 20:09:03 +00:00
|
|
|
getIt.registerFactory<AuthPage>(
|
2020-10-01 16:46:23 +00:00
|
|
|
() => AuthPage(getIt.get<AuthViewModel>(), onAuthenticationFinished:
|
|
|
|
(isAuthenticated, AuthPageState authPageState) {
|
|
|
|
if (!isAuthenticated) {
|
|
|
|
return;
|
2020-07-06 20:09:03 +00:00
|
|
|
}
|
2020-10-01 16:46:23 +00:00
|
|
|
final authStore = getIt.get<AuthenticationStore>();
|
|
|
|
final appStore = getIt.get<AppStore>();
|
|
|
|
|
|
|
|
if (appStore.wallet != null) {
|
|
|
|
authStore.allowed();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
authPageState.changeProcessText('Loading the wallet');
|
2020-11-12 20:02:37 +00:00
|
|
|
|
|
|
|
if (loginError != null) {
|
2020-11-16 18:17:03 +00:00
|
|
|
authPageState
|
|
|
|
.changeProcessText('ERROR: ${loginError.toString()}');
|
2020-11-12 20:02:37 +00:00
|
|
|
}
|
|
|
|
|
2020-10-01 16:46:23 +00:00
|
|
|
ReactionDisposer _reaction;
|
|
|
|
_reaction = reaction((_) => appStore.wallet, (Object _) {
|
|
|
|
_reaction?.reaction?.dispose();
|
|
|
|
authStore.allowed();
|
|
|
|
});
|
2020-09-21 11:50:26 +00:00
|
|
|
}, closable: false),
|
2020-07-06 20:09:03 +00:00
|
|
|
instanceName: 'login');
|
2020-06-20 07:10:00 +00:00
|
|
|
|
2020-07-06 20:09:03 +00:00
|
|
|
getIt
|
2020-09-25 10:26:08 +00:00
|
|
|
.registerFactoryParam<AuthPage, void Function(bool, AuthPageState), bool>(
|
|
|
|
(onAuthFinished, closable) => AuthPage(getIt.get<AuthViewModel>(),
|
2020-09-26 19:17:31 +00:00
|
|
|
onAuthenticationFinished: onAuthFinished,
|
|
|
|
closable: closable ?? false));
|
2020-07-06 20:09:03 +00:00
|
|
|
|
2020-08-25 16:32:40 +00:00
|
|
|
getIt.registerFactory<DashboardPage>(() => DashboardPage(
|
|
|
|
walletViewModel: getIt.get<DashboardViewModel>(),
|
|
|
|
addressListViewModel: getIt.get<WalletAddressListViewModel>()));
|
2020-06-20 07:10:00 +00:00
|
|
|
|
2020-07-06 20:09:03 +00:00
|
|
|
getIt.registerFactory<ReceivePage>(() => ReceivePage(
|
|
|
|
addressListViewModel: getIt.get<WalletAddressListViewModel>()));
|
2020-06-20 07:10:00 +00:00
|
|
|
|
2020-07-06 20:09:03 +00:00
|
|
|
getIt.registerFactoryParam<WalletAddressEditOrCreateViewModel, dynamic, void>(
|
|
|
|
(dynamic item, _) => WalletAddressEditOrCreateViewModel(
|
2020-06-20 07:10:00 +00:00
|
|
|
wallet: getIt.get<AppStore>().wallet, item: item));
|
|
|
|
|
|
|
|
getIt.registerFactoryParam<AddressEditOrCreatePage, dynamic, void>(
|
|
|
|
(dynamic item, _) => AddressEditOrCreatePage(
|
|
|
|
addressEditOrCreateViewModel:
|
2020-07-06 20:09:03 +00:00
|
|
|
getIt.get<WalletAddressEditOrCreateViewModel>(param1: item)));
|
|
|
|
|
2021-07-16 09:32:36 +00:00
|
|
|
getIt.registerFactory<SendTemplateViewModel>(() => SendTemplateViewModel(
|
2020-08-25 16:32:40 +00:00
|
|
|
getIt.get<AppStore>().wallet,
|
|
|
|
getIt.get<AppStore>().settingsStore,
|
2020-10-07 05:58:22 +00:00
|
|
|
getIt.get<SendTemplateStore>(),
|
2022-01-21 13:02:00 +00:00
|
|
|
getIt.get<FiatConversionStore>()));
|
2021-07-16 09:32:36 +00:00
|
|
|
|
|
|
|
getIt.registerFactory<SendViewModel>(() => SendViewModel(
|
|
|
|
getIt.get<AppStore>().wallet,
|
|
|
|
getIt.get<AppStore>().settingsStore,
|
|
|
|
getIt.get<SendTemplateViewModel>(),
|
2020-11-06 18:54:00 +00:00
|
|
|
getIt.get<FiatConversionStore>(),
|
2021-01-15 17:41:30 +00:00
|
|
|
_transactionDescriptionBox));
|
2020-07-06 20:09:03 +00:00
|
|
|
|
|
|
|
getIt.registerFactory(
|
|
|
|
() => SendPage(sendViewModel: getIt.get<SendViewModel>()));
|
|
|
|
|
2022-01-21 13:02:00 +00:00
|
|
|
getIt.registerFactory(() => SendTemplatePage(
|
|
|
|
sendTemplateViewModel: getIt.get<SendTemplateViewModel>()));
|
2020-07-29 16:55:42 +00:00
|
|
|
|
2020-07-06 20:09:03 +00:00
|
|
|
getIt.registerFactory(() => WalletListViewModel(
|
2021-01-15 17:41:30 +00:00
|
|
|
_walletInfoSource,
|
2020-10-22 18:24:24 +00:00
|
|
|
getIt.get<AppStore>(),
|
|
|
|
getIt.get<KeyService>(),
|
|
|
|
getIt.get<WalletNewVM>(param1: WalletType.monero)));
|
2020-06-20 07:10:00 +00:00
|
|
|
|
2020-07-06 20:09:03 +00:00
|
|
|
getIt.registerFactory(() =>
|
|
|
|
WalletListPage(walletListViewModel: getIt.get<WalletListViewModel>()));
|
2020-06-20 07:10:00 +00:00
|
|
|
|
2020-07-06 20:09:03 +00:00
|
|
|
getIt.registerFactory(() {
|
|
|
|
final wallet = getIt.get<AppStore>().wallet;
|
|
|
|
|
2021-12-24 12:37:24 +00:00
|
|
|
if (wallet.type == WalletType.monero) {
|
2020-07-06 20:09:03 +00:00
|
|
|
return MoneroAccountListViewModel(wallet);
|
|
|
|
}
|
|
|
|
|
|
|
|
// FIXME: throw exception.
|
|
|
|
return null;
|
2020-06-20 07:10:00 +00:00
|
|
|
});
|
2020-07-06 20:09:03 +00:00
|
|
|
|
|
|
|
getIt.registerFactory(() => MoneroAccountListPage(
|
|
|
|
accountListViewModel: getIt.get<MoneroAccountListViewModel>()));
|
|
|
|
|
2020-11-17 18:16:58 +00:00
|
|
|
/*getIt.registerFactory(() {
|
2020-07-06 20:09:03 +00:00
|
|
|
final wallet = getIt.get<AppStore>().wallet;
|
|
|
|
|
|
|
|
if (wallet is MoneroWallet) {
|
|
|
|
return MoneroAccountEditOrCreateViewModel(wallet.accountList);
|
|
|
|
}
|
|
|
|
|
|
|
|
// FIXME: throw exception.
|
|
|
|
return null;
|
|
|
|
});
|
|
|
|
|
|
|
|
getIt.registerFactory(() => MoneroAccountEditOrCreatePage(
|
|
|
|
moneroAccountCreationViewModel:
|
2020-11-17 18:16:58 +00:00
|
|
|
getIt.get<MoneroAccountEditOrCreateViewModel>()));*/
|
|
|
|
|
|
|
|
getIt.registerFactoryParam<MoneroAccountEditOrCreateViewModel,
|
2021-01-13 16:43:34 +00:00
|
|
|
AccountListItem, void>(
|
|
|
|
(AccountListItem account, _) => MoneroAccountEditOrCreateViewModel(
|
2021-12-24 12:37:24 +00:00
|
|
|
monero.getAccountList(getIt.get<AppStore>().wallet),
|
2021-06-18 12:36:49 +00:00
|
|
|
wallet: getIt.get<AppStore>().wallet,
|
2021-01-13 16:43:34 +00:00
|
|
|
accountListItem: account));
|
|
|
|
|
|
|
|
getIt.registerFactoryParam<MoneroAccountEditOrCreatePage, AccountListItem,
|
|
|
|
void>(
|
|
|
|
(AccountListItem account, _) => MoneroAccountEditOrCreatePage(
|
2020-11-17 18:16:58 +00:00
|
|
|
moneroAccountCreationViewModel:
|
2021-01-13 16:43:34 +00:00
|
|
|
getIt.get<MoneroAccountEditOrCreateViewModel>(param1: account)));
|
2020-07-06 20:09:03 +00:00
|
|
|
|
2020-08-25 16:32:40 +00:00
|
|
|
getIt.registerFactory(() {
|
|
|
|
final appStore = getIt.get<AppStore>();
|
2021-10-01 15:13:10 +00:00
|
|
|
final yatStore = getIt.get<YatStore>();
|
|
|
|
return SettingsViewModel(appStore.settingsStore, yatStore, appStore.wallet);
|
2020-08-25 16:32:40 +00:00
|
|
|
});
|
2020-07-06 20:09:03 +00:00
|
|
|
|
|
|
|
getIt.registerFactory(() => SettingsPage(getIt.get<SettingsViewModel>()));
|
|
|
|
|
|
|
|
getIt
|
|
|
|
.registerFactory(() => WalletSeedViewModel(getIt.get<AppStore>().wallet));
|
|
|
|
|
2020-09-11 15:52:55 +00:00
|
|
|
getIt.registerFactoryParam<WalletSeedPage, bool, void>(
|
|
|
|
(bool isWalletCreated, _) => WalletSeedPage(
|
2020-07-06 20:09:03 +00:00
|
|
|
getIt.get<WalletSeedViewModel>(),
|
2020-09-11 15:52:55 +00:00
|
|
|
isNewWalletCreated: isWalletCreated));
|
2020-07-06 20:09:03 +00:00
|
|
|
|
|
|
|
getIt
|
|
|
|
.registerFactory(() => WalletKeysViewModel(getIt.get<AppStore>().wallet));
|
|
|
|
|
|
|
|
getIt.registerFactory(() => WalletKeysPage(getIt.get<WalletKeysViewModel>()));
|
|
|
|
|
2020-09-26 19:17:31 +00:00
|
|
|
getIt.registerFactoryParam<ContactViewModel, ContactRecord, void>(
|
2020-09-28 15:47:43 +00:00
|
|
|
(ContactRecord contact, _) =>
|
2021-01-15 17:41:30 +00:00
|
|
|
ContactViewModel(_contactSource, contact: contact));
|
2020-07-06 20:09:03 +00:00
|
|
|
|
2021-01-08 18:10:37 +00:00
|
|
|
getIt.registerFactory(
|
2021-01-15 17:41:30 +00:00
|
|
|
() => ContactListViewModel(_contactSource, _walletInfoSource));
|
2020-07-06 20:09:03 +00:00
|
|
|
|
2020-09-10 14:51:59 +00:00
|
|
|
getIt.registerFactoryParam<ContactListPage, bool, void>(
|
|
|
|
(bool isEditable, _) => ContactListPage(getIt.get<ContactListViewModel>(),
|
|
|
|
isEditable: isEditable));
|
2020-07-06 20:09:03 +00:00
|
|
|
|
2020-09-26 19:17:31 +00:00
|
|
|
getIt.registerFactoryParam<ContactPage, ContactRecord, void>(
|
|
|
|
(ContactRecord contact, _) =>
|
|
|
|
ContactPage(getIt.get<ContactViewModel>(param1: contact)));
|
2020-07-06 20:09:03 +00:00
|
|
|
|
2020-08-27 16:54:34 +00:00
|
|
|
getIt.registerFactory(() {
|
|
|
|
final appStore = getIt.get<AppStore>();
|
2020-09-26 19:17:31 +00:00
|
|
|
return NodeListViewModel(
|
2021-01-15 17:41:30 +00:00
|
|
|
_nodeSource, appStore.wallet, appStore.settingsStore);
|
2020-08-27 16:54:34 +00:00
|
|
|
});
|
2020-07-06 20:09:03 +00:00
|
|
|
|
|
|
|
getIt.registerFactory(() => NodeListPage(getIt.get<NodeListViewModel>()));
|
|
|
|
|
|
|
|
getIt.registerFactory(() =>
|
2021-01-15 17:41:30 +00:00
|
|
|
NodeCreateOrEditViewModel(_nodeSource, getIt.get<AppStore>().wallet));
|
2020-07-06 20:09:03 +00:00
|
|
|
|
|
|
|
getIt.registerFactory(
|
|
|
|
() => NodeCreateOrEditPage(getIt.get<NodeCreateOrEditViewModel>()));
|
2020-07-31 15:29:21 +00:00
|
|
|
|
2020-09-01 11:18:07 +00:00
|
|
|
getIt.registerFactory(() => ExchangeViewModel(
|
2020-10-07 05:58:22 +00:00
|
|
|
getIt.get<AppStore>().wallet,
|
2021-01-15 17:41:30 +00:00
|
|
|
_tradesSource,
|
2020-10-07 05:58:22 +00:00
|
|
|
getIt.get<ExchangeTemplateStore>(),
|
2021-01-05 18:31:03 +00:00
|
|
|
getIt.get<TradesStore>(),
|
|
|
|
getIt.get<AppStore>().settingsStore));
|
2020-08-26 17:31:23 +00:00
|
|
|
|
2020-09-01 11:18:07 +00:00
|
|
|
getIt.registerFactory(() => ExchangeTradeViewModel(
|
|
|
|
wallet: getIt.get<AppStore>().wallet,
|
2021-01-15 17:41:30 +00:00
|
|
|
trades: _tradesSource,
|
2020-10-30 16:32:21 +00:00
|
|
|
tradesStore: getIt.get<TradesStore>(),
|
|
|
|
sendViewModel: getIt.get<SendViewModel>()));
|
2020-07-31 15:29:21 +00:00
|
|
|
|
2020-09-01 11:18:07 +00:00
|
|
|
getIt.registerFactory(() => ExchangePage(getIt.get<ExchangeViewModel>()));
|
2020-07-31 15:29:21 +00:00
|
|
|
|
2020-09-01 11:18:07 +00:00
|
|
|
getIt.registerFactory(
|
|
|
|
() => ExchangeConfirmPage(tradesStore: getIt.get<TradesStore>()));
|
2020-08-26 17:31:23 +00:00
|
|
|
|
2020-09-01 11:18:07 +00:00
|
|
|
getIt.registerFactory(() => ExchangeTradePage(
|
|
|
|
exchangeTradeViewModel: getIt.get<ExchangeTradeViewModel>()));
|
2020-08-26 17:31:23 +00:00
|
|
|
|
2020-09-01 11:18:07 +00:00
|
|
|
getIt.registerFactory(
|
|
|
|
() => ExchangeTemplatePage(getIt.get<ExchangeViewModel>()));
|
2020-09-15 20:35:49 +00:00
|
|
|
|
|
|
|
getIt.registerFactoryParam<WalletService, WalletType, void>(
|
|
|
|
(WalletType param1, __) {
|
|
|
|
switch (param1) {
|
|
|
|
case WalletType.monero:
|
2021-12-24 12:37:24 +00:00
|
|
|
return monero.createMoneroWalletService(_walletInfoSource);
|
2020-09-15 20:35:49 +00:00
|
|
|
case WalletType.bitcoin:
|
2022-01-21 13:02:00 +00:00
|
|
|
return bitcoin.createBitcoinWalletService(
|
|
|
|
_walletInfoSource, _unspentCoinsInfoSource);
|
2021-05-07 07:36:38 +00:00
|
|
|
case WalletType.litecoin:
|
2022-01-21 13:02:00 +00:00
|
|
|
return bitcoin.createLitecoinWalletService(
|
|
|
|
_walletInfoSource, _unspentCoinsInfoSource);
|
2020-09-15 20:35:49 +00:00
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
});
|
2020-09-21 11:50:26 +00:00
|
|
|
|
|
|
|
getIt.registerFactory<SetupPinCodeViewModel>(() => SetupPinCodeViewModel(
|
|
|
|
getIt.get<AuthService>(), getIt.get<SettingsStore>()));
|
|
|
|
|
|
|
|
getIt.registerFactoryParam<SetupPinCodePage,
|
2020-10-22 18:24:24 +00:00
|
|
|
void Function(PinCodeState<PinCodeWidget>, String), void>(
|
2020-09-21 11:50:26 +00:00
|
|
|
(onSuccessfulPinSetup, _) => SetupPinCodePage(
|
|
|
|
getIt.get<SetupPinCodeViewModel>(),
|
|
|
|
onSuccessfulPinSetup: onSuccessfulPinSetup));
|
|
|
|
|
|
|
|
getIt.registerFactory(() => RescanViewModel(getIt.get<AppStore>().wallet));
|
|
|
|
|
|
|
|
getIt.registerFactory(() => RescanPage(getIt.get<RescanViewModel>()));
|
2020-08-20 17:43:54 +00:00
|
|
|
|
2020-09-28 15:47:43 +00:00
|
|
|
getIt.registerFactory(() => FaqPage(getIt.get<SettingsStore>()));
|
|
|
|
|
|
|
|
getIt.registerFactory(() => LanguageListPage(getIt.get<SettingsStore>()));
|
2020-10-13 21:11:04 +00:00
|
|
|
|
|
|
|
getIt.registerFactoryParam<WalletRestoreViewModel, WalletType, void>(
|
|
|
|
(type, _) => WalletRestoreViewModel(getIt.get<AppStore>(),
|
2021-01-15 17:41:30 +00:00
|
|
|
getIt.get<WalletCreationService>(param1: type), _walletInfoSource,
|
2020-10-13 21:11:04 +00:00
|
|
|
type: type));
|
|
|
|
|
|
|
|
getIt.registerFactoryParam<WalletRestorePage, WalletType, void>((type, _) =>
|
|
|
|
WalletRestorePage(getIt.get<WalletRestoreViewModel>(param1: type)));
|
2020-11-06 18:54:00 +00:00
|
|
|
|
2021-01-08 18:10:37 +00:00
|
|
|
getIt
|
|
|
|
.registerFactoryParam<TransactionDetailsViewModel, TransactionInfo, void>(
|
2021-05-10 16:10:33 +00:00
|
|
|
(TransactionInfo transactionInfo, _) {
|
2022-01-21 13:02:00 +00:00
|
|
|
final wallet = getIt.get<AppStore>().wallet;
|
|
|
|
return TransactionDetailsViewModel(
|
|
|
|
transactionInfo: transactionInfo,
|
|
|
|
transactionDescriptionBox: _transactionDescriptionBox,
|
|
|
|
wallet: wallet,
|
|
|
|
settingsStore: getIt.get<SettingsStore>());
|
|
|
|
});
|
2020-12-22 18:42:30 +00:00
|
|
|
|
2020-11-06 18:54:00 +00:00
|
|
|
getIt.registerFactoryParam<TransactionDetailsPage, TransactionInfo, void>(
|
|
|
|
(TransactionInfo transactionInfo, _) => TransactionDetailsPage(
|
2021-01-08 18:10:37 +00:00
|
|
|
transactionDetailsViewModel:
|
|
|
|
getIt.get<TransactionDetailsViewModel>(param1: transactionInfo)));
|
2020-11-27 11:08:17 +00:00
|
|
|
|
2020-11-12 16:31:53 +00:00
|
|
|
getIt.registerFactoryParam<NewWalletTypePage,
|
|
|
|
void Function(BuildContext, WalletType), bool>(
|
|
|
|
(para1, param2) => NewWalletTypePage(getIt.get<WalletNewVM>(),
|
|
|
|
onTypeSelected: para1, isNewWallet: param2));
|
2020-12-11 18:10:06 +00:00
|
|
|
|
2020-12-21 20:20:46 +00:00
|
|
|
getIt.registerFactoryParam<PreSeedPage, WalletType, void>(
|
|
|
|
(WalletType type, _) => PreSeedPage(type));
|
2020-12-18 12:42:53 +00:00
|
|
|
|
|
|
|
getIt.registerFactoryParam<TradeDetailsViewModel, Trade, void>((trade, _) =>
|
2021-01-15 17:41:30 +00:00
|
|
|
TradeDetailsViewModel(tradeForDetails: trade, trades: _tradesSource));
|
2021-01-13 16:43:34 +00:00
|
|
|
|
|
|
|
getIt.registerFactory(() => BackupService(
|
|
|
|
getIt.get<FlutterSecureStorage>(),
|
2021-01-15 17:41:30 +00:00
|
|
|
_walletInfoSource,
|
2021-01-13 16:43:34 +00:00
|
|
|
getIt.get<KeyService>(),
|
|
|
|
getIt.get<SharedPreferences>()));
|
|
|
|
|
|
|
|
getIt.registerFactory(() => BackupViewModel(getIt.get<FlutterSecureStorage>(),
|
|
|
|
getIt.get<SecretStore>(), getIt.get<BackupService>()));
|
|
|
|
|
|
|
|
getIt.registerFactory(() => BackupPage(getIt.get<BackupViewModel>()));
|
|
|
|
|
|
|
|
getIt.registerFactory(() => EditBackupPasswordViewModel(
|
|
|
|
getIt.get<FlutterSecureStorage>(), getIt.get<SecretStore>())
|
|
|
|
..init());
|
|
|
|
|
|
|
|
getIt.registerFactory(
|
|
|
|
() => EditBackupPasswordPage(getIt.get<EditBackupPasswordViewModel>()));
|
|
|
|
|
2021-01-15 17:41:30 +00:00
|
|
|
getIt.registerFactory(() => RestoreOptionsPage());
|
2021-01-13 16:43:34 +00:00
|
|
|
|
|
|
|
getIt.registerFactory(
|
|
|
|
() => RestoreFromBackupViewModel(getIt.get<BackupService>()));
|
|
|
|
|
|
|
|
getIt.registerFactory(
|
|
|
|
() => RestoreFromBackupPage(getIt.get<RestoreFromBackupViewModel>()));
|
2021-01-13 17:18:28 +00:00
|
|
|
|
2020-12-18 12:42:53 +00:00
|
|
|
getIt.registerFactoryParam<TradeDetailsPage, Trade, void>((Trade trade, _) =>
|
|
|
|
TradeDetailsPage(getIt.get<TradeDetailsViewModel>(param1: trade)));
|
2021-01-15 17:41:30 +00:00
|
|
|
|
2021-04-12 18:22:22 +00:00
|
|
|
getIt.registerFactory(() => BuyAmountViewModel());
|
|
|
|
|
|
|
|
getIt.registerFactory(() {
|
|
|
|
final wallet = getIt.get<AppStore>().wallet;
|
|
|
|
|
2021-04-30 08:08:25 +00:00
|
|
|
return BuyViewModel(_ordersSource, getIt.get<OrdersStore>(),
|
2021-06-01 18:03:35 +00:00
|
|
|
getIt.get<SettingsStore>(), getIt.get<BuyAmountViewModel>(),
|
|
|
|
wallet: wallet);
|
2021-04-12 18:22:22 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
getIt.registerFactory(() {
|
|
|
|
return PreOrderPage(buyViewModel: getIt.get<BuyViewModel>());
|
|
|
|
});
|
|
|
|
|
2022-01-21 13:02:00 +00:00
|
|
|
getIt.registerFactoryParam<BuyWebViewPage, List, void>((List args, _) {
|
|
|
|
final url = args.first as String;
|
|
|
|
final buyViewModel = args[1] as BuyViewModel;
|
2021-04-15 17:10:23 +00:00
|
|
|
|
2022-01-21 13:02:00 +00:00
|
|
|
return BuyWebViewPage(
|
|
|
|
buyViewModel: buyViewModel,
|
|
|
|
ordersStore: getIt.get<OrdersStore>(),
|
|
|
|
url: url);
|
|
|
|
});
|
2021-04-13 18:40:44 +00:00
|
|
|
|
2022-01-21 13:02:00 +00:00
|
|
|
getIt.registerFactoryParam<OrderDetailsViewModel, Order, void>((order, _) {
|
|
|
|
final wallet = getIt.get<AppStore>().wallet;
|
2021-04-13 18:40:44 +00:00
|
|
|
|
2022-01-21 13:02:00 +00:00
|
|
|
return OrderDetailsViewModel(wallet: wallet, orderForDetails: order);
|
|
|
|
});
|
2021-03-23 17:19:01 +00:00
|
|
|
|
|
|
|
getIt.registerFactoryParam<OrderDetailsPage, Order, void>((Order order, _) =>
|
|
|
|
OrderDetailsPage(getIt.get<OrderDetailsViewModel>(param1: order)));
|
|
|
|
|
2021-02-25 18:25:52 +00:00
|
|
|
getIt.registerFactory(() => SupportViewModel());
|
|
|
|
|
|
|
|
getIt.registerFactory(() => SupportPage(getIt.get<SupportViewModel>()));
|
|
|
|
|
2021-07-05 13:52:24 +00:00
|
|
|
getIt.registerFactory(() {
|
|
|
|
final wallet = getIt.get<AppStore>().wallet;
|
|
|
|
|
|
|
|
return UnspentCoinsListViewModel(
|
2022-01-21 13:02:00 +00:00
|
|
|
wallet: wallet, unspentCoinsInfo: _unspentCoinsInfoSource);
|
2021-07-05 13:52:24 +00:00
|
|
|
});
|
2021-05-25 17:32:36 +00:00
|
|
|
|
|
|
|
getIt.registerFactory(() => UnspentCoinsListPage(
|
2022-01-21 13:02:00 +00:00
|
|
|
unspentCoinsListViewModel: getIt.get<UnspentCoinsListViewModel>()));
|
2021-05-25 17:32:36 +00:00
|
|
|
|
2022-01-21 13:02:00 +00:00
|
|
|
getIt.registerFactoryParam<UnspentCoinsDetailsViewModel, UnspentCoinsItem,
|
|
|
|
UnspentCoinsListViewModel>(
|
|
|
|
(item, model) => UnspentCoinsDetailsViewModel(
|
|
|
|
unspentCoinsItem: item, unspentCoinsListViewModel: model));
|
2021-07-05 13:52:24 +00:00
|
|
|
|
|
|
|
getIt.registerFactoryParam<UnspentCoinsDetailsPage, List, void>(
|
2022-01-21 13:02:00 +00:00
|
|
|
(List args, _) {
|
|
|
|
final item = args.first as UnspentCoinsItem;
|
|
|
|
final unspentCoinsListViewModel = args[1] as UnspentCoinsListViewModel;
|
|
|
|
|
|
|
|
return UnspentCoinsDetailsPage(
|
|
|
|
unspentCoinsDetailsViewModel: getIt.get<UnspentCoinsDetailsViewModel>(
|
|
|
|
param1: item, param2: unspentCoinsListViewModel));
|
2021-07-05 13:52:24 +00:00
|
|
|
});
|
2021-05-27 17:57:51 +00:00
|
|
|
|
2022-01-21 13:02:00 +00:00
|
|
|
getIt.registerFactory(() => WakeLock());
|
|
|
|
|
2021-01-15 17:41:30 +00:00
|
|
|
_isSetupFinished = true;
|
2020-06-20 07:10:00 +00:00
|
|
|
}
|