Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Reload preferences only after the app was paused

r4khul9a1f4524c980
diff --git a/mobile/apps/photos/lib/app.dart b/mobile/apps/photos/lib/app.dart
index 8d95b39578..e19c9dd683 100644
--- a/mobile/apps/photos/lib/app.dart
+++ b/mobile/apps/photos/lib/app.dart
@@ -60,6 +60,7 @@ class _EnteAppState extends State<EnteApp> with WidgetsBindingObserver {
StreamSubscription<MediaExtentionAction>? _intentActionSubscription;
StreamSubscription<Uri?>? _widgetClickedSubscription;
bool _didInitWidgetLaunchHandling = false;
+ bool _wasPaused = false;
late Future<Widget> _initialAndroidHome;
bool get _isPickerLaunch =>
widget.initialMediaExtensionAction?.action == IntentAction.pick;
@@ -262,7 +263,10 @@ class _EnteAppState extends State<EnteApp> with WidgetsBindingObserver {
if (_isPickerLaunch) {
return;
}
- unawaited(_reloadCachesUpdatedInBackground(lastAppOpenTime));
+ if (_wasPaused) {
+ _wasPaused = false;
+ unawaited(_reloadCachesUpdatedInBackground(lastAppOpenTime));
+ }
SyncService.instance.sync();
unawaited(BackgroundTasks.configure().catchError((Object _) {}));
if (Platform.isIOS) {
@@ -270,6 +274,9 @@ class _EnteAppState extends State<EnteApp> with WidgetsBindingObserver {
}
} else {
AppLifecycleService.instance.onAppInBackground(stateChangeReason);
+ if (state == AppLifecycleState.paused) {
+ _wasPaused = true;
+ }
if (Platform.isIOS && state == AppLifecycleState.paused) {
MLService.instance.stopActiveRun(MlStopReason.appPaused);
}