Skip to content

armgit / ente

Public Imported from GitHub
0

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

Show iCloud shared album caveat only on iOS, deduplicate shared album query

ashilkn29c596b6faa8
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index 32c6370575..e3e6f0afd4 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -590,7 +590,8 @@
"backedUpFolders": "Backed up folders",
"backup": "Backup",
"freeUpDeviceSpace": "Free up device space",
- "freeUpDeviceSpaceDesc": "Save space on your device by clearing files that have already been backed up. Files in iCloud shared albums cannot be cleared.",
+ "freeUpDeviceSpaceDesc": "Save space on your device by clearing files that have already been backed up.",
+ "freeUpDeviceSpaceDescICloud": "Files in iCloud shared albums cannot be cleared.",
"allClear": "✨ All clear",
"noDeviceThatCanBeDeleted": "You've no files on this device that can be deleted",
"removeDuplicates": "Remove duplicates",
diff --git a/mobile/apps/photos/lib/services/files_service.dart b/mobile/apps/photos/lib/services/files_service.dart
index 4d20e2e98f..0f04a67f76 100644
--- a/mobile/apps/photos/lib/services/files_service.dart
+++ b/mobile/apps/photos/lib/services/files_service.dart
@@ -99,13 +99,11 @@ class FilesService {
return FreeableSpaceInfo(ids.localIDs, size);
}
- /// Returns local asset IDs that belong to iCloud shared albums on iOS.
- /// These assets cannot be deleted via PhotoManager and must be excluded
- /// from the free-up-space operation.
- Future<Set<String>> _getICloudSharedAlbumAssetIDs() async {
- if (!Platform.isIOS) return {};
-
- final paths = await PhotoManager.getAssetPathList(
+ /// Returns iCloud shared album paths on iOS.
+ /// Returns empty list on non-iOS platforms.
+ Future<List<AssetPathEntity>> _getICloudSharedAlbumPaths() async {
+ if (!Platform.isIOS) return [];
+ return PhotoManager.getAssetPathList(
hasAll: false,
type: RequestType.common,
pathFilterOption: const PMPathFilter(
@@ -115,7 +113,13 @@ class FilesService {
),
),
);
+ }
+ /// Returns local asset IDs that belong to iCloud shared albums on iOS.
+ /// These assets cannot be deleted via PhotoManager and must be excluded
+ /// from the free-up-space operation.
+ Future<Set<String>> _getICloudSharedAlbumAssetIDs() async {
+ final paths = await _getICloudSharedAlbumPaths();
final Set<String> sharedIDs = {};
for (final path in paths) {
final count = await path.assetCountAsync;
@@ -133,17 +137,7 @@ class FilesService {
/// Returns path IDs of iCloud shared albums on iOS.
/// Returns empty set on non-iOS platforms.
Future<Set<String>> getICloudSharedAlbumPathIDs() async {
- if (!Platform.isIOS) return {};
- final paths = await PhotoManager.getAssetPathList(
- hasAll: false,
- type: RequestType.common,
- pathFilterOption: const PMPathFilter(
- darwin: PMDarwinPathFilter(
- type: [PMDarwinAssetCollectionType.album],
- subType: [PMDarwinAssetCollectionSubtype.albumCloudShared],
- ),
- ),
- );
+ final paths = await _getICloudSharedAlbumPaths();
return paths.map((p) => p.id).toSet();
}
diff --git a/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart b/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart
index 7f30c417da..e9a963edd9 100644
--- a/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart
+++ b/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart
@@ -91,7 +91,10 @@ class _FreeUpSpaceOptionsScreenState extends State<FreeUpSpaceOptionsScreen> {
bottom: 16,
),
child: Text(
- AppLocalizations.of(context).freeUpDeviceSpaceDesc,
+ AppLocalizations.of(context).freeUpDeviceSpaceDesc +
+ (Platform.isIOS
+ ? " ${AppLocalizations.of(context).freeUpDeviceSpaceDescICloud}"
+ : ""),
style: textTheme.mini
.copyWith(color: colorScheme.textMuted),
),