π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Reuse the sort sheet for Discover options
r4khul6cca5103848b
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/album_sort_sheet.dart b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/album_sort_sheet.dartindex 1b117ef0fd..5b14fd22fb 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/album_sort_sheet.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/album_sort_sheet.dart@@ -1,13 +1,43 @@import "package:ente_components/ente_components.dart";import "package:ente_strings/ente_strings.dart";import "package:flutter/material.dart";+import "package:photos/events/magic_sort_change_event.dart";import "package:photos/ui/components/collection_share_badge.dart";Future<bool?> showAlbumSortSheet(BuildContext context, {required bool ascending,}) {- return showBottomSheetComponent<bool>(+ return _showSortSheet(+ context,+ selected: ascending,+ options: [+ (false, context.strings.sortNewestFirst),+ (true, context.strings.sortOldestFirst),+ ],+ );+}++Future<MagicSortType?> showMagicSortSheet(+ BuildContext context, {+ required MagicSortType sortType,+}) {+ return _showSortSheet(+ context,+ selected: sortType,+ options: [+ (MagicSortType.mostRecent, context.strings.mostRecent),+ (MagicSortType.mostRelevant, context.strings.mostRelevant),+ ],+ );+}++Future<T?> _showSortSheet<T>(+ BuildContext context, {+ required T selected,+ required List<(T, String)> options,+}) {+ return showBottomSheetComponent<T>(context: context,builder: (sheetContext) => SingleChildScrollView(child: BottomSheetComponent(@@ -15,14 +45,12 @@ Future<bool?> showAlbumSortSheet(closeTooltip: sheetContext.strings.close,content: MenuGroupComponent(items: [- for (final value in [false, true])+ for (final (value, label) in options)Semantics(- selected: value == ascending,+ selected: value == selected,child: MenuComponent(- title: value- ? sheetContext.strings.sortOldestFirst- : sheetContext.strings.sortNewestFirst,- trailing: value == ascending+ title: label,+ trailing: value == selected? const CollectionSelectedBadge(): null,onTap: () => Navigator.of(sheetContext).pop(value),