New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS notification from cold boot #117

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

Comments

Projects
None yet
2 participants
@Deathspike

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

This comment has been minimized.

Show comment
Hide comment
@macdonst

macdonst Sep 13, 2015

Member

@Deathspike Line 244 is:

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

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

Member

macdonst commented Sep 13, 2015

@Deathspike Line 244 is:

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

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

@Deathspike

This comment has been minimized.

Show comment
Hide comment
@Deathspike

Deathspike Sep 14, 2015

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.

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

This comment has been minimized.

Show comment
Hide comment
@macdonst

macdonst Sep 14, 2015

Member

@Deathspike merged and thanks

Member

macdonst commented Sep 14, 2015

@Deathspike merged and thanks

@lock

This comment has been minimized.

Show comment
Hide comment
@lock

lock bot Jun 5, 2018

This thread has been automatically locked.

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.