Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Feed 4/n

Neeraj Gupta36965dda7631
diff --git a/mobile/apps/photos/lib/models/social/social_data_provider.dart b/mobile/apps/photos/lib/models/social/social_data_provider.dart
index ec61f821db..68f381fc6a 100644
--- a/mobile/apps/photos/lib/models/social/social_data_provider.dart
+++ b/mobile/apps/photos/lib/models/social/social_data_provider.dart
@@ -179,7 +179,7 @@ class SocialDataProvider {
required int collectionID,
int? fileID,
String? commentID,
- String reactionType = 'green_like',
+ String reactionType = 'green_heart',
}) async {
try {
// Check if user already has a reaction
diff --git a/mobile/apps/photos/lib/ui/social/feed_screen.dart b/mobile/apps/photos/lib/ui/social/feed_screen.dart
index d9edd153b5..1528c22ee9 100644
--- a/mobile/apps/photos/lib/ui/social/feed_screen.dart
+++ b/mobile/apps/photos/lib/ui/social/feed_screen.dart
@@ -149,7 +149,8 @@ class _FeedScreenState extends State<FeedScreen> {
anonDisplayNames:
_anonDisplayNamesByCollection[item.collectionID] ??
const {},
- onTap: () => _onFeedItemTap(item),
+ onTap: () => _openComments(item),
+ onThumbnailTap: () => _openPhoto(item),
);
},
),
@@ -186,7 +187,32 @@ class _FeedScreenState extends State<FeedScreen> {
);
}
- Future<void> _onFeedItemTap(FeedItem item) async {
+ /// Opens the comments screen for the feed item.
+ Future<void> _openComments(FeedItem item) async {
+ var fileID = item.fileID;
+
+ if (fileID == null && item.commentID != null) {
+ final comment =
+ await SocialDataProvider.instance.getCommentById(item.commentID!);
+ fileID = comment?.fileID;
+ }
+
+ if (fileID == null || !mounted) return;
+
+ unawaited(
+ routeToPage(
+ context,
+ FileCommentsScreen(
+ collectionID: item.collectionID,
+ fileID: fileID,
+ highlightCommentID: item.commentID,
+ ),
+ ),
+ );
+ }
+
+ /// Opens the photo viewer for the feed item.
+ Future<void> _openPhoto(FeedItem item) async {
var fileID = item.fileID;
if (fileID == null && item.commentID != null) {
@@ -197,45 +223,24 @@ class _FeedScreenState extends State<FeedScreen> {
if (fileID == null) return;
- // Load the file from DB
final file = await FilesDB.instance.getUploadedFile(
fileID,
item.collectionID,
);
if (file == null || !mounted) return;
- // Navigate based on feed item type
- if (item.type == FeedItemType.comment ||
- item.type == FeedItemType.reply ||
- item.type == FeedItemType.commentLike ||
- item.type == FeedItemType.replyLike) {
- // Open comments screen for comment-related items
- // For commentLike/replyLike, highlight the specific comment
- unawaited(
- routeToPage(
- context,
- FileCommentsScreen(
- collectionID: item.collectionID,
- fileID: fileID,
- highlightCommentID: item.commentID,
- ),
- ),
- );
- } else {
- // Open photo viewer for photoLike
- unawaited(
- routeToPage(
- context,
- DetailPage(
- DetailPageConfiguration(
- [file],
- 0,
- "feed_item",
- ),
+ unawaited(
+ routeToPage(
+ context,
+ DetailPage(
+ DetailPageConfiguration(
+ [file],
+ 0,
+ "feed_item",
),
- forceCustomPageRoute: true,
),
- );
- }
+ forceCustomPageRoute: true,
+ ),
+ );
}
}
diff --git a/mobile/apps/photos/lib/ui/social/widgets/feed_item_widget.dart b/mobile/apps/photos/lib/ui/social/widgets/feed_item_widget.dart
index c769d806ec..f299e7be1a 100644
--- a/mobile/apps/photos/lib/ui/social/widgets/feed_item_widget.dart
+++ b/mobile/apps/photos/lib/ui/social/widgets/feed_item_widget.dart
@@ -18,8 +18,13 @@ import "package:photos/ui/viewer/file/thumbnail_widget.dart";
class FeedItemWidget extends StatelessWidget {
final FeedItem feedItem;
final int currentUserID;
+
+ /// Called when the user taps on non-thumbnail areas (icon, avatar, text).
final VoidCallback? onTap;
+ /// Called when the user taps on the photo thumbnail.
+ final VoidCallback? onThumbnailTap;
+
/// Map of anonUserID -> decrypted display name for the collection.
final Map<String, String> anonDisplayNames;
@@ -27,6 +32,7 @@ class FeedItemWidget extends StatelessWidget {
required this.feedItem,
required this.currentUserID,
this.onTap,
+ this.onThumbnailTap,
this.anonDisplayNames = const {},
super.key,
});
@@ -35,50 +41,61 @@ class FeedItemWidget extends StatelessWidget {
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
- return GestureDetector(
- onTap: onTap,
- behavior: HitTestBehavior.opaque,
- child: Padding(
- padding: const EdgeInsets.symmetric(vertical: 18),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- // Feed type icon
- _FeedTypeIcon(type: feedItem.type),
- const SizedBox(width: 10),
- // Stacked avatars
- _StackedAvatars(
- feedItem: feedItem,
- currentUserID: currentUserID,
- anonDisplayNames: anonDisplayNames,
- ),
- const SizedBox(width: 10),
- // Text content
- Expanded(
- child: _FeedTextContent(
- feedItem: feedItem,
- currentUserID: currentUserID,
- anonDisplayNames: anonDisplayNames,
+ return Padding(
+ padding: const EdgeInsets.symmetric(vertical: 18),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ // Left side - tappable for comments
+ Expanded(
+ child: GestureDetector(
+ onTap: onTap,
+ behavior: HitTestBehavior.opaque,
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ // Feed type icon
+ _FeedTypeIcon(type: feedItem.type),
+ const SizedBox(width: 10),
+ // Stacked avatars
+ _StackedAvatars(
+ feedItem: feedItem,
+ currentUserID: currentUserID,
+ anonDisplayNames: anonDisplayNames,
+ ),
+ const SizedBox(width: 10),
+ // Text content
+ Expanded(
+ child: _FeedTextContent(
+ feedItem: feedItem,
+ currentUserID: currentUserID,
+ anonDisplayNames: anonDisplayNames,
+ ),
+ ),
+ ],
),
),
- const SizedBox(width: 12),
- // Photo thumbnail
- if (feedItem.fileID != null)
- _FeedThumbnail(
+ ),
+ const SizedBox(width: 12),
+ // Photo thumbnail - separate tap target
+ if (feedItem.fileID != null)
+ GestureDetector(
+ onTap: onThumbnailTap,
+ child: _FeedThumbnail(
fileID: feedItem.fileID!,
collectionID: feedItem.collectionID,
- )
- else
- Container(
- width: 66,
- height: 66,
- decoration: BoxDecoration(
- color: colorScheme.fillFaint,
- borderRadius: BorderRadius.circular(7.792),
- ),
),
- ],
- ),
+ )
+ else
+ Container(
+ width: 66,
+ height: 66,
+ decoration: BoxDecoration(
+ color: colorScheme.fillFaint,
+ borderRadius: BorderRadius.circular(7.792),
+ ),
+ ),
+ ],
),
);
}
diff --git a/mobile/apps/photos/lib/ui/social/widgets/feed_preview_widget.dart b/mobile/apps/photos/lib/ui/social/widgets/feed_preview_widget.dart
index e8f6cd590a..1265da10fe 100644
--- a/mobile/apps/photos/lib/ui/social/widgets/feed_preview_widget.dart
+++ b/mobile/apps/photos/lib/ui/social/widgets/feed_preview_widget.dart
@@ -125,6 +125,7 @@ class _FeedPreviewWidgetState extends State<FeedPreviewWidget> {
currentUserID: _currentUserID,
anonDisplayNames: _anonDisplayNames,
onTap: _onTap,
+ onThumbnailTap: _onTap,
),
),
Icon(