@appzung/react-native-code-push 11.0.0-rc1 → 11.0.0-rc10
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 +3 -5
- package/README.md +26 -24
- package/android/app/proguard-rules.pro +5 -0
- package/android/app/src/main/java/com/appzung/codepush/react/CodePush.java +4 -0
- package/android/app/src/main/java/com/appzung/codepush/react/CodePushConstants.java +2 -0
- package/android/app/src/main/java/com/appzung/codepush/react/CodePushNativeModule.java +86 -4
- package/android/app/src/main/java/com/appzung/codepush/react/ExpoUtils.java +22 -0
- package/ios/CodePush/CodePush.h +11 -6
- package/ios/CodePush/{CodePush.m → CodePush.mm} +132 -141
- package/ios/CodePush/CodePushConfig.m +54 -0
- package/ios/CodePush.xcodeproj/project.pbxproj +6 -6
- package/lib/commonjs/CodePush.js +11 -2
- package/lib/commonjs/CodePush.js.map +1 -1
- package/lib/commonjs/allowRestart.js +6 -2
- package/lib/commonjs/allowRestart.js.map +1 -1
- package/lib/commonjs/checkForUpdates.js +25 -26
- package/lib/commonjs/checkForUpdates.js.map +1 -1
- package/lib/commonjs/clearUpdates.js +6 -3
- package/lib/commonjs/clearUpdates.js.map +1 -1
- package/lib/commonjs/dataTransmission.js +28 -0
- package/lib/commonjs/dataTransmission.js.map +1 -0
- package/lib/commonjs/disallowRestart.js +6 -2
- package/lib/commonjs/disallowRestart.js.map +1 -1
- package/lib/commonjs/enums/CheckFrequency.enum.js +2 -2
- package/lib/commonjs/enums/InstallMode.enum.js +7 -3
- package/lib/commonjs/enums/InstallMode.enum.js.map +1 -1
- package/lib/commonjs/enums/LogLevel.enum.js +17 -0
- package/lib/commonjs/enums/LogLevel.enum.js.map +1 -0
- package/lib/commonjs/enums/SyncStatus.enum.js +7 -7
- package/lib/commonjs/enums/UpdateState.enum.js +7 -6
- package/lib/commonjs/enums/UpdateState.enum.js.map +1 -1
- package/lib/commonjs/getClientUniqueId.js +16 -0
- package/lib/commonjs/getClientUniqueId.js.map +1 -0
- package/lib/commonjs/index.js +90 -9
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/internals/CodePushApiSdk.errors.js +26 -0
- package/lib/commonjs/internals/CodePushApiSdk.errors.js.map +1 -0
- package/lib/commonjs/internals/CodePushApiSdk.js +122 -0
- package/lib/commonjs/internals/CodePushApiSdk.js.map +1 -0
- package/lib/commonjs/{enums/DeploymentStatus.enum.js → internals/CodePushApiSdk.types.js} +3 -2
- package/lib/commonjs/internals/CodePushApiSdk.types.js.map +1 -0
- package/lib/commonjs/internals/CodePushEventEmitter.js +10 -0
- package/lib/commonjs/internals/CodePushEventEmitter.js.map +1 -0
- package/lib/commonjs/internals/RemotePackageImplementation.js +9 -8
- package/lib/commonjs/internals/RemotePackageImplementation.js.map +1 -1
- package/lib/commonjs/internals/getConfiguration.js +4 -0
- package/lib/commonjs/internals/getConfiguration.js.map +1 -1
- package/lib/commonjs/internals/logger.js +51 -0
- package/lib/commonjs/internals/logger.js.map +1 -0
- package/lib/commonjs/internals/shouldUpdateBeIgnored.js +6 -5
- package/lib/commonjs/internals/shouldUpdateBeIgnored.js.map +1 -1
- package/lib/commonjs/internals/utils/fetchRetry.js +59 -0
- package/lib/commonjs/internals/utils/fetchRetry.js.map +1 -0
- package/lib/commonjs/internals/utils/log.js +10 -3
- package/lib/commonjs/internals/utils/log.js.map +1 -1
- package/lib/commonjs/internals/utils/queryStringify.js +25 -0
- package/lib/commonjs/internals/utils/queryStringify.js.map +1 -0
- package/lib/commonjs/internals/utils/requestFetchAdapter.js +38 -0
- package/lib/commonjs/internals/utils/requestFetchAdapter.js.map +1 -0
- package/lib/commonjs/internals/version.js +1 -1
- package/lib/commonjs/internals/version.js.map +1 -1
- package/lib/commonjs/logLevel.js +15 -0
- package/lib/commonjs/logLevel.js.map +1 -0
- package/lib/commonjs/logger.js +19 -0
- package/lib/commonjs/logger.js.map +1 -0
- package/lib/commonjs/notifyAppReady.js +26 -15
- package/lib/commonjs/notifyAppReady.js.map +1 -1
- package/lib/commonjs/resetClientUniqueId.js +18 -0
- package/lib/commonjs/resetClientUniqueId.js.map +1 -0
- package/lib/commonjs/restartApp.js +4 -2
- package/lib/commonjs/restartApp.js.map +1 -1
- package/lib/commonjs/sync.js +35 -28
- package/lib/commonjs/sync.js.map +1 -1
- package/lib/commonjs/telemetry.js +28 -0
- package/lib/commonjs/telemetry.js.map +1 -0
- package/lib/module/CodePush.js +11 -2
- package/lib/module/CodePush.js.map +1 -1
- package/lib/module/allowRestart.js +5 -1
- package/lib/module/allowRestart.js.map +1 -1
- package/lib/module/checkForUpdates.js +25 -26
- package/lib/module/checkForUpdates.js.map +1 -1
- package/lib/module/clearUpdates.js +5 -2
- package/lib/module/clearUpdates.js.map +1 -1
- package/lib/module/dataTransmission.js +24 -0
- package/lib/module/dataTransmission.js.map +1 -0
- package/lib/module/disallowRestart.js +5 -1
- package/lib/module/disallowRestart.js.map +1 -1
- package/lib/module/enums/CheckFrequency.enum.js +2 -2
- package/lib/module/enums/InstallMode.enum.js +7 -3
- package/lib/module/enums/InstallMode.enum.js.map +1 -1
- package/lib/module/enums/LogLevel.enum.js +13 -0
- package/lib/module/enums/LogLevel.enum.js.map +1 -0
- package/lib/module/enums/SyncStatus.enum.js +7 -7
- package/lib/module/enums/UpdateState.enum.js +7 -6
- package/lib/module/enums/UpdateState.enum.js.map +1 -1
- package/lib/module/getClientUniqueId.js +12 -0
- package/lib/module/getClientUniqueId.js.map +1 -0
- package/lib/module/index.js +8 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/internals/CodePushApiSdk.errors.js +20 -0
- package/lib/module/internals/CodePushApiSdk.errors.js.map +1 -0
- package/lib/module/internals/CodePushApiSdk.js +118 -0
- package/lib/module/internals/CodePushApiSdk.js.map +1 -0
- package/lib/module/{enums/DeploymentStatus.enum.js → internals/CodePushApiSdk.types.js} +2 -1
- package/lib/module/internals/CodePushApiSdk.types.js.map +1 -0
- package/lib/module/internals/CodePushEventEmitter.js +6 -0
- package/lib/module/internals/CodePushEventEmitter.js.map +1 -0
- package/lib/module/internals/RemotePackageImplementation.js +9 -8
- package/lib/module/internals/RemotePackageImplementation.js.map +1 -1
- package/lib/module/internals/getConfiguration.js +3 -0
- package/lib/module/internals/getConfiguration.js.map +1 -1
- package/lib/module/internals/logger.js +44 -0
- package/lib/module/internals/logger.js.map +1 -0
- package/lib/module/internals/shouldUpdateBeIgnored.js +6 -5
- package/lib/module/internals/shouldUpdateBeIgnored.js.map +1 -1
- package/lib/module/internals/utils/fetchRetry.js +55 -0
- package/lib/module/internals/utils/fetchRetry.js.map +1 -0
- package/lib/module/internals/utils/log.js +11 -3
- package/lib/module/internals/utils/log.js.map +1 -1
- package/lib/module/internals/utils/queryStringify.js +21 -0
- package/lib/module/internals/utils/queryStringify.js.map +1 -0
- package/lib/module/internals/utils/requestFetchAdapter.js +34 -0
- package/lib/module/internals/utils/requestFetchAdapter.js.map +1 -0
- package/lib/module/internals/version.js +1 -1
- package/lib/module/internals/version.js.map +1 -1
- package/lib/module/logLevel.js +9 -0
- package/lib/module/logLevel.js.map +1 -0
- package/lib/module/logger.js +4 -0
- package/lib/module/logger.js.map +1 -0
- package/lib/module/notifyAppReady.js +26 -15
- package/lib/module/notifyAppReady.js.map +1 -1
- package/lib/module/resetClientUniqueId.js +14 -0
- package/lib/module/resetClientUniqueId.js.map +1 -0
- package/lib/module/restartApp.js +4 -2
- package/lib/module/restartApp.js.map +1 -1
- package/lib/module/sync.js +35 -28
- package/lib/module/sync.js.map +1 -1
- package/lib/module/telemetry.js +24 -0
- package/lib/module/telemetry.js.map +1 -0
- package/lib/typescript/commonjs/src/CodePush.d.ts +10 -5
- package/lib/typescript/commonjs/src/CodePush.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/allowRestart.d.ts +3 -1
- package/lib/typescript/commonjs/src/allowRestart.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/checkForUpdates.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/clearUpdates.d.ts +3 -2
- package/lib/typescript/commonjs/src/clearUpdates.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/dataTransmission.d.ts +13 -0
- package/lib/typescript/commonjs/src/dataTransmission.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/disallowRestart.d.ts +3 -1
- package/lib/typescript/commonjs/src/disallowRestart.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/enums/CheckFrequency.enum.d.ts +2 -2
- package/lib/typescript/commonjs/src/enums/InstallMode.enum.d.ts +7 -3
- package/lib/typescript/commonjs/src/enums/InstallMode.enum.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/enums/LogLevel.enum.d.ts +10 -0
- package/lib/typescript/commonjs/src/enums/LogLevel.enum.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/enums/SyncStatus.enum.d.ts +7 -7
- package/lib/typescript/commonjs/src/enums/UpdateState.enum.d.ts +7 -6
- package/lib/typescript/commonjs/src/enums/UpdateState.enum.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/getClientUniqueId.d.ts +5 -0
- package/lib/typescript/commonjs/src/getClientUniqueId.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +8 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/internals/CodePushApiSdk.d.ts +15 -0
- package/lib/typescript/commonjs/src/internals/CodePushApiSdk.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/CodePushApiSdk.errors.d.ts +9 -0
- package/lib/typescript/commonjs/src/internals/CodePushApiSdk.errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/CodePushApiSdk.types.d.ts +103 -0
- package/lib/typescript/commonjs/src/internals/CodePushApiSdk.types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/CodePushEventEmitter.d.ts +3 -0
- package/lib/typescript/commonjs/src/internals/CodePushEventEmitter.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/RNAppZungCodePushModuleSpec.d.ts +5 -0
- package/lib/typescript/commonjs/src/internals/RNAppZungCodePushModuleSpec.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/internals/RemotePackageImplementation.d.ts +2 -2
- package/lib/typescript/commonjs/src/internals/RemotePackageImplementation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/internals/getConfiguration.d.ts +1 -0
- package/lib/typescript/commonjs/src/internals/getConfiguration.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/internals/logger.d.ts +33 -0
- package/lib/typescript/commonjs/src/internals/logger.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/shouldUpdateBeIgnored.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/internals/types.d.ts +2 -2
- package/lib/typescript/commonjs/src/internals/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/internals/utils/fetchRetry.d.ts +9 -0
- package/lib/typescript/commonjs/src/internals/utils/fetchRetry.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/utils/log.d.ts +2 -1
- package/lib/typescript/commonjs/src/internals/utils/log.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/internals/utils/queryStringify.d.ts +4 -0
- package/lib/typescript/commonjs/src/internals/utils/queryStringify.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/utils/requestFetchAdapter.d.ts +3 -0
- package/lib/typescript/commonjs/src/internals/utils/requestFetchAdapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/internals/version.d.ts +1 -1
- package/lib/typescript/commonjs/src/internals/version.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/logLevel.d.ts +4 -0
- package/lib/typescript/commonjs/src/logLevel.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/logger.d.ts +3 -0
- package/lib/typescript/commonjs/src/logger.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/notifyAppReady.d.ts +4 -0
- package/lib/typescript/commonjs/src/notifyAppReady.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/resetClientUniqueId.d.ts +5 -0
- package/lib/typescript/commonjs/src/resetClientUniqueId.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/restartApp.d.ts +2 -0
- package/lib/typescript/commonjs/src/restartApp.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/sync.d.ts +5 -1
- package/lib/typescript/commonjs/src/sync.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/telemetry.d.ts +13 -0
- package/lib/typescript/commonjs/src/telemetry.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types.d.ts +72 -29
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -1
- package/lib/typescript/module/src/CodePush.d.ts +10 -5
- package/lib/typescript/module/src/CodePush.d.ts.map +1 -1
- package/lib/typescript/module/src/allowRestart.d.ts +3 -1
- package/lib/typescript/module/src/allowRestart.d.ts.map +1 -1
- package/lib/typescript/module/src/checkForUpdates.d.ts.map +1 -1
- package/lib/typescript/module/src/clearUpdates.d.ts +3 -2
- package/lib/typescript/module/src/clearUpdates.d.ts.map +1 -1
- package/lib/typescript/module/src/dataTransmission.d.ts +13 -0
- package/lib/typescript/module/src/dataTransmission.d.ts.map +1 -0
- package/lib/typescript/module/src/disallowRestart.d.ts +3 -1
- package/lib/typescript/module/src/disallowRestart.d.ts.map +1 -1
- package/lib/typescript/module/src/enums/CheckFrequency.enum.d.ts +2 -2
- package/lib/typescript/module/src/enums/InstallMode.enum.d.ts +7 -3
- package/lib/typescript/module/src/enums/InstallMode.enum.d.ts.map +1 -1
- package/lib/typescript/module/src/enums/LogLevel.enum.d.ts +10 -0
- package/lib/typescript/module/src/enums/LogLevel.enum.d.ts.map +1 -0
- package/lib/typescript/module/src/enums/SyncStatus.enum.d.ts +7 -7
- package/lib/typescript/module/src/enums/UpdateState.enum.d.ts +7 -6
- package/lib/typescript/module/src/enums/UpdateState.enum.d.ts.map +1 -1
- package/lib/typescript/module/src/getClientUniqueId.d.ts +5 -0
- package/lib/typescript/module/src/getClientUniqueId.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +8 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/internals/CodePushApiSdk.d.ts +15 -0
- package/lib/typescript/module/src/internals/CodePushApiSdk.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/CodePushApiSdk.errors.d.ts +9 -0
- package/lib/typescript/module/src/internals/CodePushApiSdk.errors.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/CodePushApiSdk.types.d.ts +103 -0
- package/lib/typescript/module/src/internals/CodePushApiSdk.types.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/CodePushEventEmitter.d.ts +3 -0
- package/lib/typescript/module/src/internals/CodePushEventEmitter.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/RNAppZungCodePushModuleSpec.d.ts +5 -0
- package/lib/typescript/module/src/internals/RNAppZungCodePushModuleSpec.d.ts.map +1 -1
- package/lib/typescript/module/src/internals/RemotePackageImplementation.d.ts +2 -2
- package/lib/typescript/module/src/internals/RemotePackageImplementation.d.ts.map +1 -1
- package/lib/typescript/module/src/internals/getConfiguration.d.ts +1 -0
- package/lib/typescript/module/src/internals/getConfiguration.d.ts.map +1 -1
- package/lib/typescript/module/src/internals/logger.d.ts +33 -0
- package/lib/typescript/module/src/internals/logger.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/shouldUpdateBeIgnored.d.ts.map +1 -1
- package/lib/typescript/module/src/internals/types.d.ts +2 -2
- package/lib/typescript/module/src/internals/types.d.ts.map +1 -1
- package/lib/typescript/module/src/internals/utils/fetchRetry.d.ts +9 -0
- package/lib/typescript/module/src/internals/utils/fetchRetry.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/utils/log.d.ts +2 -1
- package/lib/typescript/module/src/internals/utils/log.d.ts.map +1 -1
- package/lib/typescript/module/src/internals/utils/queryStringify.d.ts +4 -0
- package/lib/typescript/module/src/internals/utils/queryStringify.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/utils/requestFetchAdapter.d.ts +3 -0
- package/lib/typescript/module/src/internals/utils/requestFetchAdapter.d.ts.map +1 -0
- package/lib/typescript/module/src/internals/version.d.ts +1 -1
- package/lib/typescript/module/src/internals/version.d.ts.map +1 -1
- package/lib/typescript/module/src/logLevel.d.ts +4 -0
- package/lib/typescript/module/src/logLevel.d.ts.map +1 -0
- package/lib/typescript/module/src/logger.d.ts +3 -0
- package/lib/typescript/module/src/logger.d.ts.map +1 -0
- package/lib/typescript/module/src/notifyAppReady.d.ts +4 -0
- package/lib/typescript/module/src/notifyAppReady.d.ts.map +1 -1
- package/lib/typescript/module/src/resetClientUniqueId.d.ts +5 -0
- package/lib/typescript/module/src/resetClientUniqueId.d.ts.map +1 -0
- package/lib/typescript/module/src/restartApp.d.ts +2 -0
- package/lib/typescript/module/src/restartApp.d.ts.map +1 -1
- package/lib/typescript/module/src/sync.d.ts +5 -1
- package/lib/typescript/module/src/sync.d.ts.map +1 -1
- package/lib/typescript/module/src/telemetry.d.ts +13 -0
- package/lib/typescript/module/src/telemetry.d.ts.map +1 -0
- package/lib/typescript/module/src/types.d.ts +72 -29
- package/lib/typescript/module/src/types.d.ts.map +1 -1
- package/package.json +24 -13
- package/scripts/generateBundledResourcesHash.js +73 -68
- package/scripts/getFilesInFolder.js +12 -12
- package/scripts/recordFilesBeforeBundleCommand.js +19 -20
- package/src/CodePush.tsx +20 -5
- package/src/allowRestart.ts +5 -1
- package/src/checkForUpdates.ts +26 -24
- package/src/clearUpdates.ts +5 -2
- package/src/dataTransmission.ts +21 -0
- package/src/disallowRestart.ts +5 -1
- package/src/enums/CheckFrequency.enum.ts +2 -2
- package/src/enums/InstallMode.enum.ts +7 -3
- package/src/enums/LogLevel.enum.ts +9 -0
- package/src/enums/SyncStatus.enum.ts +7 -7
- package/src/enums/UpdateState.enum.ts +7 -6
- package/src/getClientUniqueId.ts +9 -0
- package/src/index.ts +8 -1
- package/src/internals/CodePushApiSdk.errors.ts +22 -0
- package/src/internals/CodePushApiSdk.ts +160 -0
- package/src/internals/CodePushApiSdk.types.ts +117 -0
- package/src/internals/CodePushEventEmitter.ts +4 -0
- package/src/internals/RNAppZungCodePushModuleSpec.ts +7 -0
- package/src/internals/RemotePackageImplementation.ts +11 -10
- package/src/internals/getConfiguration.ts +4 -0
- package/src/internals/logger.ts +46 -0
- package/src/internals/shouldUpdateBeIgnored.ts +6 -5
- package/src/internals/types.ts +2 -2
- package/src/internals/utils/fetchRetry.ts +72 -0
- package/src/internals/utils/log.ts +13 -3
- package/src/internals/utils/queryStringify.ts +22 -0
- package/src/internals/utils/requestFetchAdapter.ts +36 -0
- package/src/internals/version.ts +1 -1
- package/src/logLevel.ts +9 -0
- package/src/logger.ts +2 -0
- package/src/notifyAppReady.ts +29 -18
- package/src/resetClientUniqueId.ts +11 -0
- package/src/restartApp.ts +4 -2
- package/src/sync.ts +41 -27
- package/src/telemetry.ts +21 -0
- package/src/types.ts +72 -29
- package/android/app/.gradle/config.properties +0 -2
- package/android/app/local.properties +0 -8
- package/docs/advanced-usage.md +0 -56
- package/docs/api-android.md +0 -22
- package/docs/api-ios.md +0 -19
- package/docs/api-js.md +0 -557
- package/docs/code-signing.md +0 -62
- package/docs/migrating-to-v10.md +0 -31
- package/docs/setup-android.md +0 -81
- package/docs/setup-ios.md +0 -108
- package/docs/setup-windows.md +0 -55
- package/lib/commonjs/enums/DeploymentStatus.enum.js.map +0 -1
- package/lib/commonjs/internals/AcquisitionSdk.js +0 -9
- package/lib/commonjs/internals/AcquisitionSdk.js.map +0 -1
- package/lib/commonjs/internals/getPromisifiedSdk.js +0 -49
- package/lib/commonjs/internals/getPromisifiedSdk.js.map +0 -1
- package/lib/commonjs/internals/utils/request-fetch-adapter.js +0 -50
- package/lib/commonjs/internals/utils/request-fetch-adapter.js.map +0 -1
- package/lib/module/enums/DeploymentStatus.enum.js.map +0 -1
- package/lib/module/internals/AcquisitionSdk.js +0 -5
- package/lib/module/internals/AcquisitionSdk.js.map +0 -1
- package/lib/module/internals/getPromisifiedSdk.js +0 -45
- package/lib/module/internals/getPromisifiedSdk.js.map +0 -1
- package/lib/module/internals/utils/request-fetch-adapter.js +0 -46
- package/lib/module/internals/utils/request-fetch-adapter.js.map +0 -1
- package/lib/typescript/commonjs/src/enums/DeploymentStatus.enum.d.ts +0 -14
- package/lib/typescript/commonjs/src/enums/DeploymentStatus.enum.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/internals/AcquisitionSdk.d.ts +0 -3
- package/lib/typescript/commonjs/src/internals/AcquisitionSdk.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/internals/getPromisifiedSdk.d.ts +0 -13
- package/lib/typescript/commonjs/src/internals/getPromisifiedSdk.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/internals/utils/request-fetch-adapter.d.ts +0 -3
- package/lib/typescript/commonjs/src/internals/utils/request-fetch-adapter.d.ts.map +0 -1
- package/lib/typescript/module/src/enums/DeploymentStatus.enum.d.ts +0 -14
- package/lib/typescript/module/src/enums/DeploymentStatus.enum.d.ts.map +0 -1
- package/lib/typescript/module/src/internals/AcquisitionSdk.d.ts +0 -3
- package/lib/typescript/module/src/internals/AcquisitionSdk.d.ts.map +0 -1
- package/lib/typescript/module/src/internals/getPromisifiedSdk.d.ts +0 -13
- package/lib/typescript/module/src/internals/getPromisifiedSdk.d.ts.map +0 -1
- package/lib/typescript/module/src/internals/utils/request-fetch-adapter.d.ts +0 -3
- package/lib/typescript/module/src/internals/utils/request-fetch-adapter.d.ts.map +0 -1
- package/src/enums/DeploymentStatus.enum.ts +0 -14
- package/src/internals/AcquisitionSdk.ts +0 -3
- package/src/internals/getPromisifiedSdk.ts +0 -72
- package/src/internals/utils/request-fetch-adapter.ts +0 -58
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appzung/react-native-code-push",
|
|
3
|
-
"version": "11.0.0-
|
|
3
|
+
"version": "11.0.0-rc10",
|
|
4
4
|
"description": "React Native plugin for the CodePush service",
|
|
5
5
|
"author": "Louis Lagrange <lagrange.louis@gmail.com> (https://github.com/Minishlink)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
|
+
"genversion": "genversion src/internals/version.ts --esm -s",
|
|
30
|
+
"prepare": "yarn genversion && typedoc && bob build",
|
|
29
31
|
"clean": "shx rm -rf bin",
|
|
30
|
-
"
|
|
31
|
-
"prebuild:tests": "npm run clean && npm run tslint",
|
|
32
|
+
"prebuild:tests": "yarn clean",
|
|
32
33
|
"build:tests": "tsc",
|
|
33
|
-
"test": "
|
|
34
|
-
"test:
|
|
35
|
-
"test:ios": "npm run build:tests && npm run test:setup:ios && npm run test:fast:ios",
|
|
34
|
+
"test:android": "yarn build:tests && yarn test:setup:android && yarn test:fast:android",
|
|
35
|
+
"test:ios": "yarn build:tests && yarn test:setup:ios && yarn test:fast:ios",
|
|
36
36
|
"test:setup": "mocha --recursive bin/test --android --ios --setup",
|
|
37
37
|
"test:setup:android": "mocha --recursive bin/test --android --setup",
|
|
38
38
|
"test:setup:ios": "mocha --recursive bin/test --ios --setup",
|
|
@@ -42,19 +42,22 @@
|
|
|
42
42
|
"test:debugger:android": "mocha --recursive --inspect-brk=0.0.0.0 bin/test --android",
|
|
43
43
|
"test:debugger:ios": "mocha --recursive --inspect-brk=0.0.0.0 bin/test --ios",
|
|
44
44
|
"test:types": "tsc --noEmit",
|
|
45
|
-
"test:format": "prettier --check \"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
45
|
+
"test:format": "prettier --check \"docs/**/*.md\" README.md",
|
|
46
|
+
"test:lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
47
|
+
"test": "yarn test:lint && yarn test:format && yarn test:types"
|
|
48
48
|
},
|
|
49
49
|
"repository": {
|
|
50
50
|
"type": "git",
|
|
51
51
|
"url": "https://github.com/appzung/react-native-code-push"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"code-push": "^4.2.3",
|
|
55
54
|
"hoist-non-react-statics": "^3.3.2"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
57
|
+
"@eslint/compat": "^1.2.7",
|
|
58
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
59
|
+
"@eslint/js": "^9.23.0",
|
|
60
|
+
"@react-native/eslint-config": "^0.78.1",
|
|
58
61
|
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
59
62
|
"@types/assert": "^1.5.2",
|
|
60
63
|
"@types/hoist-non-react-statics": "^3.3.6",
|
|
@@ -64,8 +67,11 @@
|
|
|
64
67
|
"@types/q": "^1.5.4",
|
|
65
68
|
"archiver": "^7.0.1",
|
|
66
69
|
"body-parser": "^1.20.3",
|
|
67
|
-
"code-push-plugin-testing-framework": "
|
|
70
|
+
"code-push-plugin-testing-framework": "workspace:./code-push-plugin-testing-framework",
|
|
68
71
|
"del": "v6.0.0",
|
|
72
|
+
"eslint": "^9.23.0",
|
|
73
|
+
"eslint-config-prettier": "^10.1.1",
|
|
74
|
+
"eslint-plugin-prettier": "^5.2.5",
|
|
69
75
|
"express": "^4.21.2",
|
|
70
76
|
"genversion": "^3.2.0",
|
|
71
77
|
"mkdirp": "latest",
|
|
@@ -76,7 +82,8 @@
|
|
|
76
82
|
"run-sequence": "latest",
|
|
77
83
|
"shx": "^0.3.4",
|
|
78
84
|
"slash": "^3.0.0",
|
|
79
|
-
"
|
|
85
|
+
"typedoc": "^0.28.1",
|
|
86
|
+
"typedoc-plugin-markdown": "^4.6.0",
|
|
80
87
|
"typescript": "^5.7.3"
|
|
81
88
|
},
|
|
82
89
|
"react-native-builder-bob": {
|
|
@@ -104,6 +111,9 @@
|
|
|
104
111
|
]
|
|
105
112
|
]
|
|
106
113
|
},
|
|
114
|
+
"workspaces": [
|
|
115
|
+
"code-push-plugin-testing-framework"
|
|
116
|
+
],
|
|
107
117
|
"keywords": [
|
|
108
118
|
"appzung",
|
|
109
119
|
"codepush",
|
|
@@ -116,5 +126,6 @@
|
|
|
116
126
|
"expo-updates",
|
|
117
127
|
"expo-ota",
|
|
118
128
|
"appcenter"
|
|
119
|
-
]
|
|
129
|
+
],
|
|
130
|
+
"packageManager": "yarn@4.8.1"
|
|
120
131
|
}
|
|
@@ -11,16 +11,16 @@
|
|
|
11
11
|
* manifest to generate the final hash, which is saved to the APK's assets directory.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
var crypto = require(
|
|
15
|
-
var fs = require(
|
|
16
|
-
var path = require(
|
|
14
|
+
var crypto = require('crypto');
|
|
15
|
+
var fs = require('fs');
|
|
16
|
+
var path = require('path');
|
|
17
17
|
|
|
18
|
-
var getFilesInFolder = require(
|
|
18
|
+
var getFilesInFolder = require('./getFilesInFolder');
|
|
19
19
|
|
|
20
|
-
var CODE_PUSH_FOLDER_PREFIX =
|
|
21
|
-
var CODE_PUSH_HASH_FILE_NAME =
|
|
22
|
-
var CODE_PUSH_HASH_OLD_FILE_NAME =
|
|
23
|
-
var HASH_ALGORITHM =
|
|
20
|
+
var CODE_PUSH_FOLDER_PREFIX = 'CodePush';
|
|
21
|
+
var CODE_PUSH_HASH_FILE_NAME = 'CodePushHash';
|
|
22
|
+
var CODE_PUSH_HASH_OLD_FILE_NAME = 'CodePushHash.json';
|
|
23
|
+
var HASH_ALGORITHM = 'sha256';
|
|
24
24
|
|
|
25
25
|
var resourcesDir = process.argv[2];
|
|
26
26
|
var jsBundleFilePath = process.argv[3];
|
|
@@ -30,8 +30,8 @@ var tempFileName = process.argv[5];
|
|
|
30
30
|
var oldFileToModifiedTimeMap = {};
|
|
31
31
|
var tempFileLocalPath = null;
|
|
32
32
|
if (tempFileName) {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
tempFileLocalPath = path.join(require('os').tmpdir(), tempFileName);
|
|
34
|
+
oldFileToModifiedTimeMap = require(tempFileLocalPath);
|
|
35
35
|
}
|
|
36
36
|
var resourceFiles = [];
|
|
37
37
|
|
|
@@ -39,87 +39,92 @@ getFilesInFolder(resourcesDir, resourceFiles);
|
|
|
39
39
|
|
|
40
40
|
var newFileToModifiedTimeMap = {};
|
|
41
41
|
|
|
42
|
-
resourceFiles.forEach(function(resourceFile) {
|
|
43
|
-
|
|
42
|
+
resourceFiles.forEach(function (resourceFile) {
|
|
43
|
+
newFileToModifiedTimeMap[resourceFile.path.substring(resourcesDir.length)] = resourceFile.mtime;
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
var bundleGeneratedAssetFiles = [];
|
|
47
47
|
|
|
48
48
|
for (var newFilePath in newFileToModifiedTimeMap) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
if (
|
|
50
|
+
!oldFileToModifiedTimeMap[newFilePath] ||
|
|
51
|
+
oldFileToModifiedTimeMap[newFilePath] < newFileToModifiedTimeMap[newFilePath].getTime()
|
|
52
|
+
) {
|
|
53
|
+
bundleGeneratedAssetFiles.push(newFilePath);
|
|
54
|
+
}
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
var manifest = [];
|
|
55
58
|
|
|
56
59
|
if (bundleGeneratedAssetFiles.length) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
});
|
|
60
|
+
bundleGeneratedAssetFiles.forEach(function (assetFile) {
|
|
61
|
+
// Generate hash for each asset file
|
|
62
|
+
addFileToManifest(resourcesDir, assetFile, manifest, function () {
|
|
63
|
+
if (manifest.length === bundleGeneratedAssetFiles.length) {
|
|
64
|
+
addJsBundleAndMetaToManifest();
|
|
65
|
+
}
|
|
64
66
|
});
|
|
67
|
+
});
|
|
65
68
|
} else {
|
|
66
|
-
|
|
69
|
+
addJsBundleAndMetaToManifest();
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
function addJsBundleAndMetaToManifest() {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
fs.unlinkSync(oldSavedResourcesManifestPath);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
73
|
+
addFileToManifest(path.dirname(jsBundleFilePath), path.basename(jsBundleFilePath), manifest, function () {
|
|
74
|
+
var jsBundleMetaFilePath = jsBundleFilePath + '.meta';
|
|
75
|
+
addFileToManifest(path.dirname(jsBundleMetaFilePath), path.basename(jsBundleMetaFilePath), manifest, function () {
|
|
76
|
+
manifest = manifest.sort();
|
|
77
|
+
var finalHash = crypto.createHash(HASH_ALGORITHM).update(JSON.stringify(manifest)).digest('hex');
|
|
78
|
+
|
|
79
|
+
console.log(finalHash);
|
|
80
|
+
|
|
81
|
+
var savedResourcesManifestPath = assetsDir + '/' + CODE_PUSH_HASH_FILE_NAME;
|
|
82
|
+
fs.writeFileSync(savedResourcesManifestPath, finalHash);
|
|
83
|
+
|
|
84
|
+
// "CodePushHash.json" file name breaks flow type checking.
|
|
85
|
+
// To fix the issue we need to delete "CodePushHash.json" file and
|
|
86
|
+
// use "CodePushHash" file name instead to store the hash value.
|
|
87
|
+
// Relates to https://github.com/microsoft/react-native-code-push/issues/577
|
|
88
|
+
var oldSavedResourcesManifestPath = assetsDir + '/' + CODE_PUSH_HASH_OLD_FILE_NAME;
|
|
89
|
+
if (fs.existsSync(oldSavedResourcesManifestPath)) {
|
|
90
|
+
fs.unlinkSync(oldSavedResourcesManifestPath);
|
|
91
|
+
}
|
|
92
92
|
});
|
|
93
|
+
});
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
function addFileToManifest(folder, assetFile, manifest, done) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
97
|
+
var fullFilePath = path.join(folder, assetFile);
|
|
98
|
+
if (!fileExists(fullFilePath)) {
|
|
99
|
+
done();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
var readStream = fs.createReadStream(path.join(folder, assetFile));
|
|
104
|
+
var hashStream = crypto.createHash(HASH_ALGORITHM);
|
|
105
|
+
|
|
106
|
+
readStream
|
|
107
|
+
.pipe(hashStream)
|
|
108
|
+
.on('error', function (error) {
|
|
109
|
+
throw error;
|
|
110
|
+
})
|
|
111
|
+
.on('finish', function () {
|
|
112
|
+
hashStream.end();
|
|
113
|
+
var buffer = hashStream.read();
|
|
114
|
+
var fileHash = buffer.toString('hex');
|
|
115
|
+
manifest.push(path.join(CODE_PUSH_FOLDER_PREFIX, assetFile).replace(/\\/g, '/') + ':' + fileHash);
|
|
116
|
+
done();
|
|
117
|
+
});
|
|
116
118
|
}
|
|
117
119
|
|
|
118
120
|
function fileExists(file) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
try {
|
|
122
|
+
return fs.statSync(file).isFile();
|
|
123
|
+
} catch {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
121
126
|
}
|
|
122
127
|
|
|
123
128
|
if (tempFileLocalPath) {
|
|
124
|
-
|
|
129
|
+
fs.unlinkSync(tempFileLocalPath);
|
|
125
130
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var fs = require(
|
|
2
|
-
var path = require(
|
|
1
|
+
var fs = require('fs');
|
|
2
|
+
var path = require('path');
|
|
3
3
|
|
|
4
4
|
// Utility function that collects the stats of every file in a directory
|
|
5
5
|
// as well as in its subdirectories.
|
|
6
6
|
function getFilesInFolder(folderName, fileList) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
var folderFiles = fs.readdirSync(folderName);
|
|
8
|
+
folderFiles.forEach(function (file) {
|
|
9
|
+
var fileStats = fs.statSync(path.join(folderName, file));
|
|
10
|
+
if (fileStats.isDirectory()) {
|
|
11
|
+
getFilesInFolder(path.join(folderName, file), fileList);
|
|
12
|
+
} else {
|
|
13
|
+
fileStats.path = path.join(folderName, file);
|
|
14
|
+
fileList.push(fileStats);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
module.exports = getFilesInFolder;
|
|
@@ -1,41 +1,40 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* This script creates a snapshot of the contents in the resource directory
|
|
3
3
|
* by creating a map with the modified time of all the files in the directory
|
|
4
|
-
* and saving it to a temp file. This snapshot is later referenced in
|
|
4
|
+
* and saving it to a temp file. This snapshot is later referenced in
|
|
5
5
|
* "generatePackageHash.js" to figure out which files have changed or were
|
|
6
6
|
* newly generated by the "react-native bundle" command.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
var fs = require(
|
|
10
|
-
var path = require(
|
|
11
|
-
|
|
12
|
-
var getFilesInFolder = require("./getFilesInFolder");
|
|
9
|
+
var fs = require('fs');
|
|
10
|
+
var path = require('path');
|
|
13
11
|
|
|
12
|
+
var getFilesInFolder = require('./getFilesInFolder');
|
|
14
13
|
|
|
15
14
|
var resourcesDir = process.argv[2];
|
|
16
15
|
var tempFileName = process.argv[3];
|
|
17
16
|
|
|
18
|
-
var tempFileLocalPath = path.join(require(
|
|
17
|
+
var tempFileLocalPath = path.join(require('os').tmpdir(), tempFileName);
|
|
19
18
|
var resourceFiles = [];
|
|
20
19
|
|
|
21
20
|
try {
|
|
22
|
-
|
|
23
|
-
} catch(error) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
getFilesInFolder(resourcesDir, resourceFiles);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
var targetPathNotFoundExceptionMessage = '\nResources directory path does not exist.\n';
|
|
24
|
+
targetPathNotFoundExceptionMessage += "Unable to find '" + resourcesDir;
|
|
25
|
+
targetPathNotFoundExceptionMessage += "' directory. Please check version of Android Plugin for Gradle.";
|
|
26
|
+
error.message += targetPathNotFoundExceptionMessage;
|
|
27
|
+
throw error;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
var fileToModifiedTimeMap = {};
|
|
32
31
|
|
|
33
|
-
resourceFiles.forEach(function(resourceFile) {
|
|
34
|
-
|
|
32
|
+
resourceFiles.forEach(function (resourceFile) {
|
|
33
|
+
fileToModifiedTimeMap[resourceFile.path.substring(resourcesDir.length)] = resourceFile.mtime.getTime();
|
|
35
34
|
});
|
|
36
35
|
|
|
37
|
-
fs.writeFile(tempFileLocalPath, JSON.stringify(fileToModifiedTimeMap), function(err) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
36
|
+
fs.writeFile(tempFileLocalPath, JSON.stringify(fileToModifiedTimeMap), function (err) {
|
|
37
|
+
if (err) {
|
|
38
|
+
throw err;
|
|
39
|
+
}
|
|
40
|
+
});
|
package/src/CodePush.tsx
CHANGED
|
@@ -2,6 +2,8 @@ import hoistStatics from 'hoist-non-react-statics';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { AppState } from 'react-native';
|
|
4
4
|
import { CheckFrequency } from './enums/CheckFrequency.enum';
|
|
5
|
+
import { LogLevel } from './enums/LogLevel.enum';
|
|
6
|
+
import { log } from './internals/utils/log';
|
|
5
7
|
import { notifyAppReady } from './notifyAppReady';
|
|
6
8
|
import { sync } from './sync';
|
|
7
9
|
import type {
|
|
@@ -14,25 +16,34 @@ import type {
|
|
|
14
16
|
export interface CodePushOptions extends SyncOptions {
|
|
15
17
|
/**
|
|
16
18
|
* Specifies when you would like to synchronize updates with the CodePush server.
|
|
17
|
-
*
|
|
19
|
+
*
|
|
20
|
+
* Defaults to CheckFrequency.ON_APP_START.
|
|
18
21
|
*/
|
|
19
22
|
checkFrequency?: CheckFrequency;
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
|
-
*
|
|
26
|
+
* Wraps a React component inside a "higher order" React component that knows how to synchronize your app's JavaScript bundle and image assets when it is mounted.
|
|
27
|
+
*
|
|
28
|
+
* Internally, the higher-order component calls `sync` inside its `componentDidMount` lifecycle handle, which in turns performs an update check, downloads the update if it exists and installs the update for you.
|
|
24
29
|
*
|
|
25
30
|
* @param component the React Component that will be decorated
|
|
26
31
|
*/
|
|
27
32
|
// @ts-ignore
|
|
28
|
-
export function withCodePush
|
|
33
|
+
export function withCodePush<P extends object | Record<string, unknown>>(
|
|
34
|
+
component: React.ComponentType<P>,
|
|
35
|
+
): React.ComponentType;
|
|
29
36
|
|
|
30
37
|
/**
|
|
31
|
-
*
|
|
38
|
+
* Wraps a React component inside a "higher order" React component that knows how to synchronize your app's JavaScript bundle and image assets when it is mounted.
|
|
39
|
+
*
|
|
40
|
+
* Internally, the higher-order component calls `sync` inside its `componentDidMount` lifecycle handle, which in turns performs an update check, downloads the update if it exists and installs the update for you.
|
|
32
41
|
*
|
|
33
42
|
* @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?).
|
|
34
43
|
*/
|
|
35
|
-
export function withCodePush
|
|
44
|
+
export function withCodePush<P extends object | Record<string, unknown>>(
|
|
45
|
+
options: CodePushOptions,
|
|
46
|
+
): (component: React.ComponentType<P>) => React.ComponentType;
|
|
36
47
|
|
|
37
48
|
export function withCodePush<P extends object>(optionsOrComponent: CodePushOptions | React.ComponentType<P>) {
|
|
38
49
|
const options: CodePushOptions = typeof optionsOrComponent === 'function' ? {} : optionsOrComponent;
|
|
@@ -47,6 +58,8 @@ export function withCodePush<P extends object>(optionsOrComponent: CodePushOptio
|
|
|
47
58
|
}
|
|
48
59
|
|
|
49
60
|
componentDidMount() {
|
|
61
|
+
log(LogLevel.DEBUG, `withCodePush ${JSON.stringify(options)}`);
|
|
62
|
+
|
|
50
63
|
if (options.checkFrequency === CheckFrequency.MANUAL) {
|
|
51
64
|
notifyAppReady();
|
|
52
65
|
} else {
|
|
@@ -68,11 +81,13 @@ export function withCodePush<P extends object>(optionsOrComponent: CodePushOptio
|
|
|
68
81
|
rootComponentInstance.codePushOnBinaryVersionMismatch.bind(rootComponentInstance);
|
|
69
82
|
}
|
|
70
83
|
|
|
84
|
+
log(LogLevel.DEBUG, `sync on mount`);
|
|
71
85
|
sync(options, syncStatusCallback, downloadProgressCallback, handleBinaryVersionMismatchCallback);
|
|
72
86
|
|
|
73
87
|
if (options.checkFrequency === CheckFrequency.ON_APP_RESUME) {
|
|
74
88
|
AppState.addEventListener('change', (newState: string) => {
|
|
75
89
|
if (newState === 'active') {
|
|
90
|
+
log(LogLevel.DEBUG, `sync on active appState`);
|
|
76
91
|
sync(options, syncStatusCallback, downloadProgressCallback);
|
|
77
92
|
}
|
|
78
93
|
});
|
package/src/allowRestart.ts
CHANGED
|
@@ -2,5 +2,9 @@ import { NativeRNAppZungCodePushModule } from './internals/NativeRNAppZungCodePu
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Allow CodePush to restart the app.
|
|
5
|
+
*
|
|
6
|
+
* This is an advanced API and is only necessary if your app explicitly disallowed restarts via the `disallowRestart` method.
|
|
5
7
|
*/
|
|
6
|
-
export
|
|
8
|
+
export function allowRestart() {
|
|
9
|
+
return NativeRNAppZungCodePushModule.allow();
|
|
10
|
+
}
|
package/src/checkForUpdates.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
|
+
import { LogLevel } from './enums/LogLevel.enum';
|
|
3
|
+
import { CodePushApiSdk } from './internals/CodePushApiSdk';
|
|
4
|
+
import type { ApiSdkQueryUpdatePackageInfo } from './internals/CodePushApiSdk.types';
|
|
2
5
|
import { NativeRNAppZungCodePushModule } from './internals/NativeRNAppZungCodePushModule';
|
|
3
6
|
import { RemotePackageImpl } from './internals/RemotePackageImplementation';
|
|
4
7
|
import { getConfiguration } from './internals/getConfiguration';
|
|
5
8
|
import { getCurrentPackage } from './internals/getCurrentPackage';
|
|
6
|
-
import { type PromisifiedSdkQueryPackage, getPromisifiedSdk } from './internals/getPromisifiedSdk';
|
|
7
9
|
import type { Configuration } from './internals/types';
|
|
8
10
|
import { log } from './internals/utils/log';
|
|
9
|
-
import { requestFetchAdapter } from './internals/utils/
|
|
11
|
+
import { requestFetchAdapter } from './internals/utils/requestFetchAdapter';
|
|
10
12
|
import type { HandleBinaryVersionMismatchCallback, RemotePackage } from './types';
|
|
11
13
|
|
|
12
14
|
/**
|
|
@@ -36,10 +38,8 @@ export async function checkForUpdate(
|
|
|
36
38
|
* dynamically "redirecting" end-users at different
|
|
37
39
|
* release channels (e.g. an early access release channel for insiders).
|
|
38
40
|
*/
|
|
39
|
-
const config: Configuration = releaseChannelPublicId
|
|
40
|
-
|
|
41
|
-
: nativeConfig;
|
|
42
|
-
const sdk = getPromisifiedSdk(requestFetchAdapter, config);
|
|
41
|
+
const config: Configuration = releaseChannelPublicId ? { ...nativeConfig, releaseChannelPublicId } : nativeConfig;
|
|
42
|
+
const sdk = new CodePushApiSdk(requestFetchAdapter, log, config);
|
|
43
43
|
|
|
44
44
|
const localPackage = await getCurrentPackage();
|
|
45
45
|
|
|
@@ -51,15 +51,10 @@ export async function checkForUpdate(
|
|
|
51
51
|
* to send the app version to the server, since we are interested
|
|
52
52
|
* in any updates for current binary version, regardless of hash.
|
|
53
53
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
queryPackage = { appVersion: config.appVersion };
|
|
59
|
-
if (Platform.OS === 'ios' && config.packageHash) {
|
|
60
|
-
queryPackage.packageHash = config.packageHash;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
54
|
+
const queryPackage: ApiSdkQueryUpdatePackageInfo = localPackage ?? {
|
|
55
|
+
appVersion: config.appVersion,
|
|
56
|
+
...(Platform.OS === 'ios' && config.packageHash ? { packageHash: config.packageHash } : {}),
|
|
57
|
+
};
|
|
63
58
|
|
|
64
59
|
const update = await sdk.queryUpdateWithCurrentPackage(queryPackage);
|
|
65
60
|
|
|
@@ -85,25 +80,32 @@ export async function checkForUpdate(
|
|
|
85
80
|
return null;
|
|
86
81
|
}
|
|
87
82
|
|
|
88
|
-
if ('updateAppVersion' in update
|
|
89
|
-
|
|
83
|
+
if ('updateAppVersion' in update) {
|
|
84
|
+
if (!update.updateAppVersion) {
|
|
85
|
+
throw new Error('updateAppVersion should never be false');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
log(LogLevel.INFO, 'An update is available but it is not targeting the binary version of your app.');
|
|
90
89
|
handleBinaryVersionMismatchCallback?.(update);
|
|
91
90
|
|
|
92
91
|
return null;
|
|
93
92
|
}
|
|
94
93
|
|
|
95
94
|
if (
|
|
96
|
-
(localPackage &&
|
|
95
|
+
(localPackage && update.packageHash === localPackage.packageHash) ||
|
|
97
96
|
((!localPackage || ('_isDebugOnly' in localPackage && localPackage._isDebugOnly)) &&
|
|
98
|
-
'packageHash' in update &&
|
|
99
97
|
config.packageHash === update.packageHash)
|
|
100
98
|
) {
|
|
101
99
|
return null;
|
|
102
100
|
}
|
|
103
101
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
102
|
+
const remotePackageData: Omit<RemotePackage, 'download'> = {
|
|
103
|
+
...update,
|
|
104
|
+
releaseChannelPublicId: releaseChannelPublicId || nativeConfig.releaseChannelPublicId,
|
|
105
|
+
failedInstall: await NativeRNAppZungCodePushModule.isFailedUpdate(update.packageHash),
|
|
106
|
+
isFirstRun: false,
|
|
107
|
+
isPending: false,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
return new RemotePackageImpl(remotePackageData, (packageInfo) => sdk.reportStatusDownload(packageInfo));
|
|
109
111
|
}
|
package/src/clearUpdates.ts
CHANGED
|
@@ -2,8 +2,11 @@ import { NativeRNAppZungCodePushModule } from './internals/NativeRNAppZungCodePu
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Clears all downloaded CodePush updates.
|
|
5
|
+
*
|
|
5
6
|
* This is useful when switching to a different release channel which may have an older release than the current package.
|
|
6
|
-
* Note: we don’t recommend
|
|
7
|
+
* Note: we don’t recommend using this method in scenarios other than that (CodePush will call
|
|
7
8
|
* this method automatically when needed in other cases) as it could lead to unpredictable behavior.
|
|
8
9
|
*/
|
|
9
|
-
export
|
|
10
|
+
export function clearUpdates() {
|
|
11
|
+
return NativeRNAppZungCodePushModule.clearUpdates();
|
|
12
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NativeRNAppZungCodePushModule } from './internals/NativeRNAppZungCodePushModule';
|
|
2
|
+
import { reloadCachedConfiguration } from './internals/getConfiguration';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Controls data transmission for CodePush. This may be used for privacy optIn.
|
|
6
|
+
*
|
|
7
|
+
* @param enabled - When false, disables all external API calls to CodePush servers. Checking for updates will be disabled.
|
|
8
|
+
*/
|
|
9
|
+
export async function setDataTransmissionEnabled(enabled: boolean): Promise<void> {
|
|
10
|
+
await NativeRNAppZungCodePushModule.setDataTransmissionEnabled(enabled);
|
|
11
|
+
await reloadCachedConfiguration();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Gets the current data transmission status.
|
|
16
|
+
*
|
|
17
|
+
* When setDataTransmissionEnabled has never been called, returns the default value set in your configuration.
|
|
18
|
+
*/
|
|
19
|
+
export function getDataTransmissionEnabled(): Promise<boolean> {
|
|
20
|
+
return NativeRNAppZungCodePushModule.getDataTransmissionEnabled();
|
|
21
|
+
}
|
package/src/disallowRestart.ts
CHANGED
|
@@ -2,5 +2,9 @@ import { NativeRNAppZungCodePushModule } from './internals/NativeRNAppZungCodePu
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Forbid CodePush to restart the app.
|
|
5
|
+
*
|
|
6
|
+
* 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.
|
|
5
7
|
*/
|
|
6
|
-
export
|
|
8
|
+
export function disallowRestart() {
|
|
9
|
+
return NativeRNAppZungCodePushModule.disallow();
|
|
10
|
+
}
|
|
@@ -8,12 +8,12 @@ export enum CheckFrequency {
|
|
|
8
8
|
ON_APP_START,
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* When the app re-enters the foreground.
|
|
11
|
+
* When the app re-enters the foreground after being "backgrounded" (user pressed the home button, app launches a separate payment process, etc.)
|
|
12
12
|
*/
|
|
13
13
|
ON_APP_RESUME,
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Don't automatically check for updates, but only do it when
|
|
16
|
+
* Don't automatically check for updates, but only do it when `sync()` is manually called in app code.
|
|
17
17
|
*/
|
|
18
18
|
MANUAL,
|
|
19
19
|
}
|