From V3 to V4
Ce contenu n’est pas encore disponible dans votre langue.
Why this upgrade
After many talk in the discord community with you. I discovered the manual mode was very too manual and not safe to use, for 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.
Install
npm i @capgo/capacitor-updater@4
Auto-update cloud
If you use the basic example in your app, you are safe to migrate to the new version, enjoy!
Auto-update self-hosted
For you, still simple, the changes are:
- The name of the setting from
autoUpdateUrl
inupdateUrl
- The Endpoint method changed from
GET
to POST
Manual users
For you, this is the most significant change, but for the best! You get tons of improvements, Read carefully.
Changes
autoUpdateUrl
becomesupdateUrl
since this setting can be used 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
- 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 referring 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 for 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 returns now a list of
BundleInfo
- Rename
getId
ingetDeviceId
autoUpdate
becomes true by default, if you use Manual mode, set it to false.
News
- Method
getLatest
, this method allows you to get from your server set withupdateUrl
the last version available. - Method
setDelay
who take{
kind:
“background” | “kill” | “nativeVersion” | “date”, value? : string}
as argument to set delay to different modes. - 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 reverts to past version.
Contributors
@lincolnthree Thank you so much for starting this work, it was impossible to make this update work without you.