Add a Expo.sync api to manually trigger app refresh when available
complete
a
anshul
Often it is necessary for the app developer to both query and trigger the app update manually instead of it happening automatically on app reload. Sometimes it's a good idea to wait for wifi or to wait for the end user to trigger it at their convenience. Codepush js api does well in this direction - https://github.com/Microsoft/react-native-code-push#javascript-api-reference
An api that works as follows will be nice
componentDidMount() {
Exponent.sync({key: key, installMode: Exponent.InstallMode.IMMEDIATE }, this.syncFn)
}
syncFn(status) {
switch (status) {
case Exponent.SyncStatus.CHECKING_FOR_UPDATE:
case Exponent.SyncStatus.UP_TO_DATE:
case Exponent.SyncStatus.DOWNLOADING_PACKAGE:
case Exponent.SyncStatus.INSTALLING_UPDATE:
case Exponent.SyncStatus.UPDATE_INSTALLED:
}
}
Brent Vatne
Expo.Updates landing in sdk26 very shortly
Wei Zhang
Brent Vatne: Nice! Great work! https://github.com/expo/expo-sdk/blob/master/src/Updates.js
Brent Vatne
complete
Keith Kurak
This would be really awesome, I would love to use it once available. Unfortunately, if the way to apply the update is the same as it is today (Util.reload()), any apps that secure images with session cookies or an API token/ JWT in the HTTP header will not be able to take advantage of this on Android (aka most chat / social network apps), so wondering if this bug could get a little love in the process? https://github.com/expo/expo/issues/370. Thanks!
Brent Vatne
in progress
Brent Vatne
planned
Sébastien Lorber
Having experienced the CodePush API, it is more powerful but a bit complicated to handle.
What would be nice is to download the new code in the background and when it's done, trigger a callback with a parameter that says weither this update is mandatory or not (and we can call reload() in this callback with the UI or our choice)
Brent Vatne
We have
Exponent.Util.reload()
right now that will let you reload the app if an update comes in, but no sync api yet to download it in backgroundWill Chen
Brent Vatne: any chance a sync api will be added to the roadmap?
Brent Vatne
Will Chen: it certainly would be very useful! looks like it is getting a lot of upvotes so we will discuss in next scoping meeting, I think it's unlikely for the next sdk but perhaps the following one. so much to do :)
Will Chen
Brent Vatne: Awesome! Let me know if you need help with dog-fooding / testing the sync functionality. I'm also happy to help w/ docs for it.
Brent Vatne
Yup this will be great! Definitely something we want to add. Please upvote if this is important for you as well.