implemented dual Nextcloud push registration with separate general and talk apptypes to ensure reliable Talk notification delivery; introduced stacked MessagingStyle notifications for chat threads with support for circular conversation avatars and disk caching
This commit is contained in:
@@ -15,8 +15,11 @@ class NotificationService {
|
||||
FlutterLocalNotificationsPlugin();
|
||||
|
||||
Future<void> initializeNotifications() async {
|
||||
// Dedicated monochrome status-bar icon: launcher mipmaps are unusable as
|
||||
// small icons because Android renders only their alpha silhouette (a
|
||||
// solid circle in the status bar).
|
||||
const androidSettings = AndroidInitializationSettings(
|
||||
'@mipmap/ic_launcher',
|
||||
'@drawable/ic_stat_notification',
|
||||
);
|
||||
|
||||
// iOS Talk category mirrors the Android inline reply + mark-as-read actions
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_app_badge/flutter_app_badge.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../push/chat_thread_store.dart';
|
||||
import '../routing/app_routes.dart';
|
||||
import '../state/app/modules/chat_list/bloc/chat_list_bloc.dart';
|
||||
import 'notification_service.dart';
|
||||
@@ -25,9 +26,9 @@ class NotificationTasks {
|
||||
}
|
||||
}
|
||||
|
||||
/// Per-chat tag scheme. MUST match the Notify backend, which sets this
|
||||
/// value on `AndroidNotification.setTag` AND `apns-collapse-id`.
|
||||
static String chatTag(String chatToken) => 'talk_$chatToken';
|
||||
/// Per-chat tag scheme — canonical definition lives beside the stacked
|
||||
/// notification id in chat_thread_store.dart.
|
||||
static String chatTag(String chatToken) => chatNotificationTag(chatToken);
|
||||
|
||||
/// Removes tray notifications belonging to [chatToken]. Eraser handles
|
||||
/// iOS (where the plugin's `getActiveNotifications` returns null ids
|
||||
@@ -54,6 +55,13 @@ class NotificationTasks {
|
||||
} on Object catch (e) {
|
||||
log('Active-notification sweep failed: $e');
|
||||
}
|
||||
// Drop the stacked-notification history too — otherwise the next push
|
||||
// would resurrect all already-read messages in the new notification.
|
||||
try {
|
||||
await ChatThreadStore().clearChat(chatToken);
|
||||
} on Object catch (e) {
|
||||
log('Chat thread cleanup failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
/// Refreshes the chat list. Deliberately does NOT touch [ChatBloc] —
|
||||
|
||||
Reference in New Issue
Block a user