diff --git a/src/client.ts b/src/client.ts index 24e57e1..46ab927 100644 --- a/src/client.ts +++ b/src/client.ts @@ -61,7 +61,7 @@ const defaultClientOptions: ClientOptions = { throwError: false, }; -const sharedState: { +export const sharedState: { progressHandlers: Record; downloadedHash?: string; apkStatus: 'downloading' | 'downloaded' | null; diff --git a/src/provider.tsx b/src/provider.tsx index 755450a..511fba1 100644 --- a/src/provider.tsx +++ b/src/provider.tsx @@ -12,7 +12,7 @@ import { Platform, Linking, } from 'react-native'; -import { Pushy, Cresc } from './client'; +import { Pushy, Cresc, sharedState } from './client'; import { currentVersion, packageVersion, getCurrentVersionInfo } from './core'; import { CheckResult, ProgressData, UpdateTestPayload } from './type'; import { UpdateContext } from './context'; @@ -190,7 +190,7 @@ export const UpdateProvider = ({ return; } const { downloadUrl } = info; - if (downloadUrl && Pushy.apkStatus === null) { + if (downloadUrl && sharedState.apkStatus === null) { if (options.updateStrategy === 'silentAndNow') { if (Platform.OS === 'android' && downloadUrl.endsWith('.apk')) { downloadAndInstallApk(downloadUrl);