π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Support hiding incoming shared albums
ashilkn66bfe76c262c
diff --git a/mobile/apps/photos/lib/models/collection/collection.dart b/mobile/apps/photos/lib/models/collection/collection.dartindex 653e1264dd..aa67c6ddfb 100644--- a/mobile/apps/photos/lib/models/collection/collection.dart+++ b/mobile/apps/photos/lib/models/collection/collection.dart@@ -105,6 +105,11 @@ class Collection {sharedMagicMetadata.visibility == archiveVisibility;}+ bool hasShareeHidden() {+ return sharedMmdVersion > 0 &&+ sharedMagicMetadata.visibility == hiddenVisibility;+ }+bool hasShareePinned() {return (sharedMagicMetadata.order ?? 0) != 0;}@@ -124,7 +129,14 @@ class Collection {if (isDefaultHidden()) {return true;}- return mMdVersion > 0 && (magicMetadata.visibility == hiddenVisibility);+ final userID = Configuration.instance.getUserID();+ if (userID != null && isOwner(userID)) {+ // Owner: check owner's magic metadata+ return mMdVersion > 0 && magicMetadata.visibility == hiddenVisibility;+ } else {+ // Sharee: check sharee's magic metadata+ return hasShareeHidden();+ }}bool isDefaultHidden() {diff --git a/mobile/apps/photos/lib/services/collections_service.dart b/mobile/apps/photos/lib/services/collections_service.dartindex c57272bbb0..3dbdd0a292 100644--- a/mobile/apps/photos/lib/services/collections_service.dart+++ b/mobile/apps/photos/lib/services/collections_service.dart@@ -330,15 +330,12 @@ class CollectionsService {List<Collection> getHiddenCollections({bool includeDefaultHidden = true}) {if (includeDefaultHidden) {return _collectionIDToCollections.values- .toList()- .where((element) => element.isHidden())+ .where((c) => c.isHidden()).toList();} else {return _collectionIDToCollections.values- .toList().where(- (element) => (element.isHidden() &&- element.id != cachedDefaultHiddenCollection?.id),+ (c) => c.isHidden() && c.id != cachedDefaultHiddenCollection?.id,).toList();}@@ -346,20 +343,15 @@ class CollectionsService {Set<int> getHiddenCollectionIds() {return _collectionIDToCollections.values- .toList()- .where((element) => element.isHidden())+ .where((c) => c.isHidden()).map((e) => e.id).toSet();}Set<int> archivedOrHiddenCollectionIds() {return _collectionIDToCollections.values- .toList().where(- (element) =>- element.hasShareeArchived() ||- element.isHidden() ||- element.isArchived(),+ (c) => c.hasShareeArchived() || c.isHidden() || c.isArchived(),).map((e) => e.id).toSet();diff --git a/mobile/apps/photos/lib/ui/components/menu_item_widget/menu_item_child_widgets.dart b/mobile/apps/photos/lib/ui/components/menu_item_widget/menu_item_child_widgets.dartindex 22c5b1afb0..939ae1108c 100644--- a/mobile/apps/photos/lib/ui/components/menu_item_widget/menu_item_child_widgets.dart+++ b/mobile/apps/photos/lib/ui/components/menu_item_widget/menu_item_child_widgets.dart@@ -46,7 +46,8 @@ class _TrailingWidgetState extends State<TrailingWidget> {if (oldWidget.showExecutionStates && !widget.showExecutionStates) {// Was true, now false: remove listener and reset to iconif (_listenerAdded) {- oldWidget.executionStateNotifier.removeListener(_executionStateListener);+ oldWidget.executionStateNotifier+ .removeListener(_executionStateListener);_listenerAdded = false;}_setTrailingIcon();diff --git a/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart b/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dartindex 6ef3dd2792..d9ce7be85c 100644--- a/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart+++ b/mobile/apps/photos/lib/ui/growth/apply_code_sheet.dart@@ -162,7 +162,8 @@ class _ApplyCodeContentState extends State<_ApplyCodeContent> {Text(_errorMessage ?? AppLocalizations.of(context).enterCodeDescription,style: textTheme.mini.copyWith(- color: _errorMessage != null ? warningRedColor : colorScheme.textMuted,+ color:+ _errorMessage != null ? warningRedColor : colorScheme.textMuted,),),const SizedBox(height: 20),diff --git a/mobile/apps/photos/lib/ui/growth/change_referral_code_sheet.dart b/mobile/apps/photos/lib/ui/growth/change_referral_code_sheet.dartindex f04af954a6..f752c12dda 100644--- a/mobile/apps/photos/lib/ui/growth/change_referral_code_sheet.dart+++ b/mobile/apps/photos/lib/ui/growth/change_referral_code_sheet.dart@@ -89,7 +89,8 @@ class _ChangeReferralCodeContentStateif (e is DioException) {if (e.response?.statusCode == 400) {setState(() {- _errorMessage = AppLocalizations.of(context).unavailableReferralCode;+ _errorMessage =+ AppLocalizations.of(context).unavailableReferralCode;});} else if (e.response?.statusCode == 429) {setState(() {diff --git a/mobile/apps/photos/lib/ui/growth/referral_code_widget.dart b/mobile/apps/photos/lib/ui/growth/referral_code_widget.dartindex 510558de07..ed899759e8 100644--- a/mobile/apps/photos/lib/ui/growth/referral_code_widget.dart+++ b/mobile/apps/photos/lib/ui/growth/referral_code_widget.dart@@ -80,8 +80,8 @@ class ReferralCodeWidget extends StatelessWidget {showInfoDialog(context,title: AppLocalizations.of(context).error,- body:- AppLocalizations.of(context).onlyFamilyAdminCanChangeCode(+ body: AppLocalizations.of(context)+ .onlyFamilyAdminCanChangeCode(familyAdminEmail: familyAdmin,),icon: Icons.error,diff --git a/mobile/apps/photos/lib/ui/growth/referral_screen.dart b/mobile/apps/photos/lib/ui/growth/referral_screen.dartindex 6f09707ad7..93f5de214d 100644--- a/mobile/apps/photos/lib/ui/growth/referral_screen.dart+++ b/mobile/apps/photos/lib/ui/growth/referral_screen.dart@@ -210,9 +210,10 @@ class ReferralWidget extends StatelessWidget {),const SizedBox(height: 12),Text(- AppLocalizations.of(context).referralsAreCurrentlyPaused,- style:- textTheme.small.copyWith(color: colorScheme.textFaint),+ AppLocalizations.of(context)+ .referralsAreCurrentlyPaused,+ style: textTheme.small+ .copyWith(color: colorScheme.textFaint),),],),diff --git a/mobile/apps/photos/lib/ui/growth/storage_details_screen.dart b/mobile/apps/photos/lib/ui/growth/storage_details_screen.dartindex 0dd9fd30d1..11b2b1b984 100644--- a/mobile/apps/photos/lib/ui/growth/storage_details_screen.dart+++ b/mobile/apps/photos/lib/ui/growth/storage_details_screen.dart@@ -121,8 +121,8 @@ class _StorageDetailsScreenState extends State<StorageDetailsScreen> {Expanded(child: _StatCard(value: data.refCount.toString(),- label: AppLocalizations.of(context)- .usedYourCode,+ label:+ AppLocalizations.of(context).usedYourCode,cardColor: cardColor,),),@@ -130,8 +130,7 @@ class _StorageDetailsScreenState extends State<StorageDetailsScreen> {Expanded(child: _StatCard(value: data.refUpgradeCount.toString(),- label:- AppLocalizations.of(context).eligible,+ label: AppLocalizations.of(context).eligible,cardColor: cardColor,),),@@ -145,8 +144,8 @@ class _StorageDetailsScreenState extends State<StorageDetailsScreen> {Expanded(child: _StatCard(value: "1",- label: AppLocalizations.of(context)- .claimedByYou,+ label:+ AppLocalizations.of(context).claimedByYou,cardColor: cardColor,),),diff --git a/mobile/apps/photos/lib/ui/settings/debug/debug_settings_page.dart b/mobile/apps/photos/lib/ui/settings/debug/debug_settings_page.dartindex be7ca3e9e9..b7153552b2 100644--- a/mobile/apps/photos/lib/ui/settings/debug/debug_settings_page.dart+++ b/mobile/apps/photos/lib/ui/settings/debug/debug_settings_page.dart@@ -143,8 +143,7 @@ class _DebugSettingsPageState extends State<DebugSettingsPage> {value: () =>localSettings.isChristmasBannerEnabled,onChanged: () async {- await localSettings- .setChristmasBannerEnabled(+ await localSettings.setChristmasBannerEnabled(!localSettings.isChristmasBannerEnabled,);Bus.instance.fire(ChristmasBannerEvent());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.dartindex 58ae9cc8f6..21f5f413eb 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@@ -94,6 +94,7 @@ enum AlbumPopupAction {ownedArchive,sharedArchive,ownedHide,+ sharedHide,playOnTv,autoAddPhotos,sort,@@ -622,6 +623,16 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {? Icons.unarchive: Icons.archive_outlined,),+ if (galleryType == GalleryType.sharedCollection)+ EntePopupMenuItem(+ widget.collection!.hasShareeHidden()+ ? AppLocalizations.of(context).unhide+ : AppLocalizations.of(context).hide,+ value: AlbumPopupAction.sharedHide,+ icon: widget.collection!.hasShareeHidden()+ ? Icons.visibility_outlined+ : Icons.visibility_off_outlined,+ ),if (galleryType == GalleryType.sharedCollection)EntePopupMenuItem(AppLocalizations.of(context).leaveAlbum,@@ -704,6 +715,23 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {final int newVisiblity =hasShareeArchived ? visibleVisibility : archiveVisibility;+ await changeCollectionVisibility(+ context,+ collection: widget.collection!,+ newVisibility: newVisiblity,+ prevVisibility: prevVisiblity,+ isOwner: false,+ );+ if (mounted) {+ setState(() {});+ }+ } else if (value == AlbumPopupAction.sharedHide) {+ final hasShareeHidden = widget.collection!.hasShareeHidden();+ final int prevVisiblity =+ hasShareeHidden ? hiddenVisibility : visibleVisibility;+ final int newVisiblity =+ hasShareeHidden ? visibleVisibility : hiddenVisibility;+await changeCollectionVisibility(context,collection: widget.collection!,