forked from spectre-project/spectre-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* cleanup and remove unused code * support bip39 passphrase * support 12 word standard wallets * reduce unused address buffer size * refactor utils and update imports * update send tx flow * fix allow fiat feature * refactor backup secret phrase * refactor privacy overlay * refactor database boxes * refactor navigation * refactor settings * update auth flow * bump version to `v0.3.17`
- Loading branch information
1 parent
c033808
commit 3e95ce9
Showing
155 changed files
with
7,999 additions
and
16,812 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'screens/screens.dart'; | ||
import 'util/routes.dart'; | ||
|
||
final appRouter = AppRouter(); | ||
|
||
class _AppScreens { | ||
static const splash = '/'; | ||
static const intro = '/intro'; | ||
static const wallet = '/wallet'; | ||
static const locked = '/locked'; | ||
static const lockedWithTransition = '/locked_with_transition'; | ||
static const passwordLocked = '/password_locked'; | ||
static const logout = '/logout'; | ||
static const setupWallet = '/setup_wallet'; | ||
} | ||
|
||
class AppRouter { | ||
void reload(BuildContext context) => | ||
_replaceWith(_AppScreens.splash, context); | ||
|
||
void startIntro(BuildContext context) => | ||
_replaceWith(_AppScreens.intro, context); | ||
|
||
void setupWallet(BuildContext context) => | ||
_replaceWith(_AppScreens.setupWallet, context); | ||
|
||
void requireUnlock(BuildContext context) => | ||
_replaceWith(_AppScreens.locked, context); | ||
|
||
void lockoutkWithTransition(BuildContext context) => | ||
_replaceWith(_AppScreens.lockedWithTransition, context); | ||
|
||
void requirePassword(BuildContext context) => | ||
_replaceWith(_AppScreens.passwordLocked, context); | ||
|
||
void openWallet(BuildContext context) => | ||
_replaceWith(_AppScreens.wallet, context); | ||
|
||
void logout(BuildContext context) => | ||
_replaceWith(_AppScreens.logout, context); | ||
|
||
bool isTopRoute<T>(BuildContext context) { | ||
bool isTopRoute = false; | ||
Navigator.of(context).popUntil((route) { | ||
isTopRoute = route is T; | ||
return true; | ||
}); | ||
return isTopRoute; | ||
} | ||
|
||
Future<T?> _replaceWith<T>(String screenName, BuildContext context) { | ||
return Navigator.of(context).pushNamedAndRemoveUntil( | ||
screenName, | ||
(_) => false, | ||
); | ||
} | ||
|
||
Future<T?> push<T>(BuildContext context, Route<T> route) { | ||
return Navigator.of(context).push(route); | ||
} | ||
|
||
void pop<T>(BuildContext context, {T? withResult = null}) { | ||
Navigator.of(context).pop(withResult); | ||
} | ||
|
||
Future<T?> pushAndRemoveUntilHome<T>(BuildContext context, Route<T> route) { | ||
return Navigator.of(context).pushAndRemoveUntil( | ||
route, | ||
RouteUtils.withNameLike(_AppScreens.wallet), | ||
); | ||
} | ||
|
||
String initialRoute = _AppScreens.splash; | ||
|
||
RouteFactory onGenerateRoute = (RouteSettings settings) { | ||
switch (settings.name) { | ||
case _AppScreens.intro: | ||
return NoTransitionRoute( | ||
builder: (_) => const IntroScreen(), | ||
settings: settings, | ||
); | ||
case _AppScreens.wallet: | ||
return NoTransitionRoute( | ||
builder: (_) => const HomeScreen(), | ||
settings: settings, | ||
); | ||
case _AppScreens.locked: | ||
return BarrierRoute( | ||
builder: (_) => const LockScreen(), | ||
settings: settings, | ||
); | ||
case _AppScreens.lockedWithTransition: | ||
return BarrierRoute( | ||
builder: (_) => const LockScreen(), | ||
settings: settings, | ||
); | ||
case _AppScreens.passwordLocked: | ||
return NoTransitionRoute( | ||
builder: (_) => const PasswordLockScreen(), | ||
settings: settings, | ||
); | ||
case _AppScreens.logout: | ||
return NoTransitionRoute( | ||
builder: (_) => const LogoutScreen(), | ||
settings: settings, | ||
); | ||
case _AppScreens.setupWallet: | ||
return NoTransitionRoute( | ||
builder: (_) => const SetupWalletScreen(), | ||
settings: settings, | ||
); | ||
default: | ||
return NoTransitionRoute( | ||
builder: (_) => const SplashScreen(), | ||
settings: settings, | ||
); | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.