simplified code across the app and consolidated duplicated helpers
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
import 'dart:ui';
|
||||
|
||||
@@ -13,6 +12,7 @@ import '../session/session_manager.dart';
|
||||
import 'chat_thread_store.dart';
|
||||
import 'nid_store.dart';
|
||||
import 'push_renderer.dart';
|
||||
import 'push_target.dart';
|
||||
|
||||
/// Notification action identifiers shared between the renderer (which attaches
|
||||
/// the actions) and the response handlers (which dispatch them).
|
||||
@@ -93,8 +93,7 @@ class PushActions {
|
||||
// the mark-read action does. Best effort: a failure here must not
|
||||
// fail the already-delivered reply.
|
||||
await markRead(chatToken);
|
||||
}
|
||||
if (!result.ok) {
|
||||
} else {
|
||||
// Never swallow the typed message: surface the failure (and the
|
||||
// undelivered text) as its own notification. The nid mapping stays
|
||||
// alive — the thread notification is still in the tray.
|
||||
@@ -287,14 +286,6 @@ class PushActions {
|
||||
return raw == null ? null : int.tryParse(raw);
|
||||
}
|
||||
|
||||
static String? _payloadField(String? payload, String key) {
|
||||
if (payload == null || payload.isEmpty) return null;
|
||||
try {
|
||||
final map = jsonDecode(payload) as Map<String, dynamic>;
|
||||
final value = map[key];
|
||||
return value?.toString();
|
||||
} on Object {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
static String? _payloadField(String? payload, String key) =>
|
||||
decodeNotificationPayload(payload)?[key]?.toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user