Skip to content

armgit / ente

Public Imported from GitHub
0

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

[locker] Fix empty state shown after logout/login cycle

AmanRajSinghMouryad374af01feca
diff --git a/mobile/apps/locker/lib/services/collections/collections_service.dart b/mobile/apps/locker/lib/services/collections/collections_service.dart
index cfad7b8c56..0d68a3a7d8 100644
--- a/mobile/apps/locker/lib/services/collections/collections_service.dart
+++ b/mobile/apps/locker/lib/services/collections/collections_service.dart
@@ -57,13 +57,14 @@ class CollectionService {
Future<void> init() async {
_db = CollectionDB.instance;
_apiClient = CollectionApiClient.instance;
+
+ Bus.instance.on<SignedInEvent>().listen((event) {
+ _logger.info("User signed in, starting initial sync.");
+ _init();
+ });
+
if (Configuration.instance.hasConfiguredAccount()) {
await _init();
- } else {
- Bus.instance.on<SignedInEvent>().listen((event) {
- _logger.info("User signed in, starting initial sync.");
- _init();
- });
}
}
diff --git a/mobile/apps/locker/lib/services/trash/trash_service.dart b/mobile/apps/locker/lib/services/trash/trash_service.dart
index 35edc08cdf..4ae3f98b84 100644
--- a/mobile/apps/locker/lib/services/trash/trash_service.dart
+++ b/mobile/apps/locker/lib/services/trash/trash_service.dart
@@ -39,13 +39,13 @@ class TrashService {
_trashDB = TrashDB.instance;
_collectionDB = CollectionDB.instance;
+ Bus.instance.on<SignedInEvent>().listen((event) {
+ _logger.info("User signed in, starting initial trash sync.");
+ unawaited(syncTrash());
+ });
+
if (Configuration.instance.hasConfiguredAccount()) {
unawaited(syncTrash());
- } else {
- Bus.instance.on<SignedInEvent>().listen((event) {
- _logger.info("User signed in, starting initial trash sync.");
- unawaited(syncTrash());
- });
}
}
diff --git a/mobile/apps/locker/lib/ui/pages/home_page.dart b/mobile/apps/locker/lib/ui/pages/home_page.dart
index 718731a8be..a993cf6c73 100644
--- a/mobile/apps/locker/lib/ui/pages/home_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/home_page.dart
@@ -251,10 +251,6 @@ class _HomePageState extends UploaderPageState<HomePage>
_loadCollections();
- if (CollectionService.instance.hasCompletedFirstSync()) {
- _loadCollections();
- }
-
// Initialize sharing functionality to handle shared files
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
@@ -472,13 +468,18 @@ class _HomePageState extends UploaderPageState<HomePage>
final sortedCollections =
CollectionSortUtil.getSortedCollections(collections);
+ // Only mark initial load complete when first sync has finished
+ // This prevents empty state while sync is in progress
+ final hasCompletedFirstSync =
+ CollectionService.instance.hasCompletedFirstSync();
+
if (mounted) {
setState(() {
_collections = sortedCollections;
_filteredCollections = _filterOutUncategorized(sortedCollections);
_filteredFiles = _recentFiles;
_isLoading = false;
- _hasCompletedInitialLoad = true;
+ _hasCompletedInitialLoad = hasCompletedFirstSync;
});
}
} catch (error) {
@@ -486,7 +487,8 @@ class _HomePageState extends UploaderPageState<HomePage>
setState(() {
_error = 'Error fetching collections: $error';
_isLoading = false;
- _hasCompletedInitialLoad = true;
+ _hasCompletedInitialLoad =
+ CollectionService.instance.hasCompletedFirstSync();
});
}
}