Skip to content

armgit / ente

Public Imported from GitHub
0

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

feat: add MemoryShareUpdatedEvent and update sharing functionality

AmanRajSinghMouryab49aee3ada1c
diff --git a/mobile/apps/photos/lib/events/memory_share_updated_event.dart b/mobile/apps/photos/lib/events/memory_share_updated_event.dart
new file mode 100644
index 0000000000..09c148ef44
--- /dev/null
+++ b/mobile/apps/photos/lib/events/memory_share_updated_event.dart
@@ -0,0 +1,5 @@
+class MemoryShareUpdatedEvent {
+ final String reason;
+
+ MemoryShareUpdatedEvent(this.reason);
+}
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index 141dc10b90..bdcd72fb28 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -1119,12 +1119,17 @@
"unarchive": "Unarchive",
"favorite": "Favorite",
"removeFromFavorite": "Remove from favorites",
+ "shareMemory": "Share memory",
+ "shareTheseMemories": "Share these memories",
+ "shareThisPhoto": "Share this photo",
+ "shareThisVideo": "Share this video",
"shareLink": "Share link",
- "memoryShareLinkDescription": "This link allows anyone who receives it to access your item. You can remove access at any time by deleting the link.\n\nThe link will expire automatically in 7 days.",
+ "memoryShareLinkDescription": "This link will automatically expire in 7 days.",
"deleteLink": "Delete link",
"deleteLinkQuestion": "Delete link?",
- "deleteMemoryLinkMessage": "Deleting this link will revoke memory access for all users",
+ "deleteMemoryLinkMessage": "People you shared this link with will lose access once it is deleted.",
"linkDeletedSuccessfully": "Link deleted successfully",
+ "memoryLinks": "Memory links",
"openLink": "Open link",
"pay": "Pay",
"noPaymentAppFound": "No payment app found",
diff --git a/mobile/apps/photos/lib/services/memory_share_service.dart b/mobile/apps/photos/lib/services/memory_share_service.dart
index 81c6213959..55aba29541 100644
--- a/mobile/apps/photos/lib/services/memory_share_service.dart
+++ b/mobile/apps/photos/lib/services/memory_share_service.dart
@@ -7,10 +7,12 @@ import 'package:crypto/crypto.dart';
import 'package:dio/dio.dart';
import 'package:ente_crypto/ente_crypto.dart';
import 'package:logging/logging.dart';
+import 'package:photos/core/event_bus.dart';
import 'package:photos/core/network/network.dart';
import 'package:photos/db/files_db.dart';
import 'package:photos/db/memory_shares_db.dart';
import 'package:photos/db/ml/db.dart';
+import 'package:photos/events/memory_share_updated_event.dart';
import 'package:photos/gateways/entity/models/type.dart';
import 'package:photos/models/api/memory_share/memory_share.dart';
import 'package:photos/models/file/file.dart';
@@ -111,6 +113,7 @@ class MemoryShareService {
);
await _db.upsert(localShare);
_updateMemoryShareCache(localShare);
+ Bus.instance.fire(MemoryShareUpdatedEvent("create-memory-share"));
return (shareUrl, memoryShare.id);
} catch (e, s) {
@@ -183,6 +186,7 @@ class MemoryShareService {
);
await _db.upsert(localShare);
_updateMemoryShareCache(localShare);
+ Bus.instance.fire(MemoryShareUpdatedEvent("create-memory-lane-link"));
return (shareUrl, memoryShare.id);
} catch (e, s) {
@@ -350,6 +354,7 @@ class MemoryShareService {
await _enteDio.delete('/memory-share/$shareID');
await _db.delete(shareID);
_removeMemoryShareFromCache(shareID);
+ Bus.instance.fire(MemoryShareUpdatedEvent("delete-memory-share"));
} catch (e, s) {
_logger.severe("Failed to delete memory share $shareID", e, s);
rethrow;
diff --git a/mobile/apps/photos/lib/theme/text_style.dart b/mobile/apps/photos/lib/theme/text_style.dart
index b096782fd5..49cd9d456e 100644
--- a/mobile/apps/photos/lib/theme/text_style.dart
+++ b/mobile/apps/photos/lib/theme/text_style.dart
@@ -35,6 +35,12 @@ const TextStyle h3 = TextStyle(
fontWeight: _regularWeight,
fontFamily: _fontFamily,
);
+const TextStyle h4 = TextStyle(
+ fontSize: 20,
+ height: 24 / 20.0,
+ fontWeight: _regularWeight,
+ fontFamily: _fontFamily,
+);
const TextStyle large = TextStyle(
fontSize: 18,
height: 22 / 18.0,
@@ -73,6 +79,8 @@ class EnteTextTheme {
final TextStyle h2Bold;
final TextStyle h3;
final TextStyle h3Bold;
+ final TextStyle h4;
+ final TextStyle h4Bold;
final TextStyle large;
final TextStyle largeBold;
final TextStyle body;
@@ -90,6 +98,7 @@ class EnteTextTheme {
final TextStyle h1Muted;
final TextStyle h2Muted;
final TextStyle h3Muted;
+ final TextStyle h4Muted;
final TextStyle largeMuted;
final TextStyle bodyMuted;
final TextStyle smallMuted;
@@ -101,6 +110,7 @@ class EnteTextTheme {
final TextStyle h1Faint;
final TextStyle h2Faint;
final TextStyle h3Faint;
+ final TextStyle h4Faint;
final TextStyle largeFaint;
final TextStyle bodyFaint;
final TextStyle smallFaint;
@@ -114,6 +124,8 @@ class EnteTextTheme {
required this.h2Bold,
required this.h3,
required this.h3Bold,
+ required this.h4,
+ required this.h4Bold,
required this.large,
required this.largeBold,
required this.body,
@@ -129,6 +141,7 @@ class EnteTextTheme {
required this.h1Muted,
required this.h2Muted,
required this.h3Muted,
+ required this.h4Muted,
required this.largeMuted,
required this.bodyMuted,
required this.smallMuted,
@@ -138,6 +151,7 @@ class EnteTextTheme {
required this.h1Faint,
required this.h2Faint,
required this.h3Faint,
+ required this.h4Faint,
required this.largeFaint,
required this.bodyFaint,
required this.smallFaint,
@@ -170,6 +184,8 @@ EnteTextTheme _buildEnteTextStyle(
h2Bold: h2.copyWith(color: color, fontWeight: _boldWeight),
h3: h3.copyWith(color: color),
h3Bold: h3.copyWith(color: color, fontWeight: _boldWeight),
+ h4: h4.copyWith(color: color),
+ h4Bold: h4.copyWith(color: color, fontWeight: _boldWeight),
large: large.copyWith(color: color),
largeBold: large.copyWith(color: color, fontWeight: _boldWeight),
body: body.copyWith(color: color),
@@ -185,6 +201,7 @@ EnteTextTheme _buildEnteTextStyle(
h1Muted: h1.copyWith(color: textMuted),
h2Muted: h2.copyWith(color: textMuted),
h3Muted: h3.copyWith(color: textMuted),
+ h4Muted: h4.copyWith(color: textMuted),
largeMuted: large.copyWith(color: textMuted),
bodyMuted: body.copyWith(color: textMuted),
smallMuted: small.copyWith(color: textMuted),
@@ -194,6 +211,7 @@ EnteTextTheme _buildEnteTextStyle(
h1Faint: h1.copyWith(color: textFaint),
h2Faint: h2.copyWith(color: textFaint),
h3Faint: h3.copyWith(color: textFaint),
+ h4Faint: h4.copyWith(color: textFaint),
largeFaint: large.copyWith(color: textFaint),
bodyFaint: body.copyWith(color: textFaint),
smallFaint: small.copyWith(color: textFaint),
diff --git a/mobile/apps/photos/lib/ui/components/alert_bottom_sheet.dart b/mobile/apps/photos/lib/ui/components/alert_bottom_sheet.dart
index 15178e1c9e..a8f11947cb 100644
--- a/mobile/apps/photos/lib/ui/components/alert_bottom_sheet.dart
+++ b/mobile/apps/photos/lib/ui/components/alert_bottom_sheet.dart
@@ -62,7 +62,7 @@ class AlertBottomSheet<T> extends StatelessWidget {
child: SafeArea(
top: false,
child: Padding(
- padding: const EdgeInsets.all(16),
+ padding: const EdgeInsets.all(20),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
@@ -81,15 +81,13 @@ class AlertBottomSheet<T> extends StatelessWidget {
],
Text(
title,
- style: textTheme.h3Bold,
+ style: textTheme.h4Bold,
textAlign: TextAlign.center,
),
- const SizedBox(height: 12),
+ const SizedBox(height: 6),
Text(
message,
- style: textTheme.body.copyWith(
- color: colorScheme.textMuted,
- ),
+ style: textTheme.bodyMuted,
textAlign: TextAlign.center,
),
..._buildButtonsSection(),
diff --git a/mobile/apps/photos/lib/ui/components/base_bottom_sheet.dart b/mobile/apps/photos/lib/ui/components/base_bottom_sheet.dart
index de175bbb32..57a18b1940 100644
--- a/mobile/apps/photos/lib/ui/components/base_bottom_sheet.dart
+++ b/mobile/apps/photos/lib/ui/components/base_bottom_sheet.dart
@@ -9,11 +9,11 @@ Future<T?> showBaseBottomSheet<T>(
TextStyle? titleStyle,
bool showCloseButton = true,
VoidCallback? onClose,
- double headerSpacing = 20,
+ double headerSpacing = 16,
Color? backgroundColor,
Color? modalBackgroundColor,
CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.start,
- EdgeInsets padding = const EdgeInsets.fromLTRB(24, 20, 24, 24),
+ EdgeInsets padding = const EdgeInsets.all(20),
bool isDismissible = true,
bool enableDrag = true,
bool isKeyboardAware = true,
@@ -76,9 +76,9 @@ class BaseBottomSheet extends StatelessWidget {
this.showCloseButton = true,
this.onClose,
this.crossAxisAlignment = CrossAxisAlignment.start,
- this.padding = const EdgeInsets.fromLTRB(24, 20, 24, 24),
+ this.padding = const EdgeInsets.all(20),
this.backgroundColor,
- this.headerSpacing = 20,
+ this.headerSpacing = 16,
this.isKeyboardAware = true,
this.topCornerRadius = 20,
this.closeButtonBackgroundColor,
@@ -115,7 +115,7 @@ class BaseBottomSheet extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
- Text(title, style: titleStyle ?? textTheme.largeBold),
+ Text(title, style: titleStyle ?? textTheme.h4Bold),
if (showCloseButton)
BottomSheetCloseButton(
onTap: onClose,
diff --git a/mobile/apps/photos/lib/ui/components/buttons/button_widget_v2.dart b/mobile/apps/photos/lib/ui/components/buttons/button_widget_v2.dart
index 5ca2ee29a5..1ccd685178 100644
--- a/mobile/apps/photos/lib/ui/components/buttons/button_widget_v2.dart
+++ b/mobile/apps/photos/lib/ui/components/buttons/button_widget_v2.dart
@@ -289,10 +289,14 @@ class _ButtonWidgetV2State extends State<ButtonWidgetV2>
}
final isLink = widget.buttonType == ButtonTypeV2.link;
- final labelStyle = (isLink ? textTheme.body : textTheme.bodyBold).copyWith(
+ final isTertiaryCritical =
+ widget.buttonType == ButtonTypeV2.tertiaryCritical;
+ final hasUnderline = isLink || isTertiaryCritical;
+ final labelStyle =
+ (hasUnderline ? textTheme.body : textTheme.bodyBold).copyWith(
color: colors.textColor,
- decoration: isLink ? TextDecoration.underline : null,
- decorationColor: isLink ? colors.textColor : null,
+ decoration: hasUnderline ? TextDecoration.underline : null,
+ decorationColor: hasUnderline ? colors.textColor : null,
);
final hasLeading = widget.leadingWidget != null;
diff --git a/mobile/apps/photos/lib/ui/components/models/button_type_v2.dart b/mobile/apps/photos/lib/ui/components/models/button_type_v2.dart
index c033b75f54..5288ba119a 100644
--- a/mobile/apps/photos/lib/ui/components/models/button_type_v2.dart
+++ b/mobile/apps/photos/lib/ui/components/models/button_type_v2.dart
@@ -83,8 +83,6 @@ ButtonTheme _tertiaryCriticalPalette(EnteColorScheme c) => ButtonTheme(
hoverForeground: c.redDark,
pressedForeground: c.redDarker,
disabledForeground: c.contentLighter,
- defaultBorder: c.redBase,
- disabledBorder: c.fillDark,
disabledIconColor: c.contentLighter,
);
diff --git a/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart b/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart
index f75bcf0447..87185399cc 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
@@ -14,6 +14,7 @@ import "package:photos/events/pause_video_event.dart";
import "package:photos/events/reset_zoom_of_photo_view_event.dart";
import "package:photos/events/resume_video_event.dart";
import "package:photos/generated/l10n.dart";
+import "package:photos/models/file/extensions/file_props.dart";
import "package:photos/models/file/file_type.dart";
import "package:photos/models/memories/memory.dart";
import "package:photos/service_locator.dart";
@@ -28,7 +29,6 @@ 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/sharing/memory_link_details_sheet.dart";
import "package:photos/ui/viewer/file/file_widget.dart";
import "package:photos/ui/viewer/file/thumbnail_widget.dart";
import "package:photos/ui/viewer/file_details/favorite_widget.dart";
@@ -630,7 +630,7 @@ class BottomIcons extends StatelessWidget {
),
onPressed: () async {
fullScreenState?._toggleAnimation(pause: true);
- await _showMemoryShareSheet(
+ await _shareMemory(
context,
inheritedData,
memoryTitle,
@@ -829,12 +829,16 @@ class _MemoriesZoomWidgetState extends State<MemoriesZoomWidget>
}
}
-Future<void> _showMemoryShareSheet(
+Future<void> _shareMemory(
BuildContext context,
FullScreenMemoryData inheritedData,
String memoryTitle,
) async {
final l10n = AppLocalizations.of(context);
+ final currentFile =
+ inheritedData.memories[inheritedData.indexNotifier.value].file;
+ final shareSingleItemLabel =
+ currentFile.isVideo ? l10n.shareThisVideo : l10n.shareThisPhoto;
final canShowMemoryShareLinkOption = flagService.enableMemoryShareLink &&
!(isOfflineMode && !Configuration.instance.hasConfiguredAccount());
final shouldShareLink = await showBaseBottomSheet<bool>(
@@ -849,7 +853,7 @@ Future<void> _showMemoryShareSheet(
children: [
if (canShowMemoryShareLinkOption)
MenuItemWidgetNew(
- title: l10n.shareALinkToThisMemory,
+ title: l10n.shareTheseMemories,
trailingWidget: HugeIcon(
icon: HugeIcons.strokeRoundedLink02,
color: colorScheme.textBase,
@@ -861,7 +865,7 @@ Future<void> _showMemoryShareSheet(
},
),
MenuItemWidgetNew(
- title: l10n.shareThisPhoto,
+ title: shareSingleItemLabel,
trailingWidget: HugeIcon(
icon: HugeIcons.strokeRoundedShare04,
color: colorScheme.textBase,
@@ -890,16 +894,10 @@ Future<void> _showMemoryShareSheet(
if (!context.mounted || shareLinkData == null) {
return;
}
- await showMemoryLinkDetailsSheet(
- context,
- shareUrl: shareLinkData.$1,
- shareId: shareLinkData.$2,
- );
+ await shareText(shareLinkData.$1, context: context);
return;
}
- final currentFile =
- inheritedData.memories[inheritedData.indexNotifier.value].file;
await share(context, [currentFile]);
}
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.dart
index 593a75d62f..b41603dbd9 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
@@ -19,7 +19,6 @@ Future<bool?> showMemoryLinkDetailsSheet(
return showBaseBottomSheet<bool>(
context,
title: l10n.shareLink,
- padding: const EdgeInsets.all(16),
child: Builder(
builder: (context) {
final colorScheme = getEnteColorScheme(context);
@@ -28,23 +27,30 @@ Future<bool?> showMemoryLinkDetailsSheet(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
- Text(l10n.memoryShareLinkDescription, style: textTheme.smallMuted),
+ Text(
+ l10n.memoryShareLinkDescription,
+ style:
+ textTheme.bodyMuted.copyWith(color: colorScheme.contentLight),
+ ),
const SizedBox(height: 14),
Container(
width: double.infinity,
decoration: BoxDecoration(
color: colorScheme.fillDark,
- borderRadius: BorderRadius.circular(8),
+ borderRadius: BorderRadius.circular(16),
),
child: Stack(
children: [
Padding(
- padding: const EdgeInsets.fromLTRB(12, 16, 12, 16),
- child: SelectableText(shareUrl, style: textTheme.small),
+ padding: const EdgeInsets.fromLTRB(20, 20, 56, 20),
+ child: SelectableText(
+ shareUrl,
+ style: textTheme.body.copyWith(height: 1.5),
+ ),
),
Positioned(
- right: 0,
- top: 0,
+ right: 8,
+ top: 8,
child: IconButton(
tooltip: l10n.copyLink,
iconSize: 20,
@@ -74,11 +80,12 @@ Future<bool?> showMemoryLinkDetailsSheet(
await shareText(shareUrl, context: context);
},
),
- const SizedBox(height: 16),
+ const SizedBox(height: 12),
Center(
child: ButtonWidgetV2(
- buttonType: ButtonTypeV2.critical,
+ buttonType: ButtonTypeV2.tertiaryCritical,
labelText: l10n.deleteLink,
+ shouldSurfaceExecutionStates: false,
onTap: () async {
final shouldDelete = await showAlertBottomSheet<bool>(
context,
diff --git a/mobile/apps/photos/lib/ui/tabs/shared/all_memory_links_page.dart b/mobile/apps/photos/lib/ui/tabs/shared/all_memory_links_page.dart
index 5d092afd67..1461e73180 100644
--- a/mobile/apps/photos/lib/ui/tabs/shared/all_memory_links_page.dart
+++ b/mobile/apps/photos/lib/ui/tabs/shared/all_memory_links_page.dart
@@ -1,4 +1,5 @@
import "package:flutter/material.dart";
+import "package:photos/generated/l10n.dart";
import "package:photos/models/api/memory_share/memory_share.dart";
import "package:photos/services/memory_share_service.dart";
import "package:photos/ui/components/title_bar_title_widget.dart";
@@ -62,7 +63,7 @@ class _AllMemoryLinksPageState extends State<AllMemoryLinksPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TitleBarTitleWidget(
- title: "Memory Links",
+ title: AppLocalizations.of(context).memoryLinks,
heroTag: widget.titleHeroTag,
),
Text(widget.memoryShares.length.toString()),
@@ -91,7 +92,6 @@ class _AllMemoryLinksPageState extends State<AllMemoryLinksPage> {
title: title,
fileCount: share.fileCount,
previewUploadedFileID: share.previewUploadedFileID,
- shareUrl: share.url,
),
);
},
diff --git a/mobile/apps/photos/lib/ui/tabs/shared/memory_link_item.dart b/mobile/apps/photos/lib/ui/tabs/shared/memory_link_item.dart
index 000ed8f81d..389955164b 100644
--- a/mobile/apps/photos/lib/ui/tabs/shared/memory_link_item.dart
+++ b/mobile/apps/photos/lib/ui/tabs/shared/memory_link_item.dart
@@ -1,8 +1,6 @@
import "package:flutter/material.dart";
-import "package:logging/logging.dart";
import "package:photos/db/files_db.dart";
import 'package:photos/models/file/file.dart';
-import "package:photos/services/memory_share_service.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/components/buttons/icon_button_widget.dart";
import "package:photos/ui/viewer/file/no_thumbnail_widget.dart";
@@ -10,49 +8,23 @@ import "package:photos/ui/viewer/file/thumbnail_widget.dart";
class MemoryLinkAlbumItem extends StatelessWidget {
static const heroTagPrefix = "memory_link";
- static final _logger = Logger("MemoryLinkAlbumItem");
final String title;
final int? fileCount;
final int? previewUploadedFileID;
- final String? shareUrl;
const MemoryLinkAlbumItem({
super.key,
required this.title,
this.fileCount,
this.previewUploadedFileID,
- this.shareUrl,
});
Future<EnteFile?> _loadPreviewFile() async {
final uploadedID = previewUploadedFileID;
if (uploadedID != null) {
- final localFile = await FilesDB.instance.getAnyUploadedFile(uploadedID);
- if (localFile != null) {
- return localFile;
- }
- }
-
- final resolvedShareUrl = shareUrl;
- if (resolvedShareUrl == null || resolvedShareUrl.isEmpty) {
- return null;
- }
-
- try {
- final files = await MemoryShareService.instance
- .getPublicMemoryFiles(resolvedShareUrl);
- if (files.isEmpty) {
- return null;
- }
- return files.first;
- } catch (e, s) {
- _logger.warning(
- "Failed to resolve preview file for memory link $resolvedShareUrl",
- e,
- s,
- );
- return null;
+ return FilesDB.instance.getAnyUploadedFile(uploadedID);
}
+ return null;
}
@override
diff --git a/mobile/apps/photos/lib/ui/tabs/shared_collections_tab.dart b/mobile/apps/photos/lib/ui/tabs/shared_collections_tab.dart
index c170bd3ac6..cee6f4942c 100644
--- a/mobile/apps/photos/lib/ui/tabs/shared_collections_tab.dart
+++ b/mobile/apps/photos/lib/ui/tabs/shared_collections_tab.dart
@@ -11,6 +11,7 @@ import "package:photos/events/album_sort_order_change_event.dart";
import "package:photos/events/app_mode_changed_event.dart";
import "package:photos/events/collection_updated_event.dart";
import "package:photos/events/local_photos_updated_event.dart";
+import "package:photos/events/memory_share_updated_event.dart";
import "package:photos/events/tab_changed_event.dart";
import "package:photos/events/user_logged_out_event.dart";
import "package:photos/generated/l10n.dart";
@@ -30,6 +31,7 @@ import "package:photos/ui/components/buttons/icon_button_widget.dart";
import "package:photos/ui/sharing/memory_link_details_sheet.dart";
import "package:photos/ui/social/widgets/feed_preview_widget.dart";
import "package:photos/ui/tabs/section_title.dart";
+import "package:photos/ui/tabs/shared/all_memory_links_page.dart";
import "package:photos/ui/tabs/shared/all_quick_links_page.dart";
import "package:photos/ui/tabs/shared/empty_state.dart";
import "package:photos/ui/tabs/shared/memory_link_item.dart";
@@ -54,6 +56,7 @@ class _SharedCollectionsTabState extends State<SharedCollectionsTab>
late StreamSubscription<CollectionUpdatedEvent>
_collectionUpdatesSubscription;
late StreamSubscription<AlbumSortOrderChangeEvent> _albumSortOrderChangeEvent;
+ late StreamSubscription<MemoryShareUpdatedEvent> _memoryShareUpdatedEvent;
late StreamSubscription<UserLoggedOutEvent> _loggedOutEvent;
late StreamSubscription<AppModeChangedEvent> _appModeChangedEvent;
final _debouncer = Debouncer(
@@ -108,6 +111,12 @@ class _SharedCollectionsTabState extends State<SharedCollectionsTab>
setState(() {});
}
});
+ _memoryShareUpdatedEvent =
+ Bus.instance.on<MemoryShareUpdatedEvent>().listen((event) {
+ if (mounted) {
+ setState(() {});
+ }
+ });
_loggedOutEvent = Bus.instance.on<UserLoggedOutEvent>().listen((event) {
setState(() {});
});
@@ -245,6 +254,7 @@ class _SharedCollectionsTabState extends State<SharedCollectionsTab>
(screenWidth - totalHorizontalPadding - horizontalPadding) /
albumsCountInRow;
const quickLinkTitleHeroTag = "quick_link_title";
+ const memoryLinkTitleHeroTag = "memory_link_title";
final SectionTitle sharedWithYou =
SectionTitle(title: AppLocalizations.of(context).sharedWithYou);
final SectionTitle sharedByYou =
@@ -505,11 +515,33 @@ class _SharedCollectionsTabState extends State<SharedCollectionsTab>
memoryLinks.isNotEmpty
? Column(
children: [
- const SectionOptions(
+ SectionOptions(
+ onTap: memoryLinks.length > maxMemoryLinks
+ ? () {
+ unawaited(
+ routeToPage(
+ context,
+ AllMemoryLinksPage(
+ titleHeroTag: memoryLinkTitleHeroTag,
+ memoryShares: memoryLinks,
+ ),
+ ),
+ );
+ }
+ : null,
Hero(
- tag: "memory_links",
- child: SectionTitle(title: "Memory Links"),
+ tag: memoryLinkTitleHeroTag,
+ child: SectionTitle(
+ title: AppLocalizations.of(context).memoryLinks,
+ ),
),
+ trailingWidget: memoryLinks.length > maxMemoryLinks
+ ? IconButtonWidget(
+ icon: Icons.chevron_right,
+ iconButtonType: IconButtonType.secondary,
+ iconColor: colorTheme.blurStrokePressed,
+ )
+ : null,
),
const SizedBox(height: 2),
ListView.separated(
@@ -541,7 +573,6 @@ class _SharedCollectionsTabState extends State<SharedCollectionsTab>
fileCount: share.fileCount,
previewUploadedFileID:
share.previewUploadedFileID,
- shareUrl: share.url,
),
);
},
@@ -594,6 +625,7 @@ class _SharedCollectionsTabState extends State<SharedCollectionsTab>
_localFilesSubscription.cancel();
_collectionUpdatesSubscription.cancel();
_albumSortOrderChangeEvent.cancel();
+ _memoryShareUpdatedEvent.cancel();
_loggedOutEvent.cancel();
_appModeChangedEvent.cancel();
_debouncer.cancelDebounceTimer();
diff --git a/mobile/apps/photos/lib/ui/viewer/people/memory_lane_page.dart b/mobile/apps/photos/lib/ui/viewer/people/memory_lane_page.dart
index cbe452ccbf..4935239c62 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/memory_lane_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/memory_lane_page.dart
@@ -22,9 +22,9 @@ import "package:photos/theme/colors.dart";
import "package:photos/theme/effects.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/notification/toast.dart";
-import "package:photos/ui/sharing/memory_link_details_sheet.dart";
import "package:photos/utils/dialog_util.dart";
import "package:photos/utils/face/face_thumbnail_cache.dart";
+import "package:photos/utils/share_util.dart";
class MemoryLanePage extends StatefulWidget {
final PersonEntity person;
@@ -627,10 +627,9 @@ class _MemoryLanePageState extends State<MemoryLanePage>
if (!context.mounted || shareLinkData == null) {
return;
}
- await showMemoryLinkDetailsSheet(
- context,
- shareUrl: shareLinkData.$1,
- shareId: shareLinkData.$2,
+ await shareText(
+ shareLinkData.$1,
+ context: context,
);
},
),