Skip to content

Commit

Permalink
[mob][photos] Add artificial delay to debug thrown exception (#3729)
Browse files Browse the repository at this point in the history
  • Loading branch information
ua741 authored Oct 16, 2024
2 parents 8821022 + c62a325 commit f32d881
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mobile/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ Future<void> _init(bool isBackground, {String via = ''}) async {
CryptoUtil.init();

_logger.info("Lockscreen init");
LockScreenSettings.instance.init(preferences);
unawaited(LockScreenSettings.instance.init(preferences));

_logger.info("Configuration init");
await Configuration.instance.init();
Expand Down
10 changes: 7 additions & 3 deletions mobile/lib/utils/lock_screen_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ class LockScreenSettings {
Duration(minutes: 5),
Duration(minutes: 30),
];
void init(SharedPreferences prefs) async {
Future<void> init(SharedPreferences prefs) async {
_secureStorage = const FlutterSecureStorage();
_preferences = prefs;

///Workaround for privacyScreen not working when app is killed and opened.
await setHideAppContent(getShouldHideAppContent());
/// Workaround to check if "lateinit property activity has not been
/// initialized" PlatformException goes away.
await Future.delayed(const Duration(milliseconds: 500), () {
///Workaround for privacyScreen not working when app is killed and opened.
setHideAppContent(getShouldHideAppContent());
});
}

Future<void> setHideAppContent(bool hideContent) async {
Expand Down

0 comments on commit f32d881

Please sign in to comment.