π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fixes for mobile memory
AmanRajSinghMouryac7b755abba99
diff --git a/mobile/apps/photos/assets/icons/memory-share-link-icon.svg b/mobile/apps/photos/assets/icons/memory-share-link-icon.svgnew file mode 100644index 0000000000..f4b6f6dfa3--- /dev/null+++ b/mobile/apps/photos/assets/icons/memory-share-link-icon.svg@@ -0,0 +1,5 @@+<svg width="27" height="27" viewBox="0 0 27 27" fill="none" xmlns="http://www.w3.org/2000/svg">+<path d="M15.6253 5.125H13.542C10.5957 5.125 9.12258 5.125 8.20728 6.04029C7.29199 6.95558 7.29199 8.42872 7.29199 11.375V13.4583C7.29199 16.4046 7.29199 17.8777 8.20728 18.793C9.12258 19.7083 10.5957 19.7083 13.542 19.7083H15.6253C18.5716 19.7083 20.0447 19.7083 20.96 18.793C21.8753 17.8777 21.8753 16.4046 21.8753 13.4583V11.375" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>+<path d="M17.708 2H21.8747C23.3478 2 24.0844 2 24.5421 2.45765C24.9997 2.91529 24.9997 3.65186 24.9997 5.125V9.29167M23.958 3.04167L14.583 12.4167" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>+<path d="M16.6667 22.9597C15.7514 23.875 14.2782 23.875 11.332 23.875H9.375C6.42872 23.875 4.95558 23.875 4.04029 22.9597C3.125 22.0444 3.125 20.5713 3.125 17.625V15.668C3.125 12.7218 3.125 11.2486 4.04029 10.3333" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>+</svg>diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arbindex bdcd72fb28..c1b0327bab 100644--- a/mobile/apps/photos/lib/l10n/intl_en.arb+++ b/mobile/apps/photos/lib/l10n/intl_en.arb@@ -1119,7 +1119,7 @@"unarchive": "Unarchive","favorite": "Favorite","removeFromFavorite": "Remove from favorites",- "shareMemory": "Share memory",+ "shareMemories": "Share memories","shareTheseMemories": "Share these memories","shareThisPhoto": "Share this photo","shareThisVideo": "Share this video",diff --git a/mobile/apps/photos/lib/ui/components/alert_bottom_sheet.dart b/mobile/apps/photos/lib/ui/components/alert_bottom_sheet.dartindex a8f11947cb..3400d6684a 100644--- a/mobile/apps/photos/lib/ui/components/alert_bottom_sheet.dart+++ b/mobile/apps/photos/lib/ui/components/alert_bottom_sheet.dart@@ -74,20 +74,22 @@ class AlertBottomSheet<T> extends StatelessWidget {BottomSheetCloseButton(onTap: onClose),],),- SizedBox(height: showCloseButton ? 12 : 24),+ SizedBox(height: showCloseButton ? 4 : 24),if (assetPath != null) ...[Center(child: Image.asset(assetPath!)),- const SizedBox(height: 20),+ const SizedBox(height: 24),],Text(title,- style: textTheme.h4Bold,+ style: textTheme.largeBold,textAlign: TextAlign.center,),- const SizedBox(height: 6),+ const SizedBox(height: 4),Text(message,- style: textTheme.bodyMuted,+ style: textTheme.small.copyWith(+ color: colorScheme.contentLight,+ ),textAlign: TextAlign.center,),..._buildButtonsSection(),@@ -102,7 +104,7 @@ class AlertBottomSheet<T> extends StatelessWidget {if (buttons == null || buttons!.isEmpty) return [];return [- const SizedBox(height: 20),+ const SizedBox(height: 16),ListView.separated(shrinkWrap: true,physics: const NeverScrollableScrollPhysics(),diff --git a/mobile/apps/photos/lib/ui/components/base_bottom_sheet.dart b/mobile/apps/photos/lib/ui/components/base_bottom_sheet.dartindex 57a18b1940..87d3819c2f 100644--- a/mobile/apps/photos/lib/ui/components/base_bottom_sheet.dart+++ b/mobile/apps/photos/lib/ui/components/base_bottom_sheet.dart@@ -19,8 +19,8 @@ Future<T?> showBaseBottomSheet<T>(bool isKeyboardAware = true,double topCornerRadius = 20,Color? closeButtonBackgroundColor,- double closeButtonSize = 40,- double closeIconSize = 24,+ double closeButtonSize = 36,+ double closeIconSize = 20,}) {return showModalBottomSheet<T>(context: context,@@ -82,8 +82,8 @@ class BaseBottomSheet extends StatelessWidget {this.isKeyboardAware = true,this.topCornerRadius = 20,this.closeButtonBackgroundColor,- this.closeButtonSize = 40,- this.closeIconSize = 24,+ this.closeButtonSize = 36,+ this.closeIconSize = 20,super.key,});@@ -115,7 +115,7 @@ class BaseBottomSheet extends StatelessWidget {Row(mainAxisAlignment: MainAxisAlignment.spaceBetween,children: [- Text(title, style: titleStyle ?? textTheme.h4Bold),+ Text(title, style: titleStyle ?? textTheme.largeBold),if (showCloseButton)BottomSheetCloseButton(onTap: onClose,@@ -148,8 +148,8 @@ class BottomSheetCloseButton extends StatelessWidget {super.key,this.onTap,this.backgroundColor,- this.buttonSize = 40,- this.iconSize = 24,+ this.buttonSize = 36,+ this.iconSize = 20,});@overridediff --git a/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart b/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dartindex 87185399cc..864986f525 100644--- a/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart+++ b/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart@@ -6,6 +6,7 @@ import "dart:ui";import "package:ente_pure_utils/ente_pure_utils.dart";import "package:flutter/cupertino.dart";import "package:flutter/material.dart";+import "package:flutter_svg/flutter_svg.dart";import "package:hugeicons/hugeicons.dart";import "package:photos/core/configuration.dart";import "package:photos/core/event_bus.dart";@@ -25,8 +26,6 @@ import "package:photos/theme/ente_theme.dart";import "package:photos/theme/text_style.dart";import "package:photos/ui/actions/file/file_actions.dart";import "package:photos/ui/components/base_bottom_sheet.dart";-import "package:photos/ui/components/menu_item_widget/menu_item_widget_new.dart";-import "package:photos/ui/components/settings/settings_grouped_card.dart";import "package:photos/ui/home/memories/custom_listener.dart";import "package:photos/ui/home/memories/memory_progress_indicator.dart";import "package:photos/ui/viewer/file/file_widget.dart";@@ -837,48 +836,17 @@ Future<void> _shareMemory(final l10n = AppLocalizations.of(context);final currentFile =inheritedData.memories[inheritedData.indexNotifier.value].file;- final shareSingleItemLabel =- currentFile.isVideo ? l10n.shareThisVideo : l10n.shareThisPhoto;+ final shareSingleItemLabel = currentFile.isVideo+ ? _titleCase(l10n.videoSmallCase)+ : _titleCase(l10n.photoSmallCase);final canShowMemoryShareLinkOption = flagService.enableMemoryShareLink &&!(isOfflineMode && !Configuration.instance.hasConfiguredAccount());final shouldShareLink = await showBaseBottomSheet<bool>(context,- backgroundColor: getEnteColorScheme(context).backgroundColour,- padding: const EdgeInsets.all(16),- title: l10n.shareMemory,- child: Builder(- builder: (context) {- final colorScheme = getEnteColorScheme(context);- return SettingsGroupedCard(- children: [- if (canShowMemoryShareLinkOption)- MenuItemWidgetNew(- title: l10n.shareTheseMemories,- trailingWidget: HugeIcon(- icon: HugeIcons.strokeRoundedLink02,- color: colorScheme.textBase,- size: 20,- ),- borderRadius: 0,- onTap: () async {- Navigator.of(context).pop(true);- },- ),- MenuItemWidgetNew(- title: shareSingleItemLabel,- trailingWidget: HugeIcon(- icon: HugeIcons.strokeRoundedShare04,- color: colorScheme.textBase,- size: 20,- ),- borderRadius: 0,- onTap: () async {- Navigator.of(context).pop(false);- },- ),- ],- );- },+ title: l10n.shareMemories,+ child: _MemoryShareSheet(+ canShowMemoryShareLinkOption: canShowMemoryShareLinkOption,+ shareSingleItemLabel: shareSingleItemLabel,),);if (!context.mounted || shouldShareLink == null) {@@ -926,3 +894,102 @@ Future<(String, int)?> _getOrCreateMemoryLink(return null;}}++String _titleCase(String value) {+ if (value.isEmpty) return value;+ return value[0].toUpperCase() + value.substring(1);+}++class _MemoryShareSheet extends StatelessWidget {+ final bool canShowMemoryShareLinkOption;+ final String shareSingleItemLabel;++ const _MemoryShareSheet({+ required this.canShowMemoryShareLinkOption,+ required this.shareSingleItemLabel,+ });++ @override+ Widget build(BuildContext context) {+ final l10n = AppLocalizations.of(context);+ return Row(+ children: [+ if (canShowMemoryShareLinkOption)+ _MemoryShareOption(+ icon: HugeIcons.strokeRoundedLink02,+ svgAssetPath: "assets/icons/memory-share-link-icon.svg",+ label: l10n.memories,+ onTap: () => Navigator.of(context).pop(true),+ ),+ if (canShowMemoryShareLinkOption) const SizedBox(width: 24),+ _MemoryShareOption(+ icon: HugeIcons.strokeRoundedShare05,+ label: shareSingleItemLabel,+ onTap: () => Navigator.of(context).pop(false),+ ),+ ],+ );+ }+}++class _MemoryShareOption extends StatelessWidget {+ final List<List<dynamic>> icon;+ final String label;+ final VoidCallback onTap;+ final String? svgAssetPath;++ const _MemoryShareOption({+ required this.icon,+ required this.label,+ required this.onTap,+ this.svgAssetPath,+ });++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);++ return Expanded(+ child: GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: onTap,+ child: Container(+ decoration: BoxDecoration(+ color: colorScheme.fillDark,+ borderRadius: BorderRadius.circular(16),+ ),+ padding: const EdgeInsets.symmetric(vertical: 16),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ mainAxisAlignment: MainAxisAlignment.center,+ children: [+ if (svgAssetPath != null)+ SvgPicture.asset(+ svgAssetPath!,+ width: 26,+ height: 26,+ colorFilter: ColorFilter.mode(+ colorScheme.textBase,+ BlendMode.srcIn,+ ),+ )+ else+ HugeIcon(+ icon: icon,+ color: colorScheme.textBase,+ size: 24,+ ),+ const SizedBox(height: 8),+ Text(+ label,+ textAlign: TextAlign.center,+ style: textTheme.small.copyWith(color: colorScheme.textBase),+ ),+ ],+ ),+ ),+ ),+ );+ }+}diff --git a/mobile/apps/photos/lib/ui/sharing/memory_link_details_sheet.dart b/mobile/apps/photos/lib/ui/sharing/memory_link_details_sheet.dartindex b41603dbd9..de4ac18017 100644--- a/mobile/apps/photos/lib/ui/sharing/memory_link_details_sheet.dart+++ b/mobile/apps/photos/lib/ui/sharing/memory_link_details_sheet.dart@@ -1,3 +1,5 @@+import "dart:async";+import "package:flutter/material.dart";import "package:flutter/services.dart";import "package:hugeicons/hugeicons.dart";@@ -29,8 +31,8 @@ Future<bool?> showMemoryLinkDetailsSheet(children: [Text(l10n.memoryShareLinkDescription,- style:- textTheme.bodyMuted.copyWith(color: colorScheme.contentLight),+ style: textTheme.smallMuted+ .copyWith(color: colorScheme.contentLight),),const SizedBox(height: 14),Container(@@ -45,7 +47,7 @@ Future<bool?> showMemoryLinkDetailsSheet(padding: const EdgeInsets.fromLTRB(20, 20, 56, 20),child: SelectableText(shareUrl,- style: textTheme.body.copyWith(height: 1.5),+ style: textTheme.small.copyWith(height: 1.5),),),Positioned(@@ -77,7 +79,7 @@ Future<bool?> showMemoryLinkDetailsSheet(labelText: l10n.shareLink,shouldSurfaceExecutionStates: false,onTap: () async {- await shareText(shareUrl, context: context);+ unawaited(shareText(shareUrl, context: context));},),const SizedBox(height: 12),