Skip to content

armgit / ente

Public Imported from GitHub
0

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

remove flag and add group setting

AmanRajSinghMourya32fc26dc219a
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart
index 8b69633ff7..6287ccc9fc 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/album_selection_action_widget.dart
@@ -6,8 +6,10 @@ import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
import "package:logging/logging.dart";
import "package:photos/core/configuration.dart";
+import "package:photos/core/constants.dart";
import "package:photos/db/files_db.dart";
import "package:photos/models/collection/collection.dart";
+import "package:photos/models/file/file.dart";
import "package:photos/models/metadata/common_keys.dart";
import "package:photos/models/selected_albums.dart";
import "package:photos/service_locator.dart";
@@ -20,6 +22,7 @@ import "package:photos/ui/components/buttons/button_widget.dart";
import "package:photos/ui/components/models/button_type.dart";
import "package:photos/ui/notification/toast.dart";
import "package:photos/ui/sharing/add_participant_page.dart";
+import "package:photos/ui/viewer/album_slideshow/album_slideshow.dart";
import "package:photos/utils/dialog_util.dart";
import "package:photos/utils/magic_util.dart";
@@ -71,9 +74,11 @@ class _AlbumSelectionActionWidgetState
final hasUnpinnedAlbum = widget.selectedAlbums.albums.any(
(album) => !album.isPinned,
);
+ final isOwnedCollectionSection =
+ widget.sectionType == UISectionType.homeCollections ||
+ widget.sectionType == UISectionType.outgoingCollections;
- if (widget.sectionType == UISectionType.homeCollections ||
- widget.sectionType == UISectionType.outgoingCollections) {
+ if (isOwnedCollectionSection) {
items.add(
SelectionActionButton(
labelText: context.strings.share,
@@ -83,6 +88,17 @@ class _AlbumSelectionActionWidgetState
onTap: _shareCollection,
),
);
+ }
+
+ items.add(
+ SelectionActionButton(
+ labelText: context.strings.slideshow,
+ hugeIcon: HugeIcons.strokeRoundedPresentation03,
+ onTap: _startAlbumSlideshow,
+ ),
+ );
+
+ if (isOwnedCollectionSection) {
items.add(
SelectionActionButton(
labelText: context.strings.pin,
@@ -249,6 +265,39 @@ class _AlbumSelectionActionWidgetState
widget.selectedAlbums.clearAll();
}
+ Future<void> _startAlbumSlideshow() async {
+ final albums = widget.selectedAlbums.albums.toList(growable: false);
+ final dialog = createProgressDialog(context, context.strings.pleaseWait);
+ await dialog.show();
+
+ final files = <EnteFile>[];
+ try {
+ for (final album in albums) {
+ final fileResult = await FilesDB.instance.getFilesInCollection(
+ album.id,
+ galleryLoadStartTime,
+ galleryLoadEndTime,
+ asc: album.pubMagicMetadata.asc ?? false,
+ );
+ files.addAll(fileResult.files);
+ }
+ } finally {
+ await dialog.hide();
+ }
+ if (!mounted) return;
+
+ final opened = await showAlbumSlideshow(
+ context,
+ files: files,
+ title: albums.length == 1
+ ? albums.single.displayName
+ : context.strings.slideshow,
+ );
+ if (opened && mounted) {
+ widget.selectedAlbums.clearAll();
+ }
+ }
+
Future<void> _trashCollection() async {
int count = 0;
final List<Collection> nonEmptyCollection = [];
diff --git a/mobile/apps/photos/lib/ui/viewer/album_slideshow/album_slideshow.dart b/mobile/apps/photos/lib/ui/viewer/album_slideshow/album_slideshow.dart
new file mode 100644
index 0000000000..ce36267d4e
--- /dev/null
+++ b/mobile/apps/photos/lib/ui/viewer/album_slideshow/album_slideshow.dart
@@ -0,0 +1,53 @@
+import "package:ente_pure_utils/ente_pure_utils.dart";
+import "package:ente_strings/ente_strings.dart";
+import "package:flutter/material.dart";
+import "package:photos/models/file/file.dart";
+import "package:photos/models/file/file_type.dart";
+import "package:photos/services/ignored_files_service.dart";
+import "package:photos/ui/notification/toast.dart";
+import "package:photos/ui/viewer/album_slideshow/album_slideshow_page.dart";
+
+Future<bool> showAlbumSlideshow(
+ BuildContext context, {
+ required Iterable<EnteFile> files,
+ required String title,
+}) async {
+ final ignoredIDs = await IgnoredFilesService.instance.idToIgnoreReasonMap;
+ if (!context.mounted) return false;
+
+ final uploadedFileIDs = <int>{};
+ final localFileIDs = <String>{};
+ final slideshowFiles = <EnteFile>[];
+ for (final file in files) {
+ if (file.fileType != FileType.image &&
+ file.fileType != FileType.livePhoto) {
+ continue;
+ }
+
+ final uploadedFileID = file.uploadedFileID;
+ if (uploadedFileID == null &&
+ IgnoredFilesService.instance.shouldSkipUpload(ignoredIDs, file)) {
+ continue;
+ }
+
+ if (uploadedFileID != null) {
+ if (!uploadedFileIDs.add(uploadedFileID)) continue;
+ } else {
+ final localFileID = file.localID;
+ if (localFileID != null && !localFileIDs.add(localFileID)) continue;
+ }
+ slideshowFiles.add(file);
+ }
+
+ if (slideshowFiles.isEmpty) {
+ showToast(context, context.strings.noPhotosFoundHere);
+ return false;
+ }
+
+ await routeToPage(
+ context,
+ AlbumSlideshowPage(files: slideshowFiles, title: title),
+ forceCustomPageRoute: true,
+ );
+ return true;
+}
diff --git a/mobile/apps/photos/lib/ui/viewer/album_slideshow/album_slideshow_page.dart b/mobile/apps/photos/lib/ui/viewer/album_slideshow/album_slideshow_page.dart
index 6002eed4c0..c2a57fc978 100644
--- a/mobile/apps/photos/lib/ui/viewer/album_slideshow/album_slideshow_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/album_slideshow/album_slideshow_page.dart
@@ -24,18 +24,14 @@ import "package:photos/ui/viewer/file/thumbnail_widget.dart";
const _albumSlideshowDurationOptions = [5, 10, 15, 30];
class AlbumSlideshowPage extends StatefulWidget {
- AlbumSlideshowPage({
- required this.files,
- required this.albumName,
- super.key,
- }) {
+ AlbumSlideshowPage({required this.files, required this.title, super.key}) {
if (files.isEmpty) {
throw ArgumentError("files must not be empty");
}
}
final List<EnteFile> files;
- final String albumName;
+ final String title;
@override
State<AlbumSlideshowPage> createState() => _AlbumSlideshowPageState();
@@ -500,7 +496,7 @@ class _AlbumSlideshowPageState extends State<AlbumSlideshowPage>
const SizedBox(width: Spacing.sm),
Expanded(
child: Text(
- widget.albumName,
+ widget.title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyles.display3.copyWith(
@@ -513,9 +509,7 @@ class _AlbumSlideshowPageState extends State<AlbumSlideshowPage>
child: Align(
alignment: Alignment.centerRight,
child: IconButtonComponent(
- tooltip: pendingTranslation(
- "Slideshow settings",
- ),
+ tooltip: context.strings.slideshowSettings,
variant: IconButtonComponentVariant.unfilled,
shouldSurfaceExecutionStates: false,
size: 48,
@@ -615,7 +609,7 @@ class _AlbumSlideshowSettingsSheetState
Widget build(BuildContext context) {
final colors = context.componentColors;
return BottomSheetComponent(
- title: pendingTranslation("Slideshow settings"),
+ title: context.strings.slideshowSettings,
closeTooltip: context.strings.close,
isScrollable: true,
content: Column(
@@ -623,7 +617,7 @@ class _AlbumSlideshowSettingsSheetState
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- pendingTranslation("Slide duration"),
+ context.strings.timePerPhoto,
style: TextStyles.bodyBold.copyWith(color: colors.textBase),
),
const SizedBox(height: Spacing.sm),
@@ -633,7 +627,7 @@ class _AlbumSlideshowSettingsSheetState
children: [
for (final seconds in _albumSlideshowDurationOptions)
_buildChip(
- label: pendingTranslation("$seconds sec"),
+ label: context.strings.secondsCount(count: seconds),
selected: seconds == _durationSeconds,
onTap: () {
if (seconds == _durationSeconds) return;
@@ -645,7 +639,7 @@ class _AlbumSlideshowSettingsSheetState
),
const SizedBox(height: Spacing.xl),
Text(
- pendingTranslation("Order"),
+ context.strings.photoOrder,
style: TextStyles.bodyBold.copyWith(color: colors.textBase),
),
const SizedBox(height: Spacing.sm),
@@ -654,12 +648,12 @@ class _AlbumSlideshowSettingsSheetState
runSpacing: Spacing.md,
children: [
_buildChip(
- label: pendingTranslation("In order"),
+ label: context.strings.inOrder,
selected: !_randomOrder,
onTap: () => _setRandomOrder(false),
),
_buildChip(
- label: pendingTranslation("Random"),
+ label: context.strings.shuffle,
selected: _randomOrder,
onTap: () => _setRandomOrder(true),
),
@@ -667,7 +661,7 @@ class _AlbumSlideshowSettingsSheetState
),
const SizedBox(height: Spacing.xl),
Text(
- pendingTranslation("Background"),
+ context.strings.background,
style: TextStyles.bodyBold.copyWith(color: colors.textBase),
),
const SizedBox(height: Spacing.sm),
@@ -676,12 +670,12 @@ class _AlbumSlideshowSettingsSheetState
runSpacing: Spacing.md,
children: [
_buildChip(
- label: pendingTranslation("Blurred"),
+ label: context.strings.blurred,
selected: _blurred,
onTap: () => _setBlurred(true),
),
_buildChip(
- label: pendingTranslation("Black"),
+ label: context.strings.black,
selected: !_blurred,
onTap: () => _setBlurred(false),
),
@@ -698,7 +692,7 @@ class _AlbumSlideshowSettingsSheetState
required VoidCallback onTap,
}) {
return AnimatedSize(
- duration: Motion.standard,
+ duration: Motion.slow,
curve: Curves.easeInOutCubic,
alignment: Alignment.centerLeft,
child: FilterChipComponent(
@@ -707,7 +701,7 @@ class _AlbumSlideshowSettingsSheetState
? FilterChipComponentState.selected
: FilterChipComponentState.unselected,
trailing: selected
- ? const HugeIcon(icon: HugeIcons.strokeRoundedTick02, size: 12)
+ ? const HugeIcon(icon: HugeIcons.strokeRoundedTick02, size: 18)
: null,
onChanged: (_) => onTap(),
),
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
index e2032a021f..d3201edb44 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
@@ -19,7 +19,6 @@ import 'package:photos/events/subscription_purchased_event.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/file/file_type.dart";
import 'package:photos/models/freeable_space_info.dart';
import 'package:photos/models/gallery_type.dart';
import "package:photos/models/metadata/common_keys.dart";
@@ -28,7 +27,6 @@ import 'package:photos/module/download/gallery.dart';
import 'package:photos/service_locator.dart';
import 'package:photos/services/collections_service.dart';
import "package:photos/services/files_service.dart";
-import "package:photos/services/ignored_files_service.dart";
import "package:photos/services/review_service.dart";
import "package:photos/states/location_screen_state.dart";
import "package:photos/theme/ente_theme.dart";
@@ -46,7 +44,7 @@ import 'package:photos/ui/sharing/album_participants_page.dart';
import "package:photos/ui/sharing/manage_links_widget.dart";
import 'package:photos/ui/sharing/share_collection_page.dart';
import 'package:photos/ui/tools/free_space_page.dart';
-import "package:photos/ui/viewer/album_slideshow/album_slideshow_page.dart";
+import "package:photos/ui/viewer/album_slideshow/album_slideshow.dart";
import "package:photos/ui/viewer/file/detail_page.dart";
import "package:photos/ui/viewer/gallery/component/album_description_header.dart";
import "package:photos/ui/viewer/gallery/gallery_app_bar_actions.dart";
@@ -827,7 +825,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
if (_isAlbumSlideshowAvailable)
_menuOption(
AlbumPopupAction.albumSlideshow,
- pendingTranslation("(i) Slideshow"),
+ strings.slideshow,
galleryAppBarMenuIcon(
HugeIcons.strokeRoundedPresentation03,
iconColor,
@@ -923,8 +921,7 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
_isDeviceFolderBackedUp &&
widget.onDisableDeviceFolderBackup != null;
- bool get _isAlbumSlideshowAvailable =>
- flagService.internalUser && widget.collection != null;
+ bool get _isAlbumSlideshowAvailable => widget.collection != null;
EntePopupMenuOption<AlbumPopupAction> _menuOption(
AlbumPopupAction value,
@@ -990,32 +987,10 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
return;
}
- final ignoredIDs = await IgnoredFilesService.instance.idToIgnoreReasonMap;
- if (!mounted) return;
- final imageFiles = galleryFiles
- .where(
- (file) =>
- (file.uploadedFileID != null ||
- !IgnoredFilesService.instance.shouldSkipUpload(
- ignoredIDs,
- file,
- )) &&
- (file.fileType == FileType.image ||
- file.fileType == FileType.livePhoto),
- )
- .toList(growable: false);
- if (imageFiles.isEmpty) {
- showToast(context, context.strings.noPhotosFoundHere);
- return;
- }
-
- await routeToPage(
+ await showAlbumSlideshow(
context,
- AlbumSlideshowPage(
- files: imageFiles,
- albumName: widget.collection!.displayName,
- ),
- forceCustomPageRoute: true,
+ files: galleryFiles,
+ title: widget.collection!.displayName,
);
}
diff --git a/mobile/packages/strings/lib/l10n/arb/strings_en.arb b/mobile/packages/strings/lib/l10n/arb/strings_en.arb
index 0188ec711b..3643ab4676 100644
--- a/mobile/packages/strings/lib/l10n/arb/strings_en.arb
+++ b/mobile/packages/strings/lib/l10n/arb/strings_en.arb
@@ -514,8 +514,10 @@
"birthday": "Birthday",
"birthdayJoy": "Birthday joy",
"birthdays": "Birthdays",
+ "black": "Black",
"blockLegacyKitRecoveryMessage": "Block the current recovery attempt\nNote that they can start a new recovery attempt",
"blog": "Blog",
+ "blurred": "Blurred",
"bothIssuerAndAccountCanNotBeEmpty": "Both issuer and account can not be empty",
"bringYourFamilyAlong": "Bring your family along",
"browseHelpPages": "Browse help pages",
@@ -2005,6 +2007,7 @@
"informationTypes": "Information types",
"informationTypesDesc": "Documents, notes, cards, passwords, and other item types",
"initialBackupCreated": "Initial backup created!",
+ "inOrder": "In order",
"insecureDevice": "Insecure device",
"@insecureDevice": {
"description": "Insecure device warning title"
@@ -2949,6 +2952,7 @@
"photoGridSize": "Photo grid size",
"photoLibraryAddPermissionRequired": "Ente needs permission to save photos and videos to Apple Photos. You can allow access in Settings.",
"photoLibraryAddPermissionRestricted": "Photo Library access is restricted on this device.",
+ "photoOrder": "Photo order",
"photos": "Photos",
"photosAddedByYouWillBeRemovedFromTheAlbum": "Photos added by you will be removed from the album",
"photosAndVideosCount": "{count, plural, one{{formattedCount} photo & video} other{{formattedCount} photos & videos}}",
@@ -3710,6 +3714,15 @@
}
},
"searchSettings": "Search settings",
+ "secondsCount": "{count, plural, one{{count} second} other{{count} seconds}}",
+ "@secondsCount": {
+ "placeholders": {
+ "count": {
+ "type": "int",
+ "example": "5"
+ }
+ }
+ },
"secret": "Secret",
"secretCanNotBeEmpty": "Secret can not be empty",
"security": "Security",
@@ -3988,6 +4001,7 @@
"showPerson": "Show person",
"showQRAuthMessage": "Authenticate to show QR code",
"showTextOnWidget": "Show text on widget",
+ "shuffle": "Shuffle",
"sigInBackupReminder": "Ente will automatically backup codes after sign-in.\n\nWe still recommend exporting codes as an extra backup.",
"signInToBackup": "Sign in to backup your codes",
"signOutFromOtherDevices": "Sign out from other devices",
@@ -4032,6 +4046,8 @@
},
"skip": "Skip",
"skippedFiles": "Skipped files",
+ "slideshow": "Slideshow",
+ "slideshowSettings": "Slideshow settings",
"smartMemories": "Smart memories",
"smartSuggestions": "Smart suggestions",
"snowAdventures": "Winter adventures",
@@ -4292,6 +4308,7 @@
"name": {}
}
},
+ "timePerPhoto": "Time per photo",
"title": "Title",
"todaysLogs": "Today's logs",
"toEnableAppLockPleaseSetupDevicePasscodeOrScreen": "To enable app lock, please setup device passcode or screen lock in your system settings.",