HotUpdater.checkForUpdate()
The checkForUpdate
function checks if there is an available update for the app by comparing the current app version and platform with the update server's bundle information.
This method is particularly useful when you need a custom update strategy without using the built-in wrap
method.
Use checkForUpdate
to verify if an update bundle is available. You need to provide the source of the update server and optionally, request headers.
getUpdateSource
The getUpdateSource
function is used to construct the final URL for checking for updates. It takes a baseUrl
as its first argument and an options object as its second argument. The updateStrategy
property within the options object determines the final structure of the request URL.
Example Final Endpoint Structures:
Depending on the updateStrategy
value, getUpdateSource
generates URLs like the following:
updateStrategy: 'appVersion'
: GET {baseUrl}/app-version/:platform/:appVersion/:channel/:minBundleId/:bundleId
updateStrategy: 'fingerprint'
: GET {baseUrl}/fingerprint/:platform/:fingerprintHash/:channel/:minBundleId/:bundleId
For example, if you provide https://your-update-server.com/api/update-check
as the baseUrl
, getUpdateSource
will append the correct path and parameters to the URL depending on whether updateStrategy
is 'appVersion'
or 'fingerprint'
.
The checkForUpdate
function accepts the following parameters:
Parameter | Type | Required | Description |
---|---|---|---|
source | string | ✅ | The URL of the update server. |
requestHeaders | Record<string, string> | ❌ | Optional headers to include in the update request. |
The function returns an object of type UpdateInfo
or null
if the app is up to date.