TF-1599 Handle remove notification when email mask as read or delete permanent
(cherry picked from commit 1abcc61474728cadca024d21eba43aaf4f09a078)
This commit is contained in:
+1
@@ -9,6 +9,7 @@ class LocalNotificationConfig {
|
||||
static const _channelDescription = 'Team Mail notifications';
|
||||
static const notificationTitle = 'Team Mail';
|
||||
static const notificationMessage = 'You have new messages';
|
||||
static const int groupNotificationId = 1995;
|
||||
|
||||
static const iosInitializationSettings = DarwinInitializationSettings();
|
||||
|
||||
|
||||
+16
-1
@@ -151,6 +151,10 @@ class LocalNotificationManager {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> removeNotification(String id) {
|
||||
return _localNotificationsPlugin.cancel(id.hashCode);
|
||||
}
|
||||
|
||||
void groupPushNotification() async {
|
||||
if (Platform.isIOS) {
|
||||
return;
|
||||
@@ -170,7 +174,7 @@ class LocalNotificationManager {
|
||||
);
|
||||
|
||||
await _localNotificationsPlugin.show(
|
||||
1995,
|
||||
LocalNotificationConfig.groupNotificationId,
|
||||
null,
|
||||
null,
|
||||
LocalNotificationConfig.instance.generateNotificationDetails(
|
||||
@@ -181,6 +185,17 @@ class LocalNotificationManager {
|
||||
}
|
||||
}
|
||||
|
||||
void removeGroupPushNotification() async {
|
||||
final activeNotifications = await _localNotificationsPlugin
|
||||
.resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>()
|
||||
?.getActiveNotifications();
|
||||
log('LocalNotificationManager::removeGroupPushNotification():activeNotifications: ${activeNotifications?.length}');
|
||||
if (activeNotifications == null || activeNotifications.length <= 1) {
|
||||
log('LocalNotificationManager::groupPushNotification():canceled');
|
||||
await _localNotificationsPlugin.cancel(LocalNotificationConfig.groupNotificationId);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> recreateStreamController() {
|
||||
if (localNotificationsController.isClosed) {
|
||||
localNotificationsController = StreamController<NotificationResponse>.broadcast();
|
||||
|
||||
Reference in New Issue
Block a user