From 8d450d324fce63fdab22f7d4b2f360f23941f85a Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 30 May 2019 16:56:38 +0200 Subject: [PATCH] MOBILE-3039 push: Fix crash when push received in foreground in iOS --- src/core/pushnotifications/providers/pushnotifications.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/pushnotifications/providers/pushnotifications.ts b/src/core/pushnotifications/providers/pushnotifications.ts index 992a311be..c61bf7a29 100644 --- a/src/core/pushnotifications/providers/pushnotifications.ts +++ b/src/core/pushnotifications/providers/pushnotifications.ts @@ -419,6 +419,7 @@ export class CorePushNotificationsProvider { channel: 'PushPluginChannel' }, promises = [], + isAndroid = this.platform.is('android'), extraFeatures = this.utils.isTrueOrOne(data.extrafeatures); // Apply formatText to title and message. @@ -432,7 +433,7 @@ export class CorePushNotificationsProvider { // Error formatting, use the original message. return notification.message; }).then((formattedMessage) => { - if (extraFeatures && this.utils.isFalseOrZero(data.notif)) { + if (extraFeatures && isAndroid && this.utils.isFalseOrZero(data.notif)) { // It's a message, use messaging style. Ionic Native doesn't specify this option. ( localNotif).text = [ { @@ -445,7 +446,7 @@ export class CorePushNotificationsProvider { } })); - if (extraFeatures) { + if (extraFeatures && isAndroid) { // Use a different icon if needed. localNotif.icon = notification.image; // This feature isn't supported by the official plugin, we use a fork.