mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-12 03:27:06 +10:00
UI fix
This commit is contained in:
@@ -27,6 +27,10 @@ class NotificationService {
|
||||
|
||||
AppLocalizations get _l10n => lookupAppLocalizations(_locale);
|
||||
|
||||
String _logSafe(String value) {
|
||||
return Uri.encodeComponent(value.replaceAll('\n', ' '));
|
||||
}
|
||||
|
||||
// Rate limiting to prevent notification storms
|
||||
// (Added after getting notification-flooded while evaluating RF flood management. The irony.)
|
||||
static const _minNotificationInterval = Duration(seconds: 3);
|
||||
@@ -322,11 +326,11 @@ class NotificationService {
|
||||
String _getNotificationIdentifier(_PendingNotification n) {
|
||||
switch (n.type) {
|
||||
case _NotificationType.advert:
|
||||
return n.body;
|
||||
return _logSafe(n.body);
|
||||
case _NotificationType.message:
|
||||
return 'from: ${n.title}';
|
||||
return 'from: ${_logSafe(n.title)}';
|
||||
case _NotificationType.channelMessage:
|
||||
return 'in: ${n.title}';
|
||||
return 'in: ${_logSafe(n.title)}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -572,7 +576,7 @@ class NotificationService {
|
||||
|
||||
// Show first few device names in batch summary for debugging (only if adverts exist)
|
||||
final deviceInfo = adverts.isNotEmpty
|
||||
? ' (${adverts.take(5).map((n) => n.body).join(', ')}${adverts.length > 5 ? ', ...' : ''})'
|
||||
? ' (${adverts.take(5).map((n) => _logSafe(n.body)).join(', ')}${adverts.length > 5 ? ', ...' : ''})'
|
||||
: '';
|
||||
debugPrint('[Notification] batch summary: ${parts.join(", ")}$deviceInfo');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user