Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Resolve merge conflicts and merge main

ashilkna86b6dddd412
diff --cc mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
index e30f017ae7,109418be60..f6978fd212
--- a/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
+++ b/mobile/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
@@@ -16,9 -17,9 +17,10 @@@ import "package:photos/gateways/cast_gw
import "package:photos/generated/l10n.dart";
import "package:photos/l10n/l10n.dart";
import 'package:photos/models/backup_status.dart';
+ import "package:photos/models/button_result.dart";
import 'package:photos/models/collection/collection.dart';
import 'package:photos/models/device_collection.dart';
+import "package:photos/models/file/file.dart";
import 'package:photos/models/gallery_type.dart';
import "package:photos/models/metadata/common_keys.dart";
import 'package:photos/models/selected_files.dart';
@@@ -40,9 -43,12 +44,13 @@@ import 'package:photos/ui/sharing/share
import 'package:photos/ui/tools/free_space_page.dart';
import "package:photos/ui/viewer/gallery/hooks/add_photos_sheet.dart";
import 'package:photos/ui/viewer/gallery/hooks/pick_cover_photo.dart';
+ import "package:photos/ui/viewer/gallery/state/inherited_search_filter_data.dart";
+ import "package:photos/ui/viewer/hierarchicial_search/applied_filters_for_appbar.dart";
+ import "package:photos/ui/viewer/hierarchicial_search/recommended_filters_for_appbar.dart";
+ import "package:photos/ui/viewer/location/edit_location_sheet.dart";
import 'package:photos/utils/data_util.dart';
import 'package:photos/utils/dialog_util.dart';
+import "package:photos/utils/file_download_util.dart";
import 'package:photos/utils/magic_util.dart';
import 'package:photos/utils/navigation_util.dart';
import 'package:photos/utils/toast_util.dart';
@@@ -88,9 -92,10 +96,11 @@@ enum AlbumPopupAction
pinAlbum,
removeLink,
cleanUncategorized,
+ downloadAlbum,
sortByMostRecent,
- sortByMostRelevant
+ sortByMostRelevant,
+ editLocation,
+ deleteLocation,
}
class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
@@@ -562,8 -610,10 +625,12 @@@
await showOnMap();
} else if (value == AlbumPopupAction.cleanUncategorized) {
await onCleanUncategorizedClick(context);
+ } else if (value == AlbumPopupAction.downloadAlbum) {
+ await _downloadPublicAlbumToGallery(widget.files!);
+ } else if (value == AlbumPopupAction.editLocation) {
+ editLocation();
+ } else if (value == AlbumPopupAction.deleteLocation) {
+ await deleteLocation();
} else {
showToast(context, S.of(context).somethingWentWrong);
}
@@@ -575,30 -625,24 +642,48 @@@
return actions;
}
+ Future<void> _downloadPublicAlbumToGallery(List<EnteFile>? files) async {
+ if (files == null || files.isEmpty) {
+ return;
+ }
+ final totalFiles = files.length;
+ final dialog = createProgressDialog(
+ context,
+ "Downloading... 0/$totalFiles",
+ isDismissible: true,
+ );
+ await dialog.show();
+
+ try {
+ for (var i = 0; i < files.length; i++) {
+ await downloadToGallery(files[i]);
+ dialog.update(message: "Downloading... ${i + 1}/$totalFiles");
+ }
+ } catch (e, s) {
+ _logger.severe("Failed to download album", e, s);
+ await showGenericErrorDialog(context: context, error: e);
+ }
+ await dialog.hide();
+ }
+
+ void editLocation() {
+ showEditLocationSheet(
+ context,
+ InheritedLocationScreenState.of(context).locationTagEntity,
+ );
+ }
+
+ Future<void> deleteLocation() async {
+ try {
+ await locationService.deleteLocationTag(
+ InheritedLocationScreenState.of(context).locationTagEntity.id,
+ );
+ Navigator.of(context).pop();
+ } catch (e) {
+ await showGenericErrorDialog(context: context, error: e);
+ }
+ }
+
Future<void> onCleanUncategorizedClick(BuildContext buildContext) async {
final actionResult = await showChoiceActionSheet(
context,