@novacraft-engineering/pulsar-code-push 1.5.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.
Files changed (147) hide show
  1. package/AlertAdapter.js +24 -0
  2. package/CodePush.js +671 -0
  3. package/CodePush.podspec +28 -0
  4. package/LICENSE +23 -0
  5. package/README.md +70 -0
  6. package/android/build.gradle +61 -0
  7. package/android/codepush.gradle +162 -0
  8. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  9. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  10. package/android/gradle.properties +20 -0
  11. package/android/gradlew +164 -0
  12. package/android/gradlew.bat +90 -0
  13. package/android/proguard-rules.pro +33 -0
  14. package/android/src/debug/AndroidManifest.xml +9 -0
  15. package/android/src/main/AndroidManifest.xml +5 -0
  16. package/android/src/main/java/com/microsoft/codepush/react/CodePush.java +444 -0
  17. package/android/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +35 -0
  18. package/android/src/main/java/com/microsoft/codepush/react/CodePushDialog.java +102 -0
  19. package/android/src/main/java/com/microsoft/codepush/react/CodePushInstallMode.java +16 -0
  20. package/android/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +12 -0
  21. package/android/src/main/java/com/microsoft/codepush/react/CodePushInvalidUpdateException.java +7 -0
  22. package/android/src/main/java/com/microsoft/codepush/react/CodePushMalformedDataException.java +12 -0
  23. package/android/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +862 -0
  24. package/android/src/main/java/com/microsoft/codepush/react/CodePushNotInitializedException.java +12 -0
  25. package/android/src/main/java/com/microsoft/codepush/react/CodePushTelemetryManager.java +175 -0
  26. package/android/src/main/java/com/microsoft/codepush/react/CodePushUnknownException.java +12 -0
  27. package/android/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +383 -0
  28. package/android/src/main/java/com/microsoft/codepush/react/CodePushUpdateState.java +15 -0
  29. package/android/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +275 -0
  30. package/android/src/main/java/com/microsoft/codepush/react/CodePushUtils.java +238 -0
  31. package/android/src/main/java/com/microsoft/codepush/react/DownloadProgress.java +30 -0
  32. package/android/src/main/java/com/microsoft/codepush/react/DownloadProgressCallback.java +5 -0
  33. package/android/src/main/java/com/microsoft/codepush/react/FileUtils.java +203 -0
  34. package/android/src/main/java/com/microsoft/codepush/react/ReactHostHolder.java +11 -0
  35. package/android/src/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java +17 -0
  36. package/android/src/main/java/com/microsoft/codepush/react/SettingsManager.java +173 -0
  37. package/android/src/main/java/com/microsoft/codepush/react/TLSSocketFactory.java +72 -0
  38. package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +34 -0
  39. package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +252 -0
  40. package/ios/CodePush/Base64/README.md +47 -0
  41. package/ios/CodePush/CodePush.h +235 -0
  42. package/ios/CodePush/CodePush.m +1122 -0
  43. package/ios/CodePush/CodePushConfig.m +116 -0
  44. package/ios/CodePush/CodePushDownloadHandler.m +130 -0
  45. package/ios/CodePush/CodePushErrorUtils.m +20 -0
  46. package/ios/CodePush/CodePushPackage.m +602 -0
  47. package/ios/CodePush/CodePushTelemetryManager.m +175 -0
  48. package/ios/CodePush/CodePushUpdateUtils.m +376 -0
  49. package/ios/CodePush/CodePushUtils.m +9 -0
  50. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +69 -0
  51. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +16 -0
  52. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +51 -0
  53. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +15 -0
  54. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +55 -0
  55. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +24 -0
  56. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +41 -0
  57. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +28 -0
  58. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +205 -0
  59. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +103 -0
  60. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +322 -0
  61. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +37 -0
  62. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +145 -0
  63. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +35 -0
  64. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +551 -0
  65. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +23 -0
  66. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +43 -0
  67. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +230 -0
  68. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +31 -0
  69. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +113 -0
  70. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +38 -0
  71. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +500 -0
  72. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +18 -0
  73. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +214 -0
  74. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +23 -0
  75. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +29 -0
  76. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +19 -0
  77. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +68 -0
  78. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +18 -0
  79. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +72 -0
  80. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +67 -0
  81. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +111 -0
  82. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +119 -0
  83. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +307 -0
  84. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +94 -0
  85. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +619 -0
  86. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +164 -0
  87. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +514 -0
  88. package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +24 -0
  89. package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +11 -0
  90. package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +52 -0
  91. package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +5 -0
  92. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +28 -0
  93. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +70 -0
  94. package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +22 -0
  95. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +34 -0
  96. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +73 -0
  97. package/ios/CodePush/JWT/LICENSE +19 -0
  98. package/ios/CodePush/JWT/README.md +489 -0
  99. package/ios/CodePush/RCTConvert+CodePushInstallMode.m +20 -0
  100. package/ios/CodePush/RCTConvert+CodePushUpdateState.m +20 -0
  101. package/ios/CodePush/SSZipArchive/Info.plist +26 -0
  102. package/ios/CodePush/SSZipArchive/README.md +1 -0
  103. package/ios/CodePush/SSZipArchive/SSZipArchive.h +178 -0
  104. package/ios/CodePush/SSZipArchive/SSZipArchive.m +1496 -0
  105. package/ios/CodePush/SSZipArchive/SSZipCommon.h +71 -0
  106. package/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy +23 -0
  107. package/ios/CodePush/SSZipArchive/include/ZipArchive.h +25 -0
  108. package/ios/CodePush/SSZipArchive/minizip/LICENSE +17 -0
  109. package/ios/CodePush/SSZipArchive/minizip/mz.h +273 -0
  110. package/ios/CodePush/SSZipArchive/minizip/mz_compat.c +1306 -0
  111. package/ios/CodePush/SSZipArchive/minizip/mz_compat.h +346 -0
  112. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.c +187 -0
  113. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.h +65 -0
  114. package/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c +526 -0
  115. package/ios/CodePush/SSZipArchive/minizip/mz_os.c +348 -0
  116. package/ios/CodePush/SSZipArchive/minizip/mz_os.h +176 -0
  117. package/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c +350 -0
  118. package/ios/CodePush/SSZipArchive/minizip/mz_strm.c +556 -0
  119. package/ios/CodePush/SSZipArchive/minizip/mz_strm.h +132 -0
  120. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c +383 -0
  121. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h +42 -0
  122. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c +269 -0
  123. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h +48 -0
  124. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h +40 -0
  125. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c +203 -0
  126. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c +334 -0
  127. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h +46 -0
  128. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c +429 -0
  129. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h +43 -0
  130. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c +360 -0
  131. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h +46 -0
  132. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c +389 -0
  133. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h +43 -0
  134. package/ios/CodePush/SSZipArchive/minizip/mz_zip.c +2782 -0
  135. package/ios/CodePush/SSZipArchive/minizip/mz_zip.h +262 -0
  136. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c +1942 -0
  137. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h +285 -0
  138. package/ios/CodePush.xcodeproj/project.pbxproj +1052 -0
  139. package/ios/CodePush.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  140. package/ios/CodePush.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  141. package/ios/PrivacyInfo.xcprivacy +31 -0
  142. package/logging.js +6 -0
  143. package/package-mixins.js +68 -0
  144. package/package.json +51 -0
  145. package/react-native.config.js +11 -0
  146. package/request-fetch-adapter.js +52 -0
  147. package/typings/react-native-code-push.d.ts +455 -0
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,31 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>NSPrivacyTracking</key>
6
+ <false />
7
+ <key>NSPrivacyCollectedDataTypes</key>
8
+ <array />
9
+ <key>NSPrivacyTrackingDomains</key>
10
+ <array />
11
+ <key>NSPrivacyAccessedAPITypes</key>
12
+ <array>
13
+ <dict>
14
+ <key>NSPrivacyAccessedAPIType</key>
15
+ <string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
16
+ <key>NSPrivacyAccessedAPITypeReasons</key>
17
+ <array>
18
+ <string>0A2A.1</string>
19
+ </array>
20
+ </dict>
21
+ <dict>
22
+ <key>NSPrivacyAccessedAPIType</key>
23
+ <string>NSPrivacyAccessedAPICategoryUserDefaults</string>
24
+ <key>NSPrivacyAccessedAPITypeReasons</key>
25
+ <array>
26
+ <string>CA92.1</string>
27
+ </array>
28
+ </dict>
29
+ </array>
30
+ </dict>
31
+ </plist>
package/logging.js ADDED
@@ -0,0 +1,6 @@
1
+ /* Logs messages to console with the [CodePush] prefix */
2
+ function log(message) {
3
+ console.log(`[CodePush] ${message}`);
4
+ }
5
+
6
+ module.exports = log;
@@ -0,0 +1,68 @@
1
+ import { NativeEventEmitter } from "react-native";
2
+ import log from "./logging";
3
+
4
+ // This function is used to augment remote and local
5
+ // package objects with additional functionality/properties
6
+ // beyond what is included in the metadata sent by the server.
7
+ module.exports = (NativeCodePush) => {
8
+ const remote = (reportStatusDownload) => {
9
+ return {
10
+ async download(downloadProgressCallback) {
11
+ if (!this.downloadUrl) {
12
+ throw new Error("Cannot download an update without a download url");
13
+ }
14
+
15
+ let downloadProgressSubscription;
16
+ if (downloadProgressCallback) {
17
+ const codePushEventEmitter = new NativeEventEmitter(NativeCodePush);
18
+ // Use event subscription to obtain download progress.
19
+ downloadProgressSubscription = codePushEventEmitter.addListener(
20
+ "CodePushDownloadProgress",
21
+ downloadProgressCallback
22
+ );
23
+ }
24
+
25
+ // Use the downloaded package info. Native code will save the package info
26
+ // so that the client knows what the current package version is.
27
+ try {
28
+ const updatePackageCopy = Object.assign({}, this);
29
+ Object.keys(updatePackageCopy).forEach((key) => (typeof updatePackageCopy[key] === 'function') && delete updatePackageCopy[key]);
30
+
31
+ const downloadedPackage = await NativeCodePush.downloadUpdate(updatePackageCopy, !!downloadProgressCallback);
32
+
33
+ if (reportStatusDownload) {
34
+ reportStatusDownload(this)
35
+ .catch((err) => {
36
+ log(`Report download status failed: ${err}`);
37
+ });
38
+ }
39
+
40
+ return { ...downloadedPackage, ...local };
41
+ } finally {
42
+ downloadProgressSubscription && downloadProgressSubscription.remove();
43
+ }
44
+ },
45
+
46
+ isPending: false // A remote package could never be in a pending state
47
+ };
48
+ };
49
+
50
+ const local = {
51
+ async install(installMode = NativeCodePush.codePushInstallModeOnNextRestart, minimumBackgroundDuration = 0, updateInstalledCallback) {
52
+ const localPackage = this;
53
+ const localPackageCopy = Object.assign({}, localPackage); // In dev mode, React Native deep freezes any object queued over the bridge
54
+ await NativeCodePush.installUpdate(localPackageCopy, installMode, minimumBackgroundDuration);
55
+ updateInstalledCallback && updateInstalledCallback();
56
+ if (installMode == NativeCodePush.codePushInstallModeImmediate) {
57
+ NativeCodePush.restartApp(false);
58
+ } else {
59
+ NativeCodePush.clearPendingRestart();
60
+ localPackage.isPending = true; // Mark the package as pending since it hasn't been applied yet
61
+ }
62
+ },
63
+
64
+ isPending: false // A local package wouldn't be pending until it was installed
65
+ };
66
+
67
+ return { local, remote };
68
+ };
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@novacraft-engineering/pulsar-code-push",
3
+ "version": "1.5.0",
4
+ "description": "Pulsar OTA client for React Native — over-the-air JavaScript updates. A CodePush-compatible client (RevoPush lineage) pointed at Pulsar.",
5
+ "main": "CodePush.js",
6
+ "typings": "typings/react-native-code-push.d.ts",
7
+ "homepage": "https://pulsar.novacraft.africa",
8
+ "keywords": ["react-native", "code-push", "codepush", "pulsar", "ota", "over-the-air", "hot-update"],
9
+ "author": "Novacraft Engineering",
10
+ "license": "MIT",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/Novacraft-Africa/pulsar-code-push.git"
14
+ },
15
+ "publishConfig": {"access": "public"},
16
+ "files": [
17
+ "CodePush.js",
18
+ "AlertAdapter.js",
19
+ "logging.js",
20
+ "package-mixins.js",
21
+ "request-fetch-adapter.js",
22
+ "react-native.config.js",
23
+ "CodePush.podspec",
24
+ "android",
25
+ "ios",
26
+ "typings",
27
+ "README.md",
28
+ "LICENSE"
29
+ ],
30
+ "dependencies": {
31
+ "code-push": "4.2.3",
32
+ "glob": "^7.1.7",
33
+ "hoist-non-react-statics": "^3.3.2",
34
+ "inquirer": "^8.1.5",
35
+ "plist": "^3.0.4",
36
+ "semver": "^7.3.5",
37
+ "xcode": "3.0.1"
38
+ },
39
+ "peerDependencies": {
40
+ "react": ">=18.0.0",
41
+ "react-native": ">=0.70.0"
42
+ },
43
+ "rnpm": {
44
+ "android": {
45
+ "packageInstance": "new CodePush(getResources().getString(R.string.CodePushDeploymentKey), getApplicationContext(), BuildConfig.DEBUG)"
46
+ },
47
+ "ios": {
48
+ "sharedLibraries": ["libz"]
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,11 @@
1
+ module.exports = {
2
+ dependency: {
3
+ platforms: {
4
+ android: {
5
+ packageInstance:
6
+ "CodePush.getInstance(getResources().getString(R.string.CodePushDeploymentKey), getApplicationContext(), BuildConfig.DEBUG)",
7
+ sourceDir: './android',
8
+ }
9
+ }
10
+ }
11
+ };
@@ -0,0 +1,52 @@
1
+ const packageJson = require("./package.json");
2
+
3
+ module.exports = {
4
+ async request(verb, url, requestBody, callback) {
5
+ if (typeof requestBody === "function") {
6
+ callback = requestBody;
7
+ requestBody = null;
8
+ }
9
+
10
+ const headers = {
11
+ "Accept": "application/json",
12
+ "Content-Type": "application/json",
13
+ "X-CodePush-Plugin-Name": packageJson.name,
14
+ "X-CodePush-Plugin-Version": packageJson.version,
15
+ "X-CodePush-SDK-Version": packageJson.dependencies["code-push"]
16
+ };
17
+
18
+ if (requestBody && typeof requestBody === "object") {
19
+ requestBody = JSON.stringify(requestBody);
20
+ }
21
+
22
+ try {
23
+ const response = await fetch(url, {
24
+ method: getHttpMethodName(verb),
25
+ headers: headers,
26
+ body: requestBody
27
+ });
28
+
29
+ const statusCode = response.status;
30
+ const body = await response.text();
31
+ callback(null, { statusCode, body });
32
+ } catch (err) {
33
+ callback(err);
34
+ }
35
+ }
36
+ };
37
+
38
+ function getHttpMethodName(verb) {
39
+ // Note: This should stay in sync with the enum definition in
40
+ // https://github.com/microsoft/code-push/blob/master/sdk/script/acquisition-sdk.ts#L6
41
+ return [
42
+ "GET",
43
+ "HEAD",
44
+ "POST",
45
+ "PUT",
46
+ "DELETE",
47
+ "TRACE",
48
+ "OPTIONS",
49
+ "CONNECT",
50
+ "PATCH"
51
+ ][verb];
52
+ }