Skip to content

armgit / ente

Public Imported from GitHub
0

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

never import when skipped, only skip permission in handle backup entry flow, skip sync remove continue anyway

Prateek Sunal56518bf1ac67
diff --git a/mobile/apps/photos/lib/services/backup_preference_service.dart b/mobile/apps/photos/lib/services/backup_preference_service.dart
index 9a49e66910..bd506cd94a 100644
--- a/mobile/apps/photos/lib/services/backup_preference_service.dart
+++ b/mobile/apps/photos/lib/services/backup_preference_service.dart
@@ -121,9 +121,6 @@ class BackupPreferenceService {
await _setAllFoldersShouldBackup(true);
await setSelectAllFoldersForBackup(true);
await setHasSelectedAnyBackupFolder(true);
- if (hasSkippedOnboardingPermission) {
- await setOnboardingPermissionSkipped(false);
- }
_logger.info('Auto-selected all folders for backup');
} catch (error, stackTrace) {
_logger.warning(
diff --git a/mobile/apps/photos/lib/services/sync/local_sync_service.dart b/mobile/apps/photos/lib/services/sync/local_sync_service.dart
index 839a7cf79e..20fc560622 100644
--- a/mobile/apps/photos/lib/services/sync/local_sync_service.dart
+++ b/mobile/apps/photos/lib/services/sync/local_sync_service.dart
@@ -70,6 +70,11 @@ class LocalSyncService {
_logger.info("Skipping local sync since permission has not been granted");
return;
}
+ if (backupPreferenceService.hasSkippedOnboardingPermission &&
+ !hasCompletedFirstImport()) {
+ _logger.fine("Skipping local sync, first import pending");
+ return;
+ }
if (Platform.isAndroid && AppLifecycleService.instance.isForeground) {
final permissionState =
await permissionService.requestPhotoMangerPermissions();
@@ -168,6 +173,11 @@ class LocalSyncService {
_logger.warning("syncCall called when user is not logged in");
return false;
}
+ if (backupPreferenceService.hasSkippedOnboardingPermission &&
+ !hasCompletedFirstImport()) {
+ _logger.fine("Skipping syncAll, first import pending");
+ return false;
+ }
final stopwatch = EnteWatch("localSyncAll")..start();
final localAssets = await getAllLocalAssets();
diff --git a/mobile/apps/photos/lib/ui/common/backup_flow_helper.dart b/mobile/apps/photos/lib/ui/common/backup_flow_helper.dart
index d8fd24b4d9..9f17ae789f 100644
--- a/mobile/apps/photos/lib/ui/common/backup_flow_helper.dart
+++ b/mobile/apps/photos/lib/ui/common/backup_flow_helper.dart
@@ -83,6 +83,13 @@ Future<bool?> _handleFirstImportFlow(BuildContext context) async {
return null;
}
+ // Clear skip flag to allow sync to proceed for first import.
+ // This is the entry point when user explicitly chooses to set up backup
+ // after having skipped permission during onboarding.
+ if (backupPreferenceService.hasSkippedOnboardingPermission) {
+ await backupPreferenceService.setOnboardingPermissionSkipped(false);
+ }
+
return routeToPage<bool>(
context,
const LoadingPhotosWidget(isOnboardingFlow: false),
diff --git a/mobile/apps/photos/lib/ui/settings/backup/backup_folder_selection_page.dart b/mobile/apps/photos/lib/ui/settings/backup/backup_folder_selection_page.dart
index b645ee3293..0d94d861b8 100644
--- a/mobile/apps/photos/lib/ui/settings/backup/backup_folder_selection_page.dart
+++ b/mobile/apps/photos/lib/ui/settings/backup/backup_folder_selection_page.dart
@@ -251,9 +251,6 @@ class _BackupFolderSelectionPageState extends State<BackupFolderSelectionPage> {
await RemoteSyncService.instance.updateDeviceFolderSyncStatus(syncStatus);
await dialog.hide();
await backupPreferenceService.setHasManualFolderSelection(true);
- if (backupPreferenceService.hasSkippedOnboardingPermission) {
- await backupPreferenceService.setOnboardingPermissionSkipped(false);
- }
// Skip the warning dialog if we came from the "backup only new photos"
// toggle to avoid recursive navigation back to backup settings.
diff --git a/mobile/apps/photos/lib/ui/settings/backup/backup_settings_screen.dart b/mobile/apps/photos/lib/ui/settings/backup/backup_settings_screen.dart
index 13b712e77d..67724d9b05 100644
--- a/mobile/apps/photos/lib/ui/settings/backup/backup_settings_screen.dart
+++ b/mobile/apps/photos/lib/ui/settings/backup/backup_settings_screen.dart
@@ -6,6 +6,7 @@ import 'package:photos/core/configuration.dart';
import 'package:photos/generated/l10n.dart';
import 'package:photos/l10n/l10n.dart';
import 'package:photos/service_locator.dart';
+import 'package:photos/services/sync/local_sync_service.dart';
import 'package:photos/services/sync/sync_service.dart';
import 'package:photos/services/wake_lock_service.dart';
import 'package:photos/theme/ente_theme.dart';
@@ -288,6 +289,12 @@ class BackupSettingsScreen extends StatelessWidget {
final hasAllFoldersSelected =
backupPreferenceService.hasSelectedAllFoldersForBackup;
+
+ // Hide "Continue anyway" if user skipped permission and first import not done
+ final allowContinueAnyway =
+ !backupPreferenceService.hasSkippedOnboardingPermission ||
+ LocalSyncService.instance.hasCompletedFirstImport();
+
final result = await showActionSheet(
context: context,
buttons: [
@@ -299,14 +306,15 @@ class BackupSettingsScreen extends StatelessWidget {
shouldStickToDarkTheme: true,
isInAlert: true,
),
- ButtonWidget(
- labelText: context.l10n.continueLabel,
- buttonType: ButtonType.neutral,
- buttonAction: ButtonAction.second,
- shouldSurfaceExecutionStates: false,
- shouldStickToDarkTheme: true,
- isInAlert: true,
- ),
+ if (allowContinueAnyway)
+ ButtonWidget(
+ labelText: context.l10n.continueLabel,
+ buttonType: ButtonType.neutral,
+ buttonAction: ButtonAction.second,
+ shouldSurfaceExecutionStates: false,
+ shouldStickToDarkTheme: true,
+ isInAlert: true,
+ ),
ButtonWidget(
labelText: context.l10n.cancel,
buttonType: ButtonType.secondary,
@@ -319,7 +327,9 @@ class BackupSettingsScreen extends StatelessWidget {
title: "Only backup new photos",
body: hasAllFoldersSelected
? "All folders are currently selected for backup.\n\nYou can continue for now, or update selected folders."
- : "No folders are currently selected for backup.\n\nYou can continue for now, or update selected folders.",
+ : allowContinueAnyway
+ ? "No folders are currently selected for backup.\n\nYou can continue for now, or update selected folders."
+ : "No folders are currently selected for backup.\n\nPlease select folders to continue.",
);
if (result?.action == null || result!.action == ButtonAction.cancel) {