[mob] Enable shared item action (#1638)
## Description ## Tests Monkey tested locally
This commit is contained in:
commit
0a57f3f955
5 changed files with 6 additions and 25 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<EnteFile> filesToCopy;
|
||||
late final List<EnteFile> filesToAdd;
|
||||
(filesToAdd, filesToCopy) = (await _splitFilesToAddAndCopy(
|
||||
|
|
|
@ -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<void> _addToAlbum() async {
|
||||
if (split.ownedByOtherUsers.isNotEmpty && !_isInternalUser) {
|
||||
widget.selectedFiles
|
||||
.unSelectAll(split.ownedByOtherUsers.toSet(), skipNotify: true);
|
||||
}
|
||||
showCollectionActionSheet(context, selectedFiles: widget.selectedFiles);
|
||||
}
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
@ -12,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';
|
||||
|
@ -134,9 +132,7 @@ class FileAppBarState extends State<FileAppBar> {
|
|||
);
|
||||
}
|
||||
// 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) {
|
||||
|
|
|
@ -90,7 +90,6 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
|
|||
String? _appBarTitle;
|
||||
late CollectionActions collectionActions;
|
||||
bool isQuickLink = false;
|
||||
late bool isInternalUser;
|
||||
late GalleryType galleryType;
|
||||
|
||||
final ValueNotifier<int> castNotifier = ValueNotifier<int>(0);
|
||||
|
@ -101,7 +100,6 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
|
|||
_selectedFilesListener = () {
|
||||
setState(() {});
|
||||
};
|
||||
isInternalUser = flagService.internalUser;
|
||||
collectionActions = CollectionActions(CollectionsService.instance);
|
||||
widget.selectedFiles.addListener(_selectedFilesListener);
|
||||
_userAuthEventSubscription =
|
||||
|
@ -416,7 +414,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
|
|||
? Icons.visibility_outlined
|
||||
: Icons.visibility_off_outlined,
|
||||
),
|
||||
if (widget.collection != null && isInternalUser)
|
||||
if (widget.collection != null)
|
||||
EntePopupMenuItem(
|
||||
value: AlbumPopupAction.playOnTv,
|
||||
context.l10n.playOnTv,
|
||||
|
|
Loading…
Add table
Reference in a new issue