BigPicture image notification again.
This commit is contained in:
1 parent
f415f0ad4e
commit
838773ba69
1 file changed
+16
-9
@@ -359,14 +359,27 @@ class NotificationService {
|
|||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Always MessagingStyle: Android Auto only handles messaging notifications
|
|
||||||
// in that style, so an image preview is shown as the large icon instead.
|
|
||||||
AndroidNotificationDetails _androidConversationDetails(
|
AndroidNotificationDetails _androidConversationDetails(
|
||||||
_Conversation conversation, {
|
_Conversation conversation, {
|
||||||
int? badgeCount,
|
int? badgeCount,
|
||||||
bool silent = false,
|
bool silent = false,
|
||||||
}) {
|
}) {
|
||||||
final imagePath = conversation.imagePath;
|
final imagePath = conversation.imagePath;
|
||||||
|
final styleInformation = imagePath != null
|
||||||
|
? BigPictureStyleInformation(
|
||||||
|
FilePathAndroidBitmap(imagePath),
|
||||||
|
contentTitle: conversation.title,
|
||||||
|
summaryText: _collapsedBody(conversation),
|
||||||
|
showBigPictureWhenCollapsed: true,
|
||||||
|
)
|
||||||
|
: MessagingStyleInformation(
|
||||||
|
Person(key: 'self', name: _selfName ?? _l10n.notification_you),
|
||||||
|
conversationTitle: conversation.isChannel
|
||||||
|
? conversation.title
|
||||||
|
: null,
|
||||||
|
groupConversation: conversation.isChannel,
|
||||||
|
messages: List<Message>.of(conversation.messages),
|
||||||
|
);
|
||||||
return AndroidNotificationDetails(
|
return AndroidNotificationDetails(
|
||||||
conversation.isChannel ? 'channel_messages' : 'messages',
|
conversation.isChannel ? 'channel_messages' : 'messages',
|
||||||
conversation.isChannel ? 'Channel Messages' : 'Messages',
|
conversation.isChannel ? 'Channel Messages' : 'Messages',
|
||||||
@@ -379,13 +392,7 @@ class NotificationService {
|
|||||||
number: badgeCount,
|
number: badgeCount,
|
||||||
silent: silent,
|
silent: silent,
|
||||||
category: AndroidNotificationCategory.message,
|
category: AndroidNotificationCategory.message,
|
||||||
largeIcon: imagePath != null ? FilePathAndroidBitmap(imagePath) : null,
|
styleInformation: styleInformation,
|
||||||
styleInformation: MessagingStyleInformation(
|
|
||||||
Person(key: 'self', name: _selfName ?? _l10n.notification_you),
|
|
||||||
conversationTitle: conversation.isChannel ? conversation.title : null,
|
|
||||||
groupConversation: conversation.isChannel,
|
|
||||||
messages: List<Message>.of(conversation.messages),
|
|
||||||
),
|
|
||||||
actions: _conversationActions(conversation.isChannel),
|
actions: _conversationActions(conversation.isChannel),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user