mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 10:34:32 +00:00
wrap swb open from file in platform check
This commit is contained in:
parent
825356179a
commit
c366e4a9c5
1 changed files with 27 additions and 20 deletions
|
@ -344,20 +344,23 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
|||
_prefs = ref.read(prefsChangeNotifierProvider);
|
||||
_wallets = ref.read(walletsChangeNotifierProvider);
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
// fetch open file if it exists
|
||||
await getOpenFile();
|
||||
if (Platform.isAndroid) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
// fetch open file if it exists
|
||||
await getOpenFile();
|
||||
|
||||
if (ref.read(openedFromSWBFileStringStateProvider.state).state != null) {
|
||||
// waiting for loading to complete before going straight to restore if the app was opened via file
|
||||
await loadingCompleter.future;
|
||||
if (ref.read(openedFromSWBFileStringStateProvider.state).state !=
|
||||
null) {
|
||||
// waiting for loading to complete before going straight to restore if the app was opened via file
|
||||
await loadingCompleter.future;
|
||||
|
||||
await goToRestoreSWB(
|
||||
ref.read(openedFromSWBFileStringStateProvider.state).state!);
|
||||
ref.read(openedFromSWBFileStringStateProvider.state).state = null;
|
||||
}
|
||||
// ref.read(shouldShowLockscreenOnResumeStateProvider.state).state = false;
|
||||
});
|
||||
await goToRestoreSWB(
|
||||
ref.read(openedFromSWBFileStringStateProvider.state).state!);
|
||||
ref.read(openedFromSWBFileStringStateProvider.state).state = null;
|
||||
}
|
||||
// ref.read(shouldShowLockscreenOnResumeStateProvider.state).state = false;
|
||||
});
|
||||
}
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
@ -378,14 +381,16 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
|||
case AppLifecycleState.paused:
|
||||
break;
|
||||
case AppLifecycleState.resumed:
|
||||
// fetch open file if it exists
|
||||
await getOpenFile();
|
||||
// go straight to restore if the app was resumed via file
|
||||
if (ref.read(openedFromSWBFileStringStateProvider.state).state !=
|
||||
null) {
|
||||
await goToRestoreSWB(
|
||||
ref.read(openedFromSWBFileStringStateProvider.state).state!);
|
||||
ref.read(openedFromSWBFileStringStateProvider.state).state = null;
|
||||
if (Platform.isAndroid) {
|
||||
// fetch open file if it exists
|
||||
await getOpenFile();
|
||||
// go straight to restore if the app was resumed via file
|
||||
if (ref.read(openedFromSWBFileStringStateProvider.state).state !=
|
||||
null) {
|
||||
await goToRestoreSWB(
|
||||
ref.read(openedFromSWBFileStringStateProvider.state).state!);
|
||||
ref.read(openedFromSWBFileStringStateProvider.state).state = null;
|
||||
}
|
||||
}
|
||||
// if (ref.read(hasAuthenticatedOnStartStateProvider.state).state &&
|
||||
// ref.read(shouldShowLockscreenOnResumeStateProvider.state).state) {
|
||||
|
@ -419,6 +424,7 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
|||
}
|
||||
}
|
||||
|
||||
/// should only be called on android currently
|
||||
Future<void> getOpenFile() async {
|
||||
// update provider with new file content state
|
||||
ref.read(openedFromSWBFileStringStateProvider.state).state =
|
||||
|
@ -432,6 +438,7 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
|||
level: LogLevel.Info);
|
||||
}
|
||||
|
||||
/// should only be called on android currently
|
||||
Future<void> resetOpenPath() async {
|
||||
await platform.invokeMethod("resetOpenPath");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue