Explorar o código

Show critical warning while removing others file from album

Neeraj Gupta %!s(int64=2) %!d(string=hai) anos
pai
achega
eb4c449b58

+ 9 - 5
lib/ui/actions/collection/collection_file_actions.dart

@@ -16,13 +16,15 @@ extension CollectionFileActions on CollectionActions {
     BuildContext bContext,
     BuildContext bContext,
     Collection collection,
     Collection collection,
     SelectedFiles selectedFiles,
     SelectedFiles selectedFiles,
+    bool removingOthersFile,
   ) async {
   ) async {
     final actionResult = await showActionSheet(
     final actionResult = await showActionSheet(
       context: bContext,
       context: bContext,
       buttons: [
       buttons: [
         ButtonWidget(
         ButtonWidget(
-          labelText: "Yes, remove",
-          buttonType: ButtonType.neutral,
+          labelText: "Remove",
+          buttonType:
+              removingOthersFile ? ButtonType.critical : ButtonType.neutral,
           buttonSize: ButtonSize.large,
           buttonSize: ButtonSize.large,
           shouldStickToDarkTheme: true,
           shouldStickToDarkTheme: true,
           isInAlert: true,
           isInAlert: true,
@@ -48,9 +50,11 @@ extension CollectionFileActions on CollectionActions {
           isInAlert: true,
           isInAlert: true,
         ),
         ),
       ],
       ],
-      title: "Remove from album?",
-      body: "Selected items will be removed from this album. Items which are "
-          "only in this album will be moved to Uncategorized.",
+      title: removingOthersFile ? "Remove from album?" : null,
+      body: removingOthersFile
+          ? "Some of the items you are removing were "
+              "added by other people, and you will lose access to them"
+          : "Selected items will be removed from this album",
       actionSheetType: ActionSheetType.defaultActionSheet,
       actionSheetType: ActionSheetType.defaultActionSheet,
     );
     );
     if (actionResult != null && actionResult == ButtonAction.error) {
     if (actionResult != null && actionResult == ButtonAction.error) {

+ 3 - 0
lib/ui/viewer/actions/file_selection_actions_widget.dart

@@ -316,10 +316,13 @@ class _FileSelectionActionWidgetState extends State<FileSelectionActionWidget> {
       widget.selectedFiles
       widget.selectedFiles
           .unSelectAll(split.ownedByOtherUsers.toSet(), skipNotify: true);
           .unSelectAll(split.ownedByOtherUsers.toSet(), skipNotify: true);
     }
     }
+    final bool removingOthersFile =
+        isCollectionOwner && split.ownedByOtherUsers.isNotEmpty;
     await collectionActions.showRemoveFromCollectionSheetV2(
     await collectionActions.showRemoveFromCollectionSheetV2(
       context,
       context,
       widget.collection!,
       widget.collection!,
       widget.selectedFiles,
       widget.selectedFiles,
+      removingOthersFile,
     );
     );
   }
   }