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

iOS notification from cold boot #117

Closed
Deathspike opened this issue Sep 9, 2015 · 4 comments
Closed

iOS notification from cold boot #117

Deathspike opened this issue Sep 9, 2015 · 4 comments
Labels

Comments

@Deathspike
Copy link

When the application has been killed completely, and a notification is tapped in the action center, the application launches but does not process the notification correctly. This is the flow of actions that occurred during my investigation:

  1. didReceiveRemoteNotification is fired; stores the notification as launchNotification.
  2. applicationDidBecomeActive is fired; uses launchNotification to invoke notificationReceived.
  3. notificationReceived is fired; processes and fires it into JavaScript world.
  4. Cordova becomes ready, init is fired, and JavaScript event handlers are attached.

At (4), the notification from (3) is lost. Some observations to handle the situation gracefully:

  1. notificationReceived does not check if the callbackId is registered yet (L244).
  2. init recognizes a pending notificationMessage and invokes notificationReceived (L111).

So, notificationReceived merely needs to check if callbackId is available. Replace:

if (notificationMessage)

On https://github.com/phonegap/phonegap-plugin-push/blob/master/src/ios/PushPlugin.m#L244 with:

if (notificationMessage && self.callbackId != nil)

A pull request seemed like overkill for a one-line change. I'd appreciate it if this was merged 👍

@macdonst macdonst added the bug label Sep 9, 2015
@macdonst
Copy link
Member

@Deathspike Line 244 is:

[self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];

so maybe a pull request or point me at exact line.

@Deathspike
Copy link
Author

Change:

if (notificationMessage)

On https://github.com/phonegap/phonegap-plugin-push/blob/master/src/ios/PushPlugin.m#L186 with:

if (notificationMessage && self.callbackId != nil)

Not sure how it ended up with L244 earlier.

@macdonst
Copy link
Member

@Deathspike merged and thanks

@lock
Copy link

lock bot commented Jun 5, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants