private async sendMobilePushes(
pushNotifications: PushNotifications,
mobiles: DestinationDevice[],
generatedPushData: pushGeneratorResult,
) {
if (mobiles.length === 0) {
return;
}
const params = {
action: 'route',
routingUri: generatedPushData.routingUri,
sender: undefined,
};
const data: PushNotifications.Data = {
title: generatedPushData.title,
body: generatedPushData.body,
topic: this.pushSettings.topic,
clickAction: 'FLUTTER_NOTIFICATION_CLICK',
icon: generatedPushData.icon,
sound: 'default',
badge: 0,
custom: params,
};
const mobileTokens =
mobiles.map(x => x.cloudToken);
if (mobileTokens.length > 0) {
const result = await pushNotifications.send(mobileTokens, data);
this.logPushResult(result);
}
}