Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

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

Open
razam217 opened this issue May 21, 2020 · 3 comments

Comments

@razam217
Copy link

razam217 commented May 21, 2020

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

@razam217
Copy link
Author

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

@rcavaliere-tootelo
Copy link

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

@appzer
Copy link

appzer commented Aug 5, 2020

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants