Skip to content

armgit / ente

Public Imported from GitHub
0

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

Simplify collection creation

vishnukvmd41f457e528bb
diff --git a/mobile/apps/locker/lib/services/collections/collections_service.dart b/mobile/apps/locker/lib/services/collections/collections_service.dart
index 90bb3e3bff..20ec43804f 100644
--- a/mobile/apps/locker/lib/services/collections/collections_service.dart
+++ b/mobile/apps/locker/lib/services/collections/collections_service.dart
@@ -607,9 +607,6 @@ class CollectionService {
return true;
}
- // Track if default collections have been set up
- bool _defaultCollectionsSetupCompleted = false;
-
Future<void> setupDefaultCollections() async {
try {
if (Configuration.instance.getKey() == null) {
@@ -619,12 +616,6 @@ class CollectionService {
return;
}
- // Skip if already completed
- if (_defaultCollectionsSetupCompleted) {
- _logger.info("Default collections already set up, skipping.");
- return;
- }
-
_logger.info("Setting up default collections...");
// Create uncategorized collection if it doesn't exist
@@ -636,28 +627,12 @@ class CollectionService {
// Create Documents collection if it doesn't exist
await _getOrCreateDocumentsCollection();
- _defaultCollectionsSetupCompleted = true;
_logger.info("Default collections setup completed.");
} catch (e, s) {
_logger.severe("Failed to setup default collections", e, s);
}
}
- /// Ensures default collections are set up if they haven't been already
- /// This should be called from HomePage once the master key is available
- Future<void> ensureDefaultCollections() async {
- if (!_defaultCollectionsSetupCompleted &&
- Configuration.instance.getKey() != null) {
- await setupDefaultCollections();
- } else {
- if (_defaultCollectionsSetupCompleted) {
- _logger.info("Default collections already setup, skipping");
- } else {
- _logger.warning("Master key not available, cannot setup collections");
- }
- }
- }
-
Future<Collection> _getOrCreateDocumentsCollection() async {
final collections = await getCollections();
for (final collection in collections) {
diff --git a/mobile/apps/locker/lib/ui/pages/home_page.dart b/mobile/apps/locker/lib/ui/pages/home_page.dart
index 0939d317f7..f05b491950 100644
--- a/mobile/apps/locker/lib/ui/pages/home_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/home_page.dart
@@ -275,14 +275,6 @@ class _HomePageState extends UploaderPageState<HomePage>
_loadCollections();
}
- // Ensure default collections are created now that we're on the home page
- // This handles the case where SignedInEvent fired before master key was available
- CollectionService.instance.ensureDefaultCollections().then((_) {
- _logger.info("Default collections check completed in HomePage");
- }).catchError((error) {
- _logger.warning("Failed to ensure default collections: $error");
- });
-
// Initialize sharing functionality to handle shared files
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {