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