-
-
Notifications
You must be signed in to change notification settings - Fork 107
Upgrade from v3 to v4 alpha
After many talk in the discord community with you. I discover the manual mode was very too manual and not safe to use, as example auto-revert was not possible, so if you failed update in manual the user have to remove the app and install back, what is terrible UX.
Meanwhile, I took this as an opportunity to give more freedom to you, and remove all bad code I made.
npm i @capgo/capacitor-updater@next
if you use the basic example in your app, you are safe to migrate to the new version, enjoy!
For you, still simple, the changes are the name of setting autoUpdateUrl
and the change from get
to post
For you, this is the most significant changes, but for the best! You get tons of improvements, Read carefully.
-
autoUpdateUrl
becomeupdateUrl
since this setting can be use in manual mode now too - Delete of
cancelDelay
anddelayUpdate
in favor ofsetDelay
- No more
versionName
in set - Change
version
key who was returned in most function to objectBundleInfo
interface BundleInfo {
id: string;
version: string;
downloaded: string;
status: 'success' | 'error' | 'pending' | 'downloading'
}
- Renamed of misleading names now (even to explain cannot be clear, but at usage is easy to understand the new one):
- what was called a
version
is now refer to abundle
-
id
refer to the oldversion
who was a random string of 10 char, thisid
is the only trustable and unique way to access to your bundles, example7Dfcd2RedN
. -
version
refer now to theversionName
you choose for a bundle, example1.0.0
- what was called a
-
updateUrl
move fromget
topost
, since custom headers were a problem to some of you and post is more logical, all previous headers go to the body and prefixcap_
disappear. -
versionName
method is deleted, in favor ofgetId
- list return now a list of
BundleInfo
- Rename
getId
ingetDeviceId
- Method
getLatest
, this method allow you to get from your server set withupdateUrl
the last version available. - Method
setDelay
who take{delay: boolean}
as argument to set true or false the delay for auto-update - Method
next
, to set the version in next backgrounding, in opposite toset
who do it instantly. - Method
isAutoUpdateEnabled
, to let you know if you are in auto-update context - Event
downloadComplete
when download reach 100% - Added mandatory field
version
in download method -
notifyAppReady
become mandatory in manual mode too, if not call after 10 sec the app revert to past version
@lincolnthree Thank you so much for starting this work, it was impossible to make this update work without you.