Summarize location, image and GIF messages in notifications
Notification bodies now use the chat's parsers to show a localized summary for shared locations (m: markers), channel images, GIFs and reactions instead of the raw payload. The marker parser moves out of the map screen into helpers/marker_message.dart so the service can use it.
This commit is contained in:
1 parent
ed5884e252
commit
caf20b4415
28 files changed
+575
-36
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import 'package:latlong2/latlong.dart';
|
||||
|
||||
class MarkerPayload {
|
||||
final LatLng position;
|
||||
final String label;
|
||||
final String flags;
|
||||
|
||||
MarkerPayload({
|
||||
required this.position,
|
||||
required this.label,
|
||||
required this.flags,
|
||||
});
|
||||
}
|
||||
|
||||
/// Parse a shared marker text message of the form
|
||||
/// `m:<lat>,<lon>|<label>|<flags>` and return a [MarkerPayload].
|
||||
MarkerPayload? parseMarkerText(String text) {
|
||||
final trimmed = text.trim();
|
||||
final match = RegExp(
|
||||
r'm:([\-0-9.]+),([\-0-9.]+)\|([^|]*)\|(.*)',
|
||||
).firstMatch(trimmed);
|
||||
if (match == null) return null;
|
||||
final lat = double.tryParse(match.group(1) ?? '');
|
||||
final lon = double.tryParse(match.group(2) ?? '');
|
||||
if (lat == null || lon == null) return null;
|
||||
if (lat.abs() > 90 || lon.abs() > 180) return null;
|
||||
final label = (match.group(3) ?? '').trim();
|
||||
final flags = (match.group(4) ?? '').trim();
|
||||
return MarkerPayload(position: LatLng(lat, lon), label: label, flags: flags);
|
||||
}
|
||||
@@ -2711,6 +2711,25 @@
|
||||
}
|
||||
},
|
||||
"notification_receivedNewMessage": "Received new message",
|
||||
"notification_sharedLocation": "Shared a location",
|
||||
"notification_sharedLocationNamed": "Shared a location: {label}",
|
||||
"@notification_sharedLocationNamed": {
|
||||
"placeholders": {
|
||||
"label": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"notification_reacted": "Reacted {emoji}",
|
||||
"@notification_reacted": {
|
||||
"placeholders": {
|
||||
"emoji": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
},
|
||||
"notification_sentGif": "Sent a GIF",
|
||||
"notification_sentImage": "Sent an image",
|
||||
"notification_actionReply": "Reply",
|
||||
"notification_actionMarkRead": "Mark as read",
|
||||
"notification_actionMuteChannel": "Mute channel",
|
||||
|
||||
@@ -8138,6 +8138,36 @@ abstract class AppLocalizations {
|
||||
/// **'Received new message'**
|
||||
String get notification_receivedNewMessage;
|
||||
|
||||
/// No description provided for @notification_sharedLocation.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Shared a location'**
|
||||
String get notification_sharedLocation;
|
||||
|
||||
/// No description provided for @notification_sharedLocationNamed.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Shared a location: {label}'**
|
||||
String notification_sharedLocationNamed(String label);
|
||||
|
||||
/// No description provided for @notification_reacted.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Reacted {emoji}'**
|
||||
String notification_reacted(String emoji);
|
||||
|
||||
/// No description provided for @notification_sentGif.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Sent a GIF'**
|
||||
String get notification_sentGif;
|
||||
|
||||
/// No description provided for @notification_sentImage.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Sent an image'**
|
||||
String get notification_sentImage;
|
||||
|
||||
/// No description provided for @notification_actionReply.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
||||
@@ -4768,6 +4768,25 @@ class AppLocalizationsBg extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => 'Получено ново съобщение';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => 'Отговори';
|
||||
|
||||
|
||||
@@ -4779,6 +4779,25 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => 'Neue Nachricht empfangen';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => 'Antworten';
|
||||
|
||||
|
||||
@@ -4703,6 +4703,25 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => 'Received new message';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => 'Reply';
|
||||
|
||||
|
||||
@@ -4770,6 +4770,25 @@ class AppLocalizationsEs extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => 'Nuevo mensaje recibido';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => 'Responder';
|
||||
|
||||
|
||||
@@ -4789,6 +4789,25 @@ class AppLocalizationsFr extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => 'Nouveau message reçu';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => 'Répondre';
|
||||
|
||||
|
||||
@@ -4767,6 +4767,25 @@ class AppLocalizationsHu extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => 'Új üzenet érkezett';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => 'Válasz';
|
||||
|
||||
|
||||
@@ -4776,6 +4776,25 @@ class AppLocalizationsIt extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => 'Nuovo messaggio ricevuto';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => 'Rispondi';
|
||||
|
||||
|
||||
@@ -4539,6 +4539,25 @@ class AppLocalizationsJa extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => '新しいメッセージを受信';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => '返信';
|
||||
|
||||
|
||||
@@ -4550,6 +4550,25 @@ class AppLocalizationsKo extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => '새로운 메시지를 받았습니다';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => '답장';
|
||||
|
||||
|
||||
@@ -4745,6 +4745,25 @@ class AppLocalizationsNl extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => 'Nieuw bericht ontvangen';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => 'Reageren';
|
||||
|
||||
|
||||
@@ -4802,6 +4802,25 @@ class AppLocalizationsPl extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => 'Otrzymano nową wiadomość';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => 'Odpowiedz';
|
||||
|
||||
|
||||
@@ -4772,6 +4772,25 @@ class AppLocalizationsPt extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => 'Nova mensagem recebida';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => 'Responder';
|
||||
|
||||
|
||||
@@ -4786,6 +4786,25 @@ class AppLocalizationsRu extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => 'Получено новое сообщение';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => 'Ответить';
|
||||
|
||||
|
||||
@@ -4756,6 +4756,25 @@ class AppLocalizationsSk extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => 'Prijatá nová správa';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => 'Odpovedať';
|
||||
|
||||
|
||||
@@ -4757,6 +4757,25 @@ class AppLocalizationsSl extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => 'Prejeto novo sporočilo';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => 'Odgovori';
|
||||
|
||||
|
||||
@@ -4727,6 +4727,25 @@ class AppLocalizationsSv extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => 'Nytt meddelande mottaget';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => 'Svara';
|
||||
|
||||
|
||||
@@ -4785,6 +4785,25 @@ class AppLocalizationsUk extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => 'Отримано нове повідомлення';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => 'Відповісти';
|
||||
|
||||
|
||||
@@ -4429,6 +4429,25 @@ class AppLocalizationsZh extends AppLocalizations {
|
||||
@override
|
||||
String get notification_receivedNewMessage => '收到新消息';
|
||||
|
||||
@override
|
||||
String get notification_sharedLocation => 'Shared a location';
|
||||
|
||||
@override
|
||||
String notification_sharedLocationNamed(String label) {
|
||||
return 'Shared a location: $label';
|
||||
}
|
||||
|
||||
@override
|
||||
String notification_reacted(String emoji) {
|
||||
return 'Reacted $emoji';
|
||||
}
|
||||
|
||||
@override
|
||||
String get notification_sentGif => 'Sent a GIF';
|
||||
|
||||
@override
|
||||
String get notification_sentImage => 'Sent an image';
|
||||
|
||||
@override
|
||||
String get notification_actionReply => '回复';
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import '../helpers/chat_scroll_controller.dart';
|
||||
import '../connector/meshcore_protocol.dart';
|
||||
import '../helpers/cyr2lat.dart';
|
||||
import '../helpers/gif_helper.dart';
|
||||
import '../helpers/marker_message.dart';
|
||||
import '../helpers/message_url_image_helper.dart';
|
||||
import '../helpers/path_helper.dart';
|
||||
import '../helpers/reaction_helper.dart';
|
||||
|
||||
@@ -20,6 +20,7 @@ import '../widgets/message_status_icon.dart';
|
||||
import '../widgets/empty_state.dart';
|
||||
import '../helpers/chat_scroll_controller.dart';
|
||||
import '../helpers/gif_helper.dart';
|
||||
import '../helpers/marker_message.dart';
|
||||
import '../models/channel_message.dart';
|
||||
import '../models/contact.dart';
|
||||
import '../l10n/contact_localization.dart';
|
||||
|
||||
@@ -45,6 +45,7 @@ import '../widgets/repeater_login_dialog.dart';
|
||||
import '../widgets/room_login_dialog.dart';
|
||||
import '../widgets/set_my_location_dialog.dart';
|
||||
import '../helpers/guessed_location_estimator.dart';
|
||||
import '../helpers/marker_message.dart';
|
||||
import '../helpers/snack_bar_builder.dart';
|
||||
import '../helpers/utf8_length_limiter.dart';
|
||||
import 'repeater_hub_screen.dart';
|
||||
@@ -4369,35 +4370,6 @@ class _GuessedLocation {
|
||||
});
|
||||
}
|
||||
|
||||
class MarkerPayload {
|
||||
final LatLng position;
|
||||
final String label;
|
||||
final String flags;
|
||||
|
||||
MarkerPayload({
|
||||
required this.position,
|
||||
required this.label,
|
||||
required this.flags,
|
||||
});
|
||||
}
|
||||
|
||||
/// Parse a shared marker text message of the form
|
||||
/// `m:<lat>,<lon>|<label>|<flags>` and return a [MarkerPayload].
|
||||
MarkerPayload? parseMarkerText(String text) {
|
||||
final trimmed = text.trim();
|
||||
final match = RegExp(
|
||||
r'm:([\-0-9.]+),([\-0-9.]+)\|([^|]*)\|(.*)',
|
||||
).firstMatch(trimmed);
|
||||
if (match == null) return null;
|
||||
final lat = double.tryParse(match.group(1) ?? '');
|
||||
final lon = double.tryParse(match.group(2) ?? '');
|
||||
if (lat == null || lon == null) return null;
|
||||
if (lat.abs() > 90 || lon.abs() > 180) return null;
|
||||
final label = (match.group(3) ?? '').trim();
|
||||
final flags = (match.group(4) ?? '').trim();
|
||||
return MarkerPayload(position: LatLng(lat, lon), label: label, flags: flags);
|
||||
}
|
||||
|
||||
/// Build a normalized dedupe key for shared markers.
|
||||
/// Keeps the same algorithm previously present in both chat and map screens.
|
||||
String buildSharedMarkerKey({
|
||||
|
||||
@@ -8,12 +8,15 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
|
||||
import '../helpers/gif_helper.dart';
|
||||
import '../helpers/marker_message.dart';
|
||||
import '../helpers/message_url_image_helper.dart';
|
||||
import '../helpers/reaction_helper.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../storage/prefs_manager.dart';
|
||||
import '../utils/platform_info.dart';
|
||||
import 'notification_reply.dart';
|
||||
import 'received_image_store.dart' show ReceivedImageRef;
|
||||
|
||||
class NotificationService {
|
||||
static final NotificationService _instance = NotificationService._internal();
|
||||
@@ -278,15 +281,26 @@ class NotificationService {
|
||||
await requestPermissions();
|
||||
}
|
||||
|
||||
/// Format special message types for human-readable notifications.
|
||||
static String formatNotificationText(String text) {
|
||||
/// Summarizes structured payloads (reactions, images, GIFs, shared
|
||||
/// locations) with the same parsers the chat bubbles use; other text is
|
||||
/// returned unchanged.
|
||||
static String formatNotificationText(String text, AppLocalizations l10n) {
|
||||
final trimmed = text.trim();
|
||||
final reaction = ReactionHelper.parseReaction(trimmed);
|
||||
if (reaction != null) {
|
||||
return 'Reacted ${reaction.emoji}';
|
||||
return l10n.notification_reacted(reaction.emoji);
|
||||
}
|
||||
if (RegExp(r'^g:[A-Za-z0-9_-]+$').hasMatch(trimmed)) {
|
||||
return 'Sent a GIF';
|
||||
if (ReceivedImageRef.parse(trimmed) != null) {
|
||||
return l10n.notification_sentImage;
|
||||
}
|
||||
if (GifHelper.parseGif(trimmed) != null) {
|
||||
return l10n.notification_sentGif;
|
||||
}
|
||||
final marker = parseMarkerText(trimmed);
|
||||
if (marker != null) {
|
||||
return marker.label.isEmpty
|
||||
? l10n.notification_sharedLocation
|
||||
: l10n.notification_sharedLocationNamed(marker.label);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
@@ -397,7 +411,7 @@ class NotificationService {
|
||||
message,
|
||||
urlImagesEnabled: urlImagesEnabled,
|
||||
);
|
||||
final preview = formatNotificationText(message.trim());
|
||||
final preview = formatNotificationText(message.trim(), _l10n);
|
||||
final body = preview.isEmpty
|
||||
? _l10n.notification_receivedNewMessage
|
||||
: preview;
|
||||
|
||||
Reference in new issue
Block a user