Browse Source

neon: Always call push notification received handler

pull/217/head
jld3103 2 years ago
parent
commit
7632735477
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 17
      packages/neon/lib/src/utils/push_utils.dart

17
packages/neon/lib/src/utils/push_utils.dart

@ -64,17 +64,12 @@ class PushUtils {
if (notification.subject.delete ?? false) { if (notification.subject.delete ?? false) {
await localNotificationsPlugin.cancel(_getNotificationID(instance, notification)); await localNotificationsPlugin.cancel(_getNotificationID(instance, notification));
return; } else if (notification.subject.deleteAll ?? false) {
}
if (notification.subject.deleteAll ?? false) {
await localNotificationsPlugin.cancelAll(); await localNotificationsPlugin.cancelAll();
return; Global.onPushNotificationReceived?.call(instance);
} } else if (notification.type == 'background') {
if (notification.type == 'background') {
debugPrint('Got unknown background notification ${json.encode(notification.toJson())}'); debugPrint('Got unknown background notification ${json.encode(notification.toJson())}');
return; } else {
}
final localizations = await appLocalizationsFromSystem(); final localizations = await appLocalizationsFromSystem();
final platform = await getNeonPlatform(); final platform = await getNeonPlatform();
@ -113,7 +108,8 @@ class PushUtils {
), ),
linux: LinuxNotificationDetails( linux: LinuxNotificationDetails(
icon: AssetsLinuxIcon('assets/apps/${app.id}.svg'), icon: AssetsLinuxIcon('assets/apps/${app.id}.svg'),
urgency: notification.type == 'voip' ? LinuxNotificationUrgency.critical : LinuxNotificationUrgency.normal, urgency:
notification.type == 'voip' ? LinuxNotificationUrgency.critical : LinuxNotificationUrgency.normal,
), ),
), ),
payload: json.encode( payload: json.encode(
@ -125,6 +121,7 @@ class PushUtils {
).toJson(), ).toJson(),
), ),
); );
}
Global.onPushNotificationReceived?.call(instance); Global.onPushNotificationReceived?.call(instance);
} }

Loading…
Cancel
Save