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, getUpdateSource } 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({
source: getUpdateSource("<your-update-server-url>", {
updateStrategy: "appVersion", // or "fingerprint"
}),
// If you need to send request headers, you can use the `requestHeaders` option.
requestHeaders: {
"Authorization": "Bearer <your-access-token>",
},
})(App);updateBundle
The `updateBundle` function downloads and applies a new update bundle to your React Native application. It uses the provided bundle information obtained from `checkForUpdate`.
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.