@algocare/react-native-code-push 12.6.4 → 13.0.0-rc.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 +6 -8
- package/README.md +343 -586
- package/android/app/build.gradle +2 -1
- package/android/app/proguard-rules.pro +14 -0
- package/android/app/src/debug/AndroidManifest.xml +9 -0
- package/android/app/src/main/AndroidManifest.xml +1 -2
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +14 -139
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +0 -3
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +108 -63
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +2 -33
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +13 -109
- package/android/build.gradle +3 -0
- package/app.plugin.js +1 -0
- package/bin/code-push.js +6 -0
- package/cli/commands/bundleCommand/bundleCodePush.ts +118 -0
- package/cli/commands/bundleCommand/index.ts +34 -0
- package/cli/commands/createHistoryCommand/createReleaseHistory.ts +37 -0
- package/cli/commands/createHistoryCommand/createReleaseHistoryList.ts +40 -0
- package/cli/commands/createHistoryCommand/index.ts +44 -0
- package/cli/commands/createPullRequestHistoryCommand/createPullRequestHistory.ts +33 -0
- package/cli/commands/createPullRequestHistoryCommand/index.ts +31 -0
- package/cli/commands/createPullRequestReleaseCommand/addToPullRequestRelease.ts +71 -0
- package/cli/commands/createPullRequestReleaseCommand/createPullRequestRelease.ts +75 -0
- package/cli/commands/createPullRequestReleaseCommand/index.ts +74 -0
- package/cli/commands/getPackageHashCommand/index.ts +45 -0
- package/cli/commands/initCommand/index.ts +14 -0
- package/cli/commands/initCommand/initAndroid.ts +91 -0
- package/cli/commands/initCommand/initIos.ts +123 -0
- package/cli/commands/initCommand/test/initAndroid.test.ts +128 -0
- package/cli/commands/initCommand/test/initIos.test.ts +99 -0
- package/cli/commands/releaseCommand/addToReleaseHistory.ts +57 -0
- package/cli/commands/releaseCommand/index.ts +90 -0
- package/cli/commands/releaseCommand/release.ts +105 -0
- package/cli/commands/removePullRequestHistoryCommand/index.ts +37 -0
- package/cli/commands/removePullRequestHistoryCommand/removePullRequestHistory.ts +28 -0
- package/cli/commands/showHistoryCommand/index.ts +31 -0
- package/cli/commands/updateHistoryCommand/index.ts +55 -0
- package/cli/commands/updateHistoryCommand/updateReleaseHistory.ts +42 -0
- package/cli/constant.ts +4 -0
- package/cli/dist/commands/bundleCommand/bundleCodePush.js +65 -0
- package/cli/dist/commands/bundleCommand/index.js +15 -0
- package/cli/dist/commands/createHistoryCommand/createReleaseHistory.js +25 -0
- package/cli/dist/commands/createHistoryCommand/createReleaseHistoryList.js +27 -0
- package/cli/dist/commands/createHistoryCommand/index.js +20 -0
- package/cli/dist/commands/createPullRequestHistoryCommand/createPullRequestHistory.js +23 -0
- package/cli/dist/commands/createPullRequestHistoryCommand/index.js +15 -0
- package/cli/dist/commands/createPullRequestReleaseCommand/addToPullRequestRelease.js +51 -0
- package/cli/dist/commands/createPullRequestReleaseCommand/createPullRequestRelease.js +39 -0
- package/cli/dist/commands/createPullRequestReleaseCommand/index.js +35 -0
- package/cli/dist/commands/getPackageHashCommand/index.js +26 -0
- package/cli/dist/commands/initCommand/index.js +12 -0
- package/cli/dist/commands/initCommand/initAndroid.js +73 -0
- package/cli/dist/commands/initCommand/initIos.js +108 -0
- package/cli/dist/commands/initCommand/test/initAndroid.test.js +113 -0
- package/cli/dist/commands/initCommand/test/initIos.test.js +95 -0
- package/cli/dist/commands/releaseCommand/addToReleaseHistory.js +35 -0
- package/cli/dist/commands/releaseCommand/index.js +45 -0
- package/cli/dist/commands/releaseCommand/release.js +62 -0
- package/cli/dist/commands/removePullRequestHistoryCommand/index.js +19 -0
- package/cli/dist/commands/removePullRequestHistoryCommand/removePullRequestHistory.js +18 -0
- package/cli/dist/commands/showHistoryCommand/index.js +15 -0
- package/cli/dist/commands/updateHistoryCommand/index.js +31 -0
- package/cli/dist/commands/updateHistoryCommand/updateReleaseHistory.js +28 -0
- package/cli/dist/constant.js +4 -0
- package/cli/dist/functions/getReactTempDir.js +10 -0
- package/cli/{functions → dist/functions}/makeCodePushBundle.js +5 -11
- package/cli/{functions → dist/functions}/prepareToBundleJS.js +2 -5
- package/cli/dist/functions/runExpoBundleCommand.js +35 -0
- package/cli/{functions → dist/functions}/runHermesEmitBinaryCommand.js +36 -71
- package/cli/{functions → dist/functions}/runReactNativeBundleCommand.js +19 -24
- package/cli/dist/index.js +54 -0
- package/cli/dist/utils/datetime.js +17 -0
- package/cli/dist/utils/file-utils.js +19 -0
- package/cli/dist/utils/fsUtils.js +44 -0
- package/cli/{utils → dist/utils}/hash-utils.js +19 -130
- package/cli/{utils → dist/utils}/promisfied-fs.js +5 -16
- package/cli/dist/utils/showLogo.js +21 -0
- package/cli/dist/utils/unzip.js +41 -0
- package/cli/{utils → dist/utils}/zip.js +15 -51
- package/cli/functions/{getReactTempDir.js → getReactTempDir.ts} +2 -6
- package/cli/functions/makeCodePushBundle.ts +26 -0
- package/cli/functions/prepareToBundleJS.ts +10 -0
- package/cli/functions/runExpoBundleCommand.ts +45 -0
- package/cli/functions/runHermesEmitBinaryCommand.ts +203 -0
- package/cli/functions/runReactNativeBundleCommand.ts +67 -0
- package/cli/index.ts +68 -0
- package/cli/package.json +35 -0
- package/cli/utils/datetime.ts +19 -0
- package/cli/utils/{file-utils.js → file-utils.ts} +4 -21
- package/cli/utils/fsUtils.ts +50 -0
- package/cli/utils/hash-utils.ts +143 -0
- package/cli/utils/promisfied-fs.ts +19 -0
- package/cli/utils/{showLogo.js → showLogo.ts} +4 -6
- package/cli/utils/unzip.ts +46 -0
- package/cli/utils/zip.ts +65 -0
- package/expo/plugin/withCodePush.js +14 -0
- package/expo/plugin/withCodePushAndroid.js +92 -0
- package/expo/plugin/withCodePushIos.js +143 -0
- package/ios/CodePush/CodePush.h +0 -16
- package/ios/CodePush/CodePush.m +30 -20
- package/ios/CodePush/CodePushConfig.m +1 -11
- package/ios/CodePush/CodePushPackage.m +12 -69
- package/ios/CodePush/CodePushUpdateUtils.m +1 -91
- package/ios/CodePush/SSZipArchive/Info.plist +26 -0
- package/ios/CodePush/SSZipArchive/README.md +1 -1
- package/ios/CodePush/SSZipArchive/SSZipArchive.h +129 -27
- package/ios/CodePush/SSZipArchive/SSZipArchive.m +1119 -314
- package/ios/CodePush/SSZipArchive/SSZipCommon.h +71 -0
- package/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy +23 -0
- package/ios/CodePush/SSZipArchive/include/ZipArchive.h +25 -0
- package/ios/CodePush/SSZipArchive/minizip/LICENSE +17 -0
- package/ios/CodePush/SSZipArchive/minizip/mz.h +273 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_compat.c +1306 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_compat.h +346 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_crypt.c +187 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_crypt.h +65 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c +526 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_os.c +348 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_os.h +176 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c +350 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm.c +556 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm.h +132 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c +383 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h +42 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c +269 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h +48 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h +40 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c +203 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c +334 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h +46 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c +429 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h +43 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c +360 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h +46 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c +389 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h +43 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_zip.c +2782 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_zip.h +262 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c +1942 -0
- package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h +285 -0
- package/ios/CodePush.xcodeproj/project.pbxproj +244 -453
- package/ios/PrivacyInfo.xcprivacy +31 -0
- package/package.json +68 -42
- package/react-native.config.js +1 -1
- package/{AlertAdapter.js → src/AlertAdapter.js} +5 -5
- package/src/CodePush.js +947 -0
- package/{package-mixins.js → src/package-mixins.js} +1 -1
- package/{versioning → src/versioning}/BaseVersioning.js +12 -1
- package/{versioning → src/versioning}/SemverVersioning.test.js +78 -0
- package/typings/react-native-code-push.d.ts +559 -495
- package/.claude/commands/release.md +0 -78
- package/.claude/skills/npm-release/SKILL.md +0 -89
- package/CLAUDE.md +0 -83
- package/CONTRIBUTING.md +0 -134
- package/CodePush.js +0 -972
- package/SECURITY.md +0 -41
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +0 -37
- package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +0 -12
- package/android/app/src/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java +0 -17
- package/android/codepush.gradle +0 -162
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
- package/android/gradlew +0 -164
- package/android/gradlew.bat +0 -90
- package/babel.config.js +0 -3
- package/cli/commands/bundleCommand/bundleCodePush.js +0 -57
- package/cli/commands/bundleCommand/index.js +0 -55
- package/cli/commands/common.js +0 -245
- package/cli/commands/createHistoryCommand/createReleaseHistory.js +0 -42
- package/cli/commands/createHistoryCommand/createReleaseHistoryList.js +0 -52
- package/cli/commands/createHistoryCommand/index.js +0 -95
- package/cli/commands/createPullRequestHistoryCommand/createPullRequestHistory.js +0 -34
- package/cli/commands/createPullRequestHistoryCommand/index.js +0 -29
- package/cli/commands/createPullRequestReleaseCommand/addToPullRequestRelease.js +0 -74
- package/cli/commands/createPullRequestReleaseCommand/createPullRequestRelease.js +0 -91
- package/cli/commands/createPullRequestReleaseCommand/index.js +0 -68
- package/cli/commands/getPackageHashCommand/index.js +0 -42
- package/cli/commands/releaseCommand/addToReleaseHistory.js +0 -85
- package/cli/commands/releaseCommand/index.js +0 -151
- package/cli/commands/releaseCommand/release.js +0 -121
- package/cli/commands/removePullRequestHistoryCommand/index.js +0 -28
- package/cli/commands/removePullRequestHistoryCommand/removePullRequestHistory.js +0 -23
- package/cli/commands/showHistoryCommand/index.js +0 -88
- package/cli/commands/updateHistoryCommand/index.js +0 -123
- package/cli/commands/updateHistoryCommand/updateReleaseHistory.js +0 -69
- package/cli/constant.js +0 -8
- package/cli/index.js +0 -63
- package/cli/utils/datetime.js +0 -22
- package/cli/utils/fsUtils.js +0 -64
- package/cli/utils/version.js +0 -26
- package/code-push.config.example.supabase.ts +0 -114
- package/code-push.config.js +0 -229
- package/code-push.config.ts +0 -175
- package/docs/api-android.md +0 -83
- package/docs/api-ios.md +0 -31
- package/docs/api-js.md +0 -592
- package/docs/multi-deployment-testing-android.md +0 -148
- package/docs/multi-deployment-testing-ios.md +0 -59
- package/docs/setup-android.md +0 -482
- package/docs/setup-ios.md +0 -280
- package/eslint.config.mjs +0 -32
- package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +0 -34
- package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +0 -252
- package/ios/CodePush/Base64/README.md +0 -47
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +0 -69
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +0 -16
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +0 -51
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +0 -15
- package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +0 -55
- package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +0 -24
- package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +0 -41
- package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +0 -28
- package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +0 -205
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +0 -103
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +0 -322
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +0 -37
- package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +0 -145
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +0 -35
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +0 -551
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +0 -23
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +0 -43
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +0 -230
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +0 -31
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +0 -113
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +0 -38
- package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +0 -500
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +0 -18
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +0 -214
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +0 -23
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +0 -29
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +0 -19
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +0 -68
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +0 -18
- package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +0 -72
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +0 -67
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +0 -111
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +0 -119
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +0 -307
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +0 -94
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +0 -619
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +0 -164
- package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +0 -514
- package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +0 -24
- package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +0 -11
- package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +0 -52
- package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +0 -5
- package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +0 -28
- package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +0 -70
- package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +0 -22
- package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +0 -34
- package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +0 -73
- package/ios/CodePush/JWT/LICENSE +0 -19
- package/ios/CodePush/JWT/README.md +0 -489
- package/ios/CodePush/SSZipArchive/Common.h +0 -81
- package/ios/CodePush/SSZipArchive/aes/aes.h +0 -198
- package/ios/CodePush/SSZipArchive/aes/aes_via_ace.h +0 -541
- package/ios/CodePush/SSZipArchive/aes/aescrypt.c +0 -294
- package/ios/CodePush/SSZipArchive/aes/aeskey.c +0 -548
- package/ios/CodePush/SSZipArchive/aes/aesopt.h +0 -739
- package/ios/CodePush/SSZipArchive/aes/aestab.c +0 -391
- package/ios/CodePush/SSZipArchive/aes/aestab.h +0 -173
- package/ios/CodePush/SSZipArchive/aes/brg_endian.h +0 -126
- package/ios/CodePush/SSZipArchive/aes/brg_types.h +0 -219
- package/ios/CodePush/SSZipArchive/aes/entropy.c +0 -54
- package/ios/CodePush/SSZipArchive/aes/entropy.h +0 -16
- package/ios/CodePush/SSZipArchive/aes/fileenc.c +0 -144
- package/ios/CodePush/SSZipArchive/aes/fileenc.h +0 -121
- package/ios/CodePush/SSZipArchive/aes/hmac.c +0 -145
- package/ios/CodePush/SSZipArchive/aes/hmac.h +0 -103
- package/ios/CodePush/SSZipArchive/aes/prng.c +0 -155
- package/ios/CodePush/SSZipArchive/aes/prng.h +0 -82
- package/ios/CodePush/SSZipArchive/aes/pwd2key.c +0 -103
- package/ios/CodePush/SSZipArchive/aes/pwd2key.h +0 -57
- package/ios/CodePush/SSZipArchive/aes/sha1.c +0 -258
- package/ios/CodePush/SSZipArchive/aes/sha1.h +0 -73
- package/ios/CodePush/SSZipArchive/minizip/crypt.h +0 -130
- package/ios/CodePush/SSZipArchive/minizip/ioapi.c +0 -369
- package/ios/CodePush/SSZipArchive/minizip/ioapi.h +0 -175
- package/ios/CodePush/SSZipArchive/minizip/mztools.c +0 -284
- package/ios/CodePush/SSZipArchive/minizip/mztools.h +0 -31
- package/ios/CodePush/SSZipArchive/minizip/unzip.c +0 -1839
- package/ios/CodePush/SSZipArchive/minizip/unzip.h +0 -248
- package/ios/CodePush/SSZipArchive/minizip/zip.c +0 -1910
- package/ios/CodePush/SSZipArchive/minizip/zip.h +0 -202
- package/scripts/generateBundledResourcesHash.js +0 -125
- package/scripts/getFilesInFolder.js +0 -19
- package/scripts/recordFilesBeforeBundleCommand.js +0 -41
- package/scripts/release.sh +0 -86
- package/tsconfig.json +0 -20
- package/tslint.json +0 -32
- /package/{logging.js → src/logging.js} +0 -0
- /package/{versioning → src/versioning}/BaseVersioning.test.js +0 -0
- /package/{versioning → src/versioning}/IncrementalVersioning.js +0 -0
- /package/{versioning → src/versioning}/IncrementalVersioning.test.js +0 -0
- /package/{versioning → src/versioning}/SemverVersioning.js +0 -0
- /package/{versioning → src/versioning}/index.js +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import yauzl from "yauzl";
|
|
4
|
+
|
|
5
|
+
export function unzip(zipPath: string, outputDir: string): Promise<void> {
|
|
6
|
+
return new Promise<void>((resolve, reject) => {
|
|
7
|
+
yauzl.open(zipPath, { lazyEntries: true }, (err, zipFile) => {
|
|
8
|
+
if (err) return reject(err);
|
|
9
|
+
|
|
10
|
+
zipFile.readEntry();
|
|
11
|
+
|
|
12
|
+
zipFile.on("entry", (entry) => {
|
|
13
|
+
const fullPath = path.join(outputDir, entry.fileName);
|
|
14
|
+
|
|
15
|
+
// Handle directory entry
|
|
16
|
+
if (/\/$/.test(entry.fileName)) {
|
|
17
|
+
fs.mkdir(fullPath, { recursive: true }, (err) => {
|
|
18
|
+
if (err) return reject(err);
|
|
19
|
+
zipFile.readEntry();
|
|
20
|
+
});
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Handle file entry
|
|
25
|
+
zipFile.openReadStream(entry, (err, readStream) => {
|
|
26
|
+
if (err) return reject(err);
|
|
27
|
+
|
|
28
|
+
fs.mkdir(path.dirname(fullPath), { recursive: true }, (err) => {
|
|
29
|
+
if (err) return reject(err);
|
|
30
|
+
|
|
31
|
+
const writeStream = fs.createWriteStream(fullPath);
|
|
32
|
+
readStream.pipe(writeStream);
|
|
33
|
+
|
|
34
|
+
// Continue to the next entry after writing
|
|
35
|
+
writeStream.on("close", () => {
|
|
36
|
+
zipFile.readEntry();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
zipFile.on("end", resolve);
|
|
43
|
+
zipFile.on("error", reject);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
package/cli/utils/zip.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* code based on appcenter-cli
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import yazl from "yazl";
|
|
8
|
+
import { generateRandomFilename, normalizePath, isDirectory } from "./file-utils.js";
|
|
9
|
+
import { walk } from "./promisfied-fs.js";
|
|
10
|
+
|
|
11
|
+
type ReleaseFile = { sourceLocation: string, targetLocation: string };
|
|
12
|
+
|
|
13
|
+
export function zip(updateContentsPath: string): Promise<string> {
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
16
|
+
return new Promise(async (resolve, reject) => {
|
|
17
|
+
const releaseFiles: ReleaseFile[] = [];
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
if (!isDirectory(updateContentsPath)) {
|
|
21
|
+
releaseFiles.push({
|
|
22
|
+
sourceLocation: updateContentsPath,
|
|
23
|
+
targetLocation: normalizePath(path.basename(updateContentsPath)), // Put the file in the root
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
} catch (error: unknown) {
|
|
27
|
+
if (error instanceof Error) {
|
|
28
|
+
error.message = error.message + " Make sure you have added the platform you are making a release to.`.";
|
|
29
|
+
}
|
|
30
|
+
reject(error);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const directoryPath = updateContentsPath;
|
|
34
|
+
const baseDirectoryPath = path.join(directoryPath, '..'); // For legacy reasons, put the root directory in the zip
|
|
35
|
+
|
|
36
|
+
const files: string[] = await walk(updateContentsPath);
|
|
37
|
+
|
|
38
|
+
files.forEach((filePath) => {
|
|
39
|
+
const relativePath = path.relative(baseDirectoryPath, filePath);
|
|
40
|
+
releaseFiles.push({
|
|
41
|
+
sourceLocation: filePath,
|
|
42
|
+
targetLocation: normalizePath(relativePath),
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const packagePath = path.join(process.cwd(), generateRandomFilename(15) + '.zip');
|
|
47
|
+
const zipFile = new yazl.ZipFile();
|
|
48
|
+
const writeStream = fs.createWriteStream(packagePath);
|
|
49
|
+
|
|
50
|
+
zipFile.outputStream
|
|
51
|
+
.pipe(writeStream)
|
|
52
|
+
.on('error', (error: unknown) => {
|
|
53
|
+
reject(error);
|
|
54
|
+
})
|
|
55
|
+
.on('close', () => {
|
|
56
|
+
resolve(packagePath);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
releaseFiles.forEach((releaseFile) => {
|
|
60
|
+
zipFile.addFile(releaseFile.sourceLocation, releaseFile.targetLocation);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
zipFile.end();
|
|
64
|
+
});
|
|
65
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const { createRunOncePlugin } = require('expo/config-plugins');
|
|
2
|
+
const { withAndroidMainApplicationDependency } = require('./withCodePushAndroid');
|
|
3
|
+
const { withIosBridgingHeader, withIosAppDelegateDependency } = require('./withCodePushIos');
|
|
4
|
+
const pkg = require('../../package.json');
|
|
5
|
+
|
|
6
|
+
const withCodePush = (config) => {
|
|
7
|
+
config = withAndroidMainApplicationDependency(config);
|
|
8
|
+
config = withIosBridgingHeader(config);
|
|
9
|
+
config = withIosAppDelegateDependency(config);
|
|
10
|
+
|
|
11
|
+
return config;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
module.exports = createRunOncePlugin(withCodePush, pkg.name, pkg.version);
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const { withMainApplication, WarningAggregator } = require('expo/config-plugins');
|
|
2
|
+
|
|
3
|
+
const IMPORT_CODE_PUSH = 'import com.microsoft.codepush.react.CodePush';
|
|
4
|
+
const RN_082_MARKER = 'ExpoReactHostFactory.getDefaultReactHost(';
|
|
5
|
+
const JS_BUNDLE_FILE_PATH_ARGUMENT = 'jsBundleFilePath = CodePush.getJSBundleFile()';
|
|
6
|
+
|
|
7
|
+
function androidMainApplicationApplyImplementation(mainApplication, find, add, reverse = false) {
|
|
8
|
+
if (mainApplication.includes(add)) {
|
|
9
|
+
return mainApplication;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (mainApplication.includes(find)) {
|
|
13
|
+
return mainApplication.replace(find, reverse ? `${add}\n${find}` : `${find}\n${add}`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
WarningAggregator.addWarningAndroid(
|
|
17
|
+
'withCodePushAndroid',
|
|
18
|
+
`
|
|
19
|
+
Failed to detect "${find.replace(/\n/g, '').trim()}" in the MainApplication.kt.
|
|
20
|
+
Please add "${add.replace(/\n/g, '').trim()}" to the MainApplication.kt.
|
|
21
|
+
Supported format: Expo SDK default template.
|
|
22
|
+
|
|
23
|
+
Android manual setup: https://github.com/Soomgo-Mobile/react-native-code-push#2-1-manual-setup
|
|
24
|
+
`,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return mainApplication;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function addJsBundleFilePathArgument(mainApplication) {
|
|
31
|
+
// Capture packageList block plus optional existing jsBundleFilePath line.
|
|
32
|
+
// This allows us to normalize comma placement before injecting the new argument.
|
|
33
|
+
const packageListArgumentPattern = /(packageList\s*=\s*\n\s*PackageList\(this\)[\s\S]+?\},?\s*\n)(\s*jsBundleFilePath\s*=\s*CodePush\.getJSBundleFile\(\),\s*\n)?/;
|
|
34
|
+
|
|
35
|
+
if (!packageListArgumentPattern.test(mainApplication)) {
|
|
36
|
+
WarningAggregator.addWarningAndroid(
|
|
37
|
+
'withCodePushAndroid',
|
|
38
|
+
`
|
|
39
|
+
Failed to detect "packageList = PackageList(this)" block in MainApplication.kt.
|
|
40
|
+
Please add "jsBundleFilePath = CodePush.getJSBundleFile()" inside getDefaultReactHost arguments.
|
|
41
|
+
|
|
42
|
+
Android manual setup: https://github.com/Soomgo-Mobile/react-native-code-push#2-1-manual-setup
|
|
43
|
+
`,
|
|
44
|
+
);
|
|
45
|
+
return mainApplication;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return mainApplication.replace(packageListArgumentPattern, (match, packageListArgument, existingJsBundleArgument) => {
|
|
49
|
+
const trimmedMatch = packageListArgument.replace(/\s+$/, '');
|
|
50
|
+
// Kotlin call args need a trailing comma before the next named argument.
|
|
51
|
+
const hasTrailingComma = /,\s*$/.test(trimmedMatch);
|
|
52
|
+
const packageListArgumentWithComma = hasTrailingComma ? trimmedMatch : `${trimmedMatch},`;
|
|
53
|
+
const jsBundleArgument = existingJsBundleArgument
|
|
54
|
+
? existingJsBundleArgument.replace(/\s+$/, '')
|
|
55
|
+
: ` ${JS_BUNDLE_FILE_PATH_ARGUMENT},`;
|
|
56
|
+
return `${packageListArgumentWithComma}\n${jsBundleArgument}\n`;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const withAndroidMainApplicationDependency = (config) => {
|
|
61
|
+
return withMainApplication(config, (action) => {
|
|
62
|
+
action.modResults.contents = androidMainApplicationApplyImplementation(
|
|
63
|
+
action.modResults.contents,
|
|
64
|
+
'import com.facebook.react.ReactApplication',
|
|
65
|
+
IMPORT_CODE_PUSH,
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
if (action.modResults.contents.includes(RN_082_MARKER)) {
|
|
69
|
+
action.modResults.contents = addJsBundleFilePathArgument(action.modResults.contents);
|
|
70
|
+
} else if (!action.modResults.contents.includes('CodePush.getJSBundleFile()')) {
|
|
71
|
+
// https://github.com/Soomgo-Mobile/react-native-code-push/issues/97
|
|
72
|
+
const isExpoSDK54 = config.sdkVersion?.startsWith('54.') ?? false;
|
|
73
|
+
const addingCode = isExpoSDK54
|
|
74
|
+
? ' override fun getJSBundleFile(): String {\n' +
|
|
75
|
+
' CodePush.getInstance(applicationContext, BuildConfig.DEBUG)\n' +
|
|
76
|
+
' return CodePush.getJSBundleFile()\n' +
|
|
77
|
+
' }\n'
|
|
78
|
+
: ' override fun getJSBundleFile(): String = CodePush.getJSBundleFile()\n';
|
|
79
|
+
action.modResults.contents = androidMainApplicationApplyImplementation(
|
|
80
|
+
action.modResults.contents,
|
|
81
|
+
'object : DefaultReactNativeHost(this) {',
|
|
82
|
+
addingCode,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return action;
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
module.exports = {
|
|
91
|
+
withAndroidMainApplicationDependency,
|
|
92
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
const { withAppDelegate, withXcodeProject, WarningAggregator } = require('expo/config-plugins');
|
|
2
|
+
const { getAppDelegate } = require('@expo/config-plugins/build/ios/Paths');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
|
|
6
|
+
function iosApplyImplementation(
|
|
7
|
+
appDelegate,
|
|
8
|
+
find,
|
|
9
|
+
add,
|
|
10
|
+
replace,
|
|
11
|
+
) {
|
|
12
|
+
if (appDelegate.includes(add)) {
|
|
13
|
+
return appDelegate;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (appDelegate.includes(find)) {
|
|
17
|
+
return appDelegate.replace(find, replace ? add : `${find}\n${add}`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
WarningAggregator.addWarningIOS(
|
|
21
|
+
'withCodePushIos',
|
|
22
|
+
`
|
|
23
|
+
Failed to detect "${find.replace(/\n/g, '').trim()}" in the AppDelegate.(m|swift).
|
|
24
|
+
Please ${replace ? 'replace' : 'add'} "${add.replace(/\n/g, '').trim()}" to the AppDelegate.(m|swift).
|
|
25
|
+
Supported format: Expo SDK default template.
|
|
26
|
+
|
|
27
|
+
iOS manual setup: https://github.com/Soomgo-Mobile/react-native-code-push#2-1-manual-setup
|
|
28
|
+
`,
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
return appDelegate;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function getBridgingHeaderFileFromXcode(project) {
|
|
35
|
+
const buildConfigs = project.pbxXCBuildConfigurationSection();
|
|
36
|
+
|
|
37
|
+
for (const key in buildConfigs) {
|
|
38
|
+
const config = buildConfigs[key];
|
|
39
|
+
if (
|
|
40
|
+
typeof config === 'object' &&
|
|
41
|
+
config.buildSettings &&
|
|
42
|
+
config.buildSettings['SWIFT_OBJC_BRIDGING_HEADER']
|
|
43
|
+
) {
|
|
44
|
+
const bridgingHeaderFile = config.buildSettings[
|
|
45
|
+
'SWIFT_OBJC_BRIDGING_HEADER'
|
|
46
|
+
].replace(/"/g, '');
|
|
47
|
+
|
|
48
|
+
return bridgingHeaderFile;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const withIosAppDelegateDependency = (config) => {
|
|
55
|
+
return withAppDelegate(config, (action) => {
|
|
56
|
+
const language = action.modResults.language;
|
|
57
|
+
|
|
58
|
+
if (['objc', 'objcpp'].includes(language)) {
|
|
59
|
+
action.modResults.contents = iosApplyImplementation(
|
|
60
|
+
action.modResults.contents,
|
|
61
|
+
`#import "AppDelegate.h"`,
|
|
62
|
+
`#import <CodePush/CodePush.h>`,
|
|
63
|
+
);
|
|
64
|
+
action.modResults.contents = iosApplyImplementation(
|
|
65
|
+
action.modResults.contents,
|
|
66
|
+
`return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];`,
|
|
67
|
+
`return [CodePush bundleURL];`,
|
|
68
|
+
true,
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
return action;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (language === 'swift') {
|
|
75
|
+
action.modResults.contents = iosApplyImplementation(
|
|
76
|
+
action.modResults.contents,
|
|
77
|
+
`return Bundle.main.url(forResource: "main", withExtension: "jsbundle")`,
|
|
78
|
+
`return CodePush.bundleURL()`,
|
|
79
|
+
true,
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
return action;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
WarningAggregator.addWarningIOS(
|
|
86
|
+
'withIosAppDelegate',
|
|
87
|
+
`${language} AppDelegate file is not supported yet.`,
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
return action;
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const withIosBridgingHeader = (config) => {
|
|
95
|
+
return withXcodeProject(config, (action) => {
|
|
96
|
+
const projectRoot = action.modRequest.projectRoot;
|
|
97
|
+
const appDelegate = getAppDelegate(projectRoot);
|
|
98
|
+
|
|
99
|
+
if (appDelegate.language === 'swift') {
|
|
100
|
+
const bridgingHeaderFile = getBridgingHeaderFileFromXcode(
|
|
101
|
+
action.modResults,
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const bridgingHeaderPath = path.join(
|
|
105
|
+
action.modRequest.platformProjectRoot,
|
|
106
|
+
bridgingHeaderFile,
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
if (fs.existsSync(bridgingHeaderPath)) {
|
|
110
|
+
let content = fs.readFileSync(bridgingHeaderPath, 'utf8');
|
|
111
|
+
const codePushImport = '#import <CodePush/CodePush.h>';
|
|
112
|
+
|
|
113
|
+
if (!content.includes(codePushImport)) {
|
|
114
|
+
content += `${codePushImport}\n`;
|
|
115
|
+
fs.writeFileSync(bridgingHeaderPath, content);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return action;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
WarningAggregator.addWarningIOS(
|
|
122
|
+
'withIosBridgingHeader',
|
|
123
|
+
`
|
|
124
|
+
Failed to detect ${bridgingHeaderPath} file.
|
|
125
|
+
Please add CodePush integration manually:
|
|
126
|
+
#import <CodePush/CodePush.h>
|
|
127
|
+
|
|
128
|
+
Supported format: Expo SDK default template.
|
|
129
|
+
iOS manual setup: https://github.com/Soomgo-Mobile/react-native-code-push#2-1-manual-setup
|
|
130
|
+
`
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
return action;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return action;
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
module.exports = {
|
|
141
|
+
withIosAppDelegateDependency,
|
|
142
|
+
withIosBridgingHeader,
|
|
143
|
+
};
|
package/ios/CodePush/CodePush.h
CHANGED
|
@@ -102,7 +102,6 @@
|
|
|
102
102
|
@property (readonly) NSDictionary *configuration;
|
|
103
103
|
@property (copy) NSString *deploymentKey;
|
|
104
104
|
@property (copy) NSString *serverURL;
|
|
105
|
-
@property (copy) NSString *publicKey;
|
|
106
105
|
|
|
107
106
|
+ (instancetype)current;
|
|
108
107
|
|
|
@@ -140,7 +139,6 @@ failCallback:(void (^)(NSError *err))failCallback;
|
|
|
140
139
|
|
|
141
140
|
+ (void)downloadPackage:(NSDictionary *)updatePackage
|
|
142
141
|
expectedBundleFileName:(NSString *)expectedBundleFileName
|
|
143
|
-
publicKey:(NSString *)publicKey
|
|
144
142
|
operationQueue:(dispatch_queue_t)operationQueue
|
|
145
143
|
progressCallback:(void (^)(long long, long long))progressCallback
|
|
146
144
|
doneCallback:(void (^)())doneCallback
|
|
@@ -205,20 +203,6 @@ downloadCompleteCallback:(void (^)())downloadCompleteCallback;
|
|
|
205
203
|
expectedHash:(NSString *)expectedHash
|
|
206
204
|
error:(NSError **)error;
|
|
207
205
|
|
|
208
|
-
// remove BEGIN / END tags and line breaks from public key string
|
|
209
|
-
+ (NSString *)getKeyValueFromPublicKeyString:(NSString *)publicKeyString;
|
|
210
|
-
|
|
211
|
-
+ (NSString *)getSignatureFilePath:(NSString *)updateFolderPath;
|
|
212
|
-
|
|
213
|
-
+ (NSDictionary *) verifyAndDecodeJWT:(NSString *) jwt
|
|
214
|
-
withPublicKey:(NSString *)publicKey
|
|
215
|
-
error:(NSError **)error;
|
|
216
|
-
|
|
217
|
-
+ (BOOL)verifyUpdateSignatureFor:(NSString *)updateFolderPath
|
|
218
|
-
expectedHash:(NSString *)newUpdateHash
|
|
219
|
-
withPublicKey:(NSString *)publicKeyString
|
|
220
|
-
error:(NSError **)error;
|
|
221
|
-
|
|
222
206
|
@end
|
|
223
207
|
|
|
224
208
|
void CPLog(NSString *formatString, ...);
|
package/ios/CodePush/CodePush.m
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
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>
|
|
5
4
|
#import <React/RCTEventDispatcher.h>
|
|
6
5
|
#import <React/RCTRootView.h>
|
|
7
6
|
#import <React/RCTUtils.h>
|
|
8
|
-
#
|
|
9
|
-
#import "RCTAssert.h"
|
|
10
|
-
#import "RCTBridgeModule.h"
|
|
11
|
-
#import "RCTConvert.h"
|
|
12
|
-
#import "RCTEventDispatcher.h"
|
|
13
|
-
#import "RCTRootView.h"
|
|
14
|
-
#import "RCTUtils.h"
|
|
15
|
-
#endif
|
|
7
|
+
#import <React/RCTReloadCommand.h>
|
|
16
8
|
|
|
17
9
|
#import "CodePush.h"
|
|
18
10
|
|
|
@@ -31,7 +23,8 @@
|
|
|
31
23
|
long long _latestExpectedContentLength;
|
|
32
24
|
long long _latestReceivedConentLength;
|
|
33
25
|
BOOL _didUpdateProgress;
|
|
34
|
-
|
|
26
|
+
NSTimeInterval _lastProgressEventTime;
|
|
27
|
+
|
|
35
28
|
BOOL _allowed;
|
|
36
29
|
BOOL _restartInProgress;
|
|
37
30
|
NSMutableArray *_restartQueue;
|
|
@@ -218,7 +211,7 @@ static NSString *const LatestRollbackCountKey = @"count";
|
|
|
218
211
|
|
|
219
212
|
+ (void)setDeploymentKey:(NSString *)deploymentKey
|
|
220
213
|
{
|
|
221
|
-
[CodePushConfig current].deploymentKey =
|
|
214
|
+
[CodePushConfig current].deploymentKey = @"deprecated_deployment_key";
|
|
222
215
|
}
|
|
223
216
|
|
|
224
217
|
/*
|
|
@@ -337,6 +330,18 @@ static NSString *const LatestRollbackCountKey = @"count";
|
|
|
337
330
|
}];
|
|
338
331
|
}
|
|
339
332
|
|
|
333
|
+
- (void)dispatchThrottledDownloadProgressEventWithForce:(BOOL)force
|
|
334
|
+
{
|
|
335
|
+
static const NSTimeInterval interval = 0.05; // 50 ms throttle
|
|
336
|
+
NSTimeInterval now = CFAbsoluteTimeGetCurrent();
|
|
337
|
+
if (!force && _lastProgressEventTime > 0 && (now - _lastProgressEventTime) < interval) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
_lastProgressEventTime = now;
|
|
342
|
+
[self dispatchDownloadProgressEvent];
|
|
343
|
+
}
|
|
344
|
+
|
|
340
345
|
/*
|
|
341
346
|
* This method ensures that the app was packaged with a JS bundle
|
|
342
347
|
* file, and if not, it throws the appropriate exception.
|
|
@@ -378,7 +383,8 @@ static NSString *const LatestRollbackCountKey = @"count";
|
|
|
378
383
|
_allowed = YES;
|
|
379
384
|
_restartInProgress = NO;
|
|
380
385
|
_restartQueue = [NSMutableArray arrayWithCapacity:1];
|
|
381
|
-
|
|
386
|
+
_lastProgressEventTime = 0;
|
|
387
|
+
|
|
382
388
|
self = [super init];
|
|
383
389
|
if (self) {
|
|
384
390
|
[self initializeUpdateAfterRestart];
|
|
@@ -542,7 +548,7 @@ static NSString *const LatestRollbackCountKey = @"count";
|
|
|
542
548
|
[super.bridge setValue:[CodePush bundleURL] forKey:@"bundleURL"];
|
|
543
549
|
}
|
|
544
550
|
|
|
545
|
-
|
|
551
|
+
RCTTriggerReloadCommandListeners(@"CodePush reload");
|
|
546
552
|
});
|
|
547
553
|
}
|
|
548
554
|
|
|
@@ -584,7 +590,7 @@ static NSString *const LatestRollbackCountKey = @"count";
|
|
|
584
590
|
if ([[self class] isFailedHash:[failedPackage objectForKey:PackageHashKey]]) {
|
|
585
591
|
return;
|
|
586
592
|
}
|
|
587
|
-
|
|
593
|
+
|
|
588
594
|
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
|
|
589
595
|
NSMutableArray *failedUpdates = [preferences objectForKey:FailedUpdatesKey];
|
|
590
596
|
if (failedUpdates == nil) {
|
|
@@ -724,10 +730,9 @@ RCT_EXPORT_METHOD(downloadUpdate:(NSDictionary*)updatePackage
|
|
|
724
730
|
// progress events every frame if the progress is updated.
|
|
725
731
|
_didUpdateProgress = NO;
|
|
726
732
|
self.paused = NO;
|
|
733
|
+
_lastProgressEventTime = 0;
|
|
727
734
|
}
|
|
728
735
|
|
|
729
|
-
NSString * publicKey = [[CodePushConfig current] publicKey];
|
|
730
|
-
|
|
731
736
|
// Install progress callback for reporting unzip/file-copy progress to JS
|
|
732
737
|
void (^installProgressCallback)(NSString *, NSNumber *, NSNumber *) =
|
|
733
738
|
^(NSString *phase, NSNumber *current, NSNumber *total) {
|
|
@@ -742,7 +747,6 @@ RCT_EXPORT_METHOD(downloadUpdate:(NSDictionary*)updatePackage
|
|
|
742
747
|
[CodePushPackage
|
|
743
748
|
downloadPackage:mutableUpdatePackage
|
|
744
749
|
expectedBundleFileName:[bundleResourceName stringByAppendingPathExtension:bundleResourceExtension]
|
|
745
|
-
publicKey:publicKey
|
|
746
750
|
operationQueue:_methodQueue
|
|
747
751
|
// The download is progressing forward
|
|
748
752
|
progressCallback:^(long long expectedContentLength, long long receivedContentLength) {
|
|
@@ -750,13 +754,19 @@ RCT_EXPORT_METHOD(downloadUpdate:(NSDictionary*)updatePackage
|
|
|
750
754
|
_latestExpectedContentLength = expectedContentLength;
|
|
751
755
|
_latestReceivedConentLength = receivedContentLength;
|
|
752
756
|
_didUpdateProgress = YES;
|
|
757
|
+
// Fabric/TurboModules don't hook RCTFrameUpdateObserver, so _pauseCallback
|
|
758
|
+
// stays nil there and we must emit progress events directly.
|
|
759
|
+
// On the legacy bridge _pauseCallback is set, and didUpdateFrame handles dispatch.
|
|
760
|
+
if (!_pauseCallback) {
|
|
761
|
+
[self dispatchThrottledDownloadProgressEventWithForce:NO];
|
|
762
|
+
}
|
|
753
763
|
|
|
754
764
|
// If the download is completed, stop observing frame
|
|
755
765
|
// updates and synchronously send the last event.
|
|
756
766
|
if (expectedContentLength == receivedContentLength) {
|
|
757
767
|
_didUpdateProgress = NO;
|
|
758
768
|
self.paused = YES;
|
|
759
|
-
[self
|
|
769
|
+
[self dispatchThrottledDownloadProgressEventWithForce:YES];
|
|
760
770
|
}
|
|
761
771
|
}
|
|
762
772
|
// The download and post-processing completed
|
|
@@ -934,7 +944,7 @@ RCT_EXPORT_METHOD(installUpdate:(NSDictionary*)updatePackage
|
|
|
934
944
|
selector:@selector(applicationDidBecomeActive)
|
|
935
945
|
name:UIApplicationDidBecomeActiveNotification
|
|
936
946
|
object:RCTSharedApplication()];
|
|
937
|
-
|
|
947
|
+
|
|
938
948
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
939
949
|
selector:@selector(applicationWillEnterForeground)
|
|
940
950
|
name:UIApplicationWillEnterForegroundNotification
|
|
@@ -1135,7 +1145,7 @@ RCT_EXPORT_METHOD(saveStatusReportForRetry:(NSDictionary *)statusReport)
|
|
|
1135
1145
|
return;
|
|
1136
1146
|
}
|
|
1137
1147
|
|
|
1138
|
-
[self
|
|
1148
|
+
[self dispatchThrottledDownloadProgressEventWithForce:YES];
|
|
1139
1149
|
_didUpdateProgress = NO;
|
|
1140
1150
|
}
|
|
1141
1151
|
|
|
@@ -12,7 +12,6 @@ static NSString * const BuildVersionConfigKey = @"buildVersion";
|
|
|
12
12
|
static NSString * const ClientUniqueIDConfigKey = @"clientUniqueId";
|
|
13
13
|
static NSString * const DeploymentKeyConfigKey = @"deploymentKey";
|
|
14
14
|
static NSString * const ServerURLConfigKey = @"serverUrl";
|
|
15
|
-
static NSString * const PublicKeyKey = @"publicKey";
|
|
16
15
|
|
|
17
16
|
+ (instancetype)current
|
|
18
17
|
{
|
|
@@ -35,8 +34,7 @@ static NSString * const PublicKeyKey = @"publicKey";
|
|
|
35
34
|
NSString *buildVersion = [infoDictionary objectForKey:(NSString *)kCFBundleVersionKey];
|
|
36
35
|
NSString *deploymentKey = [infoDictionary objectForKey:@"CodePushDeploymentKey"];
|
|
37
36
|
NSString *serverURL = [infoDictionary objectForKey:@"CodePushServerURL"];
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
|
|
40
38
|
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
|
41
39
|
NSString *clientUniqueId = [userDefaults stringForKey:ClientUniqueIDConfigKey];
|
|
42
40
|
if (clientUniqueId == nil) {
|
|
@@ -56,7 +54,6 @@ static NSString * const PublicKeyKey = @"publicKey";
|
|
|
56
54
|
if (serverURL) [_configDictionary setObject:serverURL forKey:ServerURLConfigKey];
|
|
57
55
|
if (clientUniqueId) [_configDictionary setObject:clientUniqueId forKey:ClientUniqueIDConfigKey];
|
|
58
56
|
if (deploymentKey) [_configDictionary setObject:deploymentKey forKey:DeploymentKeyConfigKey];
|
|
59
|
-
if (publicKey) [_configDictionary setObject:publicKey forKey:PublicKeyKey];
|
|
60
57
|
|
|
61
58
|
return self;
|
|
62
59
|
}
|
|
@@ -91,11 +88,6 @@ static NSString * const PublicKeyKey = @"publicKey";
|
|
|
91
88
|
return [_configDictionary objectForKey:ClientUniqueIDConfigKey];
|
|
92
89
|
}
|
|
93
90
|
|
|
94
|
-
- (NSString *)publicKey
|
|
95
|
-
{
|
|
96
|
-
return [_configDictionary objectForKey:PublicKeyKey];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
91
|
- (void)setAppVersion:(NSString *)appVersion
|
|
100
92
|
{
|
|
101
93
|
[_configDictionary setValue:appVersion forKey:AppVersionConfigKey];
|
|
@@ -111,6 +103,4 @@ static NSString * const PublicKeyKey = @"publicKey";
|
|
|
111
103
|
[_configDictionary setValue:serverURL forKey:ServerURLConfigKey];
|
|
112
104
|
}
|
|
113
105
|
|
|
114
|
-
//no setter for PublicKey, because it's need to be hard coded within Info.plist for safety
|
|
115
|
-
|
|
116
106
|
@end
|