Skip to content

armgit / ente

Public Imported from GitHub
0

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

add support for editing location data of more than one file by selecting from gallery

ashilkn131a83afe6be
diff --git a/lib/models/gallery_type.dart b/lib/models/gallery_type.dart
index a90ba8f952..351b10ce0a 100644
--- a/lib/models/gallery_type.dart
+++ b/lib/models/gallery_type.dart
@@ -242,6 +242,10 @@ extension GalleyTypeExtension on GalleryType {
bool showRemoveFromHiddenAlbum() {
return this == GalleryType.hiddenOwnedCollection;
}
+
+ bool showEditLocation() {
+ return this != GalleryType.sharedCollection;
+ }
}
extension GalleryAppBarExtn on GalleryType {
diff --git a/lib/ui/viewer/actions/file_selection_actions_widget.dart b/lib/ui/viewer/actions/file_selection_actions_widget.dart
index dbbf5c4df7..18039ab0d8 100644
--- a/lib/ui/viewer/actions/file_selection_actions_widget.dart
+++ b/lib/ui/viewer/actions/file_selection_actions_widget.dart
@@ -1,6 +1,7 @@
import 'package:fast_base58/fast_base58.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import "package:modal_bottom_sheet/modal_bottom_sheet.dart";
import 'package:photos/core/configuration.dart';
import "package:photos/generated/l10n.dart";
import 'package:photos/models/collection/collection.dart';
@@ -13,6 +14,8 @@ import "package:photos/models/metadata/common_keys.dart";
import 'package:photos/models/selected_files.dart';
import 'package:photos/services/collections_service.dart';
import 'package:photos/services/hidden_service.dart';
+import "package:photos/theme/colors.dart";
+import "package:photos/theme/ente_theme.dart";
import 'package:photos/ui/actions/collection/collection_file_actions.dart';
import 'package:photos/ui/actions/collection/collection_sharing_actions.dart';
import 'package:photos/ui/collections/collection_action_sheet.dart';
@@ -22,6 +25,7 @@ import 'package:photos/ui/components/buttons/button_widget.dart';
import 'package:photos/ui/components/models/button_type.dart';
import 'package:photos/ui/sharing/manage_links_widget.dart';
import "package:photos/ui/tools/collage/collage_creator_page.dart";
+import "package:photos/ui/viewer/location/update_location_data_widget.dart";
import 'package:photos/utils/delete_file_util.dart';
import 'package:photos/utils/magic_util.dart';
import 'package:photos/utils/navigation_util.dart';
@@ -309,6 +313,36 @@ class _FileSelectionActionsWidgetState
);
}
+ if (widget.type.showEditLocation()) {
+ items.add(
+ SelectionActionButton(
+ shouldShow: widget.selectedFiles.files.any(
+ (element) => (element.fileType != FileType.video &&
+ element.ownerID == currentUserID),
+ ),
+ labelText: "Edit location",
+ icon: Icons.edit_location_alt_outlined,
+ onTap: () async {
+ await showBarModalBottomSheet(
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.vertical(
+ top: Radius.circular(5),
+ ),
+ ),
+ backgroundColor: getEnteColorScheme(context).backgroundElevated,
+ barrierColor: backdropFaintDark,
+ context: context,
+ builder: (context) {
+ return UpdateLocationDataWidget(
+ widget.selectedFiles.files.toList(),
+ );
+ },
+ );
+ },
+ ),
+ );
+ }
+
items.add(
SelectionActionButton(
icon: Icons.grid_view_outlined,
diff --git a/lib/ui/viewer/location/update_location_data_widget.dart b/lib/ui/viewer/location/update_location_data_widget.dart
index 1a33ceab18..7d53674855 100644
--- a/lib/ui/viewer/location/update_location_data_widget.dart
+++ b/lib/ui/viewer/location/update_location_data_widget.dart
@@ -75,7 +75,9 @@ class _UpdateLocationDataWidgetState extends State<UpdateLocationDataWidget> {
onPressed: () async {
await FilesService.instance
.bulkEditLocationData(widget.files, selectedLocation!);
+ Navigator.of(context).pop();
},
+
heroTag: 'add-location',
),
const SizedBox(height: 16),