react-native-code-push icon indicating copy to clipboard operation
react-native-code-push copied to clipboard

Add notifications for JS bundle operations

Open daniel-beard opened this issue 10 years ago • 8 comments

  • Would be nice to listen for notifications for JS bundle operations such as:
    • Bundle downloaded succesfully
    • Bundle failed to download
    • Bundle was applied successfully
    • Bundle failed to apply
    • etc.

daniel-beard avatar Aug 25 '16 17:08 daniel-beard

Have you tried the debug command described here - https://microsoft.github.io/code-push/docs/cli.html#link-5. Would this work?

piyushjo avatar Aug 25 '16 17:08 piyushjo

Sorry, I should have been more clear, I'd like to see this from the iOS / Android SDKs and available in Release builds.

daniel-beard avatar Aug 25 '16 17:08 daniel-beard

Sorry, when you say iOS/Android SDKs, you mean you want these events to be visible from native (Obj-C/Java) code, or just from JavaScript? The former isn't our primary use case, and I would argue that all of these except the last one are already supported in the latter.

Bundle downloaded succesfully

Does codePush.SyncStatus.UPDATE_INSTALLED not address this?

Bundle failed to download

We don't expect this to happen at all, but if it does codePush.SyncStatus.UNKNOWN_ERROR should be called and the codePush.sync() promise should be rejected with the error.

Bundle was applied successfully

After booting up the new bundle, if the codePush.notifyAppReady() or codePush.sync() promise gets resolved, it means the bundle is applied successfully.

Bundle failed to apply

We could add a codePush.didRollback() API which when called, returns a promise that resolves to a boolean flag indicating whether app rolled back to an old version during the current boot up. Another way is to use codePush.checkForUpdate() to get the latest update and then check the failedInstall property of the remote package which indicates whether the latest update on the server had previously failed installation.

geof90 avatar Aug 25 '16 18:08 geof90

Following up here, I would ideally like a native (Objective-C) approach to listening to successful / failed updates. My vision for this would be NSNotification based. Would the team be open to an approach like this? I don't mind implementing this.

daniel-beard avatar Oct 31 '16 18:10 daniel-beard

@daniel-beard We are looking at moving all the download logic to native land to serve this use case. cc @sergey-akhalkov - If we have this issue capture else where, can you add it here ?

panarasi avatar Feb 01 '17 23:02 panarasi

@panarasi, got it, will do.

sergey-akhalkov avatar Feb 06 '17 12:02 sergey-akhalkov

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

ghost avatar Dec 13 '21 17:12 ghost

This issue will now be closed because it hasn't had any activity for 15 days after stale. Please feel free to open a new issue if you still have a question/issue or suggestion.

ghost avatar Dec 28 '21 18:12 ghost