@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,62 @@
|
|
|
1
|
+
## Code signing
|
|
2
|
+
|
|
3
|
+
- [Configure your release process](#configure-your-release-process)
|
|
4
|
+
- [Setup Android](#setup-android)
|
|
5
|
+
- [Setup iOS](#setup-ios)
|
|
6
|
+
|
|
7
|
+
Code signing is a security feature that helps ensure the integrity and authenticity of your app updates.
|
|
8
|
+
It means no attacker can alter your bundled code sent to AppZung.
|
|
9
|
+
|
|
10
|
+
### Configure your release process
|
|
11
|
+
|
|
12
|
+
Generate the key pair:
|
|
13
|
+
|
|
14
|
+
```shell
|
|
15
|
+
# generate private RSA key
|
|
16
|
+
openssl genrsa -out private_codepush_signing_key.pem
|
|
17
|
+
# export public key
|
|
18
|
+
openssl rsa -pubout -in private_codepush_signing_key.pem -out public_codepush_signing_key.pem
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Store the private key securely.
|
|
22
|
+
|
|
23
|
+
In the `appzung releases deploy-react-native` command that you run during your release process, add the `--private-key-path` flag pointing to the private key path.
|
|
24
|
+
You should see `Code signing: true` in the confirmation text in interactive mode.
|
|
25
|
+
|
|
26
|
+
### Setup Android
|
|
27
|
+
|
|
28
|
+
Add the `CodePushSigningPublicKey` string resource in `/android/app/src/main/res/values/strings.xml`. It may look like this:
|
|
29
|
+
|
|
30
|
+
```xml
|
|
31
|
+
<resources>
|
|
32
|
+
<string name="app_name">my_app</string>
|
|
33
|
+
<string name="CodePushSigningPublicKey">-----BEGIN PUBLIC KEY-----
|
|
34
|
+
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtPSR9lkGzZ4FR0lxF+ZA
|
|
35
|
+
P6jJ8+Xi5L601BPN4QESoRVSrJM08roOCVrs4qoYqYJy3Of2cQWvNBEh8ti3FhHu
|
|
36
|
+
tiuLFpNdfzM4DjAw0Ti5hOTfTixqVBXTJPYpSjDh7K6tUvp9MV0l5q/Ps3se1vud
|
|
37
|
+
M1/X6g54lIX/QoEXTdMgR+SKXvlUIC13T7GkDHT6Z4RlwxkWkOmf2tGguRcEBL6j
|
|
38
|
+
ww7w/3g0kWILz7nNPtXyDhIB9WLH7MKSJWdVCZm+cAqabUfpCFo7sHiyHLnUxcVY
|
|
39
|
+
OTw3sz9ceaci7z2r8SZdsfjyjiDJrq69eWtvKVUpredy9HtyALtNuLjDITahdh8A
|
|
40
|
+
zwIDAQAB
|
|
41
|
+
-----END PUBLIC KEY-----</string>
|
|
42
|
+
</resources>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Setup iOS
|
|
46
|
+
|
|
47
|
+
Add record in `Info.plist` with name `CodePushSigningPublicKey` and string value of public key content. Example:
|
|
48
|
+
|
|
49
|
+
```xml
|
|
50
|
+
<plist version="1.0">
|
|
51
|
+
<dict>
|
|
52
|
+
<!-- ...other configs... -->
|
|
53
|
+
|
|
54
|
+
<key>CodePushSigningPublicKey</key>
|
|
55
|
+
<string>-----BEGIN PUBLIC KEY-----
|
|
56
|
+
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANkWYydPuyOumR/sn2agNBVDnzyRpM16NAUpYPGxNgjSEp0etkDNgzzdzyvyl+OsAGBYF3jCxYOXozum+uV5hQECAwEAAQ==
|
|
57
|
+
-----END PUBLIC KEY-----</string>
|
|
58
|
+
|
|
59
|
+
<!-- ...other configs... -->
|
|
60
|
+
</dict>
|
|
61
|
+
</plist>
|
|
62
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
## Migration steps to @appzung/react-native-code-push v10+
|
|
2
|
+
|
|
3
|
+
If you are less in a hurry, you can migrate to `@appzung/react-native-code-push` v10+ where we will add new features in the future and actively support the module.
|
|
4
|
+
|
|
5
|
+
### Switch to @appzung/react-native-code-push npm package
|
|
6
|
+
|
|
7
|
+
1. Replace `react-native-code-push` in your package.json with `@appzung/react-native-code-push`: `@appzung/react-native-code-push: "^10.0.0"`
|
|
8
|
+
2. Run `npm install` (or `yarn` depending on your project)
|
|
9
|
+
|
|
10
|
+
### Change your JS code
|
|
11
|
+
|
|
12
|
+
1. Replace every `react-native-code-push` imports with `@appzung/react-native-code-push` imports
|
|
13
|
+
2. (optional) As the package is now compatible with ESM, if you call CodePush functions like `CodePush.sync()` or import types/interfaces, you may have to replace your imports `import CodePush from` to selective imports `import withCodePush, { sync, DownloadProgress } from` (or `import * as CodePush from`)
|
|
14
|
+
3. (optional) If you use a jest global mock, move the mock from `__mocks__/react-native-code-push.ts` to `__mocks__/@appzung/react-native-code-push.ts`
|
|
15
|
+
4. (optional) If you use dynamic deployment assignation, rename `deploymentKey` option to `releaseChannelPublicId` (TypeScript should catch that)
|
|
16
|
+
|
|
17
|
+
### Change your iOS setup
|
|
18
|
+
|
|
19
|
+
1. Run `bundle exec pod install`
|
|
20
|
+
2. Rename `CodePushDeploymentKey` to `CodePushReleaseChannelPublicId` in your `Info.plist`
|
|
21
|
+
3. (optional) If you already use code signing, rename `CodePushPublicKey` to `CodePushSigningPublicKey` in your `Info.plist`
|
|
22
|
+
|
|
23
|
+
### Change your Android setup
|
|
24
|
+
|
|
25
|
+
1. In `android/settings.gradle` remove the lines about CodePush : `include ':react-native-code-push'` and `project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')`
|
|
26
|
+
2. In `android/app/build.gradle` change the line about CodePush: `apply from: "../../node_modules/@appzung/react-native-code-push/android/codepush.gradle"`
|
|
27
|
+
3. In your Android files (eg. `MainApplication.kt`), rename every `com.microsoft.codepush` prefix imports with `com.appzung.codepush`
|
|
28
|
+
4. Rename `CodePushDeploymentKey` to `CodePushReleaseChannelPublicId` in your strings resources (located either at strings.xml or app/build.gradle).
|
|
29
|
+
5. (optional) If you already use code signing, rename `CodePushPublicKey` to `CodePushSigningPublicKey` in your strings resources
|
|
30
|
+
6. (optional) If you used `CodePushBuilder` to instantiate CodePush manually, it has been removed, consider using the standard way or contact us if you really need this
|
|
31
|
+
7. (optional) If you used a custom CodePush `packageInstance` in your `react-native.config.js` file, it is no longer possible, consider using the standard way or contact us if you really need this
|
package/docs/setup-android.md
CHANGED
|
@@ -1,77 +1,69 @@
|
|
|
1
1
|
## Android Setup
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
- [Plugin Installation and Configuration](#plugin-installation-and-configuration)
|
|
4
|
+
- [Code Signing setup](#code-signing-setup)
|
|
5
5
|
|
|
6
6
|
### Plugin Installation and Configuration
|
|
7
7
|
|
|
8
|
-
1. In your `android/
|
|
8
|
+
1. In your `android/app/build.gradle` file, add the `codepush.gradle` file as an additional build task definition to the end of the file:
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
2. In your `android/app/build.gradle` file, add the `codepush.gradle` file as an additional build task definition to the end of the file:
|
|
10
|
+
```gradle
|
|
11
|
+
...
|
|
12
|
+
apply from: "../../node_modules/@appzung/react-native-code-push/android/codepush.gradle"
|
|
13
|
+
...
|
|
14
|
+
```
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
...
|
|
20
|
-
apply from: "../../node_modules/@appzung/react-native-code-push/android/codepush.gradle"
|
|
21
|
-
...
|
|
22
|
-
```
|
|
16
|
+
2. Update the `MainApplication` file to use CodePush via the following changes:
|
|
23
17
|
|
|
24
|
-
|
|
18
|
+
If your MainApplication is a Kotlin file, update the `MainApplication.kt`
|
|
25
19
|
|
|
26
|
-
|
|
20
|
+
```kotlin
|
|
21
|
+
...
|
|
22
|
+
// 1. Import the plugin class.
|
|
23
|
+
import com.appzung.codepush.react.CodePush
|
|
27
24
|
|
|
28
|
-
|
|
29
|
-
...
|
|
30
|
-
// 1. Import the plugin class.
|
|
31
|
-
import com.appzung.codepush.react.CodePush
|
|
25
|
+
class MainApplication : Application(), ReactApplication {
|
|
32
26
|
|
|
33
|
-
|
|
27
|
+
override val reactNativeHost: ReactNativeHost =
|
|
28
|
+
object : DefaultReactNativeHost(this) {
|
|
29
|
+
...
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
// 2. Override the getJSBundleFile method in order to let
|
|
32
|
+
// the CodePush runtime determine where to get the JS
|
|
33
|
+
// bundle location from on each app start
|
|
34
|
+
override fun getJSBundleFile(): String {
|
|
35
|
+
return CodePush.getJSBundleFile()
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
```
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
// the CodePush runtime determine where to get the JS
|
|
41
|
-
// bundle location from on each app start
|
|
42
|
-
override fun getJSBundleFile(): String {
|
|
43
|
-
return CodePush.getJSBundleFile()
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
```
|
|
41
|
+
If your MainApplication is a Java file: update the `MainApplication.java`
|
|
48
42
|
|
|
49
|
-
|
|
43
|
+
```java
|
|
44
|
+
...
|
|
45
|
+
// 1. Import the plugin class.
|
|
46
|
+
import com.appzung.codepush.react.CodePush;
|
|
50
47
|
|
|
51
|
-
|
|
52
|
-
...
|
|
53
|
-
// 1. Import the plugin class.
|
|
54
|
-
import com.appzung.codepush.react.CodePush;
|
|
48
|
+
public class MainApplication extends Application implements ReactApplication {
|
|
55
49
|
|
|
56
|
-
|
|
50
|
+
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
|
|
51
|
+
...
|
|
57
52
|
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
// 2. Override the getJSBundleFile method in order to let
|
|
54
|
+
// the CodePush runtime determine where to get the JS
|
|
55
|
+
// bundle location from on each app start
|
|
56
|
+
@Override
|
|
57
|
+
protected String getJSBundleFile() {
|
|
58
|
+
return CodePush.getJSBundleFile();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
```
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
// the CodePush runtime determine where to get the JS
|
|
63
|
-
// bundle location from on each app start
|
|
64
|
-
@Override
|
|
65
|
-
protected String getJSBundleFile() {
|
|
66
|
-
return CodePush.getJSBundleFile();
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
```
|
|
64
|
+
3. Add the release channel public ID to `strings.xml`:
|
|
71
65
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
To let the CodePush runtime know which release channel it should query for updates, open your app's `strings.xml` file and add a new string named `CodePushReleaseChannelPublicId`, whose value is the public ID of the release channel you want to configure this app against. You can retrieve this value by running `appzung release-channels list` in the AppZung CLI and copying the value of the `Public ID` column.
|
|
66
|
+
To let the CodePush runtime know which release channel it should query for updates, open your app's `strings.xml` file and add a new string named `CodePushReleaseChannelPublicId`, whose value is the public ID of the release channel you want to configure this app against. You can retrieve this value by running `appzung release-channels list` in the AppZung CLI and copying the value of the `Public ID` column.
|
|
75
67
|
|
|
76
68
|
You may want to refer to the [multiple environments](./advanced-usage.md#multiple-environments) docs before actually moving your app's usage of CodePush into production.
|
|
77
69
|
|
|
@@ -82,27 +74,8 @@
|
|
|
82
74
|
<string name="app_name">AppName</string>
|
|
83
75
|
<string moduleConfig="true" name="CodePushReleaseChannelPublicId">ReleaseChannelPublicId</string>
|
|
84
76
|
</resources>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
You can self sign bundles during release and verify its signature before installation of update. In order to use Public Key for Code Signing you need to do following steps:
|
|
92
|
-
|
|
93
|
-
Add the `CodePushSigningPublicKey` string resource in `/android/app/src/main/res/values/strings.xml`. It may looks like this:
|
|
94
|
-
|
|
95
|
-
```xml
|
|
96
|
-
<resources>
|
|
97
|
-
<string name="app_name">my_app</string>
|
|
98
|
-
<string name="CodePushSigningPublicKey">-----BEGIN PUBLIC KEY-----
|
|
99
|
-
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtPSR9lkGzZ4FR0lxF+ZA
|
|
100
|
-
P6jJ8+Xi5L601BPN4QESoRVSrJM08roOCVrs4qoYqYJy3Of2cQWvNBEh8ti3FhHu
|
|
101
|
-
tiuLFpNdfzM4DjAw0Ti5hOTfTixqVBXTJPYpSjDh7K6tUvp9MV0l5q/Ps3se1vud
|
|
102
|
-
M1/X6g54lIX/QoEXTdMgR+SKXvlUIC13T7GkDHT6Z4RlwxkWkOmf2tGguRcEBL6j
|
|
103
|
-
ww7w/3g0kWILz7nNPtXyDhIB9WLH7MKSJWdVCZm+cAqabUfpCFo7sHiyHLnUxcVY
|
|
104
|
-
OTw3sz9ceaci7z2r8SZdsfjyjiDJrq69eWtvKVUpredy9HtyALtNuLjDITahdh8A
|
|
105
|
-
zwIDAQAB
|
|
106
|
-
-----END PUBLIC KEY-----</string>
|
|
107
|
-
</resources>
|
|
108
|
-
```
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
_Note: If you need to dynamically use a different release channel, you can also override your release channel public ID in JS code using [Code-Push options](./api-js.md#CodePushOptions)_
|
|
80
|
+
|
|
81
|
+
4. [Configure code signing](./code-signing.md), this is optional but recommended for security
|
package/docs/setup-ios.md
CHANGED
|
@@ -1,32 +1,44 @@
|
|
|
1
1
|
## iOS Setup
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
* [Code Signing setup](#code-signing-setup)
|
|
3
|
+
- [Plugin Installation and Configuration](#plugin-installation-and-configuration)
|
|
5
4
|
|
|
6
5
|
### Plugin Installation and Configuration
|
|
7
6
|
|
|
8
7
|
1. Run `cd ios && pod install && cd ..` to install all the necessary CocoaPods dependencies.
|
|
9
8
|
|
|
10
|
-
2. Open up the `AppDelegate.m` file, and add an import statement for the CodePush headers:
|
|
9
|
+
2. Open up the `AppDelegate.m`/`AppDelegate.swift` file, and add an import statement for the CodePush headers:
|
|
11
10
|
|
|
12
11
|
```objective-c
|
|
13
12
|
#import <CodePush/CodePush.h>
|
|
14
13
|
```
|
|
15
14
|
|
|
15
|
+
```swift
|
|
16
|
+
import CodePush
|
|
17
|
+
```
|
|
18
|
+
|
|
16
19
|
3. Find the following line of code, which sets the source URL for bridge for production releases:
|
|
17
20
|
|
|
18
21
|
```objective-c
|
|
19
22
|
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
|
|
20
23
|
```
|
|
21
24
|
|
|
25
|
+
```swift
|
|
26
|
+
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
|
|
27
|
+
```
|
|
28
|
+
|
|
22
29
|
4. Replace it with this line:
|
|
23
|
-
|
|
30
|
+
|
|
24
31
|
```objective-c
|
|
25
32
|
return [CodePush bundleURL];
|
|
26
33
|
```
|
|
34
|
+
|
|
35
|
+
```swift
|
|
36
|
+
CodePush.bundleURL()
|
|
37
|
+
```
|
|
38
|
+
|
|
27
39
|
This change configures your app to always load the most recent version of your app's JS bundle. On the first launch, this will correspond to the file that was compiled with the app. However, after an update has been pushed via CodePush, this will return the location of the most recently installed update.
|
|
28
|
-
|
|
29
|
-
|
|
40
|
+
|
|
41
|
+
_NOTE: The `bundleURL` method assumes your app's JS bundle is named `main.jsbundle`. If you have configured your app to use a different file name, simply call the `bundleURLForResource:` method (which assumes you're using the `.jsbundle` extension) or `bundleURLForResource:withExtension:` method instead, in order to overwrite that default behavior_
|
|
30
42
|
|
|
31
43
|
Typically, you're only going to want to use CodePush to resolve your JS bundle location within release builds, and therefore, we recommend using the `DEBUG` pre-processor macro to dynamically switch between using the packager server and CodePush, depending on whether you are debugging or not. This will make it much simpler to ensure you get the right behavior you want in production, while still being able to use the Chrome Dev Tools, live reload, etc. at debug-time.
|
|
32
44
|
|
|
@@ -43,34 +55,25 @@
|
|
|
43
55
|
}
|
|
44
56
|
```
|
|
45
57
|
|
|
58
|
+
```swift
|
|
59
|
+
override func bundleURL() -> URL? {
|
|
60
|
+
#if DEBUG
|
|
61
|
+
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
|
|
62
|
+
#else
|
|
63
|
+
CodePush.bundleURL()
|
|
64
|
+
#endif
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
46
68
|
5. Add the Release channel public ID to `Info.plist`:
|
|
47
69
|
|
|
48
70
|
To let the CodePush runtime know which release channel it should query for updates against, open your app's `Info.plist` file and add a new entry named `CodePushReleaseChannelPublicId`, whose value is the public ID of the release channel you want to configure this app against. You can retrieve this value by running `appzung release-channels list` in the AppZung CLI and copying the value of the `Public ID` column.
|
|
49
71
|
|
|
50
72
|
You may want to refer to the [multiple environments](./advanced-usage.md#multiple-environments) docs before actually moving your app's usage of CodePush into production.
|
|
51
73
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
### Code Signing setup
|
|
74
|
+
_Note: If you need to dynamically use a different release channel, you can also override your release channel public ID in JS code using [Code-Push options](./api-js.md#CodePushOptions)_
|
|
55
75
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
In order to configure Public Key for bundle verification you need to add record in `Info.plist` with name `CodePushSigningPublicKey` and string value of public key content. Example:
|
|
59
|
-
|
|
60
|
-
```xml
|
|
61
|
-
<plist version="1.0">
|
|
62
|
-
<dict>
|
|
63
|
-
<!-- ...other configs... -->
|
|
64
|
-
|
|
65
|
-
<key>CodePushSigningPublicKey</key>
|
|
66
|
-
<string>-----BEGIN PUBLIC KEY-----
|
|
67
|
-
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANkWYydPuyOumR/sn2agNBVDnzyRpM16NAUpYPGxNgjSEp0etkDNgzzdzyvyl+OsAGBYF3jCxYOXozum+uV5hQECAwEAAQ==
|
|
68
|
-
-----END PUBLIC KEY-----</string>
|
|
69
|
-
|
|
70
|
-
<!-- ...other configs... -->
|
|
71
|
-
</dict>
|
|
72
|
-
</plist>
|
|
73
|
-
```
|
|
76
|
+
6. [Configure code signing](./code-signing.md), this is optional but recommended for security
|
|
74
77
|
|
|
75
78
|
### (optional) HTTP exception domains configuration
|
|
76
79
|
|
|
@@ -79,7 +82,7 @@ CodePush plugin makes HTTPS requests to the following domains:
|
|
|
79
82
|
- codepush.appzung.com
|
|
80
83
|
- release-package-files-eu.appzung.com
|
|
81
84
|
|
|
82
|
-
If you want to change the default HTTP security configuration for any of these domains, you have to define the [`NSAppTransportSecurity` (ATS)][ats] configuration inside your
|
|
85
|
+
If you want to change the default HTTP security configuration for any of these domains (most of the time you don't), you have to define the [`NSAppTransportSecurity` (ATS)][ats] configuration inside your **Info.plist** file:
|
|
83
86
|
|
|
84
87
|
```xml
|
|
85
88
|
<plist version="1.0">
|
package/docs/setup-windows.md
CHANGED
|
@@ -9,6 +9,7 @@ Once the plugin has been downloaded, run `npx react-native autolink-windows` in
|
|
|
9
9
|
### Plugin Configuration (Windows)
|
|
10
10
|
|
|
11
11
|
1. Replace the following files located at `windows/<app name>` with those in the CodePushDemoAppCpp example app in this repo found at `Examples/CodePushDemoAppCpp/windows/CodePushDemoAppCpp`:
|
|
12
|
+
|
|
12
13
|
1. app.h
|
|
13
14
|
2. app.cpp
|
|
14
15
|
3. app.xaml
|
package/ios/CodePush/CodePush.m
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#if __has_include(<React/RCTAssert.h>)
|
|
2
1
|
#import <React/RCTAssert.h>
|
|
3
2
|
#import <React/RCTBridgeModule.h>
|
|
4
3
|
#import <React/RCTConvert.h>
|
|
@@ -6,18 +5,10 @@
|
|
|
6
5
|
#import <React/RCTRootView.h>
|
|
7
6
|
#import <React/RCTUtils.h>
|
|
8
7
|
#import <React/RCTReloadCommand.h>
|
|
9
|
-
#else // back compatibility for RN version < 0.40
|
|
10
|
-
#import "RCTAssert.h"
|
|
11
|
-
#import "RCTBridgeModule.h"
|
|
12
|
-
#import "RCTConvert.h"
|
|
13
|
-
#import "RCTEventDispatcher.h"
|
|
14
|
-
#import "RCTRootView.h"
|
|
15
|
-
#import "RCTUtils.h"
|
|
16
|
-
#endif
|
|
17
8
|
|
|
18
9
|
#import "CodePush.h"
|
|
19
10
|
|
|
20
|
-
@interface CodePush () <RCTBridgeModule
|
|
11
|
+
@interface CodePush () <RCTBridgeModule>
|
|
21
12
|
@end
|
|
22
13
|
|
|
23
14
|
@implementation CodePush {
|
|
@@ -30,8 +21,8 @@
|
|
|
30
21
|
|
|
31
22
|
// Used to coordinate the dispatching of download progress events to JS.
|
|
32
23
|
long long _latestExpectedContentLength;
|
|
33
|
-
long long
|
|
34
|
-
|
|
24
|
+
long long _latestReceivedContentLength;
|
|
25
|
+
NSTimeInterval _lastProgressEmitTimestamp;
|
|
35
26
|
|
|
36
27
|
BOOL _allowed;
|
|
37
28
|
BOOL _restartInProgress;
|
|
@@ -255,19 +246,6 @@ static NSString *const LatestRollbackCountKey = @"count";
|
|
|
255
246
|
#pragma mark - Private API methods
|
|
256
247
|
|
|
257
248
|
@synthesize methodQueue = _methodQueue;
|
|
258
|
-
@synthesize pauseCallback = _pauseCallback;
|
|
259
|
-
@synthesize paused = _paused;
|
|
260
|
-
|
|
261
|
-
- (void)setPaused:(BOOL)paused
|
|
262
|
-
{
|
|
263
|
-
if (_paused != paused) {
|
|
264
|
-
_paused = paused;
|
|
265
|
-
if (_pauseCallback) {
|
|
266
|
-
_pauseCallback();
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
249
|
/*
|
|
272
250
|
* This method is used to clear updates that are installed
|
|
273
251
|
* under a different app version and hence don't apply anymore,
|
|
@@ -332,7 +310,7 @@ static NSString *const LatestRollbackCountKey = @"count";
|
|
|
332
310
|
@"totalBytes" : [NSNumber
|
|
333
311
|
numberWithLongLong:_latestExpectedContentLength],
|
|
334
312
|
@"receivedBytes" : [NSNumber
|
|
335
|
-
numberWithLongLong:
|
|
313
|
+
numberWithLongLong:_latestReceivedContentLength]
|
|
336
314
|
}];
|
|
337
315
|
}
|
|
338
316
|
|
|
@@ -396,7 +374,6 @@ static NSString *const LatestRollbackCountKey = @"count";
|
|
|
396
374
|
#ifdef DEBUG
|
|
397
375
|
[self clearDebugUpdates];
|
|
398
376
|
#endif
|
|
399
|
-
self.paused = YES;
|
|
400
377
|
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
|
|
401
378
|
NSDictionary *pendingUpdate = [preferences objectForKey:PendingUpdateKey];
|
|
402
379
|
if (pendingUpdate) {
|
|
@@ -718,13 +695,6 @@ RCT_EXPORT_METHOD(downloadUpdate:(NSDictionary*)updatePackage
|
|
|
718
695
|
forKey:BinaryBundleDateKey];
|
|
719
696
|
}
|
|
720
697
|
|
|
721
|
-
if (notifyProgress) {
|
|
722
|
-
// Set up and unpause the frame observer so that it can emit
|
|
723
|
-
// progress events every frame if the progress is updated.
|
|
724
|
-
_didUpdateProgress = NO;
|
|
725
|
-
self.paused = NO;
|
|
726
|
-
}
|
|
727
|
-
|
|
728
698
|
NSString * publicKey = [[CodePushConfig current] publicKey];
|
|
729
699
|
|
|
730
700
|
[CodePushPackage
|
|
@@ -734,17 +704,18 @@ RCT_EXPORT_METHOD(downloadUpdate:(NSDictionary*)updatePackage
|
|
|
734
704
|
operationQueue:_methodQueue
|
|
735
705
|
// The download is progressing forward
|
|
736
706
|
progressCallback:^(long long expectedContentLength, long long receivedContentLength) {
|
|
737
|
-
// Update the download progress
|
|
738
|
-
_latestExpectedContentLength = expectedContentLength;
|
|
739
|
-
|
|
740
|
-
_didUpdateProgress = YES;
|
|
707
|
+
// Update the download progress
|
|
708
|
+
self->_latestExpectedContentLength = expectedContentLength;
|
|
709
|
+
self->_latestReceivedContentLength = receivedContentLength;
|
|
741
710
|
|
|
742
|
-
// If the download is completed, stop observing frame
|
|
743
|
-
// updates and synchronously send the last event.
|
|
744
711
|
if (expectedContentLength == receivedContentLength) {
|
|
745
|
-
_didUpdateProgress = NO;
|
|
746
|
-
self.paused = YES;
|
|
747
712
|
[self dispatchDownloadProgressEvent];
|
|
713
|
+
} else if (notifyProgress) {
|
|
714
|
+
NSTimeInterval timestamp = [[NSDate date] timeIntervalSince1970];
|
|
715
|
+
if (timestamp - self->_lastProgressEmitTimestamp > 30.0 / 1000.0) {
|
|
716
|
+
self->_lastProgressEmitTimestamp = timestamp;
|
|
717
|
+
[self dispatchDownloadProgressEvent];
|
|
718
|
+
}
|
|
748
719
|
}
|
|
749
720
|
}
|
|
750
721
|
// The download completed
|
|
@@ -763,9 +734,6 @@ RCT_EXPORT_METHOD(downloadUpdate:(NSDictionary*)updatePackage
|
|
|
763
734
|
[self saveFailedUpdate:mutableUpdatePackage];
|
|
764
735
|
}
|
|
765
736
|
|
|
766
|
-
// Stop observing frame updates if the download fails.
|
|
767
|
-
_didUpdateProgress = NO;
|
|
768
|
-
self.paused = YES;
|
|
769
737
|
reject([NSString stringWithFormat: @"%lu", (long)err.code], err.localizedDescription, err);
|
|
770
738
|
}];
|
|
771
739
|
}
|
|
@@ -1107,16 +1075,4 @@ RCT_EXPORT_METHOD(saveStatusReportForRetry:(NSDictionary *)statusReport)
|
|
|
1107
1075
|
[CodePushTelemetryManager saveStatusReportForRetry:statusReport];
|
|
1108
1076
|
}
|
|
1109
1077
|
|
|
1110
|
-
#pragma mark - RCTFrameUpdateObserver Methods
|
|
1111
|
-
|
|
1112
|
-
- (void)didUpdateFrame:(RCTFrameUpdate *)update
|
|
1113
|
-
{
|
|
1114
|
-
if (!_didUpdateProgress) {
|
|
1115
|
-
return;
|
|
1116
|
-
}
|
|
1117
|
-
|
|
1118
|
-
[self dispatchDownloadProgressEvent];
|
|
1119
|
-
_didUpdateProgress = NO;
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
1078
|
@end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
exports.withCodePush = withCodePush;
|
|
8
|
+
var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
var _CheckFrequencyEnum = require("./enums/CheckFrequency.enum.js");
|
|
12
|
+
var _notifyAppReady = require("./notifyAppReady.js");
|
|
13
|
+
var _sync = require("./sync.js");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
/**
|
|
17
|
+
* Decorates a React Component configuring it to sync for updates with the CodePush server.
|
|
18
|
+
*
|
|
19
|
+
* @param component the React Component that will be decorated
|
|
20
|
+
*/
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Decorates a React Component configuring it to sync for updates with the CodePush server.
|
|
25
|
+
*
|
|
26
|
+
* @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?).
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
function withCodePush(optionsOrComponent) {
|
|
30
|
+
const options = typeof optionsOrComponent === 'function' ? {} : optionsOrComponent;
|
|
31
|
+
const WithCodePush = RootComponent => {
|
|
32
|
+
class CodePushComponent extends _react.default.Component {
|
|
33
|
+
constructor(props) {
|
|
34
|
+
super(props);
|
|
35
|
+
this.rootComponentRef = /*#__PURE__*/_react.default.createRef();
|
|
36
|
+
}
|
|
37
|
+
componentDidMount() {
|
|
38
|
+
if (options.checkFrequency === _CheckFrequencyEnum.CheckFrequency.MANUAL) {
|
|
39
|
+
(0, _notifyAppReady.notifyAppReady)();
|
|
40
|
+
} else {
|
|
41
|
+
const rootComponentInstance = this.rootComponentRef.current;
|
|
42
|
+
let syncStatusCallback;
|
|
43
|
+
if (rootComponentInstance && rootComponentInstance.codePushStatusDidChange) {
|
|
44
|
+
syncStatusCallback = rootComponentInstance.codePushStatusDidChange.bind(rootComponentInstance);
|
|
45
|
+
}
|
|
46
|
+
let downloadProgressCallback;
|
|
47
|
+
if (rootComponentInstance && rootComponentInstance.codePushDownloadDidProgress) {
|
|
48
|
+
downloadProgressCallback = rootComponentInstance.codePushDownloadDidProgress.bind(rootComponentInstance);
|
|
49
|
+
}
|
|
50
|
+
let handleBinaryVersionMismatchCallback;
|
|
51
|
+
if (rootComponentInstance && rootComponentInstance.codePushOnBinaryVersionMismatch) {
|
|
52
|
+
handleBinaryVersionMismatchCallback = rootComponentInstance.codePushOnBinaryVersionMismatch.bind(rootComponentInstance);
|
|
53
|
+
}
|
|
54
|
+
(0, _sync.sync)(options, syncStatusCallback, downloadProgressCallback, handleBinaryVersionMismatchCallback);
|
|
55
|
+
if (options.checkFrequency === _CheckFrequencyEnum.CheckFrequency.ON_APP_RESUME) {
|
|
56
|
+
_reactNative.AppState.addEventListener('change', newState => {
|
|
57
|
+
if (newState === 'active') {
|
|
58
|
+
(0, _sync.sync)(options, syncStatusCallback, downloadProgressCallback);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
render() {
|
|
65
|
+
const props = {
|
|
66
|
+
...this.props
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// We can set ref property on class components only (not stateless)
|
|
70
|
+
// Check it by render method
|
|
71
|
+
if (RootComponent.prototype && RootComponent.prototype.render) {
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
props.ref = this.rootComponentRef;
|
|
74
|
+
}
|
|
75
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RootComponent, {
|
|
76
|
+
...props
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return (0, _hoistNonReactStatics.default)(CodePushComponent, RootComponent);
|
|
81
|
+
};
|
|
82
|
+
if (typeof optionsOrComponent === 'function') {
|
|
83
|
+
// Infer that the root component was directly passed to us.
|
|
84
|
+
return WithCodePush(optionsOrComponent);
|
|
85
|
+
} else {
|
|
86
|
+
return WithCodePush;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
var _default = exports.default = withCodePush;
|
|
90
|
+
//# sourceMappingURL=CodePush.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_hoistNonReactStatics","_interopRequireDefault","require","_react","_reactNative","_CheckFrequencyEnum","_notifyAppReady","_sync","_jsxRuntime","e","__esModule","default","withCodePush","optionsOrComponent","options","WithCodePush","RootComponent","CodePushComponent","React","Component","constructor","props","rootComponentRef","createRef","componentDidMount","checkFrequency","CheckFrequency","MANUAL","notifyAppReady","rootComponentInstance","current","syncStatusCallback","codePushStatusDidChange","bind","downloadProgressCallback","codePushDownloadDidProgress","handleBinaryVersionMismatchCallback","codePushOnBinaryVersionMismatch","sync","ON_APP_RESUME","AppState","addEventListener","newState","render","prototype","ref","jsx","hoistStatics","_default","exports"],"sourceRoot":"../../src","sources":["CodePush.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.allowRestart = void 0;
|
|
7
|
+
var _NativeRNAppZungCodePushModule = require("./internals/NativeRNAppZungCodePushModule.js");
|
|
8
|
+
/**
|
|
9
|
+
* Allow CodePush to restart the app.
|
|
10
|
+
*/
|
|
11
|
+
const allowRestart = exports.allowRestart = _NativeRNAppZungCodePushModule.NativeRNAppZungCodePushModule.allow;
|
|
12
|
+
//# sourceMappingURL=allowRestart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_NativeRNAppZungCodePushModule","require","allowRestart","exports","NativeRNAppZungCodePushModule","allow"],"sourceRoot":"../../src","sources":["allowRestart.ts"],"mappings":";;;;;;AAAA,IAAAA,8BAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACO,MAAMC,YAAwB,GAAAC,OAAA,CAAAD,YAAA,GAAGE,4DAA6B,CAACC,KAAK","ignoreList":[]}
|