Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix: simplify collection filtering in file upload process

AmanRajSinghMourya3bf6f721a233
diff --git a/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart b/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart
index 0fdf0da9d2..ca9cc21a28 100644
--- a/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart
+++ b/mobile/apps/locker/lib/ui/pages/file_upload_screen.dart
@@ -40,8 +40,7 @@ class _FileUploadScreenState extends State<FileUploadScreen> {
super.initState();
_files = List.from(widget.files);
- if (widget.selectedCollection != null &&
- widget.selectedCollection!.type != CollectionType.uncategorized) {
+ if (widget.selectedCollection != null) {
_selectedCollections.add(widget.selectedCollection!);
}
}
@@ -155,20 +154,15 @@ class _FileUploadScreenState extends State<FileUploadScreen> {
spacing: 8,
runSpacing: 12,
children: [
- ...widget.collections
- .where(
- (collection) =>
- collection.type != CollectionType.uncategorized,
- )
- .map((collection) {
+ ...widget.collections.map((collection) {
final isSelected =
_selectedCollections.contains(collection);
return _buildCollectionChip(
- collection.name ?? context.l10n.unnamed,
- isSelected,
- () => _onCollectionSelected(collection),
- colorScheme,
- textTheme,
+ name: collection.name ?? context.l10n.unnamed,
+ isSelected: isSelected,
+ onTap: () => _onCollectionSelected(collection),
+ colorScheme: colorScheme,
+ textTheme: textTheme,
);
}),
_buildNewCollectionChip(colorScheme, textTheme),
@@ -288,13 +282,13 @@ class _FileUploadScreenState extends State<FileUploadScreen> {
});
}
- Widget _buildCollectionChip(
- String name,
- bool isSelected,
- VoidCallback onTap,
- EnteColorScheme colorScheme,
- EnteTextTheme textTheme,
- ) {
+ Widget _buildCollectionChip({
+ required String name,
+ required bool isSelected,
+ required VoidCallback onTap,
+ required EnteColorScheme colorScheme,
+ required EnteTextTheme textTheme,
+ }) {
return GestureDetector(
onTap: onTap,
child: AnimatedContainer(
diff --git a/mobile/apps/locker/lib/ui/pages/uploader_page.dart b/mobile/apps/locker/lib/ui/pages/uploader_page.dart
index 9764e9fa52..30cd1782ff 100644
--- a/mobile/apps/locker/lib/ui/pages/uploader_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/uploader_page.dart
@@ -62,8 +62,11 @@ abstract class UploaderPageState<T extends UploaderPage> extends State<T> {
final List<Future> futures = [];
final collections = await CollectionService.instance.getCollections();
- final collectionsWithoutUncategorized = collections
- .where((c) => c.type != CollectionType.uncategorized)
+ final regularCollections = collections
+ .where(
+ (c) => (c.type != CollectionType.uncategorized &&
+ c.type != CollectionType.favorites),
+ )
.toList();
// Navigate to upload screen to get collection selection
@@ -72,7 +75,7 @@ abstract class UploaderPageState<T extends UploaderPage> extends State<T> {
MaterialPageRoute(
builder: (context) => FileUploadScreen(
files: files,
- collections: collectionsWithoutUncategorized,
+ collections: regularCollections,
selectedCollection: selectedCollection,
),
),