forked from karlsen-network/karlsen-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.
- update translations - fix camera permission - cleanup and remove unused code - remove derivation path `111111`(Kaspa) support - reduce unused address buffer size - refactor backup secret phrase - refactor privacy overlay - remove unused logger - refactor db boxes - refactor navigation - refactor `network` and `networkId` (updates api/explorer url based on ports and network suffix) - backup sheet cleanup - refactor settings - support for BIP39 passphrase - enable 12 word standard wallets - fee non optional - add mass calculator - update grpc to rusty karlsen - TKLS on testnet - replace by fee and fee estimate rpc - support for priority fee and rbf - periodically update KLS price - revert `qr_code_scanner` and `flutter_vibrate` (fix in android\build.gradle; related to the fact that now flutter checks the versions of `compileSdkVersion` and `buildToolsVersion`. Some packages either specify outdated versions or do not specify them at all) - new white and dark theme - bump version to `3.0.0+1`
- Loading branch information
Showing
276 changed files
with
21,088 additions
and
25,127 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
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
Oops, something went wrong.