From 7e0a0d9d03901ca049b241dbfc2cc9844104308b Mon Sep 17 00:00:00 2001 From: provokateurin Date: Mon, 28 Oct 2024 19:40:42 +0100 Subject: [PATCH] feat(neon_framework): Use big text style for push notifications Signed-off-by: provokateurin --- .../lib/src/utils/push_utils.dart | 2 ++ .../neon_framework/test/push_utils_test.dart | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/neon_framework/lib/src/utils/push_utils.dart b/packages/neon_framework/lib/src/utils/push_utils.dart index 694283fbc51..3d0d2907e35 100644 --- a/packages/neon_framework/lib/src/utils/push_utils.dart +++ b/packages/neon_framework/lib/src/utils/push_utils.dart @@ -76,6 +76,7 @@ class PushUtils { String accountID, { @visibleForTesting http.Client? httpClient, }) async { + _log.fine('Received a push notification.'); await onPushNotificationReceived?.call(accountID); WidgetsFlutterBinding.ensureInitialized(); @@ -181,6 +182,7 @@ class PushUtils { priority: pushNotification.priority == 'high' ? (pushNotification.type == 'voip' ? Priority.max : Priority.high) : Priority.defaultPriority, + styleInformation: message != null ? BigTextStyleInformation(message) : null, ), ), payload: json.encode(pushNotification.toJson()), diff --git a/packages/neon_framework/test/push_utils_test.dart b/packages/neon_framework/test/push_utils_test.dart index 3cb31d6efa3..54b19c01898 100644 --- a/packages/neon_framework/test/push_utils_test.dart +++ b/packages/neon_framework/test/push_utils_test.dart @@ -296,7 +296,8 @@ void main() { d.color == NcColors.primary && d.category == null && d.importance == Importance.max && - d.priority == Priority.defaultPriority, + d.priority == Priority.defaultPriority && + d.styleInformation == null, ), ), payload: payload, @@ -321,7 +322,8 @@ void main() { d.color == NcColors.primary && d.category == null && d.importance == Importance.defaultImportance && - d.priority == Priority.defaultPriority, + d.priority == Priority.defaultPriority && + (d.styleInformation! as InboxStyleInformation).summaryText == 'app', ), ), ), @@ -455,7 +457,8 @@ void main() { d.color == NcColors.primary && d.category == null && d.importance == Importance.max && - d.priority == Priority.defaultPriority, + d.priority == Priority.defaultPriority && + (d.styleInformation! as BigTextStyleInformation).bigText == 'message', ), ), payload: payload, @@ -480,7 +483,8 @@ void main() { d.color == NcColors.primary && d.category == null && d.importance == Importance.defaultImportance && - d.priority == Priority.defaultPriority, + d.priority == Priority.defaultPriority && + (d.styleInformation! as InboxStyleInformation).summaryText == 'Files', ), ), ), @@ -527,7 +531,8 @@ void main() { d.color == NcColors.primary && d.category == AndroidNotificationCategory.call && d.importance == Importance.max && - d.priority == Priority.max, + d.priority == Priority.max && + d.styleInformation == null, ), ), payload: payload, @@ -552,7 +557,8 @@ void main() { d.color == NcColors.primary && d.category == null && d.importance == Importance.defaultImportance && - d.priority == Priority.defaultPriority, + d.priority == Priority.defaultPriority && + (d.styleInformation! as InboxStyleInformation).summaryText == 'app', ), ), ),