mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-20 22:28:48 +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,11 +344,13 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
||||||
_prefs = ref.read(prefsChangeNotifierProvider);
|
_prefs = ref.read(prefsChangeNotifierProvider);
|
||||||
_wallets = ref.read(walletsChangeNotifierProvider);
|
_wallets = ref.read(walletsChangeNotifierProvider);
|
||||||
|
|
||||||
|
if (Platform.isAndroid) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
// fetch open file if it exists
|
// fetch open file if it exists
|
||||||
await getOpenFile();
|
await getOpenFile();
|
||||||
|
|
||||||
if (ref.read(openedFromSWBFileStringStateProvider.state).state != null) {
|
if (ref.read(openedFromSWBFileStringStateProvider.state).state !=
|
||||||
|
null) {
|
||||||
// waiting for loading to complete before going straight to restore if the app was opened via file
|
// waiting for loading to complete before going straight to restore if the app was opened via file
|
||||||
await loadingCompleter.future;
|
await loadingCompleter.future;
|
||||||
|
|
||||||
|
@ -358,6 +360,7 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
||||||
}
|
}
|
||||||
// ref.read(shouldShowLockscreenOnResumeStateProvider.state).state = false;
|
// ref.read(shouldShowLockscreenOnResumeStateProvider.state).state = false;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
@ -378,6 +381,7 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
||||||
case AppLifecycleState.paused:
|
case AppLifecycleState.paused:
|
||||||
break;
|
break;
|
||||||
case AppLifecycleState.resumed:
|
case AppLifecycleState.resumed:
|
||||||
|
if (Platform.isAndroid) {
|
||||||
// fetch open file if it exists
|
// fetch open file if it exists
|
||||||
await getOpenFile();
|
await getOpenFile();
|
||||||
// go straight to restore if the app was resumed via file
|
// go straight to restore if the app was resumed via file
|
||||||
|
@ -387,6 +391,7 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
||||||
ref.read(openedFromSWBFileStringStateProvider.state).state!);
|
ref.read(openedFromSWBFileStringStateProvider.state).state!);
|
||||||
ref.read(openedFromSWBFileStringStateProvider.state).state = null;
|
ref.read(openedFromSWBFileStringStateProvider.state).state = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// if (ref.read(hasAuthenticatedOnStartStateProvider.state).state &&
|
// if (ref.read(hasAuthenticatedOnStartStateProvider.state).state &&
|
||||||
// ref.read(shouldShowLockscreenOnResumeStateProvider.state).state) {
|
// ref.read(shouldShowLockscreenOnResumeStateProvider.state).state) {
|
||||||
// final now = DateTime.now().toUtc().millisecondsSinceEpoch ~/ 1000;
|
// final now = DateTime.now().toUtc().millisecondsSinceEpoch ~/ 1000;
|
||||||
|
@ -419,6 +424,7 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// should only be called on android currently
|
||||||
Future<void> getOpenFile() async {
|
Future<void> getOpenFile() async {
|
||||||
// update provider with new file content state
|
// update provider with new file content state
|
||||||
ref.read(openedFromSWBFileStringStateProvider.state).state =
|
ref.read(openedFromSWBFileStringStateProvider.state).state =
|
||||||
|
@ -432,6 +438,7 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
||||||
level: LogLevel.Info);
|
level: LogLevel.Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// should only be called on android currently
|
||||||
Future<void> resetOpenPath() async {
|
Future<void> resetOpenPath() async {
|
||||||
await platform.invokeMethod("resetOpenPath");
|
await platform.invokeMethod("resetOpenPath");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue