Skip to content

armgit / ente

Public Imported from GitHub
0

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

Hide free up space option for iCloud shared albums

ashilkn63cadcb27f0a
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index b726327ec5..32c6370575 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -590,7 +590,7 @@
"backedUpFolders": "Backed up folders",
"backup": "Backup",
"freeUpDeviceSpace": "Free up device space",
- "freeUpDeviceSpaceDesc": "Save space on your device by clearing files that have been already backed up.",
+ "freeUpDeviceSpaceDesc": "Save space on your device by clearing files that have already been backed up. 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 29c4e28b28..4d20e2e98f 100644
--- a/mobile/apps/photos/lib/services/files_service.dart
+++ b/mobile/apps/photos/lib/services/files_service.dart
@@ -130,6 +130,23 @@ class FilesService {
return sharedIDs;
}
+ /// 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],
+ ),
+ ),
+ );
+ return paths.map((p) => p.id).toSet();
+ }
+
Future<int> _getFileSize(List<int> fileIDs) async {
try {
final response = await _enteDio.post(
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
index f63982132c..969581d8ce 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
@@ -124,6 +124,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
bool isQuickLink = false;
late GalleryType galleryType;
+ bool _isICloudSharedAlbum = false;
final ValueNotifier<int> castNotifier = ValueNotifier<int>(0);
@override
@@ -149,6 +150,21 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
_appBarTitle = widget.title;
galleryType = widget.type;
+ if (Platform.isIOS &&
+ widget.type == GalleryType.localFolder &&
+ widget.deviceCollection != null) {
+ _checkIfICloudSharedAlbum();
+ }
+ }
+
+ Future<void> _checkIfICloudSharedAlbum() async {
+ final sharedPathIDs =
+ await FilesService.instance.getICloudSharedAlbumPathIDs();
+ if (mounted && sharedPathIDs.contains(widget.deviceCollection!.id)) {
+ setState(() {
+ _isICloudSharedAlbum = true;
+ });
+ }
}
@override
@@ -640,7 +656,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
value: AlbumPopupAction.leave,
icon: Icons.logout,
),
- if (galleryType == GalleryType.localFolder)
+ if (galleryType == GalleryType.localFolder && !_isICloudSharedAlbum)
EntePopupMenuItem(
AppLocalizations.of(context).freeUpDeviceSpace,
value: AlbumPopupAction.freeUpSpace,