phonegap/phonegap-plugin-push

Action Buttons are not working on IOS (event doesn't trigger, instead it only opens app)

razam217 opened this issue · 3 comments

NOTE: This was working before (not sure when it stopped working) on both IOS and Android.

Expected Behaviour

On clicking notification action button, it should trigger the corresponding event, e.g. on('applyTimeline') should trigger.
On Android, it is working perfectly fine.

Actual Behaviour

On clicking notification action button, it only opens the app, and on('notification') event triggers.

Reproduce Scenario (including but not limited to)

Every time I receive notification (with category that contains action buttons), the buttons do not work.

Steps to Reproduce

  • IOS App
  • Send Notification

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

iOS 12.4.6

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

iPhone 5s

Cordova CLI version and cordova platform version

cordova --version                                    # 9.0.0
cordova platform version ios                     # 5.1.1

Plugin version

cordova plugin version | grep phonegap-plugin-push   # 2.3.0

Sample Push Data Payload

I receive following payload when I get notification:

{
	title: “Timeline Event”,
	message: “Timelin Event Message”,
	additionalData: {
		category: “automation”,
		coldstart: false,
		customAction: “automation”,
		foreground: true,
		sceneNo: 2,
		showInApp: 1,
		timelineID: 3351
	}
}

Sample Code that illustrates the problem

var push = window.PushNotification.init({
    android: {
        senderID: keyAndroid,
        icon: 'icon_grey'
    },
    ios: {
        alert: true,
        badge: false,
        sound: true,
        clearBadge: true,
        categories: {
            'automation': {
                'yes': {
                    'callback': 'applyTimeline',
                    'title': localizationService.getTranslatedString('notificationActionApplyNow'),
                    'foreground': true,
                    'destructive': false
                },
                'no': {
                    'callback': 'ignoreTimeline',
                    'title': localizationService.getTranslatedString('notificationActionIgnore'),
                    'foreground': true,
                    'destructive': false
                }
            }
        }
    }
});

push.on('applyTimeline', function(data) {
    window.applyTimeline(data, function() {
        push.finish(function() {}, function() {}, data.additionalData.notId);
    });
});
push.on('ignoreTimeline', function(data) {
    window.ignoreTimeline(data, function() {
        push.finish(function() {}, function() {}, data.additionalData.notId);
    });
});

push.on('registration', function(data) {
    console.log(data);
});
push.on('notification', function(data) {
    console.log(data);
});
push.on('error', function(e) {
    console.log(e);
});

Logs taken while reproducing problem

@macdonst can you please look into this issue why is this happening.

I have the same problem. on('notification') is called but not the specific callback from the action button. I expect on('notification') NOT to be called on such event. Works fine on Android. Tested on an iPad 4.4 running iOS 10.x. Push plugin 2.3.0

i also have the same issue (only iOS) after upgrading the push plugin to 2.3.0