@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.
Files changed (360) hide show
  1. package/CodePush.podspec +3 -5
  2. package/README.md +26 -24
  3. package/android/app/proguard-rules.pro +5 -0
  4. package/android/app/src/main/java/com/appzung/codepush/react/CodePush.java +4 -0
  5. package/android/app/src/main/java/com/appzung/codepush/react/CodePushConstants.java +2 -0
  6. package/android/app/src/main/java/com/appzung/codepush/react/CodePushNativeModule.java +86 -4
  7. package/android/app/src/main/java/com/appzung/codepush/react/ExpoUtils.java +22 -0
  8. package/ios/CodePush/CodePush.h +11 -6
  9. package/ios/CodePush/{CodePush.m → CodePush.mm} +132 -141
  10. package/ios/CodePush/CodePushConfig.m +54 -0
  11. package/ios/CodePush.xcodeproj/project.pbxproj +6 -6
  12. package/lib/commonjs/CodePush.js +11 -2
  13. package/lib/commonjs/CodePush.js.map +1 -1
  14. package/lib/commonjs/allowRestart.js +6 -2
  15. package/lib/commonjs/allowRestart.js.map +1 -1
  16. package/lib/commonjs/checkForUpdates.js +25 -26
  17. package/lib/commonjs/checkForUpdates.js.map +1 -1
  18. package/lib/commonjs/clearUpdates.js +6 -3
  19. package/lib/commonjs/clearUpdates.js.map +1 -1
  20. package/lib/commonjs/dataTransmission.js +28 -0
  21. package/lib/commonjs/dataTransmission.js.map +1 -0
  22. package/lib/commonjs/disallowRestart.js +6 -2
  23. package/lib/commonjs/disallowRestart.js.map +1 -1
  24. package/lib/commonjs/enums/CheckFrequency.enum.js +2 -2
  25. package/lib/commonjs/enums/InstallMode.enum.js +7 -3
  26. package/lib/commonjs/enums/InstallMode.enum.js.map +1 -1
  27. package/lib/commonjs/enums/LogLevel.enum.js +17 -0
  28. package/lib/commonjs/enums/LogLevel.enum.js.map +1 -0
  29. package/lib/commonjs/enums/SyncStatus.enum.js +7 -7
  30. package/lib/commonjs/enums/UpdateState.enum.js +7 -6
  31. package/lib/commonjs/enums/UpdateState.enum.js.map +1 -1
  32. package/lib/commonjs/getClientUniqueId.js +16 -0
  33. package/lib/commonjs/getClientUniqueId.js.map +1 -0
  34. package/lib/commonjs/index.js +90 -9
  35. package/lib/commonjs/index.js.map +1 -1
  36. package/lib/commonjs/internals/CodePushApiSdk.errors.js +26 -0
  37. package/lib/commonjs/internals/CodePushApiSdk.errors.js.map +1 -0
  38. package/lib/commonjs/internals/CodePushApiSdk.js +122 -0
  39. package/lib/commonjs/internals/CodePushApiSdk.js.map +1 -0
  40. package/lib/commonjs/{enums/DeploymentStatus.enum.js → internals/CodePushApiSdk.types.js} +3 -2
  41. package/lib/commonjs/internals/CodePushApiSdk.types.js.map +1 -0
  42. package/lib/commonjs/internals/CodePushEventEmitter.js +10 -0
  43. package/lib/commonjs/internals/CodePushEventEmitter.js.map +1 -0
  44. package/lib/commonjs/internals/RemotePackageImplementation.js +9 -8
  45. package/lib/commonjs/internals/RemotePackageImplementation.js.map +1 -1
  46. package/lib/commonjs/internals/getConfiguration.js +4 -0
  47. package/lib/commonjs/internals/getConfiguration.js.map +1 -1
  48. package/lib/commonjs/internals/logger.js +51 -0
  49. package/lib/commonjs/internals/logger.js.map +1 -0
  50. package/lib/commonjs/internals/shouldUpdateBeIgnored.js +6 -5
  51. package/lib/commonjs/internals/shouldUpdateBeIgnored.js.map +1 -1
  52. package/lib/commonjs/internals/utils/fetchRetry.js +59 -0
  53. package/lib/commonjs/internals/utils/fetchRetry.js.map +1 -0
  54. package/lib/commonjs/internals/utils/log.js +10 -3
  55. package/lib/commonjs/internals/utils/log.js.map +1 -1
  56. package/lib/commonjs/internals/utils/queryStringify.js +25 -0
  57. package/lib/commonjs/internals/utils/queryStringify.js.map +1 -0
  58. package/lib/commonjs/internals/utils/requestFetchAdapter.js +38 -0
  59. package/lib/commonjs/internals/utils/requestFetchAdapter.js.map +1 -0
  60. package/lib/commonjs/internals/version.js +1 -1
  61. package/lib/commonjs/internals/version.js.map +1 -1
  62. package/lib/commonjs/logLevel.js +15 -0
  63. package/lib/commonjs/logLevel.js.map +1 -0
  64. package/lib/commonjs/logger.js +19 -0
  65. package/lib/commonjs/logger.js.map +1 -0
  66. package/lib/commonjs/notifyAppReady.js +26 -15
  67. package/lib/commonjs/notifyAppReady.js.map +1 -1
  68. package/lib/commonjs/resetClientUniqueId.js +18 -0
  69. package/lib/commonjs/resetClientUniqueId.js.map +1 -0
  70. package/lib/commonjs/restartApp.js +4 -2
  71. package/lib/commonjs/restartApp.js.map +1 -1
  72. package/lib/commonjs/sync.js +35 -28
  73. package/lib/commonjs/sync.js.map +1 -1
  74. package/lib/commonjs/telemetry.js +28 -0
  75. package/lib/commonjs/telemetry.js.map +1 -0
  76. package/lib/module/CodePush.js +11 -2
  77. package/lib/module/CodePush.js.map +1 -1
  78. package/lib/module/allowRestart.js +5 -1
  79. package/lib/module/allowRestart.js.map +1 -1
  80. package/lib/module/checkForUpdates.js +25 -26
  81. package/lib/module/checkForUpdates.js.map +1 -1
  82. package/lib/module/clearUpdates.js +5 -2
  83. package/lib/module/clearUpdates.js.map +1 -1
  84. package/lib/module/dataTransmission.js +24 -0
  85. package/lib/module/dataTransmission.js.map +1 -0
  86. package/lib/module/disallowRestart.js +5 -1
  87. package/lib/module/disallowRestart.js.map +1 -1
  88. package/lib/module/enums/CheckFrequency.enum.js +2 -2
  89. package/lib/module/enums/InstallMode.enum.js +7 -3
  90. package/lib/module/enums/InstallMode.enum.js.map +1 -1
  91. package/lib/module/enums/LogLevel.enum.js +13 -0
  92. package/lib/module/enums/LogLevel.enum.js.map +1 -0
  93. package/lib/module/enums/SyncStatus.enum.js +7 -7
  94. package/lib/module/enums/UpdateState.enum.js +7 -6
  95. package/lib/module/enums/UpdateState.enum.js.map +1 -1
  96. package/lib/module/getClientUniqueId.js +12 -0
  97. package/lib/module/getClientUniqueId.js.map +1 -0
  98. package/lib/module/index.js +8 -1
  99. package/lib/module/index.js.map +1 -1
  100. package/lib/module/internals/CodePushApiSdk.errors.js +20 -0
  101. package/lib/module/internals/CodePushApiSdk.errors.js.map +1 -0
  102. package/lib/module/internals/CodePushApiSdk.js +118 -0
  103. package/lib/module/internals/CodePushApiSdk.js.map +1 -0
  104. package/lib/module/{enums/DeploymentStatus.enum.js → internals/CodePushApiSdk.types.js} +2 -1
  105. package/lib/module/internals/CodePushApiSdk.types.js.map +1 -0
  106. package/lib/module/internals/CodePushEventEmitter.js +6 -0
  107. package/lib/module/internals/CodePushEventEmitter.js.map +1 -0
  108. package/lib/module/internals/RemotePackageImplementation.js +9 -8
  109. package/lib/module/internals/RemotePackageImplementation.js.map +1 -1
  110. package/lib/module/internals/getConfiguration.js +3 -0
  111. package/lib/module/internals/getConfiguration.js.map +1 -1
  112. package/lib/module/internals/logger.js +44 -0
  113. package/lib/module/internals/logger.js.map +1 -0
  114. package/lib/module/internals/shouldUpdateBeIgnored.js +6 -5
  115. package/lib/module/internals/shouldUpdateBeIgnored.js.map +1 -1
  116. package/lib/module/internals/utils/fetchRetry.js +55 -0
  117. package/lib/module/internals/utils/fetchRetry.js.map +1 -0
  118. package/lib/module/internals/utils/log.js +11 -3
  119. package/lib/module/internals/utils/log.js.map +1 -1
  120. package/lib/module/internals/utils/queryStringify.js +21 -0
  121. package/lib/module/internals/utils/queryStringify.js.map +1 -0
  122. package/lib/module/internals/utils/requestFetchAdapter.js +34 -0
  123. package/lib/module/internals/utils/requestFetchAdapter.js.map +1 -0
  124. package/lib/module/internals/version.js +1 -1
  125. package/lib/module/internals/version.js.map +1 -1
  126. package/lib/module/logLevel.js +9 -0
  127. package/lib/module/logLevel.js.map +1 -0
  128. package/lib/module/logger.js +4 -0
  129. package/lib/module/logger.js.map +1 -0
  130. package/lib/module/notifyAppReady.js +26 -15
  131. package/lib/module/notifyAppReady.js.map +1 -1
  132. package/lib/module/resetClientUniqueId.js +14 -0
  133. package/lib/module/resetClientUniqueId.js.map +1 -0
  134. package/lib/module/restartApp.js +4 -2
  135. package/lib/module/restartApp.js.map +1 -1
  136. package/lib/module/sync.js +35 -28
  137. package/lib/module/sync.js.map +1 -1
  138. package/lib/module/telemetry.js +24 -0
  139. package/lib/module/telemetry.js.map +1 -0
  140. package/lib/typescript/commonjs/src/CodePush.d.ts +10 -5
  141. package/lib/typescript/commonjs/src/CodePush.d.ts.map +1 -1
  142. package/lib/typescript/commonjs/src/allowRestart.d.ts +3 -1
  143. package/lib/typescript/commonjs/src/allowRestart.d.ts.map +1 -1
  144. package/lib/typescript/commonjs/src/checkForUpdates.d.ts.map +1 -1
  145. package/lib/typescript/commonjs/src/clearUpdates.d.ts +3 -2
  146. package/lib/typescript/commonjs/src/clearUpdates.d.ts.map +1 -1
  147. package/lib/typescript/commonjs/src/dataTransmission.d.ts +13 -0
  148. package/lib/typescript/commonjs/src/dataTransmission.d.ts.map +1 -0
  149. package/lib/typescript/commonjs/src/disallowRestart.d.ts +3 -1
  150. package/lib/typescript/commonjs/src/disallowRestart.d.ts.map +1 -1
  151. package/lib/typescript/commonjs/src/enums/CheckFrequency.enum.d.ts +2 -2
  152. package/lib/typescript/commonjs/src/enums/InstallMode.enum.d.ts +7 -3
  153. package/lib/typescript/commonjs/src/enums/InstallMode.enum.d.ts.map +1 -1
  154. package/lib/typescript/commonjs/src/enums/LogLevel.enum.d.ts +10 -0
  155. package/lib/typescript/commonjs/src/enums/LogLevel.enum.d.ts.map +1 -0
  156. package/lib/typescript/commonjs/src/enums/SyncStatus.enum.d.ts +7 -7
  157. package/lib/typescript/commonjs/src/enums/UpdateState.enum.d.ts +7 -6
  158. package/lib/typescript/commonjs/src/enums/UpdateState.enum.d.ts.map +1 -1
  159. package/lib/typescript/commonjs/src/getClientUniqueId.d.ts +5 -0
  160. package/lib/typescript/commonjs/src/getClientUniqueId.d.ts.map +1 -0
  161. package/lib/typescript/commonjs/src/index.d.ts +8 -1
  162. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  163. package/lib/typescript/commonjs/src/internals/CodePushApiSdk.d.ts +15 -0
  164. package/lib/typescript/commonjs/src/internals/CodePushApiSdk.d.ts.map +1 -0
  165. package/lib/typescript/commonjs/src/internals/CodePushApiSdk.errors.d.ts +9 -0
  166. package/lib/typescript/commonjs/src/internals/CodePushApiSdk.errors.d.ts.map +1 -0
  167. package/lib/typescript/commonjs/src/internals/CodePushApiSdk.types.d.ts +103 -0
  168. package/lib/typescript/commonjs/src/internals/CodePushApiSdk.types.d.ts.map +1 -0
  169. package/lib/typescript/commonjs/src/internals/CodePushEventEmitter.d.ts +3 -0
  170. package/lib/typescript/commonjs/src/internals/CodePushEventEmitter.d.ts.map +1 -0
  171. package/lib/typescript/commonjs/src/internals/RNAppZungCodePushModuleSpec.d.ts +5 -0
  172. package/lib/typescript/commonjs/src/internals/RNAppZungCodePushModuleSpec.d.ts.map +1 -1
  173. package/lib/typescript/commonjs/src/internals/RemotePackageImplementation.d.ts +2 -2
  174. package/lib/typescript/commonjs/src/internals/RemotePackageImplementation.d.ts.map +1 -1
  175. package/lib/typescript/commonjs/src/internals/getConfiguration.d.ts +1 -0
  176. package/lib/typescript/commonjs/src/internals/getConfiguration.d.ts.map +1 -1
  177. package/lib/typescript/commonjs/src/internals/logger.d.ts +33 -0
  178. package/lib/typescript/commonjs/src/internals/logger.d.ts.map +1 -0
  179. package/lib/typescript/commonjs/src/internals/shouldUpdateBeIgnored.d.ts.map +1 -1
  180. package/lib/typescript/commonjs/src/internals/types.d.ts +2 -2
  181. package/lib/typescript/commonjs/src/internals/types.d.ts.map +1 -1
  182. package/lib/typescript/commonjs/src/internals/utils/fetchRetry.d.ts +9 -0
  183. package/lib/typescript/commonjs/src/internals/utils/fetchRetry.d.ts.map +1 -0
  184. package/lib/typescript/commonjs/src/internals/utils/log.d.ts +2 -1
  185. package/lib/typescript/commonjs/src/internals/utils/log.d.ts.map +1 -1
  186. package/lib/typescript/commonjs/src/internals/utils/queryStringify.d.ts +4 -0
  187. package/lib/typescript/commonjs/src/internals/utils/queryStringify.d.ts.map +1 -0
  188. package/lib/typescript/commonjs/src/internals/utils/requestFetchAdapter.d.ts +3 -0
  189. package/lib/typescript/commonjs/src/internals/utils/requestFetchAdapter.d.ts.map +1 -0
  190. package/lib/typescript/commonjs/src/internals/version.d.ts +1 -1
  191. package/lib/typescript/commonjs/src/internals/version.d.ts.map +1 -1
  192. package/lib/typescript/commonjs/src/logLevel.d.ts +4 -0
  193. package/lib/typescript/commonjs/src/logLevel.d.ts.map +1 -0
  194. package/lib/typescript/commonjs/src/logger.d.ts +3 -0
  195. package/lib/typescript/commonjs/src/logger.d.ts.map +1 -0
  196. package/lib/typescript/commonjs/src/notifyAppReady.d.ts +4 -0
  197. package/lib/typescript/commonjs/src/notifyAppReady.d.ts.map +1 -1
  198. package/lib/typescript/commonjs/src/resetClientUniqueId.d.ts +5 -0
  199. package/lib/typescript/commonjs/src/resetClientUniqueId.d.ts.map +1 -0
  200. package/lib/typescript/commonjs/src/restartApp.d.ts +2 -0
  201. package/lib/typescript/commonjs/src/restartApp.d.ts.map +1 -1
  202. package/lib/typescript/commonjs/src/sync.d.ts +5 -1
  203. package/lib/typescript/commonjs/src/sync.d.ts.map +1 -1
  204. package/lib/typescript/commonjs/src/telemetry.d.ts +13 -0
  205. package/lib/typescript/commonjs/src/telemetry.d.ts.map +1 -0
  206. package/lib/typescript/commonjs/src/types.d.ts +72 -29
  207. package/lib/typescript/commonjs/src/types.d.ts.map +1 -1
  208. package/lib/typescript/module/src/CodePush.d.ts +10 -5
  209. package/lib/typescript/module/src/CodePush.d.ts.map +1 -1
  210. package/lib/typescript/module/src/allowRestart.d.ts +3 -1
  211. package/lib/typescript/module/src/allowRestart.d.ts.map +1 -1
  212. package/lib/typescript/module/src/checkForUpdates.d.ts.map +1 -1
  213. package/lib/typescript/module/src/clearUpdates.d.ts +3 -2
  214. package/lib/typescript/module/src/clearUpdates.d.ts.map +1 -1
  215. package/lib/typescript/module/src/dataTransmission.d.ts +13 -0
  216. package/lib/typescript/module/src/dataTransmission.d.ts.map +1 -0
  217. package/lib/typescript/module/src/disallowRestart.d.ts +3 -1
  218. package/lib/typescript/module/src/disallowRestart.d.ts.map +1 -1
  219. package/lib/typescript/module/src/enums/CheckFrequency.enum.d.ts +2 -2
  220. package/lib/typescript/module/src/enums/InstallMode.enum.d.ts +7 -3
  221. package/lib/typescript/module/src/enums/InstallMode.enum.d.ts.map +1 -1
  222. package/lib/typescript/module/src/enums/LogLevel.enum.d.ts +10 -0
  223. package/lib/typescript/module/src/enums/LogLevel.enum.d.ts.map +1 -0
  224. package/lib/typescript/module/src/enums/SyncStatus.enum.d.ts +7 -7
  225. package/lib/typescript/module/src/enums/UpdateState.enum.d.ts +7 -6
  226. package/lib/typescript/module/src/enums/UpdateState.enum.d.ts.map +1 -1
  227. package/lib/typescript/module/src/getClientUniqueId.d.ts +5 -0
  228. package/lib/typescript/module/src/getClientUniqueId.d.ts.map +1 -0
  229. package/lib/typescript/module/src/index.d.ts +8 -1
  230. package/lib/typescript/module/src/index.d.ts.map +1 -1
  231. package/lib/typescript/module/src/internals/CodePushApiSdk.d.ts +15 -0
  232. package/lib/typescript/module/src/internals/CodePushApiSdk.d.ts.map +1 -0
  233. package/lib/typescript/module/src/internals/CodePushApiSdk.errors.d.ts +9 -0
  234. package/lib/typescript/module/src/internals/CodePushApiSdk.errors.d.ts.map +1 -0
  235. package/lib/typescript/module/src/internals/CodePushApiSdk.types.d.ts +103 -0
  236. package/lib/typescript/module/src/internals/CodePushApiSdk.types.d.ts.map +1 -0
  237. package/lib/typescript/module/src/internals/CodePushEventEmitter.d.ts +3 -0
  238. package/lib/typescript/module/src/internals/CodePushEventEmitter.d.ts.map +1 -0
  239. package/lib/typescript/module/src/internals/RNAppZungCodePushModuleSpec.d.ts +5 -0
  240. package/lib/typescript/module/src/internals/RNAppZungCodePushModuleSpec.d.ts.map +1 -1
  241. package/lib/typescript/module/src/internals/RemotePackageImplementation.d.ts +2 -2
  242. package/lib/typescript/module/src/internals/RemotePackageImplementation.d.ts.map +1 -1
  243. package/lib/typescript/module/src/internals/getConfiguration.d.ts +1 -0
  244. package/lib/typescript/module/src/internals/getConfiguration.d.ts.map +1 -1
  245. package/lib/typescript/module/src/internals/logger.d.ts +33 -0
  246. package/lib/typescript/module/src/internals/logger.d.ts.map +1 -0
  247. package/lib/typescript/module/src/internals/shouldUpdateBeIgnored.d.ts.map +1 -1
  248. package/lib/typescript/module/src/internals/types.d.ts +2 -2
  249. package/lib/typescript/module/src/internals/types.d.ts.map +1 -1
  250. package/lib/typescript/module/src/internals/utils/fetchRetry.d.ts +9 -0
  251. package/lib/typescript/module/src/internals/utils/fetchRetry.d.ts.map +1 -0
  252. package/lib/typescript/module/src/internals/utils/log.d.ts +2 -1
  253. package/lib/typescript/module/src/internals/utils/log.d.ts.map +1 -1
  254. package/lib/typescript/module/src/internals/utils/queryStringify.d.ts +4 -0
  255. package/lib/typescript/module/src/internals/utils/queryStringify.d.ts.map +1 -0
  256. package/lib/typescript/module/src/internals/utils/requestFetchAdapter.d.ts +3 -0
  257. package/lib/typescript/module/src/internals/utils/requestFetchAdapter.d.ts.map +1 -0
  258. package/lib/typescript/module/src/internals/version.d.ts +1 -1
  259. package/lib/typescript/module/src/internals/version.d.ts.map +1 -1
  260. package/lib/typescript/module/src/logLevel.d.ts +4 -0
  261. package/lib/typescript/module/src/logLevel.d.ts.map +1 -0
  262. package/lib/typescript/module/src/logger.d.ts +3 -0
  263. package/lib/typescript/module/src/logger.d.ts.map +1 -0
  264. package/lib/typescript/module/src/notifyAppReady.d.ts +4 -0
  265. package/lib/typescript/module/src/notifyAppReady.d.ts.map +1 -1
  266. package/lib/typescript/module/src/resetClientUniqueId.d.ts +5 -0
  267. package/lib/typescript/module/src/resetClientUniqueId.d.ts.map +1 -0
  268. package/lib/typescript/module/src/restartApp.d.ts +2 -0
  269. package/lib/typescript/module/src/restartApp.d.ts.map +1 -1
  270. package/lib/typescript/module/src/sync.d.ts +5 -1
  271. package/lib/typescript/module/src/sync.d.ts.map +1 -1
  272. package/lib/typescript/module/src/telemetry.d.ts +13 -0
  273. package/lib/typescript/module/src/telemetry.d.ts.map +1 -0
  274. package/lib/typescript/module/src/types.d.ts +72 -29
  275. package/lib/typescript/module/src/types.d.ts.map +1 -1
  276. package/package.json +24 -13
  277. package/scripts/generateBundledResourcesHash.js +73 -68
  278. package/scripts/getFilesInFolder.js +12 -12
  279. package/scripts/recordFilesBeforeBundleCommand.js +19 -20
  280. package/src/CodePush.tsx +20 -5
  281. package/src/allowRestart.ts +5 -1
  282. package/src/checkForUpdates.ts +26 -24
  283. package/src/clearUpdates.ts +5 -2
  284. package/src/dataTransmission.ts +21 -0
  285. package/src/disallowRestart.ts +5 -1
  286. package/src/enums/CheckFrequency.enum.ts +2 -2
  287. package/src/enums/InstallMode.enum.ts +7 -3
  288. package/src/enums/LogLevel.enum.ts +9 -0
  289. package/src/enums/SyncStatus.enum.ts +7 -7
  290. package/src/enums/UpdateState.enum.ts +7 -6
  291. package/src/getClientUniqueId.ts +9 -0
  292. package/src/index.ts +8 -1
  293. package/src/internals/CodePushApiSdk.errors.ts +22 -0
  294. package/src/internals/CodePushApiSdk.ts +160 -0
  295. package/src/internals/CodePushApiSdk.types.ts +117 -0
  296. package/src/internals/CodePushEventEmitter.ts +4 -0
  297. package/src/internals/RNAppZungCodePushModuleSpec.ts +7 -0
  298. package/src/internals/RemotePackageImplementation.ts +11 -10
  299. package/src/internals/getConfiguration.ts +4 -0
  300. package/src/internals/logger.ts +46 -0
  301. package/src/internals/shouldUpdateBeIgnored.ts +6 -5
  302. package/src/internals/types.ts +2 -2
  303. package/src/internals/utils/fetchRetry.ts +72 -0
  304. package/src/internals/utils/log.ts +13 -3
  305. package/src/internals/utils/queryStringify.ts +22 -0
  306. package/src/internals/utils/requestFetchAdapter.ts +36 -0
  307. package/src/internals/version.ts +1 -1
  308. package/src/logLevel.ts +9 -0
  309. package/src/logger.ts +2 -0
  310. package/src/notifyAppReady.ts +29 -18
  311. package/src/resetClientUniqueId.ts +11 -0
  312. package/src/restartApp.ts +4 -2
  313. package/src/sync.ts +41 -27
  314. package/src/telemetry.ts +21 -0
  315. package/src/types.ts +72 -29
  316. package/android/app/.gradle/config.properties +0 -2
  317. package/android/app/local.properties +0 -8
  318. package/docs/advanced-usage.md +0 -56
  319. package/docs/api-android.md +0 -22
  320. package/docs/api-ios.md +0 -19
  321. package/docs/api-js.md +0 -557
  322. package/docs/code-signing.md +0 -62
  323. package/docs/migrating-to-v10.md +0 -31
  324. package/docs/setup-android.md +0 -81
  325. package/docs/setup-ios.md +0 -108
  326. package/docs/setup-windows.md +0 -55
  327. package/lib/commonjs/enums/DeploymentStatus.enum.js.map +0 -1
  328. package/lib/commonjs/internals/AcquisitionSdk.js +0 -9
  329. package/lib/commonjs/internals/AcquisitionSdk.js.map +0 -1
  330. package/lib/commonjs/internals/getPromisifiedSdk.js +0 -49
  331. package/lib/commonjs/internals/getPromisifiedSdk.js.map +0 -1
  332. package/lib/commonjs/internals/utils/request-fetch-adapter.js +0 -50
  333. package/lib/commonjs/internals/utils/request-fetch-adapter.js.map +0 -1
  334. package/lib/module/enums/DeploymentStatus.enum.js.map +0 -1
  335. package/lib/module/internals/AcquisitionSdk.js +0 -5
  336. package/lib/module/internals/AcquisitionSdk.js.map +0 -1
  337. package/lib/module/internals/getPromisifiedSdk.js +0 -45
  338. package/lib/module/internals/getPromisifiedSdk.js.map +0 -1
  339. package/lib/module/internals/utils/request-fetch-adapter.js +0 -46
  340. package/lib/module/internals/utils/request-fetch-adapter.js.map +0 -1
  341. package/lib/typescript/commonjs/src/enums/DeploymentStatus.enum.d.ts +0 -14
  342. package/lib/typescript/commonjs/src/enums/DeploymentStatus.enum.d.ts.map +0 -1
  343. package/lib/typescript/commonjs/src/internals/AcquisitionSdk.d.ts +0 -3
  344. package/lib/typescript/commonjs/src/internals/AcquisitionSdk.d.ts.map +0 -1
  345. package/lib/typescript/commonjs/src/internals/getPromisifiedSdk.d.ts +0 -13
  346. package/lib/typescript/commonjs/src/internals/getPromisifiedSdk.d.ts.map +0 -1
  347. package/lib/typescript/commonjs/src/internals/utils/request-fetch-adapter.d.ts +0 -3
  348. package/lib/typescript/commonjs/src/internals/utils/request-fetch-adapter.d.ts.map +0 -1
  349. package/lib/typescript/module/src/enums/DeploymentStatus.enum.d.ts +0 -14
  350. package/lib/typescript/module/src/enums/DeploymentStatus.enum.d.ts.map +0 -1
  351. package/lib/typescript/module/src/internals/AcquisitionSdk.d.ts +0 -3
  352. package/lib/typescript/module/src/internals/AcquisitionSdk.d.ts.map +0 -1
  353. package/lib/typescript/module/src/internals/getPromisifiedSdk.d.ts +0 -13
  354. package/lib/typescript/module/src/internals/getPromisifiedSdk.d.ts.map +0 -1
  355. package/lib/typescript/module/src/internals/utils/request-fetch-adapter.d.ts +0 -3
  356. package/lib/typescript/module/src/internals/utils/request-fetch-adapter.d.ts.map +0 -1
  357. package/src/enums/DeploymentStatus.enum.ts +0 -14
  358. package/src/internals/AcquisitionSdk.ts +0 -3
  359. package/src/internals/getPromisifiedSdk.ts +0 -72
  360. package/src/internals/utils/request-fetch-adapter.ts +0 -58
package/CodePush.podspec CHANGED
@@ -14,14 +14,12 @@ Pod::Spec.new do |s|
14
14
  s.tvos.deployment_target = '15.5'
15
15
  s.preserve_paths = '*.js'
16
16
  s.library = 'z'
17
- s.source_files = 'ios/CodePush/*.{h,m}'
17
+ s.source_files = 'ios/CodePush/*.{h,m,mm}'
18
18
  s.public_header_files = ['ios/CodePush/CodePush.h']
19
19
  s.pod_target_xcconfig = { "DEFINES_MODULE" => "YES" }
20
20
 
21
- # Note: Even though there are copy/pasted versions of some of these dependencies in the repo,
22
- # we explicitly let CocoaPods pull in the versions below so all dependencies are resolved and
23
- # linked properly at a parent workspace level.
24
- s.dependency 'React-Core'
21
+ install_modules_dependencies(s)
22
+
25
23
  s.dependency 'SSZipArchive', '~> 2.5.5'
26
24
  s.dependency 'JWT', '~> 3.0.0-beta.12'
27
25
  s.dependency 'Base64', '~> 1.1'
package/README.md CHANGED
@@ -21,7 +21,7 @@
21
21
  [AppZung](https://appzung.com) is a robust solution for CodePush functionality, created in response to AppCenter's retirement.
22
22
  CodePush allows you to easily add a dynamic update experience to your React Native apps.
23
23
 
24
- We offer feature-parity with the original CodePush and will introduce advanced capabilities in:
24
+ We offer feature-parity with the original CodePush and introduce advanced capabilities in:
25
25
 
26
26
  - Hosting
27
27
  - Delivery
@@ -55,13 +55,13 @@ Otherwise:
55
55
  npm install --save @appzung/react-native-code-push
56
56
  ```
57
57
 
58
- _NOTE: For Expo apps a plugin will be made available soon. In the meantime, you may eject._
59
-
60
58
  Then continue with installing the native module:
61
59
 
62
- - [iOS Setup](docs/setup-ios.md)
63
- - [Android Setup](docs/setup-android.md)
64
- - [Windows Setup](docs/setup-windows.md)
60
+ - [iOS setup](docs/setup-ios.md)
61
+ - [Android setup](docs/setup-android.md)
62
+ - [Windows setup](docs/setup-windows.md)
63
+
64
+ Or if your app is managed by the Expo framework, install and configure [@appzung/expo-config-code-push](https://github.com/AppZung/expo-config-code-push).
65
65
 
66
66
  ## Migrating to AppZung CodePush
67
67
 
@@ -109,8 +109,9 @@ We try our best to maintain backwards compatibility of our plugin with previous
109
109
  | v0.60-v0.61 | 4.1+ (TLS 1.2+) | 7 | ✅ | ❌ | v6.3.1 |
110
110
  | v0.62-v0.64 | 4.1+ (TLS 1.2+) | 7 | ✅ | ❌ | v6.4.2 |
111
111
  | v0.65-v0.70 | 4.1+ (TLS 1.2+) | 9 | ✅ | ❌ | v7.1.1 |
112
- | v0.71+ | 4.1+ (TLS 1.2+) | 9 | ✅ | ❌ | v8.3.2 |
113
- | v0.71+ | 4.1+ (TLS 1.2+) | 15.5 | ✅ | ❌ | v9.0.2 or v10+ |
112
+ | v0.71-v0.79 | 4.1+ (TLS 1.2+) | 9 | ✅ | ❌ | v8.3.2 |
113
+ | v0.71-v0.79 | 4.1+ (TLS 1.2+) | 15.5 | ✅ | ❌ | v9.0.2 |
114
+ | v0.71+ | 4.1+ (TLS 1.2+) | 15.5 | ✅ | ❌ | v10+ |
114
115
  | v0.74+ | 4.1+ (TLS 1.2+) | 15.5 | ✅ | ✅ | v11+ |
115
116
 
116
117
  We work hard to respond to new RN releases, but they do occasionally break us. We will update this chart with each RN release, so that users can check to see what our "official" support is.
@@ -142,14 +143,14 @@ If you would like your app to discover updates more quickly, you can also choose
142
143
  withCodePush({ checkFrequency: CheckFrequency.ON_APP_RESUME })(MyApp);
143
144
  ```
144
145
 
145
- Alternatively, if you want fine-grained control over when the check happens (like a button press or timer interval), eg. in a staging environment, you can call [`CodePush.sync()`](docs/api-js.md#codepushsync) at any time with your desired `SyncOptions`, and turn off CodePush's automatic checking by specifying a manual `checkFrequency`:
146
+ Alternatively, if you want fine-grained control over when the check happens (like a button press or timer interval), eg. in a staging environment, you can call [`CodePush.sync()`](docs/api-js/functions/sync.md) at any time with your desired `SyncOptions`, and turn off CodePush's automatic checking by specifying a manual `checkFrequency`:
146
147
 
147
148
  ```javascript
148
- import withCodePush, { CheckFrequency, InstallMode } from '@appzung/react-native-code-push';
149
+ import withCodePush, { CheckFrequency, InstallMode, sync } from '@appzung/react-native-code-push';
149
150
 
150
151
  class MyApp extends Component {
151
152
  onButtonPress() {
152
- CodePush.sync({
153
+ sync({
153
154
  updateDialog: true,
154
155
  installMode: InstallMode.IMMEDIATE,
155
156
  });
@@ -169,11 +170,11 @@ class MyApp extends Component {
169
170
  export default withCodePush({ checkFrequency: CheckFrequency.MANUAL })(MyApp);
170
171
  ```
171
172
 
172
- If you would like to display an update confirmation dialog (an "active install"), configure when an available update is installed (like force an immediate restart) or customize the update experience in any other way, refer to the [`codePush()`](docs/api-js.md#codepush) API reference for information on how to tweak this default behavior.
173
+ If you would like to display an update confirmation dialog (an "active install"), configure when an available update is installed (like force an immediate restart) or customize the update experience in any other way, refer to the [`withCodePush()`](docs/api-js/functions/withCodePush.md) API reference for information on how to tweak this default behavior.
173
174
 
174
175
  ## Releasing updates
175
176
 
176
- Once your app is configured and distributed to your users, and you have made some JS or asset changes, it's time to release them. The recommended way to release them is using the `appzung releases deploy-react-native` command in the AppZung CLI, which will bundle your JavaScript files, asset files, and release the update to the CodePush server.
177
+ Once your app is configured and distributed to your users, and you have made some JS or asset changes, it's time to release them. The recommended way to release them is running the `appzung releases deploy-react-native` command (or `appzung releases deploy-expo` if using Expo) in the AppZung CLI, which will bundle your JavaScript files, asset files, and release the update to the CodePush server.
177
178
 
178
179
  ### Locally
179
180
 
@@ -252,13 +253,13 @@ This is not necessarily the case for `updateDialog`, since it won't force the us
252
253
 
253
254
  ## API Reference
254
255
 
255
- - [JavaScript API](docs/api-js.md)
256
+ - [JavaScript API](docs/api-js/README.md)
256
257
  - [Objective-C API Reference (iOS)](docs/api-ios.md)
257
258
  - [Java API Reference (Android)](docs/api-android.md)
258
259
 
259
260
  ## Debugging / Troubleshooting
260
261
 
261
- The `sync` method includes a lot of diagnostic logging out-of-the-box, so if you're encountering an issue when using it, the best thing to try first is examining the output logs of your app. This will tell you whether the app is configured correctly (like can the plugin find your release channel public ID?), if the app is able to reach the server, if an available update is being discovered, if the update is being successfully downloaded/installed, etc. We want to continue improving the logging to be as intuitive/comprehensive as possible, so please [let us know](mailto:support@appzung.com) if you find it to be confusing or missing anything.
262
+ The `withCodePush`/`sync` methods include a lot of diagnostic logging out-of-the-box, so if you're encountering an issue when using it, the best thing to try first is examining the output logs of your app. This will tell you whether the app is configured correctly (like can the plugin find your release channel public ID?), if the app is able to reach the server, if an available update is being discovered, if the update is being successfully downloaded/installed, etc. We want to continue improving the logging to be as intuitive/comprehensive as possible, so please [let us know](mailto:support@appzung.com) if you find it to be confusing or missing anything.
262
263
 
263
264
  Start up the Chrome DevTools Console, the Xcode Console (iOS) and/or ADB logcat (Android), and look for messages which are prefixed with `[CodePush]`.
264
265
 
@@ -274,12 +275,13 @@ Note that by default, React Native logs are disabled on iOS in release builds, s
274
275
 
275
276
  Now you'll be able to see CodePush logs in either debug or release mode, on both iOS or Android. If examining the logs don't provide an indication of the issue, please refer to the following common issues for additional resolution ideas:
276
277
 
277
- | Issue / Symptom | Possible Solution |
278
- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
279
- | Compilation Error | Clean your build folders and double-check that your version of React Native is [compatible](#compatibility-table) with the CodePush version you are using. |
280
- | Network timeout / hang when calling `sync` or `checkForUpdate` in the iOS Simulator | Try resetting the simulator by selecting the `Simulator -> Reset Content and Settings..` menu item, and then re-running your app. |
281
- | Server responds with a `404` when calling `sync` or `checkForUpdate` | Double-check that the release channel public ID you added to your `Info.plist` (iOS), `strings.xml` or `app/build.gradle` (Android) or that you're passing to `sync`/`checkForUpdate`, is in fact correct. You can run `appzung release-channels list` to view the correct public ID for your app release channel. |
282
- | Update not being discovered | Double-check that the version of your running app (like `1.0.0`) matches the version you specified when releasing the update to CodePush. Additionally, make sure that you are releasing to the same release channel that your app is configured to sync with. |
283
- | Update not being displayed after restart | If you're not using the withCodePush HOC or calling `sync` on app start (like within `componentDidMount` of your root component), then you need to explicitly call `notifyAppReady` on app start, otherwise, the plugin will think your update failed and roll it back. |
284
- | I've released an update for iOS but my Android app also shows an update and it breaks it | Be sure you have different release channels for each platform in order to receive updates correctly |
285
- | I've released new update but changes are not reflected | Be sure that you are running app in modes other than Debug. In Debug mode, React Native app always downloads JS bundle generated by packager, so JS bundle downloaded by CodePush does not apply. |
278
+ | Issue / Symptom | Possible Solution |
279
+ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
280
+ | Compilation Error | Clean your build folders and double-check that your version of React Native is [compatible](#compatibility-table) with the CodePush version you are using. |
281
+ | Network timeout / hang when calling `sync` or `checkForUpdate` in the iOS Simulator | Try resetting the simulator by selecting the `Simulator -> Reset Content and Settings..` menu item, and then re-running your app. |
282
+ | Server responds with a `404` when calling `sync` or `checkForUpdate` | Double-check that the release channel public ID you added to your `Info.plist` (iOS), `strings.xml` or `app/build.gradle` (Android) or that you're passing to `sync`/`checkForUpdate`, is in fact correct. You can run `appzung release-channels list` to view the correct public ID for your app release channel. |
283
+ | Update not being discovered | Double-check that the version of your running app (like `1.0.0`) matches the version you specified when releasing the update to CodePush. Additionally, make sure that you are releasing to the same release channel that your app is configured to sync with. |
284
+ | Update not being displayed after restart | If you're not using the withCodePush HOC or calling `sync` on app start (like within `componentDidMount` of your root component), then you need to explicitly call `notifyAppReady` on app start, otherwise, the plugin will think your update failed and roll it back. |
285
+ | I've released an update for iOS but my Android app also shows an update and it breaks it | Be sure you have different release channels for each platform in order to receive updates correctly |
286
+ | I've released new update but changes are not reflected | Be sure that you are running app in modes other than Debug. In Debug mode, React Native app always downloads JS bundle generated by packager, so JS bundle downloaded by CodePush does not apply. |
287
+ | Android compilation fails after migrating to AppZung with error "Task :app:checkReleaseAarMetadata FAILED A problem was found with the configuration of task ':app:checkReleaseAarMetadata' (type 'CheckAarMetadataTask')". | In `android/settings.gradle` remove the lines about CodePush. Be sure to read the other [migration steps](./docs/migrating-to-v10.md) carefully to review if you missed any others. |
@@ -20,6 +20,11 @@
20
20
  -keepclassmembers class com.facebook.react.ReactInstanceManager {
21
21
  private final ** mBundleLoader;
22
22
  }
23
+ -keepclassmembers class com.facebook.react.runtime.ReactHostImpl {
24
+ private final ** mReactHostDelegate;
25
+ }
26
+ -keep interface com.facebook.react.runtime.ReactHostDelegate { *; }
27
+ -keep class * implements com.facebook.react.runtime.ReactHostDelegate { *; }
23
28
 
24
29
  # Can't find referenced class org.bouncycastle.**
25
30
  -dontwarn com.nimbusds.jose.**
@@ -100,6 +100,9 @@ public class CodePush implements ReactPackage {
100
100
  }
101
101
 
102
102
  String serverUrlFromStrings = getCustomPropertyFromStringsIfExist("ServerUrl");
103
+ if (serverUrlFromStrings == null) {
104
+ serverUrlFromStrings = getCustomPropertyFromStringsIfExist("ServerURL");
105
+ }
103
106
  if (serverUrlFromStrings != null) {
104
107
  CodePushUtils.log("Executing CodePush with a custom server URL.");
105
108
  mServerUrl = serverUrlFromStrings;
@@ -200,6 +203,7 @@ public class CodePush implements ReactPackage {
200
203
 
201
204
  public static String getJSBundleFile(String assetsBundleFileName) {
202
205
  if (mCurrentInstance == null) {
206
+ CodePushUtils.log("A CodePush instance has not been created yet. Have you added it to your app's list of ReactPackages?");
203
207
  throw new CodePushNotInitializedException("A CodePush instance has not been created yet. Have you added it to your app's list of ReactPackages?");
204
208
  }
205
209
 
@@ -32,4 +32,6 @@ public class CodePushConstants {
32
32
  public static final String LATEST_ROLLBACK_TIME_KEY = "time";
33
33
  public static final String LATEST_ROLLBACK_COUNT_KEY = "count";
34
34
  public static final String CLIENT_UNIQUE_ID_KEY = "clientUniqueId";
35
+ public static final String TELEMETRY_ENABLED_KEY = "telemetryEnabled";
36
+ public static final String DATA_TRANSMISSION_ENABLED_KEY = "dataTransmissionEnabled";
35
37
  }
@@ -5,6 +5,7 @@ import android.content.SharedPreferences;
5
5
  import android.os.AsyncTask;
6
6
  import android.os.Handler;
7
7
  import android.os.Looper;
8
+ import android.view.Choreographer;
8
9
  import android.view.View;
9
10
 
10
11
  import androidx.annotation.OptIn;
@@ -24,7 +25,6 @@ import com.facebook.react.bridge.ReadableMap;
24
25
  import com.facebook.react.bridge.WritableMap;
25
26
  import com.facebook.react.common.annotations.UnstableReactNativeAPI;
26
27
  import com.facebook.react.devsupport.interfaces.DevSupportManager;
27
- import com.facebook.react.modules.core.ChoreographerCompat;
28
28
  import com.facebook.react.modules.core.DeviceEventManagerModule;
29
29
  import com.facebook.react.modules.core.ReactChoreographer;
30
30
  import com.facebook.react.modules.debug.interfaces.DeveloperSettings;
@@ -49,6 +49,9 @@ import java.util.UUID;
49
49
  public class CodePushNativeModule extends BaseJavaModule {
50
50
  private String mBinaryContentsHash = null;
51
51
  private String mClientUniqueId = null;
52
+ private boolean mTelemetryEnabled = true;
53
+ private boolean mDataTransmissionEnabled = true;
54
+ private boolean mIsExpoApp = false;
52
55
  private LifecycleEventListener mLifecycleEventListener = null;
53
56
  private int mMinimumBackgroundDuration = 0;
54
57
 
@@ -69,6 +72,8 @@ public class CodePushNativeModule extends BaseJavaModule {
69
72
  mTelemetryManager = codePushTelemetryManager;
70
73
  mUpdateManager = codePushUpdateManager;
71
74
 
75
+ mIsExpoApp = ExpoUtils.detectExpoEnvironment(reactContext);
76
+
72
77
  // Initialize module state while we have a reference to the current context.
73
78
  mBinaryContentsHash = CodePushUpdateUtils.getHashForBinaryContents(reactContext, mCodePush.isDebugMode());
74
79
 
@@ -78,6 +83,28 @@ public class CodePushNativeModule extends BaseJavaModule {
78
83
  mClientUniqueId = UUID.randomUUID().toString();
79
84
  preferences.edit().putString(CodePushConstants.CLIENT_UNIQUE_ID_KEY, mClientUniqueId).apply();
80
85
  }
86
+
87
+ if (preferences.contains(CodePushConstants.TELEMETRY_ENABLED_KEY)) {
88
+ mTelemetryEnabled = preferences.getBoolean(CodePushConstants.TELEMETRY_ENABLED_KEY, true);
89
+ } else {
90
+ int defaultTelemetryEnabledResId = reactContext.getResources().getIdentifier("CodePushDefaultTelemetryEnabled", "bool", reactContext.getPackageName());
91
+ if (defaultTelemetryEnabledResId != 0) {
92
+ mTelemetryEnabled = reactContext.getResources().getBoolean(defaultTelemetryEnabledResId);
93
+ } else {
94
+ mTelemetryEnabled = true;
95
+ }
96
+ }
97
+
98
+ if (preferences.contains(CodePushConstants.DATA_TRANSMISSION_ENABLED_KEY)) {
99
+ mDataTransmissionEnabled = preferences.getBoolean(CodePushConstants.DATA_TRANSMISSION_ENABLED_KEY, true);
100
+ } else {
101
+ int defaultDataTransmissionEnabledResId = reactContext.getResources().getIdentifier("CodePushDefaultDataTransmissionEnabled", "bool", reactContext.getPackageName());
102
+ if (defaultDataTransmissionEnabledResId != 0) {
103
+ mDataTransmissionEnabled = reactContext.getResources().getBoolean(defaultDataTransmissionEnabledResId);
104
+ } else {
105
+ mDataTransmissionEnabled = true;
106
+ }
107
+ }
81
108
  }
82
109
 
83
110
  @Override
@@ -186,8 +213,11 @@ public class CodePushNativeModule extends BaseJavaModule {
186
213
 
187
214
  String latestJSBundleFile = mCodePush.getJSBundleFileInternal(mCodePush.getAssetsBundleFileName());
188
215
 
189
- // #2) Update the locally stored JS bundle file path
190
- setJSBundle(getReactHostDelegate((ReactHostImpl) reactHost), latestJSBundleFile);
216
+ // if expo and new arch this is unnecessary, see https://github.com/expo/expo/blob/8113ce44edaef0311e2daff3ab1a63b9731d2d6c/packages/expo-updates/android/src/main/java/expo/modules/updates/procedures/RelaunchProcedure.kt#L148
217
+ if (!mIsExpoApp) {
218
+ // #2) Update the locally stored JS bundle file path
219
+ setJSBundle(getReactHostDelegate((ReactHostImpl) reactHost), latestJSBundleFile);
220
+ }
191
221
 
192
222
  // #3) Get the context creation method
193
223
  try {
@@ -438,7 +468,7 @@ public class CodePushNativeModule extends BaseJavaModule {
438
468
  getReactApplicationContext().runOnUiQueueThread(new Runnable() {
439
469
  @Override
440
470
  public void run() {
441
- ReactChoreographer.getInstance().postFrameCallback(ReactChoreographer.CallbackType.TIMERS_EVENTS, new ChoreographerCompat.FrameCallback() {
471
+ ReactChoreographer.getInstance().postFrameCallback(ReactChoreographer.CallbackType.TIMERS_EVENTS, new Choreographer.FrameCallback() {
442
472
  @Override
443
473
  public void doFrame(long frameTimeNanos) {
444
474
  if (!latestDownloadProgress.isCompleted()) {
@@ -485,6 +515,8 @@ public class CodePushNativeModule extends BaseJavaModule {
485
515
  configMap.putString("clientUniqueId", mClientUniqueId);
486
516
  configMap.putString("releaseChannelPublicId", mCodePush.getReleaseChannelPublicId());
487
517
  configMap.putString("serverUrl", mCodePush.getServerUrl());
518
+ configMap.putBoolean("telemetryEnabled", mTelemetryEnabled);
519
+ configMap.putBoolean("dataTransmissionEnabled", mDataTransmissionEnabled);
488
520
 
489
521
  // The binary hash may be null in debug builds
490
522
  if (mBinaryContentsHash != null) {
@@ -820,6 +852,56 @@ public class CodePushNativeModule extends BaseJavaModule {
820
852
  mCodePush.clearUpdates();
821
853
  }
822
854
 
855
+ @ReactMethod
856
+ public void resetClientUniqueId(Promise promise) {
857
+ try {
858
+ String newClientUniqueId = UUID.randomUUID().toString();
859
+ SharedPreferences preferences = mCodePush.getContext().getSharedPreferences(CodePushConstants.CODE_PUSH_PREFERENCES, 0);
860
+ preferences.edit().putString(CodePushConstants.CLIENT_UNIQUE_ID_KEY, newClientUniqueId).apply();
861
+ mClientUniqueId = newClientUniqueId;
862
+ promise.resolve(mClientUniqueId);
863
+ } catch (Exception e) {
864
+ CodePushUtils.log(e);
865
+ promise.reject(e);
866
+ }
867
+ }
868
+
869
+ @ReactMethod
870
+ public void setTelemetryEnabled(boolean enabled, Promise promise) {
871
+ try {
872
+ SharedPreferences preferences = mCodePush.getContext().getSharedPreferences(CodePushConstants.CODE_PUSH_PREFERENCES, 0);
873
+ preferences.edit().putBoolean(CodePushConstants.TELEMETRY_ENABLED_KEY, enabled).apply();
874
+ mTelemetryEnabled = enabled;
875
+ promise.resolve(null);
876
+ } catch (Exception e) {
877
+ CodePushUtils.log(e);
878
+ promise.reject(e);
879
+ }
880
+ }
881
+
882
+ @ReactMethod
883
+ public void getTelemetryEnabled(Promise promise) {
884
+ promise.resolve(mTelemetryEnabled);
885
+ }
886
+
887
+ @ReactMethod
888
+ public void setDataTransmissionEnabled(boolean enabled, Promise promise) {
889
+ try {
890
+ SharedPreferences preferences = mCodePush.getContext().getSharedPreferences(CodePushConstants.CODE_PUSH_PREFERENCES, 0);
891
+ preferences.edit().putBoolean(CodePushConstants.DATA_TRANSMISSION_ENABLED_KEY, enabled).apply();
892
+ mDataTransmissionEnabled = enabled;
893
+ promise.resolve(null);
894
+ } catch (Exception e) {
895
+ CodePushUtils.log(e);
896
+ promise.reject(e);
897
+ }
898
+ }
899
+
900
+ @ReactMethod
901
+ public void getDataTransmissionEnabled(Promise promise) {
902
+ promise.resolve(mDataTransmissionEnabled);
903
+ }
904
+
823
905
  @ReactMethod
824
906
  public void addListener(String eventName) {
825
907
  // Set up any upstream listeners or background tasks as necessary
@@ -0,0 +1,22 @@
1
+ package com.appzung.codepush.react;
2
+
3
+ import com.facebook.react.bridge.ReactApplicationContext;
4
+
5
+ public class ExpoUtils {
6
+
7
+ /**
8
+ * Detects if the app is running in an Expo environment by checking for
9
+ * the presence of Expo's ReactNativeHostWrapper class.
10
+ *
11
+ * @param reactContext The React application context
12
+ * @return true if Expo environment is detected, false otherwise
13
+ */
14
+ public static boolean detectExpoEnvironment(ReactApplicationContext reactContext) {
15
+ try {
16
+ Class.forName("expo.modules.ReactNativeHostWrapper");
17
+ return true;
18
+ } catch (ClassNotFoundException e) {
19
+ return false;
20
+ }
21
+ }
22
+ }
@@ -63,12 +63,6 @@
63
63
  + (BOOL)isFailedHash:(NSString*)packageHash;
64
64
 
65
65
 
66
- /*
67
- * This method is used to get information about the latest rollback.
68
- * This information will be used to decide whether the application
69
- * should ignore the update or not.
70
- */
71
- + (NSDictionary*)getRollbackInfo;
72
66
  /*
73
67
  * This method is used to save information about the latest rollback.
74
68
  * This information will be used to decide whether the application
@@ -101,8 +95,11 @@
101
95
  @property (readonly) NSString *buildVersion;
102
96
  @property (readonly) NSDictionary *configuration;
103
97
  @property (copy) NSString *releaseChannelPublicId;
98
+ @property (readonly) NSString *clientUniqueId;
104
99
  @property (copy) NSString *serverURL;
105
100
  @property (copy) NSString *publicKey;
101
+ @property (nonatomic) BOOL telemetryEnabled;
102
+ @property (nonatomic) BOOL dataTransmissionEnabled;
106
103
 
107
104
  + (instancetype)current;
108
105
 
@@ -219,8 +216,16 @@ failCallback:(void (^)(NSError *err))failCallback;
219
216
 
220
217
  @end
221
218
 
219
+ #ifdef __cplusplus
220
+ extern "C" {
221
+ #endif
222
+
222
223
  void CPLog(NSString *formatString, ...);
223
224
 
225
+ #ifdef __cplusplus
226
+ }
227
+ #endif
228
+
224
229
  typedef NS_ENUM(NSInteger, CodePushInstallMode) {
225
230
  CodePushInstallModeImmediate,
226
231
  CodePushInstallModeOnNextRestart,