Redirect to loading screen if first load is interrupted

This commit is contained in:
Vishnu Mohandas 2021-05-13 02:22:45 +05:30
parent ecc3ec1e52
commit e3a50358db
2 changed files with 9 additions and 2 deletions

View file

@ -232,7 +232,10 @@ class SyncService {
toTime = DateTime(toYear).microsecondsSinceEpoch;
}
await _loadAndStorePhotos(startTime, syncStartTime, existingLocalFileIDs);
_prefs.setBool(kHasCompletedFirstImportKey, true);
}
if (!_prefs.containsKey(kHasCompletedFirstImportKey) ||
!_prefs.getBool(kHasCompletedFirstImportKey)) {
await _prefs.setBool(kHasCompletedFirstImportKey, true);
Bus.instance
.fire(SyncStatusUpdate(SyncStatus.completed_first_gallery_import));
}

View file

@ -23,6 +23,7 @@ import 'package:photos/ui/extents_page_view.dart';
import 'package:photos/ui/gallery.dart';
import 'package:photos/ui/gallery_app_bar_widget.dart';
import 'package:photos/ui/grant_permissions_page.dart';
import 'package:photos/ui/loading_photos_page.dart';
import 'package:photos/ui/memories_widget.dart';
import 'package:photos/services/user_service.dart';
import 'package:photos/ui/nav_bar.dart';
@ -162,7 +163,10 @@ class _HomeWidgetState extends State<HomeWidget> {
if (!SyncService.instance.hasGrantedPermissions()) {
return GrantPermissionsPage();
}
if (Configuration.instance.getPathsToBackUp().length == 0) {
if (!SyncService.instance.hasCompletedFirstImport()) {
return LoadingPhotosPage();
}
if (Configuration.instance.getPathsToBackUp().isEmpty) {
return BackupFolderSelectionPage();
}