phonegap / phonegap-plugin-push

Register and receive push notifications
MIT License
1.94k stars 1.91k forks source link

Actionable alert event listener stopped working on iOS (2.3.0) #2889

Open sckumar opened 4 years ago

sckumar commented 4 years ago

Expected Behaviour

iOS actionable alert event listener should get called when user taps on action from the background push notification pushObject.on("Approve").subscribe(notification => { console.log("approved" + notification); });

Actual Behaviour

Rather than calling actionable alert event, it triggers pushObject.on("registration").subscribe((registration: any) => { console.log(notification.additionalData.foreground); // false }

Reproduce Scenario (including but not limited to)

Run the application on iOS 13.0 and above

Steps to Reproduce

1) Register with categories 2) Send actionable alert with push notification 3) Perform action from background push notification

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

iOS 13.x

Cordova CLI version and cordova platform version

Cordova version 9.0.3 (cordova-lib@9.0.2) Platform versions android 8.1.0 ios 5.1.1

Plugin version

2.3.0

Sample Push Data Payload

{ "aps": { "category": "authorize", "title": "Payment is pending for approval", "alert": "Payment of 3500 EUR is pending for your approval" }, "actionInfo": { "currentAction": "add", "nextAction": "approve", "referenceId": "11U5F1lGesVcxzo", "rejectionInfo": null } }

Sample Code that illustrates the problem

this.platform.ready().then(() => { const options: PushOptions = { android: {}, windows: {}, ios: { alert: "true", badge: true, sound: "true", categories: { authorize: { yes: { callback: "Approve", title: "Approve", foreground: true, destructive: false }, no: { callback: "Reject", title: "Reject", foreground: true, destructive: true } } } }; this.pushObject = this.push.init(options); this.pushObject.on("registration").subscribe((registration: any) => { } this.pushObject.on("notification").subscribe((notification: any) => { } this.setCallbacks(this.pushObject); }); setCallbacks(pushObject) { pushObject.on("Approve").subscribe(notification => { console.log("approved" + notification); }); pushObject.on("Reject").subscribe(notification => { console.log("approved" + notification); }); }

Logs taken while reproducing problem

sckumar commented 4 years ago

Can anyone please help me with this ?

razam217 commented 4 years ago

@sckumar did you find any solution to this issue? I'm facing similar issue. I've also created a ticket https://github.com/phonegap/phonegap-plugin-push/issues/2916.

rcavaliere-tootelo commented 4 years ago

Anybody ? I heard it was working before. I can't get it to work iOS 10.x.