Skip to main content

Deep dive into the SDK

export type UpdateCheckMode = 'ON_START' | 'ON_FOREGROUND';
export type UpdateCheckInterval = 'ALWAYS' | 'DAILY' | 'WEEKLY' | 'CUSTOM';

export type NextBundleCommand = UpdateCheckMode;

export type UpdateMode =
| 'FORCED'
| 'ON_FOREGROUND'
| 'ON_START'
| 'SILENT_DOWNLOAD'
| 'ALERT_FORCED'
| 'ALERT_CANCELABLE';

export type UpdateAlertButton = {
text?: string;
onPress?: () => void;
};

export type UpdateAlertConfig = {
title?: string;
message?: string;
validateButtonText?: string;
rejectButtonText?: string;
onValidateUpdate?: () => void;
onRejectUpdate?: () => void;
commandOnRejection?: NextBundleCommand;
displayOnEveryForeground?: boolean;
};

export type UpdateOptions = {
updateMode: UpdateMode;
onUpdateError?: (error?: any) => void;
updateAlertConfig?: UpdateAlertConfig;
};

export interface AutoUpdateOptions extends UpdateOptions {
updateCheckMode: UpdateCheckMode;
updateCheckInterval: UpdateCheckInterval;
updateCheckIntervalCustomValue?: number;
}

SDK Setup

Ready to use Workflows

Custom workflows with the SDK API

Full SDK API documentation

Check for update

function checkForUpdate(mode: UpdateMode): Promise<Bundle | null>

Managing offline bundles

function isInstalledBundle(): Promise<boolean>
function getInstalledBundle(): Promise<Bundle | null>
function getBundles(): Promise<Bundle[]>
function clearBundles(): Promise<void>
function clearBundlesFiles(): Promise<void>

Fetch online for bundles

function fetchLatestBundle(): Promise<Bundle | null>
function fetchLatestBundles(): Promise<Bundle[]>
function fetchDistributionBundles(dist: string): Promise<Bundle[]>

Install bundles

install = download + mount

function installBundle(bundleId: string): Promise<void>
function downloadBundle(bundleId: string): Promise<Bundle>
function mountBundle(bundleId: string): Promise<void>

Uninstall bundles

uninstall = delete + unmount

function uninstallBundle(): Promise<void>
function deleteBundle(bundleId: string): Promise<Bundle>
function unmountBundle(): Promise<void>

Trigger application bundle reload

function reloadBundle(): void

Hooks API

function useInstalledBundle(): Bundle | null | undefined
function useBundles(): [Bundle[], (bundles: Bundle[]) => void, () => void]