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

Fix handle cold starts and completion handlers #10

Merged
merged 1 commit into from
Nov 29, 2016

Conversation

oblador
Copy link
Contributor

@oblador oblador commented Apr 7, 2016

Related issue #3. Tried suggested fix in that issue but that didn't solve cold starts and only made the app crash when done handler was called.

Since the bridge is not initialized when the interactive notification handler is called from a cold start (which I would imagine is by far the most common scenario) the notifications never reach the JS side. This PR fixes that by temporarily storing them in a singleton and also takes care of calling the completion block once finished which should solve those cases when the app is killed before the action is really performed.

@bleonard
Copy link

bleonard commented Apr 8, 2016

just tested this out. it seems to work as expected.
note the caveat that you have to register your actions asap. I did it at the top of index.ios.js to be sure.

@oblador
Copy link
Contributor Author

oblador commented Apr 9, 2016

Yeah, I think you should be good as long as you do it before you register with AppRegistry.

@benhughes
Copy link
Contributor

Hey guys, fix looks great. Is this going to merged anytime soon?

@jherculesdt
Copy link

Hi, there I tested this PR and it is working as expected, could you please merge this? I am using this package and is very helpful to me but I need to this implementation done to use the completeHandler correctly. Is it going to be merged anytime soon?

jherculesdt added a commit to jherculesdt/react-native-ios-notification-actions that referenced this pull request Nov 22, 2016
@holmesal holmesal merged commit 15a07b9 into holmesal:master Nov 29, 2016
@varungupta85
Copy link
Contributor

hi @oblador

Yeah, I think you should be good as long as you do it before you register with AppRegistry

I am using RNN navigation package in which the package takes care of the calling the AppRegistry internally. Moreover, I I think I need to create the actions and categories after calling requestPermissions because otherwise the actions are not linked properly. I make the requestPermissions call after authenticating with my backend service such that I can store the device token on the backend. The authentication happens as part of mounting the main app component which I think would happen after registering with AppRegistry. Could you please let me know if creating the actions and categories post call to requestPermissions is required?

@benevbright
Copy link

Guys, is this still working?

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

Successfully merging this pull request may close these issues.

7 participants