Skip to content

armgit / ente

Public Imported from GitHub
0

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

Open file before showing comments sheet from feed

ashilkn84cfafc67fc8
diff --git a/mobile/apps/photos/lib/ui/social/feed_screen.dart b/mobile/apps/photos/lib/ui/social/feed_screen.dart
index f69b1d80b9..992a4256a2 100644
--- a/mobile/apps/photos/lib/ui/social/feed_screen.dart
+++ b/mobile/apps/photos/lib/ui/social/feed_screen.dart
@@ -188,7 +188,7 @@ class _FeedScreenState extends State<FeedScreen> {
);
}
- /// Opens the comments screen for the feed item.
+ /// Opens the photo viewer for the feed item, then shows the comments sheet.
Future<void> _openComments(FeedItem item) async {
var fileID = item.fileID;
@@ -198,14 +198,36 @@ class _FeedScreenState extends State<FeedScreen> {
fileID = comment?.fileID;
}
- if (fileID == null || !mounted) return;
+ if (fileID == null) return;
+
+ final file = await FilesDB.instance.getUploadedFile(
+ fileID,
+ item.collectionID,
+ );
+ if (file == null || !mounted) return;
+
+ final capturedFileID = fileID;
+ // Navigate to the photo first, then show comments sheet after first frame
unawaited(
- showFileCommentsBottomSheet(
+ routeToPage(
context,
- collectionID: item.collectionID,
- fileID: fileID,
- highlightCommentID: item.commentID,
+ DetailPage(
+ DetailPageConfiguration(
+ [file],
+ 0,
+ "feed_comment",
+ onPageReady: (detailContext) {
+ showFileCommentsBottomSheet(
+ detailContext,
+ collectionID: item.collectionID,
+ fileID: capturedFileID,
+ highlightCommentID: item.commentID,
+ );
+ },
+ ),
+ ),
+ forceCustomPageRoute: true,
),
);
}
diff --git a/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart b/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
index 97fafc9a08..5c4dba6053 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/detail_page.dart
@@ -45,12 +45,17 @@ class DetailPageConfiguration {
final DetailPageMode mode;
final bool isLocalOnlyContext;
+ /// Callback invoked with the page context after the page is ready.
+ /// Useful for showing bottom sheets or dialogs after navigation completes.
+ final void Function(BuildContext context)? onPageReady;
+
DetailPageConfiguration(
this.files,
this.selectedIndex,
this.tagPrefix, {
this.mode = DetailPageMode.full,
this.isLocalOnlyContext = false,
+ this.onPageReady,
});
DetailPageConfiguration copyWith({
@@ -139,7 +144,9 @@ class _BodyState extends State<_Body> {
// Update shared collection state after first frame
WidgetsBinding.instance.addPostFrameCallback((_) {
+ if (!mounted) return;
_updateSharedCollectionState(_files![_selectedIndexNotifier.value]);
+ widget.config.onPageReady?.call(context);
});
}