Another mode, similar to codePush.InstallMode.ON_NEXT_RESUME, except that it applies the update in the background (after some delay).
This would be a potential speed up when resuming the app (e.g. when brought back from suspension) - I'm not sure if the added complexity is worth it (for sync()), though
On the iOS side, this would require some extra work via a background task (and some API exposed for it), I think. Similar setup for (newer) Android, too, I think.
(or, it might be worth waiting for react native to provide an abstraction for background tasks)
@nevir That's an awesome idea :) We'll definitely have to do an investigation into what this would look like. In lieu on RN improving their background task story, we also have quite a few users embedding RN into existing native apps, and have asked to be able to do the install in the background so as to mitigate the restart flash.
and have asked to be able to do the install in the background so as to mitigate the restart flash.
The way we're mitigating the flash is to expose a hook to show/hide our splash screen (which is handy for masking any view screwups on app launch, too). We hide the splash screen once everything has spun up (around the same time we call notifyAppReady). Similarly, we show the splash screen once we know there's an update that needs to be applied.
I'm not sure it's easy to abstract that, given everyone's native architecture is going to be somewhat different - could be a nice thing for example projects, though
@nevir I had a few free minutes today, and threw together a prototype of this feature. In addition to adding the new install mode, it also supports the existing minimumBackgroundDuration setting, that way you can do either of the following:
// Restart the app as soon as the app is put into the background,
// instead of waiting for it to be resumed to the foreground
codePush.sync({ installMode: codePush.InstallMode.ON_NEXT_SUSPEND });
// Restart the app _while_ it is in the background, but only after it has
// been in the background for 2 minutes, so that user context isn't
// lost unless the app suspension is long enough to not matter
codePush.sync({
installMode: codePush.InstallMode.ON_NEXT_SUSPEND,
minimumBackgroundDuration: 2 * 60
});
Does that match the use cases you had in mind? It definitely is a pretty awesome experience. I need to test it out a little more thoroughly before I want to send our a PR, but I was just curious if this was in-line with your thoughts.
Yeah! That's perfect! We'd want to use the minimumBackgroundDuration approach
(also, just to make sure: I'm assuming this works via localPackage.install() as well)
@nevir Yep this would work with LocalPackage.install as well!
I would love this! Sorry for a useless comment, but I hope this makes it in soon.
@lostintangent Do you still have that prototype ? We are thinking of move all update logic to the native land - that would help with background updates. However, if you were able to solve it in a different way, I think we should look at that too.
@sergey-akhalkov Can you investigate this issue ? This may be possible once we move all our logic to native code.
Hi @nevir, @tomauty, I've just created the PR that implements this feature, would you have a chance to look at it and verify if it works as expected?
Closing this due to #770 has been merged
Haven't had a chance to use it yet, but we're excited to (soon)!
On Tue, Apr 11, 2017, 02:53 Sergey Akhalkov notifications@github.com
wrote:
Closing this due to #770
https://github.com/Microsoft/react-native-code-push/pull/770 has been
merged—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/react-native-code-push/issues/366#issuecomment-293208962,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAChnZetwu1Pkh7DfbVivc6F9jNC3Pfnks5ru02FgaJpZM4IwXIP
.
Most helpful comment
@nevir Yep this would work with LocalPackage.install as well!