feat: Update app icons and display 'GIF' as message preview for GIF URLs in conversations.
This commit is contained in:
@@ -386,6 +386,20 @@ class _ConversationTile extends StatelessWidget {
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
static bool _isGifUrl(String text) {
|
||||
final lower = text.trim().toLowerCase();
|
||||
return lower.endsWith('.gif') ||
|
||||
lower.contains('giphy.com/') ||
|
||||
lower.contains('giphy.gif') ||
|
||||
lower.contains('tenor.com/');
|
||||
}
|
||||
|
||||
static String _formatPreview(String text) {
|
||||
if (text.isEmpty) return text;
|
||||
if (_isGifUrl(text)) return 'GIF';
|
||||
return text;
|
||||
}
|
||||
|
||||
String _resolveAvatarUrl(String? avatarKey) {
|
||||
if (avatarKey == null || avatarKey.isEmpty) return '';
|
||||
if (avatarKey.startsWith('http://') || avatarKey.startsWith('https://')) {
|
||||
@@ -402,7 +416,7 @@ class _ConversationTile extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final otherParty = conversation.otherParty;
|
||||
final avatarUrl = _resolveAvatarUrl(otherParty.avatar);
|
||||
final lastMessage = conversation.lastMessageText ?? '';
|
||||
final lastMessage = _formatPreview(conversation.lastMessageText ?? '');
|
||||
final timestamp = _formatTimestamp(conversation.lastMessageAt);
|
||||
final unread = conversation.unreadCount;
|
||||
final firstLetter = otherParty.name.isNotEmpty
|
||||
|
||||
Reference in New Issue
Block a user