|
|
@ -91,38 +91,40 @@ class PushUtils { |
|
|
|
debugPrint(s.toString()); |
|
|
|
debugPrint(s.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
final appID = notification?.app ?? pushNotification.subject.app ?? 'nextcloud'; |
|
|
|
if (notification?.shouldNotify ?? true) { |
|
|
|
String? appName = localizations.appImplementationName(appID); |
|
|
|
final appID = notification?.app ?? pushNotification.subject.app ?? 'nextcloud'; |
|
|
|
if (appName == '') { |
|
|
|
String? appName = localizations.appImplementationName(appID); |
|
|
|
debugPrint('Missing app name for $appID'); |
|
|
|
if (appName == '') { |
|
|
|
appName = null; |
|
|
|
debugPrint('Missing app name for $appID'); |
|
|
|
} |
|
|
|
appName = null; |
|
|
|
final title = (notification?.subject ?? pushNotification.subject.subject)!; |
|
|
|
} |
|
|
|
final message = (notification?.message.isNotEmpty ?? false) ? notification!.message : null; |
|
|
|
final title = (notification?.subject ?? pushNotification.subject.subject)!; |
|
|
|
final when = notification != null ? DateTime.parse(notification.datetime) : null; |
|
|
|
final message = (notification?.message.isNotEmpty ?? false) ? notification!.message : null; |
|
|
|
|
|
|
|
final when = notification != null ? DateTime.parse(notification.datetime) : null; |
|
|
|
|
|
|
|
|
|
|
|
await localNotificationsPlugin.show( |
|
|
|
await localNotificationsPlugin.show( |
|
|
|
_getNotificationID(instance, pushNotification), |
|
|
|
_getNotificationID(instance, pushNotification), |
|
|
|
message != null && appName != null ? '$appName: $title' : title, |
|
|
|
message != null && appName != null ? '$appName: $title' : title, |
|
|
|
message, |
|
|
|
message, |
|
|
|
NotificationDetails( |
|
|
|
NotificationDetails( |
|
|
|
android: AndroidNotificationDetails( |
|
|
|
android: AndroidNotificationDetails( |
|
|
|
appID, |
|
|
|
appID, |
|
|
|
appName ?? appID, |
|
|
|
appName ?? appID, |
|
|
|
subText: accounts.length > 1 && account != null ? account.client.humanReadableID : null, |
|
|
|
subText: accounts.length > 1 && account != null ? account.client.humanReadableID : null, |
|
|
|
groupKey: 'app_$appID', |
|
|
|
groupKey: 'app_$appID', |
|
|
|
icon: '@mipmap/ic_launcher', |
|
|
|
icon: '@mipmap/ic_launcher', |
|
|
|
when: when?.millisecondsSinceEpoch, |
|
|
|
when: when?.millisecondsSinceEpoch, |
|
|
|
color: themePrimaryColor, |
|
|
|
color: themePrimaryColor, |
|
|
|
category: pushNotification.type == 'voip' ? AndroidNotificationCategory.call : null, |
|
|
|
category: pushNotification.type == 'voip' ? AndroidNotificationCategory.call : null, |
|
|
|
importance: Importance.max, |
|
|
|
importance: Importance.max, |
|
|
|
priority: pushNotification.priority == 'high' |
|
|
|
priority: pushNotification.priority == 'high' |
|
|
|
? (pushNotification.type == 'voip' ? Priority.max : Priority.high) |
|
|
|
? (pushNotification.type == 'voip' ? Priority.max : Priority.high) |
|
|
|
: Priority.defaultPriority, |
|
|
|
: Priority.defaultPriority, |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
payload: json.encode(pushNotification.toJson()), |
|
|
|
payload: json.encode(pushNotification.toJson()), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Global.onPushNotificationReceived?.call(instance); |
|
|
|
Global.onPushNotificationReceived?.call(instance); |
|
|
|