showPushNotifications static method
Shows a push notification for the messages, if they've not been already showed. @param messages The list of messages.
Implementation
static Future<void> showPushNotifications(List<MBMessage> messages) async {
List<MBMessage> messagesToShow = [];
for (MBMessage message in messages) {
if (message.messageType == MBMessageType.push) {
bool needsToShowMessage = await _needsToShowMessage(message);
if (needsToShowMessage) {
messagesToShow.add(message);
}
}
}
if (messagesToShow.isNotEmpty) {
for (MBMessage message in messagesToShow) {
await _showPushNotificationForMessage(message);
}
}
}