This commit is contained in:
pradeepkumar
2026-03-28 02:21:36 +05:30
parent 40410c9972
commit 5909b7bf97
3 changed files with 70 additions and 52 deletions

View File

@@ -318,7 +318,7 @@ class _NotificationsScreenState extends ConsumerState<NotificationsScreen> {
),
const SizedBox(height: 2),
Text(
notification.description,
_formatDescription(notification.description),
style: TextStyle(
fontFamily: 'SourceSerif4',
fontSize: 14,
@@ -425,6 +425,18 @@ class _NotificationsScreenState extends ConsumerState<NotificationsScreen> {
}
}
String _formatDescription(String description) {
final trimmed = description.trim();
// Detect raw URLs (image/gif links) and show friendly text instead
if (trimmed.startsWith('http://') || trimmed.startsWith('https://')) {
final lower = trimmed.toLowerCase();
if (lower.contains('.gif')) return 'Sent a GIF';
if (lower.contains('.png') || lower.contains('.jpg') || lower.contains('.jpeg') || lower.contains('.webp')) return 'Sent an image';
return 'Sent a link';
}
return description;
}
String _timeAgo(DateTime dateTime) {
final now = DateTime.now();
final diff = now.difference(dateTime);