2020-07-22 10:04:11 +00:00
|
|
|
import 'package:cake_wallet/src/screens/dashboard/dashboard_page.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/src/screens/seed/wallet_seed_page.dart';
|
2020-06-20 07:10:00 +00:00
|
|
|
import 'package:cake_wallet/view_model/wallet_new_vm.dart';
|
|
|
|
import 'package:cake_wallet/view_model/wallet_restoration_from_seed_vm.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:hive/hive.dart';
|
|
|
|
import 'package:cake_wallet/routes.dart';
|
|
|
|
import 'package:cake_wallet/generated/i18n.dart';
|
2020-06-20 07:10:00 +00:00
|
|
|
import 'di.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
// MARK: Import domains
|
|
|
|
|
|
|
|
import 'package:cake_wallet/src/domain/common/contact.dart';
|
|
|
|
import 'package:cake_wallet/src/domain/services/user_service.dart';
|
|
|
|
import 'package:cake_wallet/src/domain/services/wallet_list_service.dart';
|
|
|
|
import 'package:cake_wallet/src/domain/services/wallet_service.dart';
|
|
|
|
import 'package:cake_wallet/src/domain/common/crypto_currency.dart';
|
|
|
|
import 'package:cake_wallet/src/domain/exchange/changenow/changenow_exchange_provider.dart';
|
|
|
|
import 'package:cake_wallet/src/domain/exchange/xmrto/xmrto_exchange_provider.dart';
|
2020-01-30 18:23:36 +00:00
|
|
|
import 'package:cake_wallet/src/domain/exchange/morphtoken/morphtoken_exchange_provider.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
import 'package:cake_wallet/src/domain/common/node.dart';
|
|
|
|
import 'package:cake_wallet/src/domain/monero/transaction_description.dart';
|
|
|
|
import 'package:cake_wallet/src/domain/exchange/trade.dart';
|
2020-01-08 12:26:34 +00:00
|
|
|
import 'package:cake_wallet/src/domain/monero/account.dart';
|
2020-06-20 07:10:00 +00:00
|
|
|
import 'package:cake_wallet/src/domain/common/mnemonic_item.dart';
|
2020-01-08 12:26:34 +00:00
|
|
|
import 'package:cake_wallet/src/domain/common/transaction_info.dart';
|
|
|
|
import 'package:cake_wallet/src/domain/monero/subaddress.dart';
|
2020-06-01 18:56:21 +00:00
|
|
|
import 'package:cake_wallet/src/domain/common/wallet_type.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
// MARK: Import stores
|
|
|
|
|
|
|
|
import 'package:cake_wallet/src/stores/authentication/authentication_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/node_list/node_list_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/auth/auth_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/balance/balance_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/send/send_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/subaddress_creation/subaddress_creation_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/subaddress_list/subaddress_list_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/sync/sync_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/user/user_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/wallet_creation/wallet_creation_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/wallet_list/wallet_list_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/wallet_restoration/wallet_restoration_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/account_list/account_list_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/address_book/address_book_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/settings/settings_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/wallet/wallet_keys_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/exchange_trade/exchange_trade_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/exchange/exchange_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/rescan/rescan_wallet_store.dart';
|
|
|
|
import 'package:cake_wallet/src/stores/price/price_store.dart';
|
|
|
|
|
|
|
|
// MARK: Import screens
|
|
|
|
|
|
|
|
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/src/screens/nodes/node_create_or_edit_page.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
import 'package:cake_wallet/src/screens/nodes/nodes_list_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/receive/receive_page.dart';
|
2020-06-20 07:10:00 +00:00
|
|
|
import 'package:cake_wallet/src/screens/subaddress/address_edit_or_create_page.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
import 'package:cake_wallet/src/screens/wallet_list/wallet_list_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/new_wallet/new_wallet_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/setup_pin_code/setup_pin_code.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/restore/restore_options_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/restore/restore_wallet_options_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/restore/restore_wallet_from_seed_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/restore/restore_wallet_from_keys_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/send/send_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/disclaimer/disclaimer_page.dart';
|
2020-02-28 20:16:39 +00:00
|
|
|
import 'package:cake_wallet/src/screens/seed_language/seed_language_page.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
import 'package:cake_wallet/src/screens/transaction_details/transaction_details_page.dart';
|
2020-07-06 20:09:03 +00:00
|
|
|
import 'package:cake_wallet/src/screens/monero_accounts/monero_account_edit_or_create_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/contact/contact_list_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/contact/contact_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/wallet_keys/wallet_keys_page.dart';
|
2020-01-04 19:31:52 +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';
|
|
|
|
import 'package:cake_wallet/src/screens/subaddress/subaddress_list_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/settings/change_language.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/restore/restore_wallet_from_seed_details.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/exchange/exchange_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/settings/settings.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/rescan/rescan_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/faq/faq_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/trade_details/trade_details_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/auth/create_unlock_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/auth/create_login_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/dashboard/create_dashboard_page.dart';
|
|
|
|
import 'package:cake_wallet/src/screens/welcome/create_welcome_page.dart';
|
2020-04-28 17:50:12 +00:00
|
|
|
import 'package:cake_wallet/src/screens/new_wallet/new_wallet_type_page.dart';
|
2020-05-08 16:22:56 +00:00
|
|
|
import 'package:cake_wallet/src/screens/send/send_template_page.dart';
|
2020-05-14 17:29:10 +00:00
|
|
|
import 'package:cake_wallet/src/screens/exchange/exchange_template_page.dart';
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
class Router {
|
|
|
|
static Route<dynamic> generateRoute(
|
|
|
|
{SharedPreferences sharedPreferences,
|
|
|
|
WalletListService walletListService,
|
|
|
|
WalletService walletService,
|
|
|
|
UserService userService,
|
|
|
|
RouteSettings settings,
|
|
|
|
PriceStore priceStore,
|
|
|
|
WalletStore walletStore,
|
|
|
|
SyncStore syncStore,
|
|
|
|
BalanceStore balanceStore,
|
|
|
|
SettingsStore settingsStore,
|
|
|
|
Box<Contact> contacts,
|
|
|
|
Box<Node> nodes,
|
|
|
|
Box<TransactionDescription> transactionDescriptions,
|
|
|
|
Box<Trade> trades}) {
|
|
|
|
switch (settings.name) {
|
|
|
|
case Routes.welcome:
|
2020-01-08 12:26:34 +00:00
|
|
|
return MaterialPageRoute<void>(builder: (_) => createWelcomePage());
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.newWalletFromWelcome:
|
2020-05-12 12:04:54 +00:00
|
|
|
final type = settings.arguments as WalletType;
|
|
|
|
walletListService.changeWalletManger(walletType: type);
|
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
2020-01-04 19:31:52 +00:00
|
|
|
builder: (_) => Provider(
|
|
|
|
create: (_) => UserStore(
|
|
|
|
accountService: UserService(
|
|
|
|
secureStorage: FlutterSecureStorage(),
|
|
|
|
sharedPreferences: sharedPreferences)),
|
|
|
|
child: SetupPinCodePage(
|
|
|
|
onPinCodeSetup: (context, _) =>
|
2020-06-02 07:47:33 +00:00
|
|
|
Navigator.pushNamed(context, Routes.newWalletType))));
|
|
|
|
|
|
|
|
case Routes.newWalletType:
|
2020-06-20 07:10:00 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
|
|
|
builder: (_) => NewWalletTypePage(
|
|
|
|
onTypeSelected: (context, type) => Navigator.of(context)
|
|
|
|
.pushNamed(Routes.newWallet, arguments: type),
|
|
|
|
));
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.newWallet:
|
2020-05-12 12:04:54 +00:00
|
|
|
final type = settings.arguments as WalletType;
|
2020-06-20 07:10:00 +00:00
|
|
|
final walletNewVM = getIt.get<WalletNewVM>(param1: type);
|
2020-05-12 12:04:54 +00:00
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
2020-06-20 07:10:00 +00:00
|
|
|
builder: (_) => NewWalletPage(walletNewVM));
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.setupPin:
|
|
|
|
Function(BuildContext, String) callback;
|
|
|
|
|
|
|
|
if (settings.arguments is Function(BuildContext, String)) {
|
2020-01-08 12:26:34 +00:00
|
|
|
callback = settings.arguments as Function(BuildContext, String);
|
2020-01-04 19:31:52 +00:00
|
|
|
}
|
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
2020-01-04 19:31:52 +00:00
|
|
|
builder: (_) => Provider(
|
|
|
|
create: (_) => UserStore(
|
|
|
|
accountService: UserService(
|
|
|
|
secureStorage: FlutterSecureStorage(),
|
|
|
|
sharedPreferences: sharedPreferences)),
|
|
|
|
child: SetupPinCodePage(
|
|
|
|
onPinCodeSetup: (context, pin) =>
|
|
|
|
callback == null ? null : callback(context, pin))),
|
|
|
|
fullscreenDialog: true);
|
|
|
|
|
2020-06-20 07:10:00 +00:00
|
|
|
case Routes.restoreWalletType:
|
|
|
|
return CupertinoPageRoute<void>(
|
|
|
|
builder: (_) => NewWalletTypePage(
|
|
|
|
onTypeSelected: (context, type) => Navigator.of(context)
|
|
|
|
.pushNamed(Routes.restoreWalletOptions, arguments: type),
|
|
|
|
));
|
|
|
|
|
2020-01-04 19:31:52 +00:00
|
|
|
case Routes.restoreOptions:
|
2020-05-12 12:04:54 +00:00
|
|
|
final type = settings.arguments as WalletType;
|
|
|
|
walletListService.changeWalletManger(walletType: type);
|
|
|
|
|
|
|
|
return CupertinoPageRoute<void>(
|
|
|
|
builder: (_) => RestoreOptionsPage(type: type));
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.restoreWalletOptions:
|
2020-05-12 12:04:54 +00:00
|
|
|
final type = settings.arguments as WalletType;
|
|
|
|
walletListService.changeWalletManger(walletType: type);
|
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
2020-06-20 07:10:00 +00:00
|
|
|
builder: (_) => RestoreWalletOptionsPage(
|
|
|
|
type: type,
|
|
|
|
onRestoreFromSeed: (context) {
|
|
|
|
final route = type == WalletType.monero
|
|
|
|
? Routes.seedLanguage
|
|
|
|
: Routes.restoreWalletFromSeed;
|
|
|
|
final args = type == WalletType.monero
|
|
|
|
? [type, Routes.restoreWalletFromSeed]
|
|
|
|
: [type];
|
|
|
|
|
|
|
|
Navigator.of(context).pushNamed(route, arguments: args);
|
|
|
|
},
|
|
|
|
onRestoreFromKeys: (context) {
|
|
|
|
final route = type == WalletType.monero
|
|
|
|
? Routes.seedLanguage
|
|
|
|
: Routes.restoreWalletFromKeys;
|
|
|
|
final args = type == WalletType.monero
|
|
|
|
? [type, Routes.restoreWalletFromSeed]
|
|
|
|
: [type];
|
|
|
|
|
|
|
|
Navigator.of(context).pushNamed(route, arguments: args);
|
|
|
|
}));
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.restoreWalletOptionsFromWelcome:
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
2020-01-04 19:31:52 +00:00
|
|
|
builder: (_) => Provider(
|
|
|
|
create: (_) => UserStore(
|
|
|
|
accountService: UserService(
|
|
|
|
secureStorage: FlutterSecureStorage(),
|
|
|
|
sharedPreferences: sharedPreferences)),
|
|
|
|
child: SetupPinCodePage(
|
|
|
|
onPinCodeSetup: (context, _) => Navigator.pushNamed(
|
2020-06-20 07:10:00 +00:00
|
|
|
context, Routes.restoreWalletType))));
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.seed:
|
2020-01-08 12:26:34 +00:00
|
|
|
return MaterialPageRoute<void>(
|
2020-07-06 20:09:03 +00:00
|
|
|
builder: (_) => getIt.get<WalletSeedPage>(
|
|
|
|
param1: settings.arguments as VoidCallback));
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.restoreWalletFromSeed:
|
2020-06-20 07:10:00 +00:00
|
|
|
final args = settings.arguments as List<dynamic>;
|
|
|
|
final type = args.first as WalletType;
|
|
|
|
final language = type == WalletType.monero
|
|
|
|
? args[1] as String
|
|
|
|
: 'English'; // FIXME: Unnamed constant; English default and only one language for bitcoin.
|
2020-05-12 12:04:54 +00:00
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
2020-01-04 19:31:52 +00:00
|
|
|
builder: (_) =>
|
2020-07-06 20:09:03 +00:00
|
|
|
RestoreWalletFromSeedPage(type: type, language: language));
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.restoreWalletFromKeys:
|
2020-06-20 07:10:00 +00:00
|
|
|
final args = settings.arguments as List<dynamic>;
|
|
|
|
final type = args.first as WalletType;
|
|
|
|
final language = type == WalletType.monero
|
|
|
|
? args[1] as String
|
|
|
|
: 'English'; // FIXME: Unnamed constant; English default and only one language for bitcoin.
|
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
2020-01-04 19:31:52 +00:00
|
|
|
builder: (_) =>
|
|
|
|
ProxyProvider<AuthenticationStore, WalletRestorationStore>(
|
|
|
|
update: (_, authStore, __) => WalletRestorationStore(
|
|
|
|
authStore: authStore,
|
|
|
|
sharedPreferences: sharedPreferences,
|
|
|
|
walletListService: walletListService),
|
|
|
|
child: RestoreWalletFromKeysPage(
|
|
|
|
walletsService: walletListService,
|
|
|
|
walletService: walletService,
|
|
|
|
sharedPreferences: sharedPreferences)));
|
|
|
|
|
|
|
|
case Routes.dashboard:
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
2020-07-22 10:04:11 +00:00
|
|
|
builder: (_) => getIt.get<DashboardPage>());
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.send:
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
2020-07-06 20:09:03 +00:00
|
|
|
fullscreenDialog: true, builder: (_) => getIt.get<SendPage>());
|
2020-01-04 19:31:52 +00:00
|
|
|
|
2020-05-08 16:22:56 +00:00
|
|
|
case Routes.sendTemplate:
|
|
|
|
return CupertinoPageRoute<void>(
|
2020-06-20 07:10:00 +00:00
|
|
|
builder: (_) => Provider(
|
|
|
|
create: (_) => SendStore(
|
|
|
|
walletService: walletService,
|
|
|
|
priceStore: priceStore,
|
|
|
|
transactionDescriptions: transactionDescriptions),
|
|
|
|
child: SendTemplatePage()));
|
2020-05-08 16:22:56 +00:00
|
|
|
|
2020-01-04 19:31:52 +00:00
|
|
|
case Routes.receive:
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
2020-06-20 07:10:00 +00:00
|
|
|
fullscreenDialog: true, builder: (_) => getIt.get<ReceivePage>());
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.transactionDetails:
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
2020-01-04 19:31:52 +00:00
|
|
|
fullscreenDialog: true,
|
2020-01-08 12:26:34 +00:00
|
|
|
builder: (_) => TransactionDetailsPage(
|
|
|
|
transactionInfo: settings.arguments as TransactionInfo));
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.newSubaddress:
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
2020-06-20 07:10:00 +00:00
|
|
|
builder: (_) =>
|
|
|
|
getIt.get<AddressEditOrCreatePage>(param1: settings.arguments));
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.disclaimer:
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(builder: (_) => DisclaimerPage());
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.readDisclaimer:
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
2020-01-04 19:31:52 +00:00
|
|
|
builder: (_) => DisclaimerPage(isReadOnly: true));
|
|
|
|
|
2020-02-28 20:16:39 +00:00
|
|
|
case Routes.seedLanguage:
|
2020-06-20 07:10:00 +00:00
|
|
|
final args = settings.arguments as List<dynamic>;
|
|
|
|
final type = args.first as WalletType;
|
|
|
|
final redirectRoute = args[1] as String;
|
|
|
|
|
|
|
|
return CupertinoPageRoute<void>(builder: (_) {
|
|
|
|
return SeedLanguage(
|
|
|
|
onConfirm: (context, lang) => Navigator.of(context)
|
|
|
|
.popAndPushNamed(redirectRoute, arguments: [type, lang]));
|
|
|
|
});
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.walletList:
|
2020-01-08 12:26:34 +00:00
|
|
|
return MaterialPageRoute<void>(
|
2020-01-04 19:31:52 +00:00
|
|
|
fullscreenDialog: true,
|
2020-07-06 20:09:03 +00:00
|
|
|
builder: (_) => getIt.get<WalletListPage>());
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.auth:
|
2020-01-08 12:26:34 +00:00
|
|
|
return MaterialPageRoute<void>(
|
2020-01-04 19:31:52 +00:00
|
|
|
fullscreenDialog: true,
|
2020-07-06 20:09:03 +00:00
|
|
|
builder: (_) => getIt.get<AuthPage>(
|
|
|
|
param1: settings.arguments as OnAuthenticationFinished));
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.unlock:
|
2020-01-08 12:26:34 +00:00
|
|
|
return MaterialPageRoute<void>(
|
2020-01-04 19:31:52 +00:00
|
|
|
fullscreenDialog: true,
|
|
|
|
builder: (_) => createUnlockPage(
|
|
|
|
sharedPreferences: sharedPreferences,
|
|
|
|
userService: userService,
|
|
|
|
walletService: walletService,
|
2020-01-08 12:26:34 +00:00
|
|
|
onAuthenticationFinished:
|
|
|
|
settings.arguments as OnAuthenticationFinished));
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.nodeList:
|
2020-07-06 20:09:03 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
|
|
|
builder: (_) => getIt.get<NodeListPage>());
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.newNode:
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
2020-07-06 20:09:03 +00:00
|
|
|
builder: (_) => getIt.get<NodeCreateOrEditPage>());
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.login:
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(builder: (context) {
|
2020-01-04 19:31:52 +00:00
|
|
|
final authenticationStore = Provider.of<AuthenticationStore>(context);
|
|
|
|
|
|
|
|
return createLoginPage(
|
|
|
|
sharedPreferences: sharedPreferences,
|
|
|
|
userService: userService,
|
|
|
|
walletService: walletService,
|
|
|
|
walletListService: walletListService,
|
|
|
|
authenticationStore: authenticationStore);
|
|
|
|
});
|
|
|
|
|
|
|
|
case Routes.accountCreation:
|
2020-07-06 20:09:03 +00:00
|
|
|
return CupertinoPageRoute<String>(
|
|
|
|
builder: (_) => getIt.get<MoneroAccountEditOrCreatePage>());
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.addressBook:
|
2020-07-06 20:09:03 +00:00
|
|
|
return MaterialPageRoute<void>(
|
|
|
|
builder: (_) => getIt.get<ContactListPage>());
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.pickerAddressBook:
|
2020-07-06 20:09:03 +00:00
|
|
|
return MaterialPageRoute<void>(
|
|
|
|
builder: (_) => getIt.get<ContactListPage>());
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.addressBookAddContact:
|
2020-07-06 20:09:03 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
|
|
|
builder: (_) =>
|
|
|
|
getIt.get<ContactPage>(param1: settings.arguments as Contact));
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.showKeys:
|
2020-01-08 12:26:34 +00:00
|
|
|
return MaterialPageRoute<void>(
|
2020-07-06 20:09:03 +00:00
|
|
|
builder: (_) => getIt.get<WalletKeysPage>(),
|
2020-01-04 19:31:52 +00:00
|
|
|
fullscreenDialog: true);
|
|
|
|
|
|
|
|
case Routes.exchangeTrade:
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
2020-01-04 19:31:52 +00:00
|
|
|
builder: (_) => MultiProvider(
|
|
|
|
providers: [
|
|
|
|
ProxyProvider<SettingsStore, ExchangeTradeStore>(
|
|
|
|
update: (_, settingsStore, __) => ExchangeTradeStore(
|
2020-01-08 12:26:34 +00:00
|
|
|
trade: settings.arguments as Trade,
|
2020-02-10 19:35:44 +00:00
|
|
|
walletStore: walletStore,
|
|
|
|
trades: trades),
|
2020-01-04 19:31:52 +00:00
|
|
|
),
|
|
|
|
ProxyProvider<SettingsStore, SendStore>(
|
|
|
|
update: (_, settingsStore, __) => SendStore(
|
|
|
|
transactionDescriptions: transactionDescriptions,
|
|
|
|
walletService: walletService,
|
|
|
|
settingsStore: settingsStore,
|
|
|
|
priceStore: priceStore)),
|
|
|
|
],
|
|
|
|
child: ExchangeTradePage(),
|
|
|
|
));
|
|
|
|
|
|
|
|
case Routes.exchangeConfirm:
|
2020-01-08 12:26:34 +00:00
|
|
|
return MaterialPageRoute<void>(
|
|
|
|
builder: (_) =>
|
|
|
|
ExchangeConfirmPage(trade: settings.arguments as Trade));
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.tradeDetails:
|
2020-01-08 12:26:34 +00:00
|
|
|
return MaterialPageRoute<void>(builder: (context) {
|
2020-01-04 19:31:52 +00:00
|
|
|
return MultiProvider(providers: [
|
|
|
|
ProxyProvider<SettingsStore, ExchangeTradeStore>(
|
|
|
|
update: (_, settingsStore, __) => ExchangeTradeStore(
|
2020-02-12 13:28:30 +00:00
|
|
|
trade: settings.arguments as Trade,
|
|
|
|
walletStore: walletStore,
|
|
|
|
trades: trades),
|
2020-01-04 19:31:52 +00:00
|
|
|
)
|
|
|
|
], child: TradeDetailsPage());
|
|
|
|
});
|
|
|
|
|
|
|
|
case Routes.subaddressList:
|
2020-01-08 12:26:34 +00:00
|
|
|
return MaterialPageRoute<Subaddress>(
|
2020-01-04 19:31:52 +00:00
|
|
|
builder: (_) => MultiProvider(providers: [
|
|
|
|
Provider(
|
|
|
|
create: (_) =>
|
|
|
|
SubaddressListStore(walletService: walletService))
|
|
|
|
], child: SubaddressListPage()));
|
|
|
|
|
|
|
|
case Routes.restoreWalletFromSeedDetails:
|
2020-06-20 07:10:00 +00:00
|
|
|
final args = settings.arguments as List;
|
|
|
|
final walletRestorationFromSeedVM =
|
|
|
|
getIt.get<WalletRestorationFromSeedVM>(param1: args);
|
|
|
|
|
2020-01-08 12:26:34 +00:00
|
|
|
return CupertinoPageRoute<void>(
|
2020-06-20 07:10:00 +00:00
|
|
|
builder: (_) => RestoreWalletFromSeedDetailsPage(
|
|
|
|
walletRestorationFromSeedVM: walletRestorationFromSeedVM));
|
2020-01-08 12:26:34 +00:00
|
|
|
|
2020-01-04 19:31:52 +00:00
|
|
|
case Routes.exchange:
|
2020-01-08 12:26:34 +00:00
|
|
|
return MaterialPageRoute<void>(
|
2020-01-04 19:31:52 +00:00
|
|
|
builder: (_) => MultiProvider(providers: [
|
|
|
|
Provider(create: (_) {
|
|
|
|
final xmrtoprovider = XMRTOExchangeProvider();
|
|
|
|
|
|
|
|
return ExchangeStore(
|
|
|
|
initialProvider: xmrtoprovider,
|
|
|
|
initialDepositCurrency: CryptoCurrency.xmr,
|
|
|
|
initialReceiveCurrency: CryptoCurrency.btc,
|
|
|
|
trades: trades,
|
|
|
|
providerList: [
|
|
|
|
xmrtoprovider,
|
2020-01-30 18:23:36 +00:00
|
|
|
ChangeNowExchangeProvider(),
|
2020-02-10 19:35:44 +00:00
|
|
|
MorphTokenExchangeProvider(trades: trades)
|
2020-01-04 19:31:52 +00:00
|
|
|
],
|
|
|
|
walletStore: walletStore);
|
|
|
|
}),
|
|
|
|
], child: ExchangePage()));
|
|
|
|
|
2020-05-14 17:29:10 +00:00
|
|
|
case Routes.exchangeTemplate:
|
|
|
|
return MaterialPageRoute<void>(
|
2020-06-20 07:10:00 +00:00
|
|
|
builder: (_) => Provider(
|
|
|
|
create: (_) {
|
|
|
|
final xmrtoprovider = XMRTOExchangeProvider();
|
|
|
|
|
|
|
|
return ExchangeStore(
|
|
|
|
initialProvider: xmrtoprovider,
|
|
|
|
initialDepositCurrency: CryptoCurrency.xmr,
|
|
|
|
initialReceiveCurrency: CryptoCurrency.btc,
|
|
|
|
trades: trades,
|
|
|
|
providerList: [
|
|
|
|
xmrtoprovider,
|
|
|
|
ChangeNowExchangeProvider(),
|
|
|
|
MorphTokenExchangeProvider(trades: trades)
|
|
|
|
],
|
|
|
|
walletStore: walletStore);
|
|
|
|
},
|
|
|
|
child: ExchangeTemplatePage(),
|
|
|
|
));
|
2020-05-14 17:29:10 +00:00
|
|
|
|
2020-01-04 19:31:52 +00:00
|
|
|
case Routes.settings:
|
2020-01-08 12:26:34 +00:00
|
|
|
return MaterialPageRoute<void>(
|
2020-07-06 20:09:03 +00:00
|
|
|
builder: (_) => getIt.get<SettingsPage>());
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.rescan:
|
2020-01-08 12:26:34 +00:00
|
|
|
return MaterialPageRoute<void>(
|
2020-01-04 19:31:52 +00:00
|
|
|
builder: (_) => Provider(
|
|
|
|
create: (_) => RescanWalletStore(walletService: walletService),
|
|
|
|
child: RescanPage()));
|
|
|
|
|
|
|
|
case Routes.faq:
|
2020-01-08 12:26:34 +00:00
|
|
|
return MaterialPageRoute<void>(builder: (_) => FaqPage());
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
case Routes.changeLanguage:
|
2020-01-08 12:26:34 +00:00
|
|
|
return MaterialPageRoute<void>(builder: (_) => ChangeLanguage());
|
2020-01-04 19:31:52 +00:00
|
|
|
|
|
|
|
default:
|
2020-01-08 12:26:34 +00:00
|
|
|
return MaterialPageRoute<void>(
|
2020-01-04 19:31:52 +00:00
|
|
|
builder: (_) => Scaffold(
|
|
|
|
body: Center(
|
|
|
|
child: Text(S.current.router_no_route(settings.name))),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|