TF-438 Apply new design for push notification

This commit is contained in:
dab246
2022-11-24 19:21:32 +07:00
committed by Dat H. Pham
parent 44bf37a246
commit f3f2c19f20
17 changed files with 86 additions and 70 deletions
@@ -44,7 +44,10 @@ class LocalNotificationConfig {
importance: Importance.max,
priority: Priority.high,
setAsGroupSummary: setAsGroup,
styleInformation: styleInformation
styleInformation: styleInformation,
channelShowBadge: true,
showWhen: true,
largeIcon: const DrawableResourceAndroidBitmap('@mipmap/ic_large_notification')
),
iOS: const DarwinNotificationDetails(
presentSound: true,
@@ -99,19 +99,18 @@ class LocalNotificationManager {
String? payload
}) async {
final inboxStyleInformation = InboxStyleInformation(
[title, message ?? ''],
contentTitle: (emailAddress?.asString() ?? '').addBlockTag('b'),
summaryText: (emailAddress?.asString() ?? '').addBlockTag('b'),
htmlFormatTitle: true,
htmlFormatContent: true,
[message?.addBlockTag('p', attribute: 'style="color:#6D7885;"') ?? ''],
htmlFormatLines: true,
contentTitle: title,
htmlFormatContentTitle: true,
summaryText: (emailAddress?.asString() ?? '').addBlockTag('b'),
htmlFormatSummaryText: true,
);
await _localNotificationsPlugin.show(
id.hashCode,
title.addBlockTag('b'),
message ?? '',
null,
null,
LocalNotificationConfig.instance.generateNotificationDetails(styleInformation: inboxStyleInformation),
payload: payload
);
@@ -123,11 +122,20 @@ class LocalNotificationManager {
?.getActiveNotifications();
if (activeNotifications != null && activeNotifications.isNotEmpty) {
final inboxStyleInformation = InboxStyleInformation(
[''],
summaryText: '${activeNotifications.length - 1} new emails'.addBlockTag('b'),
htmlFormatSummaryText: true,
);
await _localNotificationsPlugin.show(
1995,
'',
'',
LocalNotificationConfig.instance.generateNotificationDetails(setAsGroup: true)
null,
null,
LocalNotificationConfig.instance.generateNotificationDetails(
setAsGroup: true,
styleInformation: inboxStyleInformation
),
);
}
}