@appzung/react-native-code-push 10.0.0-rc1 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CodePush.podspec +1 -0
- package/LICENSE.md +2 -2
- package/README.md +74 -95
- package/android/app/build.gradle +62 -18
- package/android/app/src/main/AndroidManifest.xml +2 -3
- package/android/app/src/main/AndroidManifestNew.xml +3 -0
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePush.java +21 -89
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushNativeModule.java +32 -3
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUpdateManager.java +2 -2
- package/android/build.gradle +1 -11
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/gradle.properties +4 -20
- package/docs/advanced-usage.md +2 -2
- package/docs/api-android.md +12 -10
- package/docs/api-ios.md +5 -5
- package/docs/api-js.md +180 -178
- package/docs/code-signing.md +62 -0
- package/docs/migrating-to-v10.md +31 -0
- package/docs/setup-android.md +52 -79
- package/docs/setup-ios.md +31 -28
- package/docs/setup-windows.md +1 -0
- package/ios/CodePush/CodePush.m +13 -57
- package/lib/commonjs/CodePush.js +90 -0
- package/lib/commonjs/CodePush.js.map +1 -0
- package/lib/commonjs/allowRestart.js +12 -0
- package/lib/commonjs/allowRestart.js.map +1 -0
- package/lib/commonjs/checkForUpdates.js +105 -0
- package/lib/commonjs/checkForUpdates.js.map +1 -0
- package/lib/commonjs/clearUpdates.js +15 -0
- package/lib/commonjs/clearUpdates.js.map +1 -0
- package/lib/commonjs/disallowRestart.js +12 -0
- package/lib/commonjs/disallowRestart.js.map +1 -0
- package/lib/commonjs/enums/CheckFrequency.enum.js +25 -0
- package/lib/commonjs/enums/CheckFrequency.enum.js.map +1 -0
- package/lib/commonjs/enums/DeploymentStatus.enum.js +21 -0
- package/lib/commonjs/enums/DeploymentStatus.enum.js.map +1 -0
- package/lib/commonjs/enums/InstallMode.enum.js +35 -0
- package/lib/commonjs/enums/InstallMode.enum.js.map +1 -0
- package/lib/commonjs/enums/SyncStatus.enum.js +53 -0
- package/lib/commonjs/enums/SyncStatus.enum.js.map +1 -0
- package/lib/commonjs/enums/UpdateState.enum.js +29 -0
- package/lib/commonjs/enums/UpdateState.enum.js.map +1 -0
- package/lib/commonjs/getUpdateMetadata.js +25 -0
- package/lib/commonjs/getUpdateMetadata.js.map +1 -0
- package/lib/commonjs/index.js +195 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/internals/AcquisitionSdk.js +9 -0
- package/lib/commonjs/internals/AcquisitionSdk.js.map +1 -0
- package/lib/commonjs/internals/LocalPackageImplementation.js +29 -0
- package/lib/commonjs/internals/LocalPackageImplementation.js.map +1 -0
- package/lib/commonjs/internals/NativeRNAppZungCodePushModule.js +8 -0
- package/lib/commonjs/internals/NativeRNAppZungCodePushModule.js.map +1 -0
- package/lib/commonjs/internals/RNAppZungCodePushModuleSpec.js +6 -0
- package/lib/commonjs/internals/RNAppZungCodePushModuleSpec.js.map +1 -0
- package/lib/commonjs/internals/RemotePackageImplementation.js +49 -0
- package/lib/commonjs/internals/RemotePackageImplementation.js.map +1 -0
- package/lib/commonjs/internals/getConfiguration.js +15 -0
- package/lib/commonjs/internals/getConfiguration.js.map +1 -0
- package/lib/commonjs/internals/getCurrentPackage.js +12 -0
- package/lib/commonjs/internals/getCurrentPackage.js.map +1 -0
- package/lib/commonjs/internals/getPromisifiedSdk.js +49 -0
- package/lib/commonjs/internals/getPromisifiedSdk.js.map +1 -0
- package/lib/commonjs/internals/shouldUpdateBeIgnored.js +62 -0
- package/lib/commonjs/internals/shouldUpdateBeIgnored.js.map +1 -0
- package/lib/commonjs/internals/types.js +6 -0
- package/lib/commonjs/internals/types.js.map +1 -0
- package/lib/commonjs/internals/utils/log.js +11 -0
- package/lib/commonjs/internals/utils/log.js.map +1 -0
- package/lib/commonjs/internals/utils/request-fetch-adapter.js +50 -0
- package/lib/commonjs/internals/utils/request-fetch-adapter.js.map +1 -0
- package/lib/commonjs/internals/version.js +9 -0
- package/lib/commonjs/internals/version.js.map +1 -0
- package/lib/commonjs/notifyAppReady.js +83 -0
- package/lib/commonjs/notifyAppReady.js.map +1 -0
- package/lib/commonjs/reactNative.d.js +2 -0
- package/lib/commonjs/reactNative.d.js.map +1 -0
- package/lib/commonjs/restartApp.js +16 -0
- package/lib/commonjs/restartApp.js.map +1 -0
- package/lib/commonjs/sync.js +219 -0
- package/lib/commonjs/sync.js.map +1 -0
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/CodePush.js +84 -0
- package/lib/module/CodePush.js.map +1 -0
- package/lib/module/allowRestart.js +9 -0
- package/lib/module/allowRestart.js.map +1 -0
- package/lib/module/checkForUpdates.js +101 -0
- package/lib/module/checkForUpdates.js.map +1 -0
- package/lib/module/clearUpdates.js +12 -0
- package/lib/module/clearUpdates.js.map +1 -0
- package/lib/module/disallowRestart.js +9 -0
- package/lib/module/disallowRestart.js.map +1 -0
- package/lib/module/enums/CheckFrequency.enum.js +21 -0
- package/lib/module/enums/CheckFrequency.enum.js.map +1 -0
- package/lib/module/enums/DeploymentStatus.enum.js +17 -0
- package/lib/module/enums/DeploymentStatus.enum.js.map +1 -0
- package/lib/module/enums/InstallMode.enum.js +32 -0
- package/lib/module/enums/InstallMode.enum.js.map +1 -0
- package/lib/module/enums/SyncStatus.enum.js +49 -0
- package/lib/module/enums/SyncStatus.enum.js.map +1 -0
- package/lib/module/enums/UpdateState.enum.js +26 -0
- package/lib/module/enums/UpdateState.enum.js.map +1 -0
- package/lib/module/getUpdateMetadata.js +21 -0
- package/lib/module/getUpdateMetadata.js.map +1 -0
- package/lib/module/index.js +19 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/internals/AcquisitionSdk.js +5 -0
- package/lib/module/internals/AcquisitionSdk.js.map +1 -0
- package/lib/module/internals/LocalPackageImplementation.js +24 -0
- package/lib/module/internals/LocalPackageImplementation.js.map +1 -0
- package/lib/module/internals/NativeRNAppZungCodePushModule.js +4 -0
- package/lib/module/internals/NativeRNAppZungCodePushModule.js.map +1 -0
- package/lib/module/internals/RNAppZungCodePushModuleSpec.js +4 -0
- package/lib/module/internals/RNAppZungCodePushModuleSpec.js.map +1 -0
- package/lib/module/internals/RemotePackageImplementation.js +44 -0
- package/lib/module/internals/RemotePackageImplementation.js.map +1 -0
- package/lib/module/internals/getConfiguration.js +11 -0
- package/lib/module/internals/getConfiguration.js.map +1 -0
- package/lib/module/internals/getCurrentPackage.js +8 -0
- package/lib/module/internals/getCurrentPackage.js.map +1 -0
- package/lib/module/internals/getPromisifiedSdk.js +45 -0
- package/lib/module/internals/getPromisifiedSdk.js.map +1 -0
- package/lib/module/internals/shouldUpdateBeIgnored.js +58 -0
- package/lib/module/internals/shouldUpdateBeIgnored.js.map +1 -0
- package/lib/module/internals/types.js +4 -0
- package/lib/module/internals/types.js.map +1 -0
- package/lib/module/internals/utils/log.js +7 -0
- package/lib/module/internals/utils/log.js.map +1 -0
- package/lib/module/internals/utils/request-fetch-adapter.js +46 -0
- package/lib/module/internals/utils/request-fetch-adapter.js.map +1 -0
- package/lib/module/internals/version.js +5 -0
- package/lib/module/internals/version.js.map +1 -0
- package/lib/module/notifyAppReady.js +79 -0
- package/lib/module/notifyAppReady.js.map +1 -0
- package/lib/module/reactNative.d.js +2 -0
- package/lib/module/reactNative.d.js.map +1 -0
- package/lib/module/restartApp.js +13 -0
- package/lib/module/restartApp.js.map +1 -0
- package/lib/module/sync.js +215 -0
- package/lib/module/sync.js.map +1 -0
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/CodePush.d.ts +24 -0
- package/lib/typescript/commonjs/src/CodePush.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/allowRestart.d.ts +5 -0
- package/lib/typescript/commonjs/src/allowRestart.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/checkForUpdates.d.ts +9 -0
- package/lib/typescript/commonjs/src/checkForUpdates.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/clearUpdates.d.ts +8 -0
- package/lib/typescript/commonjs/src/clearUpdates.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/disallowRestart.d.ts +5 -0
- package/lib/typescript/commonjs/src/disallowRestart.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/enums/CheckFrequency.enum.d.ts +18 -0
- package/lib/typescript/commonjs/src/enums/CheckFrequency.enum.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/enums/DeploymentStatus.enum.d.ts +14 -0
- package/lib/typescript/commonjs/src/enums/DeploymentStatus.enum.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/enums/InstallMode.enum.d.ts +27 -0
- package/lib/typescript/commonjs/src/enums/InstallMode.enum.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/enums/SyncStatus.enum.d.ts +46 -0
- package/lib/typescript/commonjs/src/enums/SyncStatus.enum.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/enums/UpdateState.enum.d.ts +21 -0
- package/lib/typescript/commonjs/src/enums/UpdateState.enum.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/getUpdateMetadata.d.ts +9 -0
- package/lib/typescript/commonjs/src/getUpdateMetadata.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +17 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/AcquisitionSdk.d.ts +3 -0
- package/lib/typescript/commonjs/src/internals/AcquisitionSdk.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/LocalPackageImplementation.d.ts +17 -0
- package/lib/typescript/commonjs/src/internals/LocalPackageImplementation.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/NativeRNAppZungCodePushModule.d.ts +3 -0
- package/lib/typescript/commonjs/src/internals/NativeRNAppZungCodePushModule.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/RNAppZungCodePushModuleSpec.d.ts +36 -0
- package/lib/typescript/commonjs/src/internals/RNAppZungCodePushModuleSpec.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/RemotePackageImplementation.d.ts +18 -0
- package/lib/typescript/commonjs/src/internals/RemotePackageImplementation.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/getConfiguration.d.ts +3 -0
- package/lib/typescript/commonjs/src/internals/getConfiguration.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/getCurrentPackage.d.ts +2 -0
- package/lib/typescript/commonjs/src/internals/getCurrentPackage.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/getPromisifiedSdk.d.ts +13 -0
- package/lib/typescript/commonjs/src/internals/getPromisifiedSdk.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/shouldUpdateBeIgnored.d.ts +3 -0
- package/lib/typescript/commonjs/src/internals/shouldUpdateBeIgnored.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/types.d.ts +16 -0
- package/lib/typescript/commonjs/src/internals/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/utils/log.d.ts +2 -0
- package/lib/typescript/commonjs/src/internals/utils/log.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/utils/request-fetch-adapter.d.ts +3 -0
- package/lib/typescript/commonjs/src/internals/utils/request-fetch-adapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/version.d.ts +2 -0
- package/lib/typescript/commonjs/src/internals/version.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/notifyAppReady.d.ts +6 -0
- package/lib/typescript/commonjs/src/notifyAppReady.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/restartApp.d.ts +7 -0
- package/lib/typescript/commonjs/src/restartApp.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/sync.d.ts +17 -0
- package/lib/typescript/commonjs/src/sync.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types.d.ts +196 -0
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/CodePush.d.ts +24 -0
- package/lib/typescript/module/src/CodePush.d.ts.map +1 -0
- package/lib/typescript/module/src/allowRestart.d.ts +5 -0
- package/lib/typescript/module/src/allowRestart.d.ts.map +1 -0
- package/lib/typescript/module/src/checkForUpdates.d.ts +9 -0
- package/lib/typescript/module/src/checkForUpdates.d.ts.map +1 -0
- package/lib/typescript/module/src/clearUpdates.d.ts +8 -0
- package/lib/typescript/module/src/clearUpdates.d.ts.map +1 -0
- package/lib/typescript/module/src/disallowRestart.d.ts +5 -0
- package/lib/typescript/module/src/disallowRestart.d.ts.map +1 -0
- package/lib/typescript/module/src/enums/CheckFrequency.enum.d.ts +18 -0
- package/lib/typescript/module/src/enums/CheckFrequency.enum.d.ts.map +1 -0
- package/lib/typescript/module/src/enums/DeploymentStatus.enum.d.ts +14 -0
- package/lib/typescript/module/src/enums/DeploymentStatus.enum.d.ts.map +1 -0
- package/lib/typescript/module/src/enums/InstallMode.enum.d.ts +27 -0
- package/lib/typescript/module/src/enums/InstallMode.enum.d.ts.map +1 -0
- package/lib/typescript/module/src/enums/SyncStatus.enum.d.ts +46 -0
- package/lib/typescript/module/src/enums/SyncStatus.enum.d.ts.map +1 -0
- package/lib/typescript/module/src/enums/UpdateState.enum.d.ts +21 -0
- package/lib/typescript/module/src/enums/UpdateState.enum.d.ts.map +1 -0
- package/lib/typescript/module/src/getUpdateMetadata.d.ts +9 -0
- package/lib/typescript/module/src/getUpdateMetadata.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +17 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/AcquisitionSdk.d.ts +3 -0
- package/lib/typescript/module/src/internals/AcquisitionSdk.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/LocalPackageImplementation.d.ts +17 -0
- package/lib/typescript/module/src/internals/LocalPackageImplementation.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/NativeRNAppZungCodePushModule.d.ts +3 -0
- package/lib/typescript/module/src/internals/NativeRNAppZungCodePushModule.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/RNAppZungCodePushModuleSpec.d.ts +36 -0
- package/lib/typescript/module/src/internals/RNAppZungCodePushModuleSpec.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/RemotePackageImplementation.d.ts +18 -0
- package/lib/typescript/module/src/internals/RemotePackageImplementation.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/getConfiguration.d.ts +3 -0
- package/lib/typescript/module/src/internals/getConfiguration.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/getCurrentPackage.d.ts +2 -0
- package/lib/typescript/module/src/internals/getCurrentPackage.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/getPromisifiedSdk.d.ts +13 -0
- package/lib/typescript/module/src/internals/getPromisifiedSdk.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/shouldUpdateBeIgnored.d.ts +3 -0
- package/lib/typescript/module/src/internals/shouldUpdateBeIgnored.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/types.d.ts +16 -0
- package/lib/typescript/module/src/internals/types.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/utils/log.d.ts +2 -0
- package/lib/typescript/module/src/internals/utils/log.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/utils/request-fetch-adapter.d.ts +3 -0
- package/lib/typescript/module/src/internals/utils/request-fetch-adapter.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/version.d.ts +2 -0
- package/lib/typescript/module/src/internals/version.d.ts.map +1 -0
- package/lib/typescript/module/src/notifyAppReady.d.ts +6 -0
- package/lib/typescript/module/src/notifyAppReady.d.ts.map +1 -0
- package/lib/typescript/module/src/restartApp.d.ts +7 -0
- package/lib/typescript/module/src/restartApp.d.ts.map +1 -0
- package/lib/typescript/module/src/sync.d.ts +17 -0
- package/lib/typescript/module/src/sync.d.ts.map +1 -0
- package/lib/typescript/module/src/types.d.ts +196 -0
- package/lib/typescript/module/src/types.d.ts.map +1 -0
- package/package.json +58 -11
- package/react-native.config.js +8 -8
- package/src/CodePush.tsx +108 -0
- package/src/allowRestart.ts +6 -0
- package/src/checkForUpdates.ts +109 -0
- package/src/clearUpdates.ts +9 -0
- package/src/disallowRestart.ts +6 -0
- package/src/enums/CheckFrequency.enum.ts +19 -0
- package/src/enums/DeploymentStatus.enum.ts +14 -0
- package/src/enums/InstallMode.enum.ts +31 -0
- package/src/enums/SyncStatus.enum.ts +53 -0
- package/src/enums/UpdateState.enum.ts +24 -0
- package/src/getUpdateMetadata.ts +23 -0
- package/src/index.ts +18 -0
- package/src/internals/AcquisitionSdk.ts +3 -0
- package/src/internals/LocalPackageImplementation.ts +45 -0
- package/src/internals/NativeRNAppZungCodePushModule.ts +3 -0
- package/src/internals/RNAppZungCodePushModuleSpec.ts +54 -0
- package/src/internals/RemotePackageImplementation.ts +69 -0
- package/src/internals/getConfiguration.ts +12 -0
- package/src/internals/getCurrentPackage.ts +6 -0
- package/src/internals/getPromisifiedSdk.ts +72 -0
- package/src/internals/shouldUpdateBeIgnored.ts +76 -0
- package/src/internals/types.ts +18 -0
- package/{logging.js → src/internals/utils/log.ts} +1 -3
- package/src/internals/utils/request-fetch-adapter.ts +58 -0
- package/src/internals/version.ts +2 -0
- package/src/notifyAppReady.ts +94 -0
- package/src/reactNative.d.ts +34 -0
- package/src/restartApp.ts +10 -0
- package/src/sync.ts +272 -0
- package/src/types.ts +237 -0
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +29 -12
- package/AlertAdapter.js +0 -24
- package/CONTRIBUTING.md +0 -134
- package/CodePush.js +0 -674
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +0 -37
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushDialog.java +0 -102
- package/package-mixins.js +0 -68
- package/request-fetch-adapter.js +0 -52
- package/tslint.json +0 -32
- package/typings/react-native-code-push.d.ts +0 -455
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushConstants.java +0 -0
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushInstallMode.java +0 -0
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushInvalidPublicKeyException.java +0 -0
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushInvalidUpdateException.java +0 -0
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushMalformedDataException.java +0 -0
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushNotInitializedException.java +0 -0
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushTelemetryManager.java +0 -0
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUnknownException.java +0 -0
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUpdateState.java +0 -0
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUpdateUtils.java +0 -0
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUtils.java +0 -0
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/DownloadProgress.java +0 -0
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/DownloadProgressCallback.java +0 -0
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/FileUtils.java +0 -0
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/ReactInstanceHolder.java +0 -0
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/SettingsManager.java +0 -0
- /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/TLSSocketFactory.java +0 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.sync = exports.DEFAULT_UPDATE_DIALOG = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _checkForUpdates = require("./checkForUpdates.js");
|
|
9
|
+
var _InstallModeEnum = require("./enums/InstallMode.enum.js");
|
|
10
|
+
var _SyncStatusEnum = require("./enums/SyncStatus.enum.js");
|
|
11
|
+
var _getCurrentPackage = require("./internals/getCurrentPackage.js");
|
|
12
|
+
var _shouldUpdateBeIgnored = require("./internals/shouldUpdateBeIgnored.js");
|
|
13
|
+
var _log = require("./internals/utils/log.js");
|
|
14
|
+
var _notifyAppReady = require("./notifyAppReady.js");
|
|
15
|
+
/**
|
|
16
|
+
* Represents the default settings that will be used by the sync method if
|
|
17
|
+
* an update dialog is configured to be displayed.
|
|
18
|
+
*/
|
|
19
|
+
const DEFAULT_UPDATE_DIALOG = exports.DEFAULT_UPDATE_DIALOG = {
|
|
20
|
+
appendReleaseDescription: false,
|
|
21
|
+
descriptionPrefix: ' Description: ',
|
|
22
|
+
mandatoryContinueButtonLabel: 'Continue',
|
|
23
|
+
mandatoryUpdateMessage: 'An update is available that must be installed.',
|
|
24
|
+
optionalIgnoreButtonLabel: 'Ignore',
|
|
25
|
+
optionalInstallButtonLabel: 'Install',
|
|
26
|
+
optionalUpdateMessage: 'An update is available. Would you like to install it?',
|
|
27
|
+
title: 'Update available'
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/*
|
|
31
|
+
* The syncInternal method provides a simple, one-line experience for
|
|
32
|
+
* incorporating the check, download and installation of an update.
|
|
33
|
+
*
|
|
34
|
+
* It simply composes the existing API methods together and adds additional
|
|
35
|
+
* support for respecting mandatory updates, ignoring previously failed
|
|
36
|
+
* releases, and displaying a standard confirmation UI to the end-user
|
|
37
|
+
* when an update is available.
|
|
38
|
+
*/
|
|
39
|
+
async function syncInternal(options, syncStatusChangeCallback, downloadProgressCallback, handleBinaryVersionMismatchCallback) {
|
|
40
|
+
let resolvedInstallMode;
|
|
41
|
+
const syncOptions = {
|
|
42
|
+
releaseChannelPublicId: undefined,
|
|
43
|
+
ignoreFailedUpdates: true,
|
|
44
|
+
rollbackRetryOptions: undefined,
|
|
45
|
+
installMode: _InstallModeEnum.InstallMode.ON_NEXT_RESTART,
|
|
46
|
+
mandatoryInstallMode: _InstallModeEnum.InstallMode.IMMEDIATE,
|
|
47
|
+
minimumBackgroundDuration: 0,
|
|
48
|
+
updateDialog: undefined,
|
|
49
|
+
...options
|
|
50
|
+
};
|
|
51
|
+
syncStatusChangeCallback = typeof syncStatusChangeCallback === 'function' ? syncStatusChangeCallback : syncStatus => {
|
|
52
|
+
switch (syncStatus) {
|
|
53
|
+
case _SyncStatusEnum.SyncStatus.CHECKING_FOR_UPDATE:
|
|
54
|
+
(0, _log.log)('Checking for update.');
|
|
55
|
+
break;
|
|
56
|
+
case _SyncStatusEnum.SyncStatus.AWAITING_USER_ACTION:
|
|
57
|
+
(0, _log.log)('Awaiting user action.');
|
|
58
|
+
break;
|
|
59
|
+
case _SyncStatusEnum.SyncStatus.DOWNLOADING_PACKAGE:
|
|
60
|
+
(0, _log.log)('Downloading package.');
|
|
61
|
+
break;
|
|
62
|
+
case _SyncStatusEnum.SyncStatus.INSTALLING_UPDATE:
|
|
63
|
+
(0, _log.log)('Installing update.');
|
|
64
|
+
break;
|
|
65
|
+
case _SyncStatusEnum.SyncStatus.UP_TO_DATE:
|
|
66
|
+
(0, _log.log)('App is up to date.');
|
|
67
|
+
break;
|
|
68
|
+
case _SyncStatusEnum.SyncStatus.UPDATE_IGNORED:
|
|
69
|
+
(0, _log.log)('User cancelled the update.');
|
|
70
|
+
break;
|
|
71
|
+
case _SyncStatusEnum.SyncStatus.UPDATE_INSTALLED:
|
|
72
|
+
if (resolvedInstallMode == _InstallModeEnum.InstallMode.ON_NEXT_RESTART) {
|
|
73
|
+
(0, _log.log)('Update is installed and will be run on the next app restart.');
|
|
74
|
+
} else if (resolvedInstallMode == _InstallModeEnum.InstallMode.ON_NEXT_RESUME) {
|
|
75
|
+
if (!!syncOptions.minimumBackgroundDuration) {
|
|
76
|
+
(0, _log.log)(`Update is installed and will be run after the app has been in the background for at least ${syncOptions.minimumBackgroundDuration} seconds.`);
|
|
77
|
+
} else {
|
|
78
|
+
(0, _log.log)('Update is installed and will be run when the app next resumes.');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
case _SyncStatusEnum.SyncStatus.UNKNOWN_ERROR:
|
|
83
|
+
(0, _log.log)('An unknown error occurred.');
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
try {
|
|
88
|
+
await (0, _notifyAppReady.notifyAppReady)();
|
|
89
|
+
syncStatusChangeCallback(_SyncStatusEnum.SyncStatus.CHECKING_FOR_UPDATE);
|
|
90
|
+
const remotePackage = await (0, _checkForUpdates.checkForUpdate)(syncOptions.releaseChannelPublicId, handleBinaryVersionMismatchCallback);
|
|
91
|
+
const doDownloadAndInstall = async () => {
|
|
92
|
+
if (!remotePackage) {
|
|
93
|
+
throw new Error('remotePackage should be defined');
|
|
94
|
+
}
|
|
95
|
+
syncStatusChangeCallback(_SyncStatusEnum.SyncStatus.DOWNLOADING_PACKAGE);
|
|
96
|
+
const localPackage = await remotePackage.download(downloadProgressCallback);
|
|
97
|
+
|
|
98
|
+
// Determine the correct install mode based on whether the update is mandatory or not.
|
|
99
|
+
resolvedInstallMode = localPackage.isMandatory ? syncOptions.mandatoryInstallMode : syncOptions.installMode;
|
|
100
|
+
syncStatusChangeCallback(_SyncStatusEnum.SyncStatus.INSTALLING_UPDATE);
|
|
101
|
+
await localPackage.install(resolvedInstallMode, syncOptions.minimumBackgroundDuration, () => {
|
|
102
|
+
syncStatusChangeCallback(_SyncStatusEnum.SyncStatus.UPDATE_INSTALLED);
|
|
103
|
+
});
|
|
104
|
+
return _SyncStatusEnum.SyncStatus.UPDATE_INSTALLED;
|
|
105
|
+
};
|
|
106
|
+
const updateShouldBeIgnored = await (0, _shouldUpdateBeIgnored.shouldUpdateBeIgnored)(remotePackage, syncOptions);
|
|
107
|
+
if (!remotePackage || updateShouldBeIgnored) {
|
|
108
|
+
if (updateShouldBeIgnored) {
|
|
109
|
+
(0, _log.log)('An update is available, but it is being ignored due to having been previously rolled back.');
|
|
110
|
+
}
|
|
111
|
+
const currentPackage = await (0, _getCurrentPackage.getCurrentPackage)();
|
|
112
|
+
if (currentPackage && currentPackage.isPending) {
|
|
113
|
+
syncStatusChangeCallback(_SyncStatusEnum.SyncStatus.UPDATE_INSTALLED);
|
|
114
|
+
return _SyncStatusEnum.SyncStatus.UPDATE_INSTALLED;
|
|
115
|
+
} else {
|
|
116
|
+
syncStatusChangeCallback(_SyncStatusEnum.SyncStatus.UP_TO_DATE);
|
|
117
|
+
return _SyncStatusEnum.SyncStatus.UP_TO_DATE;
|
|
118
|
+
}
|
|
119
|
+
} else if (syncOptions.updateDialog) {
|
|
120
|
+
const updateDialogConfig = typeof syncOptions.updateDialog !== 'object' ? DEFAULT_UPDATE_DIALOG : {
|
|
121
|
+
...DEFAULT_UPDATE_DIALOG,
|
|
122
|
+
...syncOptions.updateDialog
|
|
123
|
+
};
|
|
124
|
+
return await new Promise((resolve, reject) => {
|
|
125
|
+
let message;
|
|
126
|
+
let installButtonText;
|
|
127
|
+
const dialogButtons = [];
|
|
128
|
+
if (remotePackage.isMandatory) {
|
|
129
|
+
message = updateDialogConfig.mandatoryUpdateMessage;
|
|
130
|
+
installButtonText = updateDialogConfig.mandatoryContinueButtonLabel;
|
|
131
|
+
} else {
|
|
132
|
+
message = updateDialogConfig.optionalUpdateMessage;
|
|
133
|
+
installButtonText = updateDialogConfig.optionalInstallButtonLabel;
|
|
134
|
+
// Since this is an optional update, add a button
|
|
135
|
+
// to allow the end-user to ignore it
|
|
136
|
+
dialogButtons.push({
|
|
137
|
+
text: updateDialogConfig.optionalIgnoreButtonLabel ?? '',
|
|
138
|
+
onPress: () => {
|
|
139
|
+
syncStatusChangeCallback(_SyncStatusEnum.SyncStatus.UPDATE_IGNORED);
|
|
140
|
+
resolve(_SyncStatusEnum.SyncStatus.UPDATE_IGNORED);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Since the install button should be placed to the
|
|
146
|
+
// right of any other button, add it last
|
|
147
|
+
dialogButtons.push({
|
|
148
|
+
text: installButtonText ?? '',
|
|
149
|
+
onPress: () => {
|
|
150
|
+
doDownloadAndInstall().then(resolve, reject);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// If the update has a description, and the developer
|
|
155
|
+
// explicitly chose to display it, then set that as the message
|
|
156
|
+
if (updateDialogConfig.appendReleaseDescription && remotePackage.description) {
|
|
157
|
+
message += `${updateDialogConfig.descriptionPrefix} ${remotePackage.description}`;
|
|
158
|
+
}
|
|
159
|
+
syncStatusChangeCallback(_SyncStatusEnum.SyncStatus.AWAITING_USER_ACTION);
|
|
160
|
+
_reactNative.Alert.alert(updateDialogConfig.title || '', message || '', _reactNative.Platform.OS === 'android' ? [...dialogButtons.reverse()] : dialogButtons);
|
|
161
|
+
});
|
|
162
|
+
} else {
|
|
163
|
+
return await doDownloadAndInstall();
|
|
164
|
+
}
|
|
165
|
+
} catch (error) {
|
|
166
|
+
syncStatusChangeCallback(_SyncStatusEnum.SyncStatus.UNKNOWN_ERROR);
|
|
167
|
+
(0, _log.log)(error != null && typeof error === 'object' && 'message' in error && typeof error.message === 'string' ? error.message : 'Unknown');
|
|
168
|
+
throw error;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Allows checking for an update, downloading it and installing it, all with a single call.
|
|
174
|
+
*
|
|
175
|
+
* @param options Options used to configure the end-user update experience (e.g. show a prompt?, install the update immediately?).
|
|
176
|
+
* @param syncStatusChangedCallback An optional callback that allows tracking the status of the sync operation, as opposed to simply checking the resolved state via the returned Promise.
|
|
177
|
+
* @param downloadProgressCallback An optional callback that allows tracking the progress of an update while it is being downloaded.
|
|
178
|
+
* @param handleBinaryVersionMismatchCallback An optional callback for handling target binary version mismatch
|
|
179
|
+
*/
|
|
180
|
+
const sync = exports.sync = (() => {
|
|
181
|
+
// This function allows only one syncInternal operation to proceed at any given time.
|
|
182
|
+
// Parallel calls to sync() while one is ongoing yields CodePush.SyncStatus.SYNC_IN_PROGRESS.
|
|
183
|
+
|
|
184
|
+
let syncInProgress = false;
|
|
185
|
+
const setSyncCompleted = () => {
|
|
186
|
+
syncInProgress = false;
|
|
187
|
+
};
|
|
188
|
+
return (options, syncStatusChangeCallback, downloadProgressCallback, handleBinaryVersionMismatchCallback) => {
|
|
189
|
+
let syncStatusCallbackWithTryCatch;
|
|
190
|
+
let downloadProgressCallbackWithTryCatch;
|
|
191
|
+
if (typeof syncStatusChangeCallback === 'function') {
|
|
192
|
+
syncStatusCallbackWithTryCatch = (...args) => {
|
|
193
|
+
try {
|
|
194
|
+
syncStatusChangeCallback(...args);
|
|
195
|
+
} catch (error) {
|
|
196
|
+
(0, _log.log)(`An error has occurred : ${error instanceof Error ? error.stack : 'unknown'}`);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
if (typeof downloadProgressCallback === 'function') {
|
|
201
|
+
downloadProgressCallbackWithTryCatch = (...args) => {
|
|
202
|
+
try {
|
|
203
|
+
downloadProgressCallback(...args);
|
|
204
|
+
} catch (error) {
|
|
205
|
+
(0, _log.log)(`An error has occurred: ${error instanceof Error ? error.stack : 'unknown'}`);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
if (syncInProgress) {
|
|
210
|
+
typeof syncStatusCallbackWithTryCatch === 'function' ? syncStatusCallbackWithTryCatch(_SyncStatusEnum.SyncStatus.SYNC_IN_PROGRESS) : (0, _log.log)('Sync already in progress.');
|
|
211
|
+
return Promise.resolve(_SyncStatusEnum.SyncStatus.SYNC_IN_PROGRESS);
|
|
212
|
+
}
|
|
213
|
+
syncInProgress = true;
|
|
214
|
+
const syncPromise = syncInternal(options, syncStatusCallbackWithTryCatch, downloadProgressCallbackWithTryCatch, handleBinaryVersionMismatchCallback);
|
|
215
|
+
syncPromise.then(setSyncCompleted).catch(setSyncCompleted);
|
|
216
|
+
return syncPromise;
|
|
217
|
+
};
|
|
218
|
+
})();
|
|
219
|
+
//# sourceMappingURL=sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_checkForUpdates","_InstallModeEnum","_SyncStatusEnum","_getCurrentPackage","_shouldUpdateBeIgnored","_log","_notifyAppReady","DEFAULT_UPDATE_DIALOG","exports","appendReleaseDescription","descriptionPrefix","mandatoryContinueButtonLabel","mandatoryUpdateMessage","optionalIgnoreButtonLabel","optionalInstallButtonLabel","optionalUpdateMessage","title","syncInternal","options","syncStatusChangeCallback","downloadProgressCallback","handleBinaryVersionMismatchCallback","resolvedInstallMode","syncOptions","releaseChannelPublicId","undefined","ignoreFailedUpdates","rollbackRetryOptions","installMode","InstallMode","ON_NEXT_RESTART","mandatoryInstallMode","IMMEDIATE","minimumBackgroundDuration","updateDialog","syncStatus","SyncStatus","CHECKING_FOR_UPDATE","log","AWAITING_USER_ACTION","DOWNLOADING_PACKAGE","INSTALLING_UPDATE","UP_TO_DATE","UPDATE_IGNORED","UPDATE_INSTALLED","ON_NEXT_RESUME","UNKNOWN_ERROR","notifyAppReady","remotePackage","checkForUpdate","doDownloadAndInstall","Error","localPackage","download","isMandatory","install","updateShouldBeIgnored","shouldUpdateBeIgnored","currentPackage","getCurrentPackage","isPending","updateDialogConfig","Promise","resolve","reject","message","installButtonText","dialogButtons","push","text","onPress","then","description","Alert","alert","Platform","OS","reverse","error","sync","syncInProgress","setSyncCompleted","syncStatusCallbackWithTryCatch","downloadProgressCallbackWithTryCatch","args","stack","SYNC_IN_PROGRESS","syncPromise","catch"],"sourceRoot":"../../src","sources":["sync.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,O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AAc,EAAE;MAClB,OAAOE,8BAA8B,KAAK,UAAU,GAChDA,8BAA8B,CAAC9C,0BAAU,CAACkD,gBAAgB,CAAC,GAC3D,IAAAhD,QAAG,EAAC,2BAA2B,CAAC;MACpC,OAAOwB,OAAO,CAACC,OAAO,CAAC3B,0BAAU,CAACkD,gBAAgB,CAAC;IACrD;IAEAN,cAAc,GAAG,IAAI;IAErB,MAAMO,WAAW,GAAGtE,YAAY,CAC9BC,OAAO,EACPgE,8BAA8B,EAC9BC,oCAAoC,EACpC9D,mCACF,CAAC;IAEDkE,WAAW,CAAChB,IAAI,CAACU,gBAAgB,CAAC,CAACO,KAAK,CAACP,gBAAgB,CAAC;IAE1D,OAAOM,WAAW;EACpB,CAAC;AACH,CAAC,EAAE,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import hoistStatics from 'hoist-non-react-statics';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { AppState } from 'react-native';
|
|
6
|
+
import { CheckFrequency } from "./enums/CheckFrequency.enum.js";
|
|
7
|
+
import { notifyAppReady } from "./notifyAppReady.js";
|
|
8
|
+
import { sync } from "./sync.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Decorates a React Component configuring it to sync for updates with the CodePush server.
|
|
12
|
+
*
|
|
13
|
+
* @param component the React Component that will be decorated
|
|
14
|
+
*/
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Decorates a React Component configuring it to sync for updates with the CodePush server.
|
|
19
|
+
*
|
|
20
|
+
* @param options Options used to configure the end-user sync and update experience (e.g. when to check for updates?, show a prompt?, install the update immediately?).
|
|
21
|
+
*/
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
export function withCodePush(optionsOrComponent) {
|
|
24
|
+
const options = typeof optionsOrComponent === 'function' ? {} : optionsOrComponent;
|
|
25
|
+
const WithCodePush = RootComponent => {
|
|
26
|
+
class CodePushComponent extends React.Component {
|
|
27
|
+
constructor(props) {
|
|
28
|
+
super(props);
|
|
29
|
+
this.rootComponentRef = /*#__PURE__*/React.createRef();
|
|
30
|
+
}
|
|
31
|
+
componentDidMount() {
|
|
32
|
+
if (options.checkFrequency === CheckFrequency.MANUAL) {
|
|
33
|
+
notifyAppReady();
|
|
34
|
+
} else {
|
|
35
|
+
const rootComponentInstance = this.rootComponentRef.current;
|
|
36
|
+
let syncStatusCallback;
|
|
37
|
+
if (rootComponentInstance && rootComponentInstance.codePushStatusDidChange) {
|
|
38
|
+
syncStatusCallback = rootComponentInstance.codePushStatusDidChange.bind(rootComponentInstance);
|
|
39
|
+
}
|
|
40
|
+
let downloadProgressCallback;
|
|
41
|
+
if (rootComponentInstance && rootComponentInstance.codePushDownloadDidProgress) {
|
|
42
|
+
downloadProgressCallback = rootComponentInstance.codePushDownloadDidProgress.bind(rootComponentInstance);
|
|
43
|
+
}
|
|
44
|
+
let handleBinaryVersionMismatchCallback;
|
|
45
|
+
if (rootComponentInstance && rootComponentInstance.codePushOnBinaryVersionMismatch) {
|
|
46
|
+
handleBinaryVersionMismatchCallback = rootComponentInstance.codePushOnBinaryVersionMismatch.bind(rootComponentInstance);
|
|
47
|
+
}
|
|
48
|
+
sync(options, syncStatusCallback, downloadProgressCallback, handleBinaryVersionMismatchCallback);
|
|
49
|
+
if (options.checkFrequency === CheckFrequency.ON_APP_RESUME) {
|
|
50
|
+
AppState.addEventListener('change', newState => {
|
|
51
|
+
if (newState === 'active') {
|
|
52
|
+
sync(options, syncStatusCallback, downloadProgressCallback);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
render() {
|
|
59
|
+
const props = {
|
|
60
|
+
...this.props
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// We can set ref property on class components only (not stateless)
|
|
64
|
+
// Check it by render method
|
|
65
|
+
if (RootComponent.prototype && RootComponent.prototype.render) {
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
props.ref = this.rootComponentRef;
|
|
68
|
+
}
|
|
69
|
+
return /*#__PURE__*/_jsx(RootComponent, {
|
|
70
|
+
...props
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return hoistStatics(CodePushComponent, RootComponent);
|
|
75
|
+
};
|
|
76
|
+
if (typeof optionsOrComponent === 'function') {
|
|
77
|
+
// Infer that the root component was directly passed to us.
|
|
78
|
+
return WithCodePush(optionsOrComponent);
|
|
79
|
+
} else {
|
|
80
|
+
return WithCodePush;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export default withCodePush;
|
|
84
|
+
//# sourceMappingURL=CodePush.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hoistStatics","React","AppState","CheckFrequency","notifyAppReady","sync","jsx","_jsx","withCodePush","optionsOrComponent","options","WithCodePush","RootComponent","CodePushComponent","Component","constructor","props","rootComponentRef","createRef","componentDidMount","checkFrequency","MANUAL","rootComponentInstance","current","syncStatusCallback","codePushStatusDidChange","bind","downloadProgressCallback","codePushDownloadDidProgress","handleBinaryVersionMismatchCallback","codePushOnBinaryVersionMismatch","ON_APP_RESUME","addEventListener","newState","render","prototype","ref"],"sourceRoot":"../../src","sources":["CodePush.tsx"],"mappings":";;AAAA,OAAOA,YAAY,MAAM,yBAAyB;AAClD,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,cAAc,QAAQ,gCAA6B;AAC5D,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,IAAI,QAAQ,WAAQ;;AAgB7B;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AAJA,SAAAC,GAAA,I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AC3D7B,QAAQ,CAAC8B,gBAAgB,CAAC,QAAQ,EAAGC,QAAgB,IAAK;cACxD,IAAIA,QAAQ,KAAK,QAAQ,EAAE;gBACzB5B,IAAI,CAACK,OAAO,EAAEc,kBAAkB,EAAEG,wBAAwB,CAAC;cAC7D;YACF,CAAC,CAAC;UACJ;QACF;MACF;MAEAO,MAAMA,CAAA,EAAG;QACP,MAAMlB,KAAK,GAAG;UAAE,GAAG,IAAI,CAACA;QAAM,CAAC;;QAE/B;QACA;QACA,IAAIJ,aAAa,CAACuB,SAAS,IAAIvB,aAAa,CAACuB,SAAS,CAACD,MAAM,EAAE;UAC7D;UACAlB,KAAK,CAACoB,GAAG,GAAG,IAAI,CAACnB,gBAAgB;QACnC;QAEA,oBAAOV,IAAA,CAACK,aAAa;UAAA,GAAKI;QAAK,CAAG,CAAC;MACrC;IACF;IAEA,OAAOhB,YAAY,CAACa,iBAAiB,EAAED,aAAa,CAAC;EACvD,CAAC;EAED,IAAI,OAAOH,kBAAkB,KAAK,UAAU,EAAE;IAC5C;IACA,OAAOE,YAAY,CAACF,kBAAkB,CAAC;EACzC,CAAC,MAAM;IACL,OAAOE,YAAY;EACrB;AACF;AAEA,eAAeH,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeRNAppZungCodePushModule } from "./internals/NativeRNAppZungCodePushModule.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Allow CodePush to restart the app.
|
|
7
|
+
*/
|
|
8
|
+
export const allowRestart = NativeRNAppZungCodePushModule.allow;
|
|
9
|
+
//# sourceMappingURL=allowRestart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeRNAppZungCodePushModule","allowRestart","allow"],"sourceRoot":"../../src","sources":["allowRestart.ts"],"mappings":";;AAAA,SAASA,6BAA6B,QAAQ,8CAA2C;;AAEzF;AACA;AACA;AACA,OAAO,MAAMC,YAAwB,GAAGD,6BAA6B,CAACE,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import { NativeRNAppZungCodePushModule } from "./internals/NativeRNAppZungCodePushModule.js";
|
|
5
|
+
import { RemotePackageImpl } from "./internals/RemotePackageImplementation.js";
|
|
6
|
+
import { getConfiguration } from "./internals/getConfiguration.js";
|
|
7
|
+
import { getCurrentPackage } from "./internals/getCurrentPackage.js";
|
|
8
|
+
import { getPromisifiedSdk } from "./internals/getPromisifiedSdk.js";
|
|
9
|
+
import { log } from "./internals/utils/log.js";
|
|
10
|
+
import { requestFetchAdapter } from "./internals/utils/request-fetch-adapter.js";
|
|
11
|
+
/**
|
|
12
|
+
* Asks the CodePush service whether the configured app release channel has an update available.
|
|
13
|
+
*
|
|
14
|
+
* @param releaseChannelPublicId The release channel public ID to use to query the CodePush server for an update.
|
|
15
|
+
* @param handleBinaryVersionMismatchCallback An optional callback for handling target binary version mismatch
|
|
16
|
+
*/
|
|
17
|
+
export async function checkForUpdate(releaseChannelPublicId, handleBinaryVersionMismatchCallback) {
|
|
18
|
+
/*
|
|
19
|
+
* Before we ask the server if an update exists, we
|
|
20
|
+
* need to retrieve three pieces of information from the
|
|
21
|
+
* native side: release channel, app version (e.g. 1.0.1)
|
|
22
|
+
* and the hash of the currently running update (if there is one).
|
|
23
|
+
* This allows the client to only receive updates which are targeted
|
|
24
|
+
* for their specific release channel and version and which are actually
|
|
25
|
+
* different from the CodePush update they have already installed.
|
|
26
|
+
*/
|
|
27
|
+
const nativeConfig = await getConfiguration();
|
|
28
|
+
/*
|
|
29
|
+
* If a release channel was explicitly provided,
|
|
30
|
+
* then let's override the one we retrieved
|
|
31
|
+
* from the native-side of the app. This allows
|
|
32
|
+
* dynamically "redirecting" end-users at different
|
|
33
|
+
* release channels (e.g. an early access release channel for insiders).
|
|
34
|
+
*/
|
|
35
|
+
const config = releaseChannelPublicId ? {
|
|
36
|
+
...nativeConfig,
|
|
37
|
+
...{
|
|
38
|
+
releaseChannelPublicId
|
|
39
|
+
}
|
|
40
|
+
} : nativeConfig;
|
|
41
|
+
const sdk = getPromisifiedSdk(requestFetchAdapter, config);
|
|
42
|
+
const localPackage = await getCurrentPackage();
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
* If the app has a previously installed update, and that update
|
|
46
|
+
* was targeted at the same app version that is currently running,
|
|
47
|
+
* then we want to use its package hash to determine whether a new
|
|
48
|
+
* release has been made on the server. Otherwise, we only need
|
|
49
|
+
* to send the app version to the server, since we are interested
|
|
50
|
+
* in any updates for current binary version, regardless of hash.
|
|
51
|
+
*/
|
|
52
|
+
let queryPackage;
|
|
53
|
+
if (localPackage) {
|
|
54
|
+
queryPackage = localPackage;
|
|
55
|
+
} else {
|
|
56
|
+
queryPackage = {
|
|
57
|
+
appVersion: config.appVersion
|
|
58
|
+
};
|
|
59
|
+
if (Platform.OS === 'ios' && config.packageHash) {
|
|
60
|
+
queryPackage.packageHash = config.packageHash;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const update = await sdk.queryUpdateWithCurrentPackage(queryPackage);
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
* There are four cases where checkForUpdate will resolve to null:
|
|
67
|
+
* ----------------------------------------------------------------
|
|
68
|
+
* 1) The server said there isn't an update. This is the most common case.
|
|
69
|
+
* 2) The server said there is an update but it requires a newer binary version.
|
|
70
|
+
* This would occur when end-users are running an older binary version than
|
|
71
|
+
* is available, and CodePush is making sure they don't get an update that
|
|
72
|
+
* potentially wouldn't be compatible with what they are running.
|
|
73
|
+
* 3) The server said there is an update, but the update's hash is the same as
|
|
74
|
+
* the currently running update. This should _never_ happen, unless there is a
|
|
75
|
+
* bug in the server, but we're adding this check just to double-check that the
|
|
76
|
+
* client app is resilient to a potential issue with the update check.
|
|
77
|
+
* 4) The server said there is an update, but the update's hash is the same as that
|
|
78
|
+
* of the binary's currently running version. This should only happen in Android -
|
|
79
|
+
* unlike iOS, we don't attach the binary's hash to the updateCheck request
|
|
80
|
+
* because we want to avoid having to install diff updates against the binary's
|
|
81
|
+
* version, which we can't do yet on Android.
|
|
82
|
+
*/
|
|
83
|
+
if (!update) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
if ('updateAppVersion' in update && update.updateAppVersion) {
|
|
87
|
+
log('An update is available but it is not targeting the binary version of your app.');
|
|
88
|
+
handleBinaryVersionMismatchCallback?.(update);
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
if (localPackage && 'packageHash' in update && update.packageHash === localPackage.packageHash || (!localPackage || '_isDebugOnly' in localPackage && localPackage._isDebugOnly) && 'packageHash' in update && config.packageHash === update.packageHash) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// @ts-expect-error sdk typing is wrong
|
|
96
|
+
const remotePackage = new RemotePackageImpl(update, sdk.reportStatusDownload);
|
|
97
|
+
remotePackage.failedInstall = await NativeRNAppZungCodePushModule.isFailedUpdate(remotePackage.packageHash);
|
|
98
|
+
remotePackage.releaseChannelPublicId = releaseChannelPublicId || nativeConfig.releaseChannelPublicId;
|
|
99
|
+
return remotePackage;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=checkForUpdates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","NativeRNAppZungCodePushModule","RemotePackageImpl","getConfiguration","getCurrentPackage","getPromisifiedSdk","log","requestFetchAdapter","checkForUpdate","releaseChannelPublicId","handleBinaryVersionMismatchCallback","nativeConfig","config","sdk","localPackage","queryPackage","appVersion","OS","packageHash","update","queryUpdateWithCurrentPackage","updateAppVersion","_isDebugOnly","remotePackage","reportStatusDownload","failedInstall","isFailedUpdate"],"sourceRoot":"../../src","sources":["checkForUpdates.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,6BAA6B,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AAO,IAAI;EACb;EAEA,IAAI,kBAAkB,IAAIA,MAAM,IAAIA,MAAM,CAACE,gBAAgB,EAAE;IAC3Df,GAAG,CAAC,gFAAgF,CAAC;IACrFI,mCAAmC,GAAGS,MAAM,CAAC;IAE7C,OAAO,IAAI;EACb;EAEA,IACGL,YAAY,IAAI,aAAa,IAAIK,MAAM,IAAIA,MAAM,CAACD,WAAW,KAAKJ,YAAY,CAACI,WAAW,IAC1F,CAAC,CAACJ,YAAY,IAAK,cAAc,IAAIA,YAAY,IAAIA,YAAY,CAACQ,YAAa,KAC9E,aAAa,IAAIH,MAAM,IACvBP,MAAM,CAACM,WAAW,KAAKC,MAAM,CAACD,WAAY,EAC5C;IACA,OAAO,IAAI;EACb;;EAEA;EACA,MAAMK,aAAa,GAAG,IAAIrB,iBAAiB,CAACiB,MAAM,EAAEN,GAAG,CAACW,oBAAoB,CAAC;EAC7ED,aAAa,CAACE,aAAa,GAAG,MAAMxB,6BAA6B,CAACyB,cAAc,CAACH,aAAa,CAACL,WAAW,CAAC;EAC3GK,aAAa,CAACd,sBAAsB,GAAGA,sBAAsB,IAAIE,YAAY,CAACF,sBAAsB;EACpG,OAAOc,aAAa;AACtB","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeRNAppZungCodePushModule } from "./internals/NativeRNAppZungCodePushModule.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Clears all downloaded CodePush updates.
|
|
7
|
+
* This is useful when switching to a different release channel which may have an older release than the current package.
|
|
8
|
+
* Note: we don’t recommend to use this method in scenarios other than that (CodePush will call
|
|
9
|
+
* this method automatically when needed in other cases) as it could lead to unpredictable behavior.
|
|
10
|
+
*/
|
|
11
|
+
export const clearUpdates = NativeRNAppZungCodePushModule.clearUpdates;
|
|
12
|
+
//# sourceMappingURL=clearUpdates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeRNAppZungCodePushModule","clearUpdates"],"sourceRoot":"../../src","sources":["clearUpdates.ts"],"mappings":";;AAAA,SAASA,6BAA6B,QAAQ,8CAA2C;;AAEzF;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAwB,GAAGD,6BAA6B,CAACC,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeRNAppZungCodePushModule } from "./internals/NativeRNAppZungCodePushModule.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Forbid CodePush to restart the app.
|
|
7
|
+
*/
|
|
8
|
+
export const disallowRestart = NativeRNAppZungCodePushModule.disallow;
|
|
9
|
+
//# sourceMappingURL=disallowRestart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeRNAppZungCodePushModule","disallowRestart","disallow"],"sourceRoot":"../../src","sources":["disallowRestart.ts"],"mappings":";;AAAA,SAASA,6BAA6B,QAAQ,8CAA2C;;AAEzF;AACA;AACA;AACA,OAAO,MAAMC,eAA2B,GAAGD,6BAA6B,CAACE,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Indicates when you would like to check for (and install) updates from the CodePush server.
|
|
5
|
+
*/
|
|
6
|
+
export let CheckFrequency = /*#__PURE__*/function (CheckFrequency) {
|
|
7
|
+
/**
|
|
8
|
+
* When the app is fully initialized (or more specifically, when the root component is mounted).
|
|
9
|
+
*/
|
|
10
|
+
CheckFrequency[CheckFrequency["ON_APP_START"] = 0] = "ON_APP_START";
|
|
11
|
+
/**
|
|
12
|
+
* When the app re-enters the foreground.
|
|
13
|
+
*/
|
|
14
|
+
CheckFrequency[CheckFrequency["ON_APP_RESUME"] = 1] = "ON_APP_RESUME";
|
|
15
|
+
/**
|
|
16
|
+
* Don't automatically check for updates, but only do it when codePush.sync() is manually called inside app code.
|
|
17
|
+
*/
|
|
18
|
+
CheckFrequency[CheckFrequency["MANUAL"] = 2] = "MANUAL";
|
|
19
|
+
return CheckFrequency;
|
|
20
|
+
}({});
|
|
21
|
+
//# sourceMappingURL=CheckFrequency.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CheckFrequency"],"sourceRoot":"../../../src","sources":["enums/CheckFrequency.enum.ts"],"mappings":";;AAAA;AACA;AACA;AACA,WAAYA,cAAc,0BAAdA,cAAc;EACxB;AACF;AACA;EAHYA,cAAc,CAAdA,cAAc;EAMxB;AACF;AACA;EARYA,cAAc,CAAdA,cAAc;EAWxB;AACF;AACA;EAbYA,cAAc,CAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Indicates the status of a deployment (after installing and restarting).
|
|
5
|
+
*/
|
|
6
|
+
export let DeploymentStatus = /*#__PURE__*/function (DeploymentStatus) {
|
|
7
|
+
/**
|
|
8
|
+
* The deployment failed (and was rolled back).
|
|
9
|
+
*/
|
|
10
|
+
DeploymentStatus["FAILED"] = "DeploymentFailed";
|
|
11
|
+
/**
|
|
12
|
+
* The deployment succeeded.
|
|
13
|
+
*/
|
|
14
|
+
DeploymentStatus["SUCCEEDED"] = "DeploymentSucceeded";
|
|
15
|
+
return DeploymentStatus;
|
|
16
|
+
}({});
|
|
17
|
+
//# sourceMappingURL=DeploymentStatus.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DeploymentStatus"],"sourceRoot":"../../../src","sources":["enums/DeploymentStatus.enum.ts"],"mappings":";;AAAA;AACA;AACA;AACA,WAAYA,gBAAgB,0BAAhBA,gBAAgB;EAC1B;AACF;AACA;EAHYA,gBAAgB;EAM1B;AACF;AACA;EARYA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NativeRNAppZungCodePushModule } from "../internals/NativeRNAppZungCodePushModule.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Indicates when you would like an installed update to actually be applied.
|
|
7
|
+
*/
|
|
8
|
+
export let InstallMode = function (InstallMode) {
|
|
9
|
+
/**
|
|
10
|
+
* Indicates that you want to install the update and restart the app immediately.
|
|
11
|
+
*/
|
|
12
|
+
InstallMode[InstallMode["IMMEDIATE"] = NativeRNAppZungCodePushModule.getConstants().codePushInstallModeImmediate] = "IMMEDIATE";
|
|
13
|
+
/**
|
|
14
|
+
* Indicates that you want to install the update, but not forcibly restart the app.
|
|
15
|
+
*/
|
|
16
|
+
InstallMode[InstallMode["ON_NEXT_RESTART"] = NativeRNAppZungCodePushModule.getConstants().codePushInstallModeOnNextRestart] = "ON_NEXT_RESTART";
|
|
17
|
+
/**
|
|
18
|
+
* Indicates that you want to install the update, but don't want to restart the app until the next time
|
|
19
|
+
* the end user resumes it from the background. This way, you don't disrupt their current session,
|
|
20
|
+
* but you can get the update in front of them sooner than having to wait for the next natural restart.
|
|
21
|
+
* This value is appropriate for silent installs that can be applied on resume in a non-invasive way.
|
|
22
|
+
*/
|
|
23
|
+
InstallMode[InstallMode["ON_NEXT_RESUME"] = NativeRNAppZungCodePushModule.getConstants().codePushInstallModeOnNextResume] = "ON_NEXT_RESUME";
|
|
24
|
+
/**
|
|
25
|
+
* Indicates that you want to install the update when the app is in the background,
|
|
26
|
+
* but only after it has been in the background for "minimumBackgroundDuration" seconds (0 by default),
|
|
27
|
+
* so that user context isn't lost unless the app suspension is long enough to not matter.
|
|
28
|
+
*/
|
|
29
|
+
InstallMode[InstallMode["ON_NEXT_SUSPEND"] = NativeRNAppZungCodePushModule.getConstants().codePushInstallModeOnNextSuspend] = "ON_NEXT_SUSPEND";
|
|
30
|
+
return InstallMode;
|
|
31
|
+
}({});
|
|
32
|
+
//# sourceMappingURL=InstallMode.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeRNAppZungCodePushModule","InstallMode","getConstants","codePushInstallModeImmediate","codePushInstallModeOnNextRestart","codePushInstallModeOnNextResume","codePushInstallModeOnNextSuspend"],"sourceRoot":"../../../src","sources":["enums/InstallMode.enum.ts"],"mappings":";;AAAA,SAASA,6BAA6B,QAAQ,+CAA4C;;AAE1F;AACA;AACA;AACA,WAAYC,WAAW,aAAXA,WAAW;EACrB;AACF;AACA;EAHYA,WAAW,CAAXA,WAAW,gBAITD,6BAA6B,CAACE,YAAY,CAAC,CAAC,CAACC,4BAA4B;EAErF;AACF;AACA;EARYF,WAAW,CAAXA,WAAW,sBASHD,6BAA6B,CAACE,YAAY,CAAC,CAAC,CAACE,gCAAgC;EAE/F;AACF;AACA;AACA;AACA;AACA;EAhBYH,WAAW,CAAXA,WAAW,qBAiBJD,6BAA6B,CAACE,YAAY,CAAC,CAAC,CAACG,+BAA+B;EAE7F;AACF;AACA;AACA;AACA;EAvBYJ,WAAW,CAAXA,WAAW,sBAwBHD,6BAA6B,CAACE,YAAY,CAAC,CAAC,CAACI,gCAAgC;EAAA,OAxBrFL,WAAW;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Indicates the current status of a sync operation.
|
|
5
|
+
*/
|
|
6
|
+
export let SyncStatus = /*#__PURE__*/function (SyncStatus) {
|
|
7
|
+
/**
|
|
8
|
+
* The app is up-to-date with the CodePush server.
|
|
9
|
+
*/
|
|
10
|
+
SyncStatus[SyncStatus["UP_TO_DATE"] = 0] = "UP_TO_DATE";
|
|
11
|
+
/**
|
|
12
|
+
* An available update has been installed and will be run either immediately after the
|
|
13
|
+
* syncStatusChangedCallback function returns or the next time the app resumes/restarts,
|
|
14
|
+
* depending on the InstallMode specified in SyncOptions
|
|
15
|
+
*/
|
|
16
|
+
SyncStatus[SyncStatus["UPDATE_INSTALLED"] = 1] = "UPDATE_INSTALLED";
|
|
17
|
+
/**
|
|
18
|
+
* The app had an optional update which the end user chose to ignore.
|
|
19
|
+
* (This is only applicable when the updateDialog is used)
|
|
20
|
+
*/
|
|
21
|
+
SyncStatus[SyncStatus["UPDATE_IGNORED"] = 2] = "UPDATE_IGNORED";
|
|
22
|
+
/**
|
|
23
|
+
* The sync operation encountered an unknown error.
|
|
24
|
+
*/
|
|
25
|
+
SyncStatus[SyncStatus["UNKNOWN_ERROR"] = 3] = "UNKNOWN_ERROR";
|
|
26
|
+
/**
|
|
27
|
+
* There is an ongoing sync operation running which prevents the current call from being executed.
|
|
28
|
+
*/
|
|
29
|
+
SyncStatus[SyncStatus["SYNC_IN_PROGRESS"] = 4] = "SYNC_IN_PROGRESS";
|
|
30
|
+
/**
|
|
31
|
+
* The CodePush server is being queried for an update.
|
|
32
|
+
*/
|
|
33
|
+
SyncStatus[SyncStatus["CHECKING_FOR_UPDATE"] = 5] = "CHECKING_FOR_UPDATE";
|
|
34
|
+
/**
|
|
35
|
+
* An update is available, and a confirmation dialog was shown
|
|
36
|
+
* to the end user. (This is only applicable when the updateDialog is used)
|
|
37
|
+
*/
|
|
38
|
+
SyncStatus[SyncStatus["AWAITING_USER_ACTION"] = 6] = "AWAITING_USER_ACTION";
|
|
39
|
+
/**
|
|
40
|
+
* An available update is being downloaded from the CodePush server.
|
|
41
|
+
*/
|
|
42
|
+
SyncStatus[SyncStatus["DOWNLOADING_PACKAGE"] = 7] = "DOWNLOADING_PACKAGE";
|
|
43
|
+
/**
|
|
44
|
+
* An available update was downloaded and is about to be installed.
|
|
45
|
+
*/
|
|
46
|
+
SyncStatus[SyncStatus["INSTALLING_UPDATE"] = 8] = "INSTALLING_UPDATE";
|
|
47
|
+
return SyncStatus;
|
|
48
|
+
}({});
|
|
49
|
+
//# sourceMappingURL=SyncStatus.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SyncStatus"],"sourceRoot":"../../../src","sources":["enums/SyncStatus.enum.ts"],"mappings":";;AAAA;AACA;AACA;AACA,WAAYA,UAAU,0BAAVA,UAAU;EACpB;AACF;AACA;EAHYA,UAAU,CAAVA,UAAU;EAMpB;AACF;AACA;AACA;AACA;EAVYA,UAAU,CAAVA,UAAU;EAapB;AACF;AACA;AACA;EAhBYA,UAAU,CAAVA,UAAU;EAmBpB;AACF;AACA;EArBYA,UAAU,CAAVA,UAAU;EAwBpB;AACF;AACA;EA1BYA,UAAU,CAAVA,UAAU;EA6BpB;AACF;AACA;EA/BYA,UAAU,CAAVA,UAAU;EAkCpB;AACF;AACA;AACA;EArCYA,UAAU,CAAVA,UAAU;EAwCpB;AACF;AACA;EA1CYA,UAAU,CAAVA,UAAU;EA6CpB;AACF;AACA;EA/CYA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA","ignoreList":[]}
|