@appzung/react-native-code-push 9.0.2 → 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 +1 -1
- package/README.md +169 -329
- package/android/app/.gradle/config.properties +2 -0
- package/android/app/build.gradle +63 -19
- package/android/app/local.properties +8 -0
- 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 +35 -97
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushConstants.java +1 -1
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushInstallMode.java +2 -2
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushInvalidPublicKeyException.java +2 -2
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushInvalidUpdateException.java +1 -1
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushMalformedDataException.java +2 -2
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushNativeModule.java +37 -8
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushNotInitializedException.java +2 -2
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushTelemetryManager.java +14 -14
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUnknownException.java +2 -2
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUpdateManager.java +3 -3
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUpdateState.java +2 -2
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUpdateUtils.java +1 -1
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUtils.java +1 -1
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/DownloadProgress.java +1 -1
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/DownloadProgressCallback.java +1 -1
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/FileUtils.java +1 -1
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/ReactInstanceHolder.java +1 -1
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/SettingsManager.java +1 -1
- package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/TLSSocketFactory.java +1 -1
- package/android/build.gradle +1 -11
- package/android/codepush.gradle +3 -3
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/gradle.properties +4 -20
- package/docs/advanced-usage.md +56 -0
- package/docs/api-android.md +16 -77
- package/docs/api-ios.md +9 -21
- package/docs/api-js.md +184 -219
- package/docs/code-signing.md +62 -0
- package/docs/migrating-to-v10.md +31 -0
- package/docs/setup-android.md +54 -463
- package/docs/setup-ios.md +37 -208
- package/docs/setup-windows.md +8 -74
- package/ios/CodePush/CodePush.h +4 -4
- package/ios/CodePush/CodePush.m +21 -65
- package/ios/CodePush/CodePushConfig.m +14 -11
- package/ios/CodePush/CodePushPackage.m +60 -60
- package/ios/CodePush/CodePushTelemetryManager.m +13 -13
- package/ios/CodePush.xcodeproj/project.pbxproj +1 -562
- 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 +79 -29
- package/react-native.config.js +8 -8
- package/scripts/generateBundledResourcesHash.js +1 -1
- package/scripts/getFilesInFolder.js +1 -1
- package/scripts/recordFilesBeforeBundleCommand.js +1 -1
- 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/windows/CodePush/CodePushConfig.cpp +3 -3
- package/windows/CodePush/CodePushConfig.h +3 -3
- package/windows/CodePush/CodePushNativeModule.cpp +27 -27
- package/windows/CodePush/CodePushNativeModule.h +4 -4
- package/windows/CodePush/CodePushTelemetryManager.cpp +12 -12
- package/windows/CodePush/CodePushTelemetryManager.h +1 -1
- package/.azurepipelines/build-rn-code-push-1es.yml +0 -104
- package/.azurepipelines/test-rn-code-push.yml +0 -94
- package/.config/CredScanSuppressions.json +0 -14
- package/AlertAdapter.js +0 -24
- package/CONTRIBUTING.md +0 -134
- package/CodePush.js +0 -671
- package/SECURITY.md +0 -41
- 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/docs/multi-deployment-testing-android.md +0 -148
- package/docs/multi-deployment-testing-ios.md +0 -59
- package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +0 -34
- package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +0 -252
- package/ios/CodePush/Base64/README.md +0 -47
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +0 -69
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +0 -16
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +0 -51
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +0 -15
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +0 -55
- package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +0 -24
- package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +0 -41
- package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +0 -28
- package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +0 -205
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +0 -103
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +0 -322
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +0 -37
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +0 -145
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +0 -35
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +0 -551
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +0 -23
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +0 -43
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +0 -230
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +0 -31
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +0 -113
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +0 -38
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +0 -500
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +0 -18
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +0 -214
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +0 -23
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +0 -29
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +0 -19
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +0 -68
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +0 -18
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +0 -72
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +0 -67
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +0 -111
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +0 -119
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +0 -307
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +0 -94
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +0 -619
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +0 -164
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +0 -514
- package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +0 -24
- package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +0 -11
- package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +0 -52
- package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +0 -5
- package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +0 -28
- package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +0 -70
- package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +0 -22
- package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +0 -34
- package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +0 -73
- package/ios/CodePush/JWT/LICENSE +0 -19
- package/ios/CodePush/JWT/README.md +0 -489
- package/ios/CodePush/SSZipArchive/Info.plist +0 -26
- package/ios/CodePush/SSZipArchive/README.md +0 -1
- package/ios/CodePush/SSZipArchive/SSZipArchive.h +0 -178
- package/ios/CodePush/SSZipArchive/SSZipArchive.m +0 -1496
- package/ios/CodePush/SSZipArchive/SSZipCommon.h +0 -71
- package/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy +0 -23
- package/ios/CodePush/SSZipArchive/include/ZipArchive.h +0 -25
- package/ios/CodePush/SSZipArchive/minizip/LICENSE +0 -17
- package/ios/CodePush/SSZipArchive/minizip/mz.h +0 -273
- package/ios/CodePush/SSZipArchive/minizip/mz_compat.c +0 -1306
- package/ios/CodePush/SSZipArchive/minizip/mz_compat.h +0 -346
- package/ios/CodePush/SSZipArchive/minizip/mz_crypt.c +0 -187
- package/ios/CodePush/SSZipArchive/minizip/mz_crypt.h +0 -65
- package/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c +0 -526
- package/ios/CodePush/SSZipArchive/minizip/mz_os.c +0 -348
- package/ios/CodePush/SSZipArchive/minizip/mz_os.h +0 -176
- package/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c +0 -350
- package/ios/CodePush/SSZipArchive/minizip/mz_strm.c +0 -556
- package/ios/CodePush/SSZipArchive/minizip/mz_strm.h +0 -132
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c +0 -383
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h +0 -42
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c +0 -269
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h +0 -48
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h +0 -40
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c +0 -203
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c +0 -334
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h +0 -46
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c +0 -429
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h +0 -43
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c +0 -360
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h +0 -46
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c +0 -389
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h +0 -43
- package/ios/CodePush/SSZipArchive/minizip/mz_zip.c +0 -2782
- package/ios/CodePush/SSZipArchive/minizip/mz_zip.h +0 -262
- package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c +0 -1942
- package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h +0 -285
- package/package-mixins.js +0 -68
- package/request-fetch-adapter.js +0 -52
- package/scripts/postlink/android/postlink.js +0 -87
- package/scripts/postlink/ios/postlink.js +0 -116
- package/scripts/postlink/run.js +0 -11
- package/scripts/postunlink/android/postunlink.js +0 -74
- package/scripts/postunlink/ios/postunlink.js +0 -87
- package/scripts/postunlink/run.js +0 -11
- package/scripts/tools/linkToolsAndroid.js +0 -57
- package/scripts/tools/linkToolsIos.js +0 -130
- package/tslint.json +0 -32
- package/typings/react-native-code-push.d.ts +0 -455
- package/windows-legacy/CodePush/CodePush.csproj +0 -128
- package/windows-legacy/CodePush/CodePushUtils.cs +0 -47
- package/windows-legacy/CodePush/FileUtils.cs +0 -40
- package/windows-legacy/CodePush/Properties/AssemblyInfo.cs +0 -29
- package/windows-legacy/CodePush/Properties/CodePush.rd.xml +0 -33
- package/windows-legacy/CodePush/UpdateManager.cs +0 -305
- package/windows-legacy/CodePush/UpdateUtils.cs +0 -46
- package/windows-legacy/CodePush.Net46/Adapters/Http/HttpProgress.cs +0 -28
- package/windows-legacy/CodePush.Net46/Adapters/Storage/ApplicationDataContainer.cs +0 -106
- package/windows-legacy/CodePush.Net46/CodePush.Net46.csproj +0 -103
- package/windows-legacy/CodePush.Net46/CodePushUtils.cs +0 -158
- package/windows-legacy/CodePush.Net46/FileUtils.cs +0 -55
- package/windows-legacy/CodePush.Net46/Properties/AssemblyInfo.cs +0 -36
- package/windows-legacy/CodePush.Net46/UpdateManager.cs +0 -330
- package/windows-legacy/CodePush.Net46/UpdateUtils.cs +0 -70
- package/windows-legacy/CodePush.Net46/packages.config +0 -5
- package/windows-legacy/CodePush.Net46.Test/ApplicationDataContainerTest.cs +0 -105
- package/windows-legacy/CodePush.Net46.Test/CodePush.Net46.Test.csproj +0 -137
- package/windows-legacy/CodePush.Net46.Test/Properties/AssemblyInfo.cs +0 -36
- package/windows-legacy/CodePush.Net46.Test/TelemetryManagerTest.cs +0 -117
- package/windows-legacy/CodePush.Net46.Test/app.config +0 -11
- package/windows-legacy/CodePush.Net46.Test/packages.config +0 -4
- package/windows-legacy/CodePush.Shared/CodePush.Shared.projitems +0 -22
- package/windows-legacy/CodePush.Shared/CodePush.Shared.shproj +0 -13
- package/windows-legacy/CodePush.Shared/CodePushConstants.cs +0 -35
- package/windows-legacy/CodePush.Shared/CodePushNativeModule.cs +0 -329
- package/windows-legacy/CodePush.Shared/CodePushReactPackage.cs +0 -235
- package/windows-legacy/CodePush.Shared/CodePushUtils.cs +0 -70
- package/windows-legacy/CodePush.Shared/InstallMode.cs +0 -9
- package/windows-legacy/CodePush.Shared/MinimumBackgroundListener.cs +0 -44
- package/windows-legacy/CodePush.Shared/SettingsManager.cs +0 -148
- package/windows-legacy/CodePush.Shared/TelemetryManager.cs +0 -250
- package/windows-legacy/CodePush.Shared/UpdateState.cs +0 -9
package/docs/api-js.md
CHANGED
|
@@ -12,25 +12,22 @@ The following sections describe the shape and behavior of these APIs in detail:
|
|
|
12
12
|
|
|
13
13
|
When you require `react-native-code-push`, the module object provides the following top-level methods in addition to the root-level [component decorator](#codepush):
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
- [allowRestart](#codepushallowrestart): Re-allows programmatic restarts to occur as a result of an update being installed, and optionally, immediately restarts the app if a pending update had attempted to restart the app while restarts were disallowed. This is an advanced API and is only necessary if your app explicitly disallowed restarts via the `disallowRestart` method.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
- [checkForUpdate](#codepushcheckforupdate): Asks the CodePush service whether the configured app release channel has an update available.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
- [disallowRestart](#codepushdisallowrestart): Temporarily disallows any programmatic restarts to occur as a result of a CodePush update being installed. This is an advanced API, and is useful when a component within your app (for example an onboarding process) needs to ensure that no end-user interruptions can occur during its lifetime.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
- [getUpdateMetadata](#codepushgetupdatemetadata): Retrieves the metadata for an installed update (like description, mandatory).
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
- [notifyAppReady](#codepushnotifyappready): Notifies the CodePush runtime that an installed update is considered successful. If you are manually checking for and installing updates (i.e. not using the [sync](#codepushsync) method to handle it all for you), then this method **MUST** be called; otherwise CodePush will treat the update as failed and rollback to the previous version when the app next restarts.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
- [restartApp](#codepushrestartapp): Immediately restarts the app. If there is an update pending, it will be immediately displayed to the end user. Otherwise, calling this method simply has the same behavior as the end user killing and restarting the process.
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
- [sync](#codepushsync): Allows checking for an update, downloading it and installing it, all with a single call. Unless you need custom UI and/or behavior, we recommend most developers to use this method when integrating CodePush into their apps
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* [clearUpdates](#clearupdates): Clear all downloaded CodePush updates. This is useful when switching to a different deployment which may have an older release than the current package.
|
|
32
|
-
|
|
33
|
-
_Note: we don’t recommend to use this method in scenarios other than that (CodePush will call this method automatically when needed in other cases) as it could lead to unpredictable behavior._
|
|
29
|
+
- [clearUpdates](#clearupdates): Clear all downloaded CodePush updates. This is useful when switching to a different release channel which may have an older release than the current package.
|
|
30
|
+
_Note: we don’t recommend to use this method in scenarios other than that (CodePush will call this method automatically when needed in other cases) as it could lead to unpredictable behavior._
|
|
34
31
|
|
|
35
32
|
#### codePush
|
|
36
33
|
|
|
@@ -39,6 +36,7 @@ When you require `react-native-code-push`, the module object provides the follow
|
|
|
39
36
|
codePush(rootComponent: React.Component): React.Component;
|
|
40
37
|
codePush(options: CodePushOptions)(rootComponent: React.Component): React.Component;
|
|
41
38
|
```
|
|
39
|
+
|
|
42
40
|
```javascript
|
|
43
41
|
// Decorator; Requires ES7 support
|
|
44
42
|
@codePush
|
|
@@ -49,112 +47,112 @@ Used to wrap a React component inside a "higher order" React component that know
|
|
|
49
47
|
|
|
50
48
|
This decorator provides support for letting you customize its behaviour to easily enable apps with different requirements. Below are some examples of ways you can use it (you can pick one or even use a combination):
|
|
51
49
|
|
|
52
|
-
1. **Silent sync on app start**
|
|
50
|
+
1. **Silent sync on app start** _(the simplest, default behavior)_. Your app will automatically download available updates, and apply them the next time the app restarts (like the OS or end user killed it, or the device was restarted). This way, the entire update experience is "silent" to the end user, since they don't see any update prompt and/or "synthetic" app restarts.
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
```javascript
|
|
53
|
+
// Fully silent update which keeps the app in
|
|
54
|
+
// sync with the server, without ever
|
|
55
|
+
// interrupting the end user
|
|
56
|
+
class MyApp extends Component<{}> {}
|
|
57
|
+
MyApp = codePush(MyApp);
|
|
58
|
+
export default MyApp;
|
|
59
|
+
```
|
|
62
60
|
|
|
63
61
|
2. **Silent sync every time the app resumes**. Same as 1, except we check for updates, or apply an update if one exists every time the app returns to the foreground after being "backgrounded".
|
|
64
62
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
```javascript
|
|
64
|
+
// Sync for updates every time the app resumes.
|
|
65
|
+
class MyApp extends Component<{}> {}
|
|
66
|
+
MyApp = codePush({ checkFrequency: codePush.CheckFrequency.ON_APP_RESUME, installMode: codePush.InstallMode.ON_NEXT_RESUME })(MyApp);
|
|
67
|
+
export default MyApp;
|
|
68
|
+
```
|
|
71
69
|
|
|
72
70
|
3. **Interactive**. When an update is available, prompt the end user for permission before downloading it, and then immediately apply the update. If an update was released using the `mandatory` flag, the end user would still be notified about the update, but they wouldn't have the choice to ignore it.
|
|
73
71
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
```javascript
|
|
73
|
+
// Active update, which lets the end user know
|
|
74
|
+
// about each update, and displays it to them
|
|
75
|
+
// immediately after downloading it
|
|
76
|
+
class MyApp extends Component<{}> {}
|
|
77
|
+
MyApp = codePush({ updateDialog: true, installMode: codePush.InstallMode.IMMEDIATE })(MyApp);
|
|
78
|
+
export default MyApp;
|
|
79
|
+
```
|
|
82
80
|
|
|
83
81
|
4. **Log/display progress**. While the app is syncing with the server for updates, make use of the `codePushStatusDidChange` and/or `codePushDownloadDidProgress` event hooks to log down the different stages of this process, or even display a progress bar to the user.
|
|
84
82
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
83
|
+
```javascript
|
|
84
|
+
// Make use of the event hooks to keep track of
|
|
85
|
+
// the different stages of the sync process.
|
|
86
|
+
class MyApp extends Component<{}> {
|
|
87
|
+
codePushStatusDidChange(status) {
|
|
88
|
+
switch(status) {
|
|
89
|
+
case codePush.SyncStatus.CHECKING_FOR_UPDATE:
|
|
90
|
+
console.log("Checking for updates.");
|
|
91
|
+
break;
|
|
92
|
+
case codePush.SyncStatus.DOWNLOADING_PACKAGE:
|
|
93
|
+
console.log("Downloading package.");
|
|
94
|
+
break;
|
|
95
|
+
case codePush.SyncStatus.INSTALLING_UPDATE:
|
|
96
|
+
console.log("Installing update.");
|
|
97
|
+
break;
|
|
98
|
+
case codePush.SyncStatus.UP_TO_DATE:
|
|
99
|
+
console.log("Up-to-date.");
|
|
100
|
+
break;
|
|
101
|
+
case codePush.SyncStatus.UPDATE_INSTALLED:
|
|
102
|
+
console.log("Update installed.");
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
codePushDownloadDidProgress(progress) {
|
|
108
|
+
console.log(progress.receivedBytes + " of " + progress.totalBytes + " received.");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
MyApp = codePush(MyApp);
|
|
112
|
+
export default MyApp;
|
|
113
|
+
```
|
|
116
114
|
|
|
117
115
|
##### CodePushOptions
|
|
118
116
|
|
|
119
117
|
The `codePush` decorator accepts an "options" object that allows you to customize numerous aspects of the default behavior mentioned above:
|
|
120
118
|
|
|
121
|
-
|
|
119
|
+
- **checkFrequency** _(codePush.CheckFrequency)_ - Specifies when you would like to check for updates. Defaults to `codePush.CheckFrequency.ON_APP_START`. Refer to the [`CheckFrequency`](#checkfrequency) enum reference for a description of the available options and what they do.
|
|
122
120
|
|
|
123
|
-
|
|
121
|
+
- **releaseChannelPublicId** _(String)_ - Specifies the release channel public ID you want to query for an update against. By default, this value is derived from the `Info.plist` file (iOS) and strings resources (Android), but this option allows you to override it from the script-side if you need to dynamically use a different release channel.
|
|
124
122
|
|
|
125
|
-
|
|
123
|
+
- **installMode** _(codePush.InstallMode)_ - Specifies when you would like to install optional updates (i.e. those that aren't marked as mandatory). Defaults to `codePush.InstallMode.ON_NEXT_RESTART`. Refer to the [`InstallMode`](#installmode) enum reference for a description of the available options and what they do.
|
|
126
124
|
|
|
127
|
-
|
|
125
|
+
- **mandatoryInstallMode** _(codePush.InstallMode)_ - Specifies when you would like to install updates which are marked as mandatory. Defaults to `codePush.InstallMode.IMMEDIATE`. Refer to the [`InstallMode`](#installmode) enum reference for a description of the available options and what they do.
|
|
128
126
|
|
|
129
|
-
|
|
127
|
+
- **minimumBackgroundDuration** _(Number)_ - Specifies the minimum number of seconds that the app needs to have been in the background before restarting the app. This property only applies to updates which are installed using `InstallMode.ON_NEXT_RESUME` or `InstallMode.ON_NEXT_SUSPEND`, and can be useful for getting your update in front of end users sooner, without being too obtrusive. Defaults to `0`, which has the effect of applying the update immediately after a resume or unless the app suspension is long enough to not matter, regardless how long it was in the background.
|
|
130
128
|
|
|
131
|
-
|
|
129
|
+
- **updateDialog** _(UpdateDialogOptions)_ - An "options" object used to determine whether a confirmation dialog should be displayed to the end user when an update is available, and if so, what strings to use. Defaults to `null`, which has the effect of disabling the dialog completely. Setting this to any truthy value will enable the dialog with the default strings, and passing an object to this parameter allows enabling the dialog as well as overriding one or more of the default strings. Before enabling this option within an App Store-distributed app, please refer to [this note](https://github.com/appzung/react-native-code-push#app-store).
|
|
132
130
|
|
|
133
|
-
|
|
131
|
+
The following list represents the available options and their defaults:
|
|
134
132
|
|
|
135
|
-
|
|
133
|
+
- **appendReleaseDescription** _(Boolean)_ - Indicates whether you would like to append the description of an available release to the notification message which is displayed to the end user. Defaults to `false`.
|
|
136
134
|
|
|
137
|
-
|
|
135
|
+
- **descriptionPrefix** _(String)_ - Indicates the string you would like to prefix the release description with, if any, when displaying the update notification to the end user. Defaults to `" Description: "`
|
|
138
136
|
|
|
139
|
-
|
|
137
|
+
- **mandatoryContinueButtonLabel** _(String)_ - The text to use for the button the end user must press in order to install a mandatory update. Defaults to `"Continue"`.
|
|
140
138
|
|
|
141
|
-
|
|
139
|
+
- **mandatoryUpdateMessage** _(String)_ - The text used as the body of an update notification, when the update is specified as mandatory. Defaults to `"An update is available that must be installed."`.
|
|
142
140
|
|
|
143
|
-
|
|
141
|
+
- **optionalIgnoreButtonLabel** _(String)_ - The text to use for the button the end user can press in order to ignore an optional update that is available. Defaults to `"Ignore"`.
|
|
144
142
|
|
|
145
|
-
|
|
143
|
+
- **optionalInstallButtonLabel** _(String)_ - The text to use for the button the end user can press in order to install an optional update. Defaults to `"Install"`.
|
|
146
144
|
|
|
147
|
-
|
|
145
|
+
- **optionalUpdateMessage** _(String)_ - The text used as the body of an update notification, when the update is optional. Defaults to `"An update is available. Would you like to install it?"`.
|
|
148
146
|
|
|
149
|
-
|
|
147
|
+
- **title** _(String)_ - The text used as the header of an update notification that is displayed to the end user. Defaults to `"Update available"`.
|
|
150
148
|
|
|
151
|
-
|
|
149
|
+
- **rollbackRetryOptions** _(RollbackRetryOptions)_ - The rollback retry mechanism allows the application to attempt to reinstall an update that was previously rolled back (with the restrictions specified in the options). It is an "options" object used to determine whether a rollback retry should occur, and if so, what settings to use for the rollback retry. This defaults to null, which has the effect of disabling the retry mechanism. Setting this to any truthy value will enable the retry mechanism with the default settings, and passing an object to this parameter allows enabling the rollback retry as well as overriding one or more of the default values.
|
|
152
150
|
|
|
153
|
-
|
|
151
|
+
The following list represents the available options and their defaults:
|
|
154
152
|
|
|
155
|
-
|
|
153
|
+
- **delayInHours** _(Number)_ - Specifies the minimum time in hours that the app will wait after the latest rollback before attempting to reinstall the same rolled-back package. Defaults to `24`.
|
|
156
154
|
|
|
157
|
-
|
|
155
|
+
- **maxRetryAttempts** _(Number)_ - Specifies the maximum number of retry attempts that the app can make before it stops trying. Cannot be less than `1`. Defaults to `1`.
|
|
158
156
|
|
|
159
157
|
##### codePushStatusDidChange (event hook)
|
|
160
158
|
|
|
@@ -164,9 +162,9 @@ Called when the sync process moves from one stage to another in the overall upda
|
|
|
164
162
|
|
|
165
163
|
Called periodically when an available update is being downloaded from the CodePush server. The method is called with a `DownloadProgress` object, which contains the following two properties:
|
|
166
164
|
|
|
167
|
-
|
|
165
|
+
- **totalBytes** _(Number)_ - The total number of bytes expected to be received for this update (i.e. the size of the set of files which changed from the previous release).
|
|
168
166
|
|
|
169
|
-
|
|
167
|
+
- **receivedBytes** _(Number)_ - The number of bytes downloaded thus far, which can be used to track download progress.
|
|
170
168
|
|
|
171
169
|
#### codePush.allowRestart
|
|
172
170
|
|
|
@@ -195,40 +193,40 @@ See [disallowRestart](#codepushdisallowrestart) for an example of how this metho
|
|
|
195
193
|
#### codePush.checkForUpdate
|
|
196
194
|
|
|
197
195
|
```javascript
|
|
198
|
-
codePush.checkForUpdate(
|
|
196
|
+
codePush.checkForUpdate(releaseChannelPublicId: String = null, handleBinaryVersionMismatchCallback: (update: RemotePackage) => void): Promise<RemotePackage>;
|
|
199
197
|
```
|
|
200
198
|
|
|
201
|
-
Queries the CodePush service to see whether the configured app
|
|
199
|
+
Queries the CodePush service to see whether the configured app release channel has an update available. By default, it will use the release channel public ID that is configured in your `Info.plist` file (iOS), or strings resources (Android), but you can override that by specifying a value via the optional `releaseChannelPublicId` parameter. This can be useful when you want to dynamically "redirect" a user to a specific release channel, such as allowing "early access" via an easter egg or a user setting switch.
|
|
202
200
|
|
|
203
201
|
Second optional parameter `handleBinaryVersionMismatchCallback` is an optional callback function that can be used to notify user if there are any binary update.
|
|
204
202
|
E.g. consider a use-case where currently installed binary version is 1.0.1 with label(codepush label) v1. Later native code was changed in the dev cycle and binary version was updated to 1.0.2. When code-push update check is triggered we ignore updates having binary version mismatch (because the update is not targeting to the binary version of currently installed app). In this case installed app (1.0.1) will ignore the update targeting version 1.0.2. You can use `handleBinaryVersionMismatchCallback` to provide a hook to handle such situations.
|
|
205
203
|
|
|
206
204
|
**NOTE:**
|
|
207
|
-
Be cautious to use Alerts within this callback if you are developing iOS application, due to [App Store](https://developer.apple.com/app-store/review/guidelines/) review process:
|
|
205
|
+
Be cautious to use Alerts within this callback if you are developing iOS application, due to [App Store](https://developer.apple.com/app-store/review/guidelines/) review process:
|
|
206
|
+
|
|
208
207
|
> Apps must not force users to rate the app, review the app, download other apps, or other similar actions in order to access functionality, content, or use of the app.
|
|
209
208
|
|
|
210
209
|
This method returns a `Promise` which resolves to one of two possible values:
|
|
211
210
|
|
|
212
211
|
1. `null` if there is no update available. This can occur in the following scenarios:
|
|
213
212
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
213
|
+
1. The configured release channel doesn't contain any releases, and therefore, nothing to update.
|
|
214
|
+
2. The latest release within the configured release channel is targeting a different binary version than what you're currently running (either older or newer).
|
|
215
|
+
3. The currently running app already has the latest release from the configured release channel, and therefore, doesn't need it again.
|
|
216
|
+
4. The latest release within the configured release channel is currently marked as disabled, and therefore, isn't allowed to be downloaded.
|
|
217
|
+
5. The latest release within the configured release channel is in an "active rollout" state, and the requesting device doesn't fall within the percentage of users who are eligible for it.
|
|
219
218
|
|
|
220
219
|
2. A [`RemotePackage`](#remotepackage) instance which represents an available update that can be inspected and/or subsequently downloaded.
|
|
221
220
|
|
|
222
221
|
Example Usage:
|
|
223
222
|
|
|
224
223
|
```javascript
|
|
225
|
-
codePush.checkForUpdate()
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
224
|
+
codePush.checkForUpdate().then((update) => {
|
|
225
|
+
if (!update) {
|
|
226
|
+
console.log('The app is up to date!');
|
|
227
|
+
} else {
|
|
228
|
+
console.log('An update is available! Should we download it?');
|
|
229
|
+
}
|
|
232
230
|
});
|
|
233
231
|
```
|
|
234
232
|
|
|
@@ -244,7 +242,7 @@ Temporarily disallows programmatic restarts to occur as a result of either of fo
|
|
|
244
242
|
2. A CodePush update is installed using `InstallMode.ON_NEXT_RESUME` and the app is resumed from the background (optionally being throttled by the `minimumBackgroundDuration` property)
|
|
245
243
|
3. The `restartApp` method was called
|
|
246
244
|
|
|
247
|
-
|
|
245
|
+
_NOTE: #1 and #2 effectively work by calling `restartApp` for you, so you can think of `disallowRestart` as blocking any call to `restartApp`, regardless if your app calls it directly or indirectly._
|
|
248
246
|
|
|
249
247
|
After calling this method, any calls to `sync` would still be allowed to check for an update, download it and install it, but an attempt to restart the app would be queued until `allowRestart` is called. This way, the restart request is captured and can be "flushed" whenever you want to allow it to occur.
|
|
250
248
|
|
|
@@ -275,39 +273,6 @@ class OnboardingProcess extends Component {
|
|
|
275
273
|
}
|
|
276
274
|
```
|
|
277
275
|
|
|
278
|
-
#### codePush.getCurrentPackage
|
|
279
|
-
|
|
280
|
-
*NOTE: This method is considered deprecated as of `v1.10.3-beta` of the CodePush module. If you're running this version (or newer), we would recommend using the [`codePush.getUpdateMetadata`](#codepushgetupdatemetadata) instead, since it has more predictable behavior.*
|
|
281
|
-
|
|
282
|
-
```javascript
|
|
283
|
-
codePush.getCurrentPackage(): Promise<LocalPackage>;
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
Retrieves the metadata about the currently installed "package" (like description, installation time). This can be useful for scenarios such as displaying a "what's new?" dialog after an update has been applied or checking whether there is a pending update that is waiting to be applied via a resume or restart.
|
|
287
|
-
|
|
288
|
-
This method returns a `Promise` which resolves to one of two possible values:
|
|
289
|
-
|
|
290
|
-
1. `null` if the app is currently running the JS bundle from the binary and not a CodePush update. This occurs in the following scenarios:
|
|
291
|
-
|
|
292
|
-
1. The end-user installed the app binary and has yet to install a CodePush update
|
|
293
|
-
1. The end-user installed an update of the binary (for example from the store), which cleared away the old CodePush updates, and gave precedence back to the JS binary in the binary.
|
|
294
|
-
|
|
295
|
-
2. A [`LocalPackage`](#localpackage) instance which represents the metadata for the currently running CodePush update.
|
|
296
|
-
|
|
297
|
-
Example Usage:
|
|
298
|
-
|
|
299
|
-
```javascript
|
|
300
|
-
codePush.getCurrentPackage()
|
|
301
|
-
.then((update) => {
|
|
302
|
-
// If the current app "session" represents the first time
|
|
303
|
-
// this update has run, and it had a description provided
|
|
304
|
-
// with it upon release, let's show it to the end user
|
|
305
|
-
if (update.isFirstRun && update.description) {
|
|
306
|
-
// Display a "what's new?" modal
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
```
|
|
310
|
-
|
|
311
276
|
#### codePush.getUpdateMetadata
|
|
312
277
|
|
|
313
278
|
```javascript
|
|
@@ -320,13 +285,13 @@ This method returns a `Promise` which resolves to one of two possible values:
|
|
|
320
285
|
|
|
321
286
|
1. `null` if an update with the specified state doesn't currently exist. This occurs in the following scenarios:
|
|
322
287
|
|
|
323
|
-
|
|
288
|
+
1. The end-user hasn't installed any CodePush updates yet, and therefore, no metadata is available for any updates, regardless what you specify as the `updateState` parameter.
|
|
324
289
|
|
|
325
|
-
|
|
290
|
+
2. The end-user installed an update of the binary (for example from the store), which cleared away the old CodePush updates, and gave precedence back to the JS binary in the binary. Therefore, it would exhibit the same behavior as #1
|
|
326
291
|
|
|
327
|
-
|
|
292
|
+
3. The `updateState` parameter is set to `UpdateState.RUNNING`, but the app isn't currently running a CodePush update. There may be a pending update, but the app hasn't been restarted yet in order to make it active.
|
|
328
293
|
|
|
329
|
-
|
|
294
|
+
4. The `updateState` parameter is set to `UpdateState.PENDING`, but the app doesn't have any currently pending updates.
|
|
330
295
|
|
|
331
296
|
2. A [`LocalPackage`](#localpackage) instance which represents the metadata for the currently requested CodePush update (either the running or pending).
|
|
332
297
|
|
|
@@ -337,16 +302,16 @@ Example Usage:
|
|
|
337
302
|
// so, register it with the HockeyApp SDK (https://github.com/slowpath/react-native-hockeyapp)
|
|
338
303
|
// so that crash reports will correctly display the JS bundle version the user was running.
|
|
339
304
|
codePush.getUpdateMetadata().then((update) => {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
305
|
+
if (update) {
|
|
306
|
+
hockeyApp.addMetadata({ CodePushRelease: update.label });
|
|
307
|
+
}
|
|
343
308
|
});
|
|
344
309
|
|
|
345
310
|
// Check to see if there is still an update pending.
|
|
346
311
|
codePush.getUpdateMetadata(UpdateState.PENDING).then((update) => {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
312
|
+
if (update) {
|
|
313
|
+
// There's a pending update, do we want to force a restart?
|
|
314
|
+
}
|
|
350
315
|
});
|
|
351
316
|
```
|
|
352
317
|
|
|
@@ -360,8 +325,6 @@ Notifies the CodePush runtime that a freshly installed update should be consider
|
|
|
360
325
|
|
|
361
326
|
If you are using the `sync` function, and doing your update check on app start, then you don't need to manually call `notifyAppReady` since `sync` will call it for you. This behavior exists due to the assumption that the point at which `sync` is called in your app represents a good approximation of a successful startup.
|
|
362
327
|
|
|
363
|
-
*NOTE: This method is also aliased as `notifyApplicationReady` (for backwards compatibility).*
|
|
364
|
-
|
|
365
328
|
#### codePush.restartApp
|
|
366
329
|
|
|
367
330
|
```javascript
|
|
@@ -372,7 +335,7 @@ Immediately restarts the app. If a truthy value is provided to the `onlyIfUpdate
|
|
|
372
335
|
|
|
373
336
|
This method is for advanced scenarios, and is primarily useful when the following conditions are true:
|
|
374
337
|
|
|
375
|
-
1. Your app is specifying an install mode value of `ON_NEXT_RESTART` or `ON_NEXT_RESUME` when calling the `sync` or `LocalPackage.install` methods. This has the effect of not applying your update until the app has been restarted (by either the end user or OS)
|
|
338
|
+
1. Your app is specifying an install mode value of `ON_NEXT_RESTART` or `ON_NEXT_RESUME` when calling the `sync` or `LocalPackage.install` methods. This has the effect of not applying your update until the app has been restarted (by either the end user or OS) or resumed, and therefore, the update won't be immediately displayed to the end user.
|
|
376
339
|
|
|
377
340
|
2. You have an app-specific user event (like the end user navigated back to the app's home route) that allows you to apply the update in an unobtrusive way, and potentially gets the update in front of the end user sooner then waiting until the next restart or resume.
|
|
378
341
|
|
|
@@ -382,11 +345,11 @@ This method is for advanced scenarios, and is primarily useful when the followin
|
|
|
382
345
|
codePush.sync(options: Object, syncStatusChangeCallback: function(syncStatus: Number), downloadProgressCallback: function(progress: DownloadProgress), handleBinaryVersionMismatchCallback: function(update: RemotePackage)): Promise<Number>;
|
|
383
346
|
```
|
|
384
347
|
|
|
385
|
-
Synchronizes your app's JavaScript bundle and image assets with the latest release to the configured
|
|
348
|
+
Synchronizes your app's JavaScript bundle and image assets with the latest release to the configured release channel. Unlike the [checkForUpdate](#codepushcheckforupdate) method, which simply checks for the presence of an update, and let's you control what to do next, `sync` handles the update check, download and installation experience for you.
|
|
386
349
|
|
|
387
350
|
This method provides support for two different (but customizable) "modes" to easily enable apps with different requirements:
|
|
388
351
|
|
|
389
|
-
1. **Silent mode**
|
|
352
|
+
1. **Silent mode** _(the default behavior)_, which automatically downloads available updates, and applies them the next time the app restarts (for example the OS or end user killed it, or the device was restarted). This way, the entire update experience is "silent" to the end user, since they don't see any update prompt and/or "synthetic" app restarts.
|
|
390
353
|
|
|
391
354
|
2. **Active mode**, which when an update is available, prompts the end user for permission before downloading it, and then immediately applies the update. If an update was released using the `mandatory` flag, the end user would still be notified about the update, but they wouldn't have the choice to ignore it.
|
|
392
355
|
|
|
@@ -404,29 +367,29 @@ codePush.sync();
|
|
|
404
367
|
codePush.sync({ updateDialog: true, installMode: codePush.InstallMode.IMMEDIATE });
|
|
405
368
|
```
|
|
406
369
|
|
|
407
|
-
|
|
370
|
+
_Note: If you want to decide whether you check and/or download an available update based on the end user's device battery level, network conditions, etc. then simply wrap the call to `sync` in a condition that ensures you only call it when desired._
|
|
408
371
|
|
|
409
372
|
##### SyncOptions
|
|
410
373
|
|
|
411
374
|
While the `sync` method tries to make it easy to perform silent and active updates with little configuration, it accepts an "options" object that allows you to customize numerous aspects of the default behavior mentioned above. The options available are identical to the [CodePushOptions](#codepushoptions), with the exception of the `checkFrequency` option:
|
|
412
375
|
|
|
413
|
-
|
|
376
|
+
- **releaseChannelPublicId** _(String)_ - Refer to [`CodePushOptions`](#codepushoptions).
|
|
414
377
|
|
|
415
|
-
|
|
378
|
+
- **installMode** _(codePush.InstallMode)_ - Refer to [`CodePushOptions`](#codepushoptions).
|
|
416
379
|
|
|
417
|
-
|
|
380
|
+
- **mandatoryInstallMode** _(codePush.InstallMode)_ - Refer to [`CodePushOptions`](#codepushoptions).
|
|
418
381
|
|
|
419
|
-
|
|
382
|
+
- **minimumBackgroundDuration** _(Number)_ - Refer to [`CodePushOptions`](#codepushoptions).
|
|
420
383
|
|
|
421
|
-
|
|
384
|
+
- **updateDialog** _(UpdateDialogOptions)_ - Refer to [`CodePushOptions`](#codepushoptions).
|
|
422
385
|
|
|
423
386
|
Example Usage:
|
|
424
387
|
|
|
425
388
|
```javascript
|
|
426
|
-
// Use a different
|
|
389
|
+
// Use a different release channel public ID for this
|
|
427
390
|
// specific call, instead of the one configured
|
|
428
391
|
// in the Info.plist file
|
|
429
|
-
codePush.sync({
|
|
392
|
+
codePush.sync({ releaseChannelPublicId: 'KEY' });
|
|
430
393
|
|
|
431
394
|
// Download the update silently, but install it on
|
|
432
395
|
// the next resume, as long as at least 5 minutes
|
|
@@ -439,63 +402,64 @@ codePush.sync({ mandatoryInstallMode: codePush.InstallMode.ON_NEXT_RESUME });
|
|
|
439
402
|
|
|
440
403
|
// Changing the title displayed in the
|
|
441
404
|
// confirmation dialog of an "active" update
|
|
442
|
-
codePush.sync({ updateDialog: { title:
|
|
405
|
+
codePush.sync({ updateDialog: { title: 'An update is available!' } });
|
|
443
406
|
|
|
444
407
|
// Displaying an update prompt which includes the
|
|
445
408
|
// description associated with the CodePush release
|
|
446
409
|
codePush.sync({
|
|
447
|
-
|
|
410
|
+
updateDialog: {
|
|
448
411
|
appendReleaseDescription: true,
|
|
449
|
-
descriptionPrefix:
|
|
450
|
-
|
|
451
|
-
|
|
412
|
+
descriptionPrefix: '\n\nChange log:\n',
|
|
413
|
+
},
|
|
414
|
+
installMode: codePush.InstallMode.IMMEDIATE,
|
|
452
415
|
});
|
|
453
416
|
```
|
|
454
417
|
|
|
455
418
|
In addition to the options, the `sync` method also accepts several optional function parameters which allow you to subscribe to the lifecycle of the `sync` "pipeline" in order to display additional UI as needed (like a "checking for update modal or a download progress modal):
|
|
456
419
|
|
|
457
|
-
|
|
420
|
+
- **syncStatusChangedCallback** _((syncStatus: Number) => void)_ - Called when the sync process moves from one stage to another in the overall update process. The method is called with a status code which represents the current state, and can be any of the [`SyncStatus`](#syncstatus) values.
|
|
458
421
|
|
|
459
|
-
|
|
422
|
+
- **downloadProgressCallback** _((progress: DownloadProgress) => void)_ - Called periodically when an available update is being downloaded from the CodePush server. The method is called with a `DownloadProgress` object, which contains the following two properties:
|
|
460
423
|
|
|
461
|
-
|
|
424
|
+
- **totalBytes** _(Number)_ - The total number of bytes expected to be received for this update (i.e. the size of the set of files which changed from the previous release).
|
|
462
425
|
|
|
463
|
-
|
|
426
|
+
- **receivedBytes** _(Number)_ - The number of bytes downloaded thus far, which can be used to track download progress.
|
|
464
427
|
|
|
465
|
-
|
|
466
|
-
Called when there are any binary update available. The method is called with a [`RemotePackage`](#remotepackage) object. Refer to [codePush.checkForUpdate](#codepushcheckforupdate) section for more details.
|
|
428
|
+
- **handleBinaryVersionMismatchCallback** _((update: RemotePackage) => void)_ -
|
|
429
|
+
Called when there are any binary update available. The method is called with a [`RemotePackage`](#remotepackage) object. Refer to [codePush.checkForUpdate](#codepushcheckforupdate) section for more details.
|
|
467
430
|
|
|
468
431
|
Example Usage:
|
|
469
432
|
|
|
470
433
|
```javascript
|
|
471
434
|
// Prompt the user when an update is available
|
|
472
435
|
// and then display a "downloading" modal
|
|
473
|
-
codePush.sync(
|
|
436
|
+
codePush.sync(
|
|
437
|
+
{ updateDialog: true },
|
|
474
438
|
(status) => {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
439
|
+
switch (status) {
|
|
440
|
+
case codePush.SyncStatus.DOWNLOADING_PACKAGE:
|
|
441
|
+
// Show "downloading" modal
|
|
442
|
+
break;
|
|
443
|
+
case codePush.SyncStatus.INSTALLING_UPDATE:
|
|
444
|
+
// Hide "downloading" modal
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
483
447
|
},
|
|
484
|
-
({ receivedBytes, totalBytes
|
|
448
|
+
({ receivedBytes, totalBytes }) => {
|
|
485
449
|
/* Update download modal progress */
|
|
486
|
-
}
|
|
450
|
+
},
|
|
487
451
|
);
|
|
488
452
|
```
|
|
489
453
|
|
|
490
454
|
This method returns a `Promise` which is resolved to a `SyncStatus` code that indicates why the `sync` call succeeded. This code can be one of the following `SyncStatus` values:
|
|
491
455
|
|
|
492
|
-
|
|
456
|
+
- **codePush.SyncStatus.UP_TO_DATE** _(0)_ - The app is up-to-date with the CodePush server.
|
|
493
457
|
|
|
494
|
-
|
|
458
|
+
- **codePush.SyncStatus.UPDATE_IGNORED** _(2)_ - The app had an optional update which the end user chose to ignore. (This is only applicable when the `updateDialog` is used)
|
|
495
459
|
|
|
496
|
-
|
|
460
|
+
- **codePush.SyncStatus.UPDATE_INSTALLED** _(1)_ - The update has been installed and will be run either immediately after the `syncStatusChangedCallback` function returns or the next time the app resumes/restarts, depending on the `InstallMode` specified in `SyncOptions`.
|
|
497
461
|
|
|
498
|
-
|
|
462
|
+
- **codePush.SyncStatus.SYNC_IN_PROGRESS** _(4)_ - There is an ongoing `sync` operation running which prevents the current call from being executed.
|
|
499
463
|
|
|
500
464
|
The `sync` method can be called anywhere you'd like to check for an update. That could be in the `componentWillMount` lifecycle event of your root component, the onPress handler of a `<TouchableHighlight>` component, in the callback of a periodic timer, or whatever else makes sense for your needs. Just like the `checkForUpdate` method, it will perform the network request to check for an update in the background, so it won't impact your UI thread and/or JavaScript thread's responsiveness.
|
|
501
465
|
|
|
@@ -503,29 +467,30 @@ The `sync` method can be called anywhere you'd like to check for an update. That
|
|
|
503
467
|
|
|
504
468
|
The `checkForUpdate` and `getUpdateMetadata` methods return `Promise` objects, that when resolved, provide acces to "package" objects. The package represents your code update as well as any extra metadata (like description, mandatory?). The CodePush API has the distinction between the following types of packages:
|
|
505
469
|
|
|
506
|
-
|
|
470
|
+
- [LocalPackage](#localpackage): Represents a downloaded update that is either already running, or has been installed and is pending an app restart.
|
|
507
471
|
|
|
508
|
-
|
|
472
|
+
- [RemotePackage](#remotepackage): Represents an available update on the CodePush server that hasn't been downloaded yet.
|
|
509
473
|
|
|
510
474
|
##### LocalPackage
|
|
511
475
|
|
|
512
476
|
Contains details about an update that has been downloaded locally or already installed. You can get a reference to an instance of this object either by calling the module-level `getUpdateMetadata` method, or as the value of the promise returned by the `RemotePackage.download` method.
|
|
513
477
|
|
|
514
478
|
###### Properties
|
|
515
|
-
|
|
516
|
-
-
|
|
517
|
-
-
|
|
518
|
-
-
|
|
519
|
-
-
|
|
520
|
-
-
|
|
521
|
-
-
|
|
522
|
-
-
|
|
523
|
-
-
|
|
524
|
-
-
|
|
479
|
+
|
|
480
|
+
- **appVersion**: The app binary version that this update is dependent on. This is the value that was specified via the `appStoreVersion` parameter when calling the CLI's `release` command. _(String)_
|
|
481
|
+
- **releaseChannelPublicId**: The release channel that was used to originally download this update. _(String)_
|
|
482
|
+
- **description**: The description of the update. This is the same value that you specified in the CLI when you released the update. _(String)_
|
|
483
|
+
- **failedInstall**: Indicates whether this update has been previously installed but was rolled back. The `sync` method will automatically ignore updates which have previously failed, so you only need to worry about this property if using `checkForUpdate`. _(Boolean)_
|
|
484
|
+
- **isFirstRun**: Indicates whether this is the first time the update has been run after being installed. This is useful for determining whether you would like to show a "What's New?" UI to the end user after installing an update. _(Boolean)_
|
|
485
|
+
- **isMandatory**: Indicates whether the update is considered mandatory. This is the value that was specified in the CLI when the update was released. _(Boolean)_
|
|
486
|
+
- **isPending**: Indicates whether this update is in a "pending" state. When `true`, that means the update has been downloaded and installed, but the app restart needed to apply it hasn't occurred yet, and therefore, it's changes aren't currently visible to the end-user. _(Boolean)_
|
|
487
|
+
- **label**: The internal label automatically given to the update by the CodePush server, such as `v5`. This value uniquely identifies the update within its release channel. _(String)_
|
|
488
|
+
- **packageHash**: The SHA hash value of the update. _(String)_
|
|
489
|
+
- **packageSize**: The size of the code contained within the update, in bytes. _(Number)_
|
|
525
490
|
|
|
526
491
|
###### Methods
|
|
527
492
|
|
|
528
|
-
-
|
|
493
|
+
- **install(installMode: codePush.InstallMode = codePush.InstallMode.ON_NEXT_RESTART, minimumBackgroundDuration = 0): Promise<void>**: Installs the update by saving it to the location on disk where the runtime expects to find the latest version of the app. The `installMode` parameter controls when the changes are actually presented to the end user. The default value is to wait until the next app restart to display the changes, but you can refer to the [`InstallMode`](#installmode) enum reference for a description of the available options and what they do. If the `installMode` parameter is set to `InstallMode.ON_NEXT_RESUME`, then the `minimumBackgroundDuration` parameter allows you to control how long the app must have been in the background before forcing the install after it is resumed.
|
|
529
494
|
|
|
530
495
|
##### RemotePackage
|
|
531
496
|
|
|
@@ -535,11 +500,11 @@ Contains details about an update that is available for download from the CodePus
|
|
|
535
500
|
|
|
536
501
|
The `RemotePackage` inherits all of the same properties as the `LocalPackage`, but includes one additional one:
|
|
537
502
|
|
|
538
|
-
-
|
|
503
|
+
- **downloadUrl**: The URL at which the package is available for download. This property is only needed for advanced usage, since the `download` method will automatically handle the acquisition of updates for you. _(String)_
|
|
539
504
|
|
|
540
505
|
###### Methods
|
|
541
506
|
|
|
542
|
-
-
|
|
507
|
+
- **download(downloadProgressCallback?: Function): Promise<LocalPackage>**: Downloads the available update from the CodePush service. If a `downloadProgressCallback` is specified, it will be called periodically with a `DownloadProgress` object (`{ totalBytes: Number, receivedBytes: Number }`) that reports the progress of the download until it completes. Returns a Promise that resolves with the `LocalPackage`.
|
|
543
508
|
|
|
544
509
|
#### Enums
|
|
545
510
|
|
|
@@ -549,44 +514,44 @@ The CodePush API includes the following enums which can be used to customize the
|
|
|
549
514
|
|
|
550
515
|
This enum specifies when you would like an installed update to actually be applied, and can be passed to either the `sync` or `LocalPackage.install` methods. It includes the following values:
|
|
551
516
|
|
|
552
|
-
|
|
517
|
+
- **codePush.InstallMode.IMMEDIATE** _(0)_ - Indicates that you want to install the update and restart the app immediately. This value is appropriate for debugging scenarios as well as when displaying an update prompt to the user, since they would expect to see the changes immediately after accepting the installation. Additionally, this mode can be used to enforce mandatory updates, since it removes the potentially undesired latency between the update installation and the next time the end user restarts or resumes the app.
|
|
553
518
|
|
|
554
|
-
|
|
519
|
+
- **codePush.InstallMode.ON_NEXT_RESTART** _(1)_ - Indicates that you want to install the update, but not forcibly restart the app. When the app is "naturally" restarted (due the OS or end user killing it), the update will be seamlessly picked up. This value is appropriate when performing silent updates, since it would likely be disruptive to the end user if the app suddenly restarted out of nowhere, since they wouldn't have realized an update was even downloaded. This is the default mode used for both the `sync` and `LocalPackage.install` methods.
|
|
555
520
|
|
|
556
|
-
|
|
521
|
+
- **codePush.InstallMode.ON_NEXT_RESUME** _(2)_ - Indicates that you want to install the update, but don't want to restart the app until the next time the end user resumes it from the background. This way, you don't disrupt their current session, but you can get the update in front of them sooner then having to wait for the next natural restart. This value is appropriate for silent installs that can be applied on resume in a non-invasive way.
|
|
557
522
|
|
|
558
|
-
|
|
523
|
+
- **codePush.InstallMode.ON_NEXT_SUSPEND** _(3)_ - Indicates that you want to install the update _while_ it is in the background, but only after it has been in the background for `minimumBackgroundDuration` seconds (0 by default), so that user context isn't lost unless the app suspension is long enough to not matter.
|
|
559
524
|
|
|
560
525
|
##### CheckFrequency
|
|
561
526
|
|
|
562
527
|
This enum specifies when you would like your app to sync with the server for updates, and can be passed to the `codePushify` decorator. It includes the following values:
|
|
563
528
|
|
|
564
|
-
|
|
529
|
+
- **codePush.CheckFrequency.ON_APP_START** _(0)_ - Indicates that you want to check for updates whenever the app's process is started.
|
|
565
530
|
|
|
566
|
-
|
|
531
|
+
- **codePush.CheckFrequency.ON_APP_RESUME** _(1)_ - Indicates that you want to check for updates whenever the app is brought back to the foreground after being "backgrounded" (user pressed the home button, app launches a seperate payment process, etc).
|
|
567
532
|
|
|
568
|
-
|
|
533
|
+
- **codePush.CheckFrequency.MANUAL** _(2)_ - Disable automatic checking for updates, but only check when [`codePush.sync()`](#codepushsync) is called in app code.
|
|
569
534
|
|
|
570
535
|
##### SyncStatus
|
|
571
536
|
|
|
572
537
|
This enum is provided to the `syncStatusChangedCallback` function that can be passed to the `sync` method, in order to hook into the overall update process. It includes the following values:
|
|
573
538
|
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
539
|
+
- **codePush.SyncStatus.UP_TO_DATE** _(0)_ - The app is fully up-to-date with the configured release channel.
|
|
540
|
+
- **codePush.SyncStatus.UPDATE_INSTALLED** _(1)_ - An available update has been installed and will be run either immediately after the `syncStatusChangedCallback` function returns or the next time the app resumes/restarts, depending on the `InstallMode` specified in `SyncOptions`.
|
|
541
|
+
- **codePush.SyncStatus.UPDATE_IGNORED** _(2)_ - The app has an optional update, which the end user chose to ignore. (This is only applicable when the `updateDialog` is used)
|
|
542
|
+
- **codePush.SyncStatus.UNKNOWN_ERROR** _(3)_ - The sync operation encountered an unknown error.
|
|
543
|
+
- **codePush.SyncStatus.SYNC_IN_PROGRESS** _(4)_ - There is an ongoing `sync` operation running which prevents the current call from being executed.
|
|
544
|
+
- **codePush.SyncStatus.CHECKING_FOR_UPDATE** _(5)_ - The CodePush server is being queried for an update.
|
|
545
|
+
- **codePush.SyncStatus.AWAITING_USER_ACTION** _(6)_ - An update is available, and a confirmation dialog was shown to the end user. (This is only applicable when the `updateDialog` is used)
|
|
546
|
+
- **codePush.SyncStatus.DOWNLOADING_PACKAGE** _(7)_ - An available update is being downloaded from the CodePush server.
|
|
547
|
+
- **codePush.SyncStatus.INSTALLING_UPDATE** _(8)_ - An available update was downloaded and is about to be installed.
|
|
583
548
|
|
|
584
549
|
##### UpdateState
|
|
585
550
|
|
|
586
551
|
This enum specifies the state that an update is currently in, and can be specified when calling the `getUpdateMetadata` method. It includes the following values:
|
|
587
552
|
|
|
588
|
-
|
|
553
|
+
- **codePush.UpdateState.RUNNING** _(0)_ - Indicates that an update represents the version of the app that is currently running. This can be useful for identifying attributes about the app, for scenarios such as displaying the release description in a "what's new?" dialog or reporting the latest version to an analytics and/or crash reporting service.
|
|
589
554
|
|
|
590
|
-
|
|
555
|
+
- **codePush.UpdateState.PENDING** _(1)_ - Indicates than an update has been installed, but the app hasn't been restarted yet in order to apply it. This can be useful for determining whether there is a pending update, which you may want to force a programmatic restart (via `restartApp`) in order to apply.
|
|
591
556
|
|
|
592
|
-
|
|
557
|
+
- **codePush.UpdateState.LATEST** _(2)_ - Indicates than an update represents the latest available release, and can be either currently running or pending.
|