refactored internal documentation and simplified comments across chat BLoCs, file viewer, and navigation components
This commit is contained in:
@@ -10,12 +10,10 @@ import '../widget/debug/json_viewer.dart';
|
||||
import '../widget/info_dialog.dart';
|
||||
import 'notification_tasks.dart';
|
||||
|
||||
// `vm:entry-point` on the class so AOT tree-shaking doesn't drop it: the
|
||||
// FCM background handler runs in a fresh isolate that looks up the class
|
||||
// by name from native code.
|
||||
// `vm:entry-point` keeps this alive through AOT tree-shaking — the FCM
|
||||
// background isolate looks the class up by name from native code.
|
||||
@pragma('vm:entry-point')
|
||||
class NotificationController {
|
||||
// Notification display is handled by the Firebase SDK using server-generated payloads.
|
||||
@pragma('vm:entry-point')
|
||||
static Future<void> onBackgroundMessageHandler(RemoteMessage message) async {
|
||||
NotificationTasks.updateBadgeCount(message);
|
||||
@@ -27,10 +25,8 @@ class NotificationController {
|
||||
) async {
|
||||
final pushToken = _extractChatToken(message);
|
||||
final chatBloc = context.read<ChatBloc>();
|
||||
// hasOpenChat (not currentToken) is the source of truth here:
|
||||
// currentToken sticks around after leaveChat so that didPopNext can
|
||||
// re-claim a stacked chat. Using it would suppress notifications for
|
||||
// the last-opened chat even after the user has navigated away.
|
||||
// hasOpenChat, not currentToken: currentToken sticks around after
|
||||
// leaveChat so didPopNext can re-claim a stacked chat.
|
||||
final activeToken = chatBloc.state.data?.currentToken ?? '';
|
||||
final chatIsOpen =
|
||||
chatBloc.hasOpenChat &&
|
||||
@@ -41,8 +37,7 @@ class NotificationController {
|
||||
NotificationTasks.updateBadgeCount(message);
|
||||
|
||||
if (chatIsOpen) {
|
||||
// Long-poll already fetches the message and moves the marker; just
|
||||
// dismiss any tray entry that slipped through foreground rendering.
|
||||
// Long-poll handles the message; just dismiss any stray tray entry.
|
||||
unawaited(NotificationTasks.clearNotificationsForChat(pushToken));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user