From ab33bc34a192085618f7ec1b2fff6120de96aa94 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Tue, 7 May 2024 10:36:22 +0530 Subject: [PATCH 1/4] [mob] Allow fav for shared items --- mobile/lib/ui/viewer/file/file_app_bar.dart | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mobile/lib/ui/viewer/file/file_app_bar.dart b/mobile/lib/ui/viewer/file/file_app_bar.dart index 2918924db..a6b413136 100644 --- a/mobile/lib/ui/viewer/file/file_app_bar.dart +++ b/mobile/lib/ui/viewer/file/file_app_bar.dart @@ -1,6 +1,5 @@ import 'dart:io'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:logging/logging.dart'; import 'package:media_extension/media_extension.dart'; @@ -134,9 +133,7 @@ class FileAppBarState extends State { ); } // only show fav option for files owned by the user - if ((isOwnedByUser || flagService.internalUser) && - !isFileHidden && - isFileUploaded) { + if (!isFileHidden && isFileUploaded) { _actions.add(FavoriteWidget(widget.file)); } if (!isFileUploaded) { From 20c2df773df3974a70234969e3a1e14707bf6c37 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Tue, 7 May 2024 10:39:12 +0530 Subject: [PATCH 2/4] [mob][cast] Enable cast for all --- mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart index 00b11e9dd..d2b7a6ec3 100644 --- a/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart +++ b/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart @@ -90,7 +90,6 @@ class _GalleryAppBarWidgetState extends State { String? _appBarTitle; late CollectionActions collectionActions; bool isQuickLink = false; - late bool isInternalUser; late GalleryType galleryType; final ValueNotifier castNotifier = ValueNotifier(0); @@ -101,7 +100,6 @@ class _GalleryAppBarWidgetState extends State { _selectedFilesListener = () { setState(() {}); }; - isInternalUser = flagService.internalUser; collectionActions = CollectionActions(CollectionsService.instance); widget.selectedFiles.addListener(_selectedFilesListener); _userAuthEventSubscription = @@ -416,7 +414,7 @@ class _GalleryAppBarWidgetState extends State { ? Icons.visibility_outlined : Icons.visibility_off_outlined, ), - if (widget.collection != null && isInternalUser) + if (widget.collection != null) EntePopupMenuItem( value: AlbumPopupAction.playOnTv, context.l10n.playOnTv, From f348a81904dd53a23af417eb2c0b1dcdf654aff8 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Tue, 7 May 2024 11:11:46 +0530 Subject: [PATCH 3/4] [mob] Enable saving shared items for all users --- mobile/lib/models/gallery_type.dart | 2 +- mobile/lib/services/collections_service.dart | 4 ---- .../actions/file_selection_actions_widget.dart | 15 +++------------ 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/mobile/lib/models/gallery_type.dart b/mobile/lib/models/gallery_type.dart index ba0eb397f..40426f701 100644 --- a/mobile/lib/models/gallery_type.dart +++ b/mobile/lib/models/gallery_type.dart @@ -32,12 +32,12 @@ extension GalleyTypeExtension on GalleryType { case GalleryType.locationTag: case GalleryType.quickLink: case GalleryType.uncategorized: + case GalleryType.sharedCollection: return true; case GalleryType.hiddenSection: case GalleryType.hiddenOwnedCollection: case GalleryType.trash: - case GalleryType.sharedCollection: return false; } } diff --git a/mobile/lib/services/collections_service.dart b/mobile/lib/services/collections_service.dart index 0981eb767..5b16bc70f 100644 --- a/mobile/lib/services/collections_service.dart +++ b/mobile/lib/services/collections_service.dart @@ -30,7 +30,6 @@ import 'package:photos/models/collection/collection_items.dart'; import 'package:photos/models/file/file.dart'; import "package:photos/models/files_split.dart"; import "package:photos/models/metadata/collection_magic.dart"; -import "package:photos/service_locator.dart"; import 'package:photos/services/app_lifecycle_service.dart'; import "package:photos/services/favorites_service.dart"; import 'package:photos/services/file_magic_service.dart'; @@ -1179,9 +1178,6 @@ class CollectionsService { await _addToCollection(dstCollectionID, splitResult.ownedByCurrentUser); } if (splitResult.ownedByOtherUsers.isNotEmpty) { - if (!flagService.internalUser) { - throw ArgumentError('Cannot add files owned by other users'); - } late final List filesToCopy; late final List filesToAdd; (filesToAdd, filesToCopy) = (await _splitFilesToAddAndCopy( diff --git a/mobile/lib/ui/viewer/actions/file_selection_actions_widget.dart b/mobile/lib/ui/viewer/actions/file_selection_actions_widget.dart index a630e3354..e805927a6 100644 --- a/mobile/lib/ui/viewer/actions/file_selection_actions_widget.dart +++ b/mobile/lib/ui/viewer/actions/file_selection_actions_widget.dart @@ -15,7 +15,6 @@ import 'package:photos/models/files_split.dart'; import 'package:photos/models/gallery_type.dart'; import "package:photos/models/metadata/common_keys.dart"; import 'package:photos/models/selected_files.dart'; -import "package:photos/service_locator.dart"; import 'package:photos/services/collections_service.dart'; import 'package:photos/services/hidden_service.dart'; import "package:photos/theme/colors.dart"; @@ -64,7 +63,6 @@ class _FileSelectionActionsWidgetState late FilesSplit split; late CollectionActions collectionActions; late bool isCollectionOwner; - bool _isInternalUser = false; // _cachedCollectionForSharedLink is primarily used to avoid creating duplicate // links if user keeps on creating Create link button after selecting @@ -102,7 +100,6 @@ class _FileSelectionActionsWidgetState @override Widget build(BuildContext context) { - _isInternalUser = flagService.internalUser; final ownedFilesCount = split.ownedByCurrentUser.length; final ownedAndPendingUploadFilesCount = ownedFilesCount + split.pendingUploads.length; @@ -150,14 +147,13 @@ class _FileSelectionActionsWidgetState final showUploadIcon = widget.type == GalleryType.localFolder && split.ownedByCurrentUser.isEmpty; - if (widget.type.showAddToAlbum() || - (_isInternalUser && widget.type == GalleryType.sharedCollection)) { + if (widget.type.showAddToAlbum()) { if (showUploadIcon) { items.add( SelectionActionButton( icon: Icons.cloud_upload_outlined, labelText: S.of(context).addToEnte, - onTap: (anyOwnedFiles || _isInternalUser) ? _addToAlbum : null, + onTap: _addToAlbum, ), ); } else { @@ -165,8 +161,7 @@ class _FileSelectionActionsWidgetState SelectionActionButton( icon: Icons.add_outlined, labelText: S.of(context).addToAlbum, - onTap: (anyOwnedFiles || _isInternalUser) ? _addToAlbum : null, - shouldShow: ownedAndPendingUploadFilesCount > 0 || _isInternalUser, + onTap: _addToAlbum, ), ); } @@ -450,10 +445,6 @@ class _FileSelectionActionsWidgetState } Future _addToAlbum() async { - if (split.ownedByOtherUsers.isNotEmpty && !_isInternalUser) { - widget.selectedFiles - .unSelectAll(split.ownedByOtherUsers.toSet(), skipNotify: true); - } showCollectionActionSheet(context, selectedFiles: widget.selectedFiles); } From 920f8fcd376eec167d39f25f6bc7503b2ab84293 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Tue, 7 May 2024 11:12:46 +0530 Subject: [PATCH 4/4] [mob] Remove unused import --- mobile/lib/ui/viewer/file/file_app_bar.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/mobile/lib/ui/viewer/file/file_app_bar.dart b/mobile/lib/ui/viewer/file/file_app_bar.dart index a6b413136..2f2c8d061 100644 --- a/mobile/lib/ui/viewer/file/file_app_bar.dart +++ b/mobile/lib/ui/viewer/file/file_app_bar.dart @@ -11,7 +11,6 @@ import 'package:photos/models/file/file_type.dart'; import 'package:photos/models/file/trash_file.dart'; import "package:photos/models/metadata/common_keys.dart"; import 'package:photos/models/selected_files.dart'; -import "package:photos/service_locator.dart"; import 'package:photos/services/collections_service.dart'; import 'package:photos/services/hidden_service.dart'; import 'package:photos/ui/collections/collection_action_sheet.dart';