TF-1369 Fix [FCM] Unsupported operation Platform

This commit is contained in:
dab246
2023-01-03 15:13:30 +07:00
committed by Dat H. Pham
parent 9301c0350b
commit eec4418e60
4 changed files with 21 additions and 7 deletions
@@ -2,6 +2,7 @@
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:core/utils/app_logger.dart';
import 'package:core/utils/build_utils.dart';
import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
import 'package:model/email/presentation_email.dart';
@@ -143,12 +144,16 @@ class EmailChangeListener extends ChangeListener {
if (_newState != null) {
_storeEmailDeliveryStateAction(_newState!);
for (var presentationEmail in success.emailList) {
_showLocalNotification(presentationEmail, _newState!);
if (!BuildUtils.isWeb) {
for (var presentationEmail in success.emailList) {
_showLocalNotification(presentationEmail, _newState!);
}
}
}
LocalNotificationManager.instance.groupPushNotification();
if (!BuildUtils.isWeb) {
LocalNotificationManager.instance.groupPushNotification();
}
}
}
@@ -38,6 +38,7 @@ class LocalNotificationManager {
} catch (e) {
logError('LocalNotificationManager::setUp(): ERROR: ${e.toString()}');
}
return Future.value();
}
bool get isOpenAppByNotification => _notificationAppLaunchDetails?.didNotificationLaunchApp ?? false;
@@ -141,6 +142,10 @@ class LocalNotificationManager {
}
void groupPushNotification() async {
if (Platform.isIOS) {
return;
}
final activeNotifications = await _localNotificationsPlugin
.resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>()
?.getActiveNotifications();