π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][locker] Swap offline action icon between states
AmanRajSinghMourya5208402c6481
diff --git a/mobile/apps/locker/assets/svg/cloud-download-cancel.svg b/mobile/apps/locker/assets/svg/cloud-download-cancel.svgnew file mode 100644index 0000000000..a1f4ac37a7--- /dev/null+++ b/mobile/apps/locker/assets/svg/cloud-download-cancel.svg@@ -0,0 +1,10 @@+<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">+<g id="cloud-download-cancel">+<g id="elements">+<path id="Vector" d="M17.5 8.51009C17.5 8.67896 17.4924 8.84606 17.4776 9.01106M17.4776 9.01106C17.485 9.01102 17.4925 9.01101 17.5 9.01101C19.9853 9.01101 22 11.0294 22 13.5193C22 15.8398 20.25 17.7508 18 18M17.4776 9.01106C17.4251 9.59444 17.2819 10.1516 17.0621 10.6683M6.52042 8.03192C3.98398 8.27373 2 10.4139 2 13.0183C2 15.135 3.31048 16.9451 5.16295 17.6786M6.52042 8.03192C6.67826 8.01687 6.83823 8.00917 7 8.00917C7.5226 8.00917 8.02648 8.0895 8.5 8.23849M6.52042 8.03192C6.76233 5.21267 9.12324 3 12 3C13.9288 3 15.6257 3.9947 16.6075 5.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>+<path id="Vector_2" d="M12 19V13.5M12 19C11.2998 19 9.99153 17.0057 9.5 16.5M12 19C12.7002 19 14.0085 17.0057 14.5 16.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>+</g>+<path id="Vector 588" d="M7.5 22H16.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>+<path id="Vector_3" d="M20.5 4L5 21" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>+</g>+</svg>diff --git a/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart b/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dartindex b3615db975..5248d2739d 100644--- a/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart+++ b/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart@@ -62,8 +62,9 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {List<EnteFile> _getOwnedFiles(List<EnteFile> files) {final currentUserID = Configuration.instance.getUserID();- final ownedFiles =- files.where((file) => file.ownerID == currentUserID).toList();+ final ownedFiles = files+ .where((file) => file.ownerID == currentUserID)+ .toList();final sharedCount = files.length - ownedFiles.length;if (sharedCount > 0 && mounted) {@@ -182,10 +183,9 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {widget.selectedFiles.files;final isAllSelected =widget.files.isNotEmpty &&- widget.files.every(- (file) =>- selectedSet.contains(file),- );+ widget.files.every(+ (file) => selectedSet.contains(file),+ );final buttonText = isAllSelected? context.l10n.deselectAll: context.l10n.selectAll;@@ -198,16 +198,18 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {if (isAllSelected) {widget.selectedFiles.clearAll();} else {- widget.selectedFiles- .selectAll(widget.files.toSet());+ widget.selectedFiles.selectAll(+ widget.files.toSet(),+ );}},child: Container(decoration: BoxDecoration(color:colorScheme.backgroundElevated2,- borderRadius:- BorderRadius.circular(50),+ borderRadius: BorderRadius.circular(+ 50,+ ),),padding: const EdgeInsets.symmetric(horizontal: 12.0,@@ -237,8 +239,8 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {listenable: widget.selectedFiles,builder: (context, child) {final count = widget.selectedFiles.count;- final countText =- context.l10n.selectedCount(count);+ final countText = context.l10n+ .selectedCount(count);return InkWell(onTap: () {@@ -248,8 +250,9 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {decoration: BoxDecoration(color:colorScheme.backgroundElevated2,- borderRadius:- BorderRadius.circular(50),+ borderRadius: BorderRadius.circular(+ 50,+ ),),padding: const EdgeInsets.symmetric(horizontal: 12.0,@@ -339,27 +342,32 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {final file = isSingleSelection ? files.first : null;final viewType = widget.collectionViewType;- final isImportant = isSingleSelection &&+ final isImportant =+ isSingleSelection &&file != null &&FavoritesService.instance.isFavoriteCache(file);final showImportant = viewType?.showMarkImportantOption ?? true;final showDelete = viewType?.showDeleteOption ?? true;- final eligibleOfflineFiles =- OfflineFilesService.instance.getEligibleFiles(files);+ final eligibleOfflineFiles = OfflineFilesService.instance.getEligibleFiles(+ files,+ );final showOffline = viewType?.showOfflineOption ?? true;final actions = <Widget>[];if (showOffline && eligibleOfflineFiles.isNotEmpty) {- final shouldRemoveOffline = isSingleSelection &&+ final shouldRemoveOffline =+ isSingleSelection &&eligibleOfflineFiles.length == 1 &&LockerDB.instance.isFileMarkedOffline(eligibleOfflineFiles.first);actions.add(SelectionActionButton(hugeIcon: SvgPicture.asset(- "assets/svg/cloud-download.svg",+ shouldRemoveOffline+ ? "assets/svg/cloud-download-cancel.svg"+ : "assets/svg/cloud-download.svg",width: 24,height: 24,colorFilter: ColorFilter.mode(@@ -389,8 +397,9 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {icon: HugeIcons.strokeRoundedStar,color: colorScheme.textBase,),- label:- isImportant ? context.l10n.unimportant : context.l10n.important,+ label: isImportant+ ? context.l10n.unimportant+ : context.l10n.important,onTap: () => isSingleSelection? _markImportant(context, file!): _markMultipleImportant(context, files),@@ -414,9 +423,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {);}- return Row(- children: _buildActionRow(actions),- );+ return Row(children: _buildActionRow(actions));}Widget _buildTrashActionRow(@@ -431,9 +438,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {child: Row(children: _buildActionRow([SelectionActionButton(- hugeIcon: const HugeIcon(- icon: HugeIcons.strokeRoundedRefresh,- ),+ hugeIcon: const HugeIcon(icon: HugeIcons.strokeRoundedRefresh),label: context.l10n.restore,onTap: () => _restoreFiles(context, files),),@@ -465,9 +470,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {color: colorScheme.backgroundElevated2,borderRadius: BorderRadius.circular(24),),- child: Row(- children: _buildActionRow(actions, spacing: 0),- ),+ child: Row(children: _buildActionRow(actions, spacing: 0)),);}@@ -496,9 +499,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {if (isSingleSelection && showEdit) {actions.add(SelectionActionButton(- hugeIcon: const HugeIcon(- icon: HugeIcons.strokeRoundedPencilEdit02,- ),+ hugeIcon: const HugeIcon(icon: HugeIcons.strokeRoundedPencilEdit02),label: context.l10n.edit,onTap: () => _editFile(context, file!),),@@ -508,9 +509,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {if (isSingleSelection && showShare) {actions.add(SelectionActionButton(- hugeIcon: const HugeIcon(- icon: HugeIcons.strokeRoundedNavigation06,- ),+ hugeIcon: const HugeIcon(icon: HugeIcons.strokeRoundedNavigation06),label: context.l10n.share,onTap: () => _shareFileLink(context, file!),),@@ -520,9 +519,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {if (showAddTo) {actions.add(SelectionActionButton(- hugeIcon: const HugeIcon(- icon: HugeIcons.strokeRoundedArrowRight03,- ),+ hugeIcon: const HugeIcon(icon: HugeIcons.strokeRoundedArrowRight03),label: context.l10n.addTo,onTap: () => _showAddToDialog(context, files),),@@ -531,9 +528,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {actions.add(SelectionActionButton(- hugeIcon: const HugeIcon(- icon: HugeIcons.strokeRoundedDownload01,- ),+ hugeIcon: const HugeIcon(icon: HugeIcons.strokeRoundedDownload01),label: context.l10n.download,onTap: () => isSingleSelection? _downloadFile(context, file!)@@ -550,14 +545,8 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {required bool shouldRemoveOffline,}) async {final success = shouldRemoveOffline- ? await OfflineFilesService.instance.unmarkFilesOffline(- context,- files,- )- : await OfflineFilesService.instance.markFilesOffline(- context,- files,- );+ ? await OfflineFilesService.instance.unmarkFilesOffline(context, files)+ : await OfflineFilesService.instance.markFilesOffline(context, files);if (success) {widget.selectedFiles.clearAll();@@ -573,10 +562,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {} catch (e, stackTrace) {_logger.severe("Failed to download file: $e", e, stackTrace);if (context.mounted) {- await showGenericErrorBottomSheet(- context: context,- error: e,- );+ await showGenericErrorBottomSheet(context: context, error: e);}}}@@ -597,10 +583,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {} catch (e, stackTrace) {_logger.severe("Failed to download files: $e", e, stackTrace);if (context.mounted) {- await showGenericErrorBottomSheet(- context: context,- error: e,- );+ await showGenericErrorBottomSheet(context: context, error: e);}}}@@ -637,8 +620,8 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {'Opening add-to dialog for ${ownedFiles.length} file(s); fetching collections.',);- final allCollections =- await CollectionService.instance.getCollectionsForUI();+ final allCollections = await CollectionService.instance+ .getCollectionsForUI();final dedupedCollections = uniqueCollectionsById(allCollections);_logger.info('Presenting ${dedupedCollections.length} unique collection option(s) '@@ -673,8 +656,8 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {);List<Collection> currentCollections;try {- currentCollections =- await CollectionService.instance.getCollectionsForFile(file);+ currentCollections = await CollectionService.instance+ .getCollectionsForFile(file);} catch (_) {_logger.warning('Failed to fetch existing collections for file ${file.uploadedFileID}',@@ -682,8 +665,9 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {currentCollections = <Collection>[];}- final currentCollectionIds =- currentCollections.map((collection) => collection.id).toSet();+ final currentCollectionIds = currentCollections+ .map((collection) => collection.id)+ .toSet();final collectionsToAdd = result.selectedCollections.where((collection) => !currentCollectionIds.contains(collection.id),@@ -706,10 +690,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {if (addFutures.isEmpty) {await dialog.hide();widget.selectedFiles.clearAll();- showToast(- context,- context.l10n.noChangesWereMade,- );+ showToast(context, context.l10n.noChangesWereMade);return;}@@ -723,20 +704,12 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {widget.selectedFiles.clearAll();- showToast(- context,- context.l10n.fileUpdatedSuccessfully,- );+ showToast(context, context.l10n.fileUpdatedSuccessfully);} catch (e) {await dialog.hide();- _logger.severe(- 'Failed add-to operation: $e',- );+ _logger.severe('Failed add-to operation: $e');- await showGenericErrorBottomSheet(- context: context,- error: e,- );+ await showGenericErrorBottomSheet(context: context, error: e);}}}@@ -788,8 +761,8 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {await dialog.show();for (final file in ownedFiles) {- final collections =- await CollectionService.instance.getCollectionsForFile(file);+ final collections = await CollectionService.instance+ .getCollectionsForFile(file);if (collections.isNotEmpty) {await CollectionService.instance.trashFile(file, collections.first);@@ -800,10 +773,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {widget.selectedFiles.clearAll();- showToast(- context,- context.l10n.fileDeletedSuccessfully,- );+ showToast(context, context.l10n.fileDeletedSuccessfully);} catch (e, stackTrace) {await dialog.hide();@@ -815,10 +785,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {if (!context.mounted) {return;}- await showGenericErrorBottomSheet(- context: context,- error: e,- );+ await showGenericErrorBottomSheet(context: context, error: e);}}@@ -860,8 +827,8 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {Future<void> _restoreFiles(BuildContext context, List<EnteFile> files) async {_logger.info('Opening restore dialog for ${files.length} file(s)');- final allCollections =- await CollectionService.instance.getCollectionsForUI();+ final allCollections = await CollectionService.instance+ .getCollectionsForUI();final dedupedCollections = uniqueCollectionsById(allCollections);final result = await showAddToCollectionSheet(@@ -904,10 +871,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {_logger.severe('Failed to restore files: $e', e, stackTrace);if (context.mounted) {- await showGenericErrorBottomSheet(- context: context,- error: e,- );+ await showGenericErrorBottomSheet(context: context, error: e);}}}@@ -946,20 +910,14 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {widget.selectedFiles.clearAll();if (context.mounted) {- showToast(- context,- context.l10n.filesDeletedPermanently(files.length),- );+ showToast(context, context.l10n.filesDeletedPermanently(files.length));}} catch (e, stackTrace) {await dialog.hide();_logger.severe('Failed to delete files from trash: $e', e, stackTrace);if (context.mounted) {- await showGenericErrorBottomSheet(- context: context,- error: e,- );+ await showGenericErrorBottomSheet(context: context, error: e);}}}