Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][locker] Update offline icons and file item spacing (#10144)

Aman Raj5b2489d89dc6
diff --git a/mobile/apps/locker/assets/svg/cloud-download-cancel.svg b/mobile/apps/locker/assets/svg/cloud-download-cancel.svg
deleted file mode 100644
index a1f4ac37a7..0000000000
--- a/mobile/apps/locker/assets/svg/cloud-download-cancel.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-<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/assets/svg/cloud-download.svg b/mobile/apps/locker/assets/svg/cloud-download.svg
deleted file mode 100644
index 931385e400..0000000000
--- a/mobile/apps/locker/assets/svg/cloud-download.svg
+++ /dev/null
@@ -1,9 +0,0 @@
-<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
-<g id="cloud-download">
-<g id="elements">
-<path id="Vector" d="M17.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.4924 8.84606 17.5 8.67896 17.5 8.51009C17.5 5.46695 15.0376 3 12 3C9.12324 3 6.76233 5.21267 6.52042 8.03192M17.4776 9.01106C17.3753 10.1476 16.9286 11.1846 16.2428 12.0165M6.52042 8.03192C3.98398 8.27373 2 10.4139 2 13.0183C2 15.4417 3.71776 17.4632 6 17.9273M6.52042 8.03192C6.67826 8.01687 6.83823 8.00917 7 8.00917C8.12582 8.00917 9.16474 8.38194 10.0005 9.01101" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
-<path id="Vector_2" d="M12 19L12 11M12 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"/>
-</g>
-</svg>
diff --git a/mobile/apps/locker/assets/svg/cloud_only.svg b/mobile/apps/locker/assets/svg/cloud_only.svg
new file mode 100644
index 0000000000..74338fe0f0
--- /dev/null
+++ b/mobile/apps/locker/assets/svg/cloud_only.svg
@@ -0,0 +1,7 @@
+<svg width="20" height="22" viewBox="0 0 19.5 21.5" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <g id="elements">
+ <path id="Vector" d="M4.75001 1.1535C5.79953 0.750006 7.3317 0.750006 9.75001 0.750006C13.0498 0.750006 14.6998 0.750006 15.7249 1.77513C16.75 2.80026 16.75 4.45017 16.75 7.75001V13.75C16.75 14.2932 16.75 14.7917 16.7454 15.25M2.99931 3.25001C2.75001 4.27338 2.75001 5.69027 2.75001 7.75001V13.75C2.75001 17.0498 2.75001 18.6998 3.77513 19.7249C4.80026 20.75 6.45017 20.75 9.75001 20.75C13.0498 20.75 14.6998 20.75 15.7249 19.7249C16.1101 19.3396 16.3506 18.8661 16.5007 18.25" stroke="black" stroke-width="1.5" stroke-linecap="round"/>
+ <path id="Vector_2" d="M8.75001 17.75H10.75" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+ <path id="Vector_3" d="M0.750006 0.750006L18.75 20.75" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+ </g>
+</svg>
diff --git a/mobile/apps/locker/assets/svg/keep_offline.svg b/mobile/apps/locker/assets/svg/keep_offline.svg
new file mode 100644
index 0000000000..491634f7c1
--- /dev/null
+++ b/mobile/apps/locker/assets/svg/keep_offline.svg
@@ -0,0 +1,6 @@
+<svg width="16" height="22" viewBox="0 0 15.5 21.5" fill="none" xmlns="http://www.w3.org/2000/svg">
+ <g id="elements">
+ <path id="Vector" d="M0.750001 7.75C0.750001 4.45017 0.750001 2.80025 1.77513 1.77513C2.80025 0.750001 4.45017 0.750001 7.75 0.750001C11.0498 0.750001 12.6997 0.750001 13.7249 1.77513C14.75 2.80025 14.75 4.45017 14.75 7.75V13.75C14.75 17.0498 14.75 18.6997 13.7249 19.7249C12.6997 20.75 11.0498 20.75 7.75 20.75C4.45017 20.75 2.80025 20.75 1.77513 19.7249C0.750001 18.6997 0.750001 17.0498 0.750001 13.75V7.75Z" stroke="black" stroke-width="1.5" stroke-linecap="round"/>
+ <path id="Vector_2" d="M6.75 17.75H8.75" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
+ </g>
+</svg>
diff --git a/mobile/apps/locker/lib/l10n/app_en.arb b/mobile/apps/locker/lib/l10n/app_en.arb
index 6372d0a9f9..36cc091463 100644
--- a/mobile/apps/locker/lib/l10n/app_en.arb
+++ b/mobile/apps/locker/lib/l10n/app_en.arb
@@ -30,7 +30,7 @@
}
},
"keepOffline": "Keep offline",
- "cloudOnly": "Cloud only",
+ "cloudOnly": "Remove offline",
"savingOffline": "Saving offline...",
"filesAvailableOffline": "{count, plural, =1{1 file saved offline} other{{count} files saved offline}}",
"@filesAvailableOffline": {
diff --git a/mobile/apps/locker/lib/l10n/app_localizations.dart b/mobile/apps/locker/lib/l10n/app_localizations.dart
index 63efb8cb80..fe98df402a 100644
--- a/mobile/apps/locker/lib/l10n/app_localizations.dart
+++ b/mobile/apps/locker/lib/l10n/app_localizations.dart
@@ -279,7 +279,7 @@ abstract class AppLocalizations {
/// No description provided for @cloudOnly.
///
/// In en, this message translates to:
- /// **'Cloud only'**
+ /// **'Remove offline'**
String get cloudOnly;
/// No description provided for @savingOffline.
diff --git a/mobile/apps/locker/lib/l10n/app_localizations_en.dart b/mobile/apps/locker/lib/l10n/app_localizations_en.dart
index 49a7db60a3..c57e875436 100644
--- a/mobile/apps/locker/lib/l10n/app_localizations_en.dart
+++ b/mobile/apps/locker/lib/l10n/app_localizations_en.dart
@@ -79,7 +79,7 @@ class AppLocalizationsEn extends AppLocalizations {
String get keepOffline => 'Keep offline';
@override
- String get cloudOnly => 'Cloud only';
+ String get cloudOnly => 'Remove offline';
@override
String get savingOffline => 'Saving offline...';
diff --git a/mobile/apps/locker/lib/services/update_service.dart b/mobile/apps/locker/lib/services/update_service.dart
index afaa1f6b19..21def08f59 100644
--- a/mobile/apps/locker/lib/services/update_service.dart
+++ b/mobile/apps/locker/lib/services/update_service.dart
@@ -100,7 +100,11 @@ class UpdateService {
if (!_isInitialized) {
return false;
}
- final lastShownVersion = _prefs!.getInt(kChangeLogShownVersionKey) ?? 0;
+ final lastShownVersion = _prefs!.getInt(kChangeLogShownVersionKey);
+ if (lastShownVersion == null) {
+ await markChangeLogShown();
+ return false;
+ }
return lastShownVersion < currentChangeLogVersion;
}
diff --git a/mobile/apps/locker/lib/ui/components/file_list_widget.dart b/mobile/apps/locker/lib/ui/components/file_list_widget.dart
index 342583a256..c4d12a47eb 100644
--- a/mobile/apps/locker/lib/ui/components/file_list_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/file_list_widget.dart
@@ -58,18 +58,16 @@ class FileListWidget extends StatelessWidget {
child: Row(
children: [
SizedBox(
- height: 60,
- width: 60,
+ height: 40,
+ width: 40,
child: Stack(
+ clipBehavior: Clip.none,
children: [
- Padding(
- padding: const EdgeInsets.all(10.0),
- child: _buildFileIcon(),
- ),
+ _buildFileIcon(),
if (showSharingIndicator)
Positioned(
- right: 1,
- bottom: 10,
+ right: -4,
+ bottom: -4,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
@@ -128,6 +126,7 @@ class FileListWidget extends StatelessWidget {
return AnimatedContainer(
duration: const Duration(milliseconds: 200),
curve: Curves.easeOut,
+ padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
border: Border.all(
color: isSelected
@@ -139,34 +138,33 @@ class FileListWidget extends StatelessWidget {
borderRadius: const BorderRadius.all(Radius.circular(20)),
),
child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
fileRowWidget,
- Padding(
- padding: const EdgeInsets.only(right: 12.0),
- child: SizedBox(
- width: 24,
- height: 24,
- child: AnimatedSwitcher(
- duration: const Duration(milliseconds: 300),
- switchInCurve: Curves.easeOut,
- switchOutCurve: Curves.easeIn,
- layoutBuilder: (currentChild, previousChildren) {
- return Stack(
- alignment: Alignment.centerRight,
- children: [
- ...previousChildren,
- if (currentChild != null) currentChild,
- ],
- );
- },
- child: _buildTrailingIndicator(
- primaryColor: colorScheme.primary700,
- isSelected: isSelected,
- isIncoming: isIncoming,
- isMarkedOffline: !isTrashFile && isMarkedOffline,
- owner: collection?.owner,
- ),
+ const SizedBox(width: 12),
+ SizedBox(
+ width: 24,
+ height: 24,
+ child: AnimatedSwitcher(
+ duration: const Duration(milliseconds: 300),
+ switchInCurve: Curves.easeOut,
+ switchOutCurve: Curves.easeIn,
+ layoutBuilder: (currentChild, previousChildren) {
+ return Stack(
+ alignment: Alignment.centerRight,
+ children: [
+ ...previousChildren,
+ if (currentChild != null) currentChild,
+ ],
+ );
+ },
+ child: _buildTrailingIndicator(
+ color: isSelected
+ ? colorScheme.primary700
+ : colorScheme.textMuted,
+ isSelected: isSelected,
+ isIncoming: isIncoming,
+ isMarkedOffline: !isTrashFile && isMarkedOffline,
+ owner: collection?.owner,
),
),
),
@@ -209,7 +207,7 @@ class FileListWidget extends StatelessWidget {
}
Widget _buildTrailingIndicator({
- required Color primaryColor,
+ required Color color,
required bool isSelected,
required bool isIncoming,
required bool isMarkedOffline,
@@ -219,18 +217,18 @@ class FileListWidget extends StatelessWidget {
return Icon(
key: const ValueKey("selected"),
Icons.check_circle_rounded,
- color: primaryColor,
+ color: color,
size: 24,
);
}
if (isMarkedOffline) {
return SvgPicture.asset(
- "assets/svg/cloud-download.svg",
+ "assets/svg/keep_offline.svg",
key: const ValueKey("offline"),
width: 20.0,
height: 20.0,
- colorFilter: ColorFilter.mode(primaryColor, BlendMode.srcIn),
+ colorFilter: ColorFilter.mode(color, BlendMode.srcIn),
);
}
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.dart
index 5248d2739d..e1be58bd7e 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,9 +62,8 @@ 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) {
@@ -183,9 +182,10 @@ 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;
@@ -239,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: () {
@@ -342,8 +342,7 @@ 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);
@@ -357,8 +356,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
final actions = <Widget>[];
if (showOffline && eligibleOfflineFiles.isNotEmpty) {
- final shouldRemoveOffline =
- isSingleSelection &&
+ final shouldRemoveOffline = isSingleSelection &&
eligibleOfflineFiles.length == 1 &&
LockerDB.instance.isFileMarkedOffline(eligibleOfflineFiles.first);
@@ -366,10 +364,10 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
SelectionActionButton(
hugeIcon: SvgPicture.asset(
shouldRemoveOffline
- ? "assets/svg/cloud-download-cancel.svg"
- : "assets/svg/cloud-download.svg",
- width: 24,
- height: 24,
+ ? "assets/svg/cloud_only.svg"
+ : "assets/svg/keep_offline.svg",
+ width: 22,
+ height: 22,
colorFilter: ColorFilter.mode(
colorScheme.textBase,
BlendMode.srcIn,
@@ -397,9 +395,8 @@ 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),
@@ -620,8 +617,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) '
@@ -656,8 +653,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}',
@@ -665,9 +662,8 @@ 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),
@@ -761,8 +757,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);
@@ -827,8 +823,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(
diff --git a/mobile/apps/locker/pubspec.yaml b/mobile/apps/locker/pubspec.yaml
index 0c509f654e..d777ef5966 100644
--- a/mobile/apps/locker/pubspec.yaml
+++ b/mobile/apps/locker/pubspec.yaml
@@ -1,7 +1,7 @@
name: locker
description: "Ente Locker – Safe space for your important documents"
publish_to: "none"
-version: 1.0.2+98
+version: 1.0.2+99
environment:
sdk: ">=3.0.0 <4.0.0"