Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob] Enable saving shared items for all users

Neeraj Guptaf348a81904dd
diff --git a/mobile/lib/models/gallery_type.dart b/mobile/lib/models/gallery_type.dart
index ba0eb397f7..40426f7015 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 0981eb767e..5b16bc70fb 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<EnteFile> filesToCopy;
late final List<EnteFile> 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 a630e3354a..e805927a64 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<void> _addToAlbum() async {
- if (split.ownedByOtherUsers.isNotEmpty && !_isInternalUser) {
- widget.selectedFiles
- .unSelectAll(split.ownedByOtherUsers.toSet(), skipNotify: true);
- }
showCollectionActionSheet(context, selectedFiles: widget.selectedFiles);
}