Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix skipped backup permission flow

Neeraj Gupta1430ec5689cd
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 6461972a1e..d561569e8e 100644
--- a/mobile/apps/photos/lib/services/sync/local_sync_service.dart
+++ b/mobile/apps/photos/lib/services/sync/local_sync_service.dart
@@ -67,6 +67,9 @@ class LocalSyncService {
_permissionGrantedSubscription = Bus.instance
.on<PermissionGrantedEvent>()
.listen((event) async {
+ if (!permissionService.hasGrantedPermissions()) {
+ return;
+ }
_registerChangeCallback();
if (isLocalGalleryMode) {
// Local gallery onboarding grants permission without explicitly
@@ -93,6 +96,7 @@ class LocalSyncService {
return;
}
}
+ _registerChangeCallback();
if (_existingSync != null) {
_logger.warning("Sync already in progress, skipping.");
return _existingSync!.future;
diff --git a/mobile/apps/photos/lib/ui/home/grant_permissions_widget.dart b/mobile/apps/photos/lib/ui/home/grant_permissions_widget.dart
index 895312ef76..433fe81421 100644
--- a/mobile/apps/photos/lib/ui/home/grant_permissions_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/grant_permissions_widget.dart
@@ -201,11 +201,6 @@ class _GrantPermissionsWidgetState extends State<GrantPermissionsWidget> {
Future<void> _onTapSkip() async {
await backupPreferenceService.setOnboardingPermissionSkipped(true);
- final state = await permissionService.getPermissionState();
- if (state == PermissionState.authorized ||
- state == PermissionState.limited) {
- await permissionService.onUpdatePermission(state);
- }
SyncService.instance.sync().ignore();
if (mounted) {
setState(() {});
diff --git a/mobile/apps/photos/lib/ui/home/loading_photos_widget.dart b/mobile/apps/photos/lib/ui/home/loading_photos_widget.dart
index 8a44eba0b3..01b71b65fb 100644
--- a/mobile/apps/photos/lib/ui/home/loading_photos_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/loading_photos_widget.dart
@@ -55,11 +55,12 @@ class _LoadingPhotosWidgetState extends State<LoadingPhotosWidget> {
event,
) async {
if (mounted && event.status == SyncStatus.completedFirstGalleryImport) {
- if (permissionService.hasGrantedLimitedPermissions()) {
- // Do nothing, let HomeWidget refresh
- } else {
- await _goToFolderSelection();
+ if (widget.isOnboardingFlow &&
+ permissionService.hasGrantedLimitedPermissions()) {
+ // Do nothing, let HomeWidget refresh.
+ return;
}
+ await _goToFolderSelection();
}
});