reload
By default, the `shouldForceUpdate` flag is `false`, the bundle is downloaded but not applied until the user restarts the app.
Usage
Calling HotUpdater.reload() reloads the app. If there is a completed update bundle ready to be applied, it will be applied immediately.
The shouldForceUpdate flag simply downloads the bundle and calls reload immediately.
You can use it as shown below, but it is recommended to use it together with the `useHotUpdaterStore().progress value.
Refer to useHotUpdaterStore() for more information.
import { HotUpdater } from "@hot-updater/react-native";
import { Button, Text, View } from "react-native";
function App() {
const handleReload = () => {
// Immediately reapply if there is a downloaded bundle
await HotUpdater.reload();
}
return (
<View>
<Text>Hello World</Text>
<Button title="Reload" onPress={handleReload} />
</View>
);
}
export default HotUpdater.wrap({
baseURL: "<your-update-server-url>",
updateStrategy: "appVersion", // or "fingerprint"
updateMode: "auto",
// If you need to send request headers, you can use the `requestHeaders` option.
requestHeaders: {
"Authorization": "Bearer <your-access-token>",
},
})(App);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.
getChannel
The `HotUpdater.getChannel()` function retrieves the current release channel of the app. This is useful when you want to determine which channel updates are being applied from.