Skip to content

Commit

Permalink
Merge pull request #10 from RyanRory/crash-fixes
Browse files Browse the repository at this point in the history
Crash fixes
  • Loading branch information
jagerman authored Jul 14, 2021
2 parents 22be311 + 2d0898e commit 86e677d
Show file tree
Hide file tree
Showing 21 changed files with 303 additions and 314 deletions.
67 changes: 33 additions & 34 deletions lib/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Router {
return MaterialPageRoute<void>(builder: (_) => WelcomePage());

case Routes.newWalletFromWelcome:
return CupertinoPageRoute<void>(
return MaterialPageRoute<void>(
builder: (_) => Provider(
create: (_) => UserStore(
accountService: UserService(
Expand All @@ -110,7 +110,7 @@ class Router {
Navigator.pushNamed(context, Routes.newWallet))));

case Routes.newWallet:
return CupertinoPageRoute<void>(
return MaterialPageRoute<void>(
builder:
(_) =>
ProxyProvider<AuthenticationStore, WalletCreationStore>(
Expand All @@ -130,26 +130,25 @@ class Router {
callback = settings.arguments as Function(BuildContext, String);
}

return CupertinoPageRoute<void>(
return MaterialPageRoute<void>(
builder: (_) => Provider(
create: (_) => UserStore(
accountService: UserService(
secureStorage: FlutterSecureStorage(),
sharedPreferences: sharedPreferences)),
child: SetupPinCodePage(
onPinCodeSetup: (context, pin) =>
callback == null ? null : callback(context, pin))),
fullscreenDialog: true);
callback == null ? null : callback(context, pin))));

case Routes.restoreOptions:
return CupertinoPageRoute<void>(builder: (_) => RestoreOptionsPage());
return MaterialPageRoute<void>(builder: (_) => RestoreOptionsPage());

case Routes.restoreWalletOptions:
return CupertinoPageRoute<void>(
return MaterialPageRoute<void>(
builder: (_) => RestoreWalletOptionsPage());

case Routes.restoreWalletOptionsFromWelcome:
return CupertinoPageRoute<void>(
return MaterialPageRoute<void>(
builder: (_) => Provider(
create: (_) => UserStore(
accountService: UserService(
Expand All @@ -167,7 +166,7 @@ class Router {
callback: settings.arguments as void Function()));

case Routes.restoreWalletFromSeed:
return CupertinoPageRoute<void>(
return MaterialPageRoute<void>(
builder: (_) =>
ProxyProvider<AuthenticationStore, WalletRestorationStore>(
update: (_, authStore, __) => WalletRestorationStore(
Expand All @@ -180,7 +179,7 @@ class Router {
sharedPreferences: sharedPreferences)));

case Routes.restoreWalletFromKeys:
return CupertinoPageRoute<void>(
return MaterialPageRoute<void>(
builder: (_) =>
ProxyProvider<AuthenticationStore, WalletRestorationStore>(
update: (_, authStore, __) => WalletRestorationStore(
Expand All @@ -193,7 +192,7 @@ class Router {
sharedPreferences: sharedPreferences)));

case Routes.dashboard:
return CupertinoPageRoute<void>(
return MaterialPageRoute<void>(
builder: (_) => createDashboardPage(
walletService: walletService,
priceStore: priceStore,
Expand All @@ -202,7 +201,7 @@ class Router {
walletStore: walletStore));

case Routes.send:
return CupertinoPageRoute<void>(
return MaterialPageRoute<void>(
fullscreenDialog: true,
builder: (_) => MultiProvider(providers: [
ProxyProvider<SettingsStore, BalanceStore>(
Expand All @@ -222,7 +221,7 @@ class Router {
], child: SendPage()));

case Routes.receive:
return CupertinoPageRoute<void>(
return MaterialPageRoute<void>(
fullscreenDialog: true,
builder: (_) => MultiProvider(providers: [
Provider(
Expand All @@ -231,41 +230,40 @@ class Router {
], child: ReceivePage()));

case Routes.transactionDetails:
return CupertinoPageRoute<void>(
fullscreenDialog: true,
return MaterialPageRoute<void>(
builder: (_) => TransactionDetailsPage(
transactionInfo: settings.arguments as TransactionInfo));

case Routes.newSubaddress:
return CupertinoPageRoute<void>(
return MaterialPageRoute<void>(
builder: (_) => Provider(
create: (_) =>
SubadrressCreationStore(walletService: walletService),
child: NewSubaddressPage()));

case Routes.disclaimer:
return CupertinoPageRoute<void>(builder: (_) => DisclaimerPage());
return MaterialPageRoute<void>(builder: (_) => DisclaimerPage());

case Routes.readDisclaimer:
return CupertinoPageRoute<void>(
return MaterialPageRoute<void>(
builder: (_) => DisclaimerPage(isReadOnly: true));

case Routes.seedLanguage:
return CupertinoPageRoute<void>(builder: (_) => SeedLanguage());
return MaterialPageRoute<void>(builder: (_) => SeedLanguage());

case Routes.walletList:
return MaterialPageRoute<void>(
fullscreenDialog: true,
builder: (_) => Provider(
create: (_) => WalletListStore(
walletListService: walletListService,
walletService: walletService),
child: WalletListPage()));

case Routes.auth:
return MaterialPageRoute<void>(
return PageRouteBuilder<void>(
fullscreenDialog: true,
builder: (_) => Provider(
transitionDuration: Duration(milliseconds: 0),
pageBuilder: (_, __, ___) => Provider(
create: (_) => AuthStore(
sharedPreferences: sharedPreferences,
userService: userService,
Expand All @@ -276,30 +274,31 @@ class Router {
));

case Routes.unlock:
return MaterialPageRoute<void>(
return PageRouteBuilder<void>(
fullscreenDialog: true,
builder: (_) => createUnlockPage(
transitionDuration: Duration(milliseconds: 0),
pageBuilder: (_, __, ___) => createUnlockPage(
sharedPreferences: sharedPreferences,
userService: userService,
walletService: walletService,
onAuthenticationFinished:
settings.arguments as OnAuthenticationFinished));

case Routes.nodeList:
return CupertinoPageRoute<void>(builder: (context) {
return MaterialPageRoute<void>(builder: (context) {
return Provider(
create: (_) => NodeListStore(nodesSource: nodes),
child: NodeListPage());
});

case Routes.newNode:
return CupertinoPageRoute<void>(
return MaterialPageRoute<void>(
builder: (_) => Provider<NodeListStore>(
create: (_) => NodeListStore(nodesSource: nodes),
child: NewNodePage()));

case Routes.login:
return CupertinoPageRoute<void>(builder: (context) {
return MaterialPageRoute<void>(builder: (context) {
final authenticationStore = Provider.of<AuthenticationStore>(context);

return createLoginPage(
Expand All @@ -318,11 +317,10 @@ class Router {
create: (_) =>
AccountListStore(walletService: walletService)),
], child: AccountListPage());
},
fullscreenDialog: true);
});

case Routes.accountCreation:
return CupertinoPageRoute<String>(builder: (context) {
return MaterialPageRoute<String>(builder: (context) {
return Provider(
create: (_) => AccountListStore(walletService: walletService),
child: AccountPage(account: settings.arguments as Account));
Expand Down Expand Up @@ -355,7 +353,7 @@ class Router {
});

case Routes.addressBookAddContact:
return CupertinoPageRoute<void>(builder: (context) {
return MaterialPageRoute<void>(builder: (context) {
return MultiProvider(
providers: [
Provider(
Expand Down Expand Up @@ -400,7 +398,7 @@ class Router {
], child: SubaddressListPage()));

case Routes.restoreWalletFromSeedDetails:
return CupertinoPageRoute<void>(
return MaterialPageRoute<void>(
builder: (_) =>
ProxyProvider<AuthenticationStore, WalletRestorationStore>(
update: (_, authStore, __) => WalletRestorationStore(
Expand Down Expand Up @@ -432,13 +430,14 @@ class Router {
return MaterialPageRoute<void>(builder: (_) => ChangeLanguage());

case Routes.profile:
return CupertinoPageRoute<void>(builder: (_) => ProfilePage());
return MaterialPageRoute<void>(builder: (_) => ProfilePage());

case Routes.stake:
return CupertinoPageRoute<void>(builder: (_) => StakePage());
return MaterialPageRoute<void>(builder: (_) => StakePage());

case Routes.newStake:
return MaterialPageRoute<void>(
fullscreenDialog: true,
builder: (_) => MultiProvider(providers: [
ProxyProvider<SettingsStore, BalanceStore>(
update: (_, settingsStore, __) => BalanceStore(
Expand Down
7 changes: 5 additions & 2 deletions lib/src/domain/services/wallet_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,17 @@ class WalletService extends Wallet {
Future<Map<String, String>> getKeys() => _currentWallet.getKeys();

@override
int getFullBalance() => _currentWallet.getFullBalance();
Future<int> getFullBalance() => _currentWallet.getFullBalance();

@override
int getUnlockedBalance() => _currentWallet.getUnlockedBalance();
Future<int> getUnlockedBalance() => _currentWallet.getUnlockedBalance();

@override
int getCurrentHeight() => _currentWallet.getCurrentHeight();

@override
bool isRefreshing() => currentWallet.isRefreshing();

@override
Future<int> getNodeHeight() => _currentWallet.getNodeHeight();

Expand Down
6 changes: 0 additions & 6 deletions lib/src/screens/address_book/address_book_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,9 @@ class AddressBookPage extends BasePage {

final bool isEditable;

@override
bool get isModalBackButton => true;

@override
String get title => S.current.address_book;

@override
AppBarStyle get appBarStyle => AppBarStyle.withShadow;

@override
Widget trailing(BuildContext context) {
if (!isEditable) return null;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/screens/seed/seed_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class SeedPage extends BasePage {
padding: EdgeInsets.only(bottom: 20.0),
margin: EdgeInsets.only(bottom: 10.0),
child: Text(
walletSeedStore.name,
walletSeedStore.name ?? '',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18.0,
Expand Down
3 changes: 0 additions & 3 deletions lib/src/screens/settings/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ class SettingsPage extends BasePage {
@override
String get title => S.current.settings_title;

@override
bool get isModalBackButton => true;

@override
Color get backgroundColor => Palette.lightGrey2;

Expand Down
Loading

0 comments on commit 86e677d

Please sign in to comment.