π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Re-add Important
vishnukvmd78a423905452
diff --git a/mobile/apps/locker/lib/ui/pages/base_info_page.dart b/mobile/apps/locker/lib/ui/pages/base_info_page.dartindex c20c0559b6..bda92be201 100644--- a/mobile/apps/locker/lib/ui/pages/base_info_page.dart+++ b/mobile/apps/locker/lib/ui/pages/base_info_page.dart@@ -178,29 +178,58 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>Future<void> _loadCollections() async {try {final collections = await CollectionService.instance.getCollections();+ final filteredCollections = collections+ .where((c) => c.type != CollectionType.uncategorized)+ .toList();++ Set<int> initialSelection = _selectedCollectionIds;++ if (widget.existingFile != null) {+ final fileCollections =+ await CollectionService.instance.getCollectionsForFile(+ widget.existingFile!,+ );+ initialSelection = fileCollections+ .where((c) => c.type != CollectionType.uncategorized)+ .map((c) => c.id)+ .toSet();+ } else if (initialSelection.isEmpty && filteredCollections.isNotEmpty) {+ final defaultCollection = _pickDefaultCollection(filteredCollections);+ initialSelection = {defaultCollection.id};+ }++ if (!mounted) {+ return;+ }+setState(() {- // Filter out uncategorized and favorites collections- _availableCollections = collections- .where(- (c) =>- c.type != CollectionType.uncategorized &&- c.type != CollectionType.favorites,- )- .toList();- // Pre-select a default collection if available- if (_availableCollections.isNotEmpty) {- final defaultCollection = _availableCollections.firstWhere(- (c) => c.name == context.l10n.informationCollectionName,- orElse: () => _availableCollections.first,- );- _selectedCollectionIds = {defaultCollection.id};- }+ _availableCollections = filteredCollections;+ _selectedCollectionIds = initialSelection;});} catch (e) {// Handle error silently or show a message}}+ Collection _pickDefaultCollection(List<Collection> collections) {+ assert(collections.isNotEmpty, 'Collections list cannot be empty');++ final infoCollectionName = context.l10n.informationCollectionName;+ for (final collection in collections) {+ if ((collection.name ?? '') == infoCollectionName) {+ return collection;+ }+ }++ for (final collection in collections) {+ if (collection.type != CollectionType.favorites) {+ return collection;+ }+ }++ return collections.first;+ }+void _onToggleCollection(int collectionId) {setState(() {if (_selectedCollectionIds.contains(collectionId)) {diff --git a/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart b/mobile/apps/locker/lib/ui/pages/file_upload_screen.dartindex 3d1e64cc89..8635e54fb0 100644--- a/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart+++ b/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart@@ -41,8 +41,7 @@ class _FileUploadScreenState extends State<FileUploadScreen> {_files = List.from(widget.files);if (widget.selectedCollection != null &&- widget.selectedCollection!.type != CollectionType.uncategorized &&- widget.selectedCollection!.type != CollectionType.favorites) {+ widget.selectedCollection!.type != CollectionType.uncategorized) {_selectedCollections.add(widget.selectedCollection!);}}