@appzung/react-native-code-push 10.0.0-rc1 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (320) hide show
  1. package/CodePush.podspec +1 -0
  2. package/LICENSE.md +2 -2
  3. package/README.md +74 -95
  4. package/android/app/build.gradle +62 -18
  5. package/android/app/src/main/AndroidManifest.xml +2 -3
  6. package/android/app/src/main/AndroidManifestNew.xml +3 -0
  7. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePush.java +21 -89
  8. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushNativeModule.java +32 -3
  9. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUpdateManager.java +2 -2
  10. package/android/build.gradle +1 -11
  11. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  12. package/android/gradle.properties +4 -20
  13. package/docs/advanced-usage.md +2 -2
  14. package/docs/api-android.md +12 -10
  15. package/docs/api-ios.md +5 -5
  16. package/docs/api-js.md +180 -178
  17. package/docs/code-signing.md +62 -0
  18. package/docs/migrating-to-v10.md +31 -0
  19. package/docs/setup-android.md +52 -79
  20. package/docs/setup-ios.md +31 -28
  21. package/docs/setup-windows.md +1 -0
  22. package/ios/CodePush/CodePush.m +13 -57
  23. package/lib/commonjs/CodePush.js +90 -0
  24. package/lib/commonjs/CodePush.js.map +1 -0
  25. package/lib/commonjs/allowRestart.js +12 -0
  26. package/lib/commonjs/allowRestart.js.map +1 -0
  27. package/lib/commonjs/checkForUpdates.js +105 -0
  28. package/lib/commonjs/checkForUpdates.js.map +1 -0
  29. package/lib/commonjs/clearUpdates.js +15 -0
  30. package/lib/commonjs/clearUpdates.js.map +1 -0
  31. package/lib/commonjs/disallowRestart.js +12 -0
  32. package/lib/commonjs/disallowRestart.js.map +1 -0
  33. package/lib/commonjs/enums/CheckFrequency.enum.js +25 -0
  34. package/lib/commonjs/enums/CheckFrequency.enum.js.map +1 -0
  35. package/lib/commonjs/enums/DeploymentStatus.enum.js +21 -0
  36. package/lib/commonjs/enums/DeploymentStatus.enum.js.map +1 -0
  37. package/lib/commonjs/enums/InstallMode.enum.js +35 -0
  38. package/lib/commonjs/enums/InstallMode.enum.js.map +1 -0
  39. package/lib/commonjs/enums/SyncStatus.enum.js +53 -0
  40. package/lib/commonjs/enums/SyncStatus.enum.js.map +1 -0
  41. package/lib/commonjs/enums/UpdateState.enum.js +29 -0
  42. package/lib/commonjs/enums/UpdateState.enum.js.map +1 -0
  43. package/lib/commonjs/getUpdateMetadata.js +25 -0
  44. package/lib/commonjs/getUpdateMetadata.js.map +1 -0
  45. package/lib/commonjs/index.js +195 -0
  46. package/lib/commonjs/index.js.map +1 -0
  47. package/lib/commonjs/internals/AcquisitionSdk.js +9 -0
  48. package/lib/commonjs/internals/AcquisitionSdk.js.map +1 -0
  49. package/lib/commonjs/internals/LocalPackageImplementation.js +29 -0
  50. package/lib/commonjs/internals/LocalPackageImplementation.js.map +1 -0
  51. package/lib/commonjs/internals/NativeRNAppZungCodePushModule.js +8 -0
  52. package/lib/commonjs/internals/NativeRNAppZungCodePushModule.js.map +1 -0
  53. package/lib/commonjs/internals/RNAppZungCodePushModuleSpec.js +6 -0
  54. package/lib/commonjs/internals/RNAppZungCodePushModuleSpec.js.map +1 -0
  55. package/lib/commonjs/internals/RemotePackageImplementation.js +49 -0
  56. package/lib/commonjs/internals/RemotePackageImplementation.js.map +1 -0
  57. package/lib/commonjs/internals/getConfiguration.js +15 -0
  58. package/lib/commonjs/internals/getConfiguration.js.map +1 -0
  59. package/lib/commonjs/internals/getCurrentPackage.js +12 -0
  60. package/lib/commonjs/internals/getCurrentPackage.js.map +1 -0
  61. package/lib/commonjs/internals/getPromisifiedSdk.js +49 -0
  62. package/lib/commonjs/internals/getPromisifiedSdk.js.map +1 -0
  63. package/lib/commonjs/internals/shouldUpdateBeIgnored.js +62 -0
  64. package/lib/commonjs/internals/shouldUpdateBeIgnored.js.map +1 -0
  65. package/lib/commonjs/internals/types.js +6 -0
  66. package/lib/commonjs/internals/types.js.map +1 -0
  67. package/lib/commonjs/internals/utils/log.js +11 -0
  68. package/lib/commonjs/internals/utils/log.js.map +1 -0
  69. package/lib/commonjs/internals/utils/request-fetch-adapter.js +50 -0
  70. package/lib/commonjs/internals/utils/request-fetch-adapter.js.map +1 -0
  71. package/lib/commonjs/internals/version.js +9 -0
  72. package/lib/commonjs/internals/version.js.map +1 -0
  73. package/lib/commonjs/notifyAppReady.js +83 -0
  74. package/lib/commonjs/notifyAppReady.js.map +1 -0
  75. package/lib/commonjs/reactNative.d.js +2 -0
  76. package/lib/commonjs/reactNative.d.js.map +1 -0
  77. package/lib/commonjs/restartApp.js +16 -0
  78. package/lib/commonjs/restartApp.js.map +1 -0
  79. package/lib/commonjs/sync.js +219 -0
  80. package/lib/commonjs/sync.js.map +1 -0
  81. package/lib/commonjs/types.js +6 -0
  82. package/lib/commonjs/types.js.map +1 -0
  83. package/lib/module/CodePush.js +84 -0
  84. package/lib/module/CodePush.js.map +1 -0
  85. package/lib/module/allowRestart.js +9 -0
  86. package/lib/module/allowRestart.js.map +1 -0
  87. package/lib/module/checkForUpdates.js +101 -0
  88. package/lib/module/checkForUpdates.js.map +1 -0
  89. package/lib/module/clearUpdates.js +12 -0
  90. package/lib/module/clearUpdates.js.map +1 -0
  91. package/lib/module/disallowRestart.js +9 -0
  92. package/lib/module/disallowRestart.js.map +1 -0
  93. package/lib/module/enums/CheckFrequency.enum.js +21 -0
  94. package/lib/module/enums/CheckFrequency.enum.js.map +1 -0
  95. package/lib/module/enums/DeploymentStatus.enum.js +17 -0
  96. package/lib/module/enums/DeploymentStatus.enum.js.map +1 -0
  97. package/lib/module/enums/InstallMode.enum.js +32 -0
  98. package/lib/module/enums/InstallMode.enum.js.map +1 -0
  99. package/lib/module/enums/SyncStatus.enum.js +49 -0
  100. package/lib/module/enums/SyncStatus.enum.js.map +1 -0
  101. package/lib/module/enums/UpdateState.enum.js +26 -0
  102. package/lib/module/enums/UpdateState.enum.js.map +1 -0
  103. package/lib/module/getUpdateMetadata.js +21 -0
  104. package/lib/module/getUpdateMetadata.js.map +1 -0
  105. package/lib/module/index.js +19 -0
  106. package/lib/module/index.js.map +1 -0
  107. package/lib/module/internals/AcquisitionSdk.js +5 -0
  108. package/lib/module/internals/AcquisitionSdk.js.map +1 -0
  109. package/lib/module/internals/LocalPackageImplementation.js +24 -0
  110. package/lib/module/internals/LocalPackageImplementation.js.map +1 -0
  111. package/lib/module/internals/NativeRNAppZungCodePushModule.js +4 -0
  112. package/lib/module/internals/NativeRNAppZungCodePushModule.js.map +1 -0
  113. package/lib/module/internals/RNAppZungCodePushModuleSpec.js +4 -0
  114. package/lib/module/internals/RNAppZungCodePushModuleSpec.js.map +1 -0
  115. package/lib/module/internals/RemotePackageImplementation.js +44 -0
  116. package/lib/module/internals/RemotePackageImplementation.js.map +1 -0
  117. package/lib/module/internals/getConfiguration.js +11 -0
  118. package/lib/module/internals/getConfiguration.js.map +1 -0
  119. package/lib/module/internals/getCurrentPackage.js +8 -0
  120. package/lib/module/internals/getCurrentPackage.js.map +1 -0
  121. package/lib/module/internals/getPromisifiedSdk.js +45 -0
  122. package/lib/module/internals/getPromisifiedSdk.js.map +1 -0
  123. package/lib/module/internals/shouldUpdateBeIgnored.js +58 -0
  124. package/lib/module/internals/shouldUpdateBeIgnored.js.map +1 -0
  125. package/lib/module/internals/types.js +4 -0
  126. package/lib/module/internals/types.js.map +1 -0
  127. package/lib/module/internals/utils/log.js +7 -0
  128. package/lib/module/internals/utils/log.js.map +1 -0
  129. package/lib/module/internals/utils/request-fetch-adapter.js +46 -0
  130. package/lib/module/internals/utils/request-fetch-adapter.js.map +1 -0
  131. package/lib/module/internals/version.js +5 -0
  132. package/lib/module/internals/version.js.map +1 -0
  133. package/lib/module/notifyAppReady.js +79 -0
  134. package/lib/module/notifyAppReady.js.map +1 -0
  135. package/lib/module/reactNative.d.js +2 -0
  136. package/lib/module/reactNative.d.js.map +1 -0
  137. package/lib/module/restartApp.js +13 -0
  138. package/lib/module/restartApp.js.map +1 -0
  139. package/lib/module/sync.js +215 -0
  140. package/lib/module/sync.js.map +1 -0
  141. package/lib/module/types.js +4 -0
  142. package/lib/module/types.js.map +1 -0
  143. package/lib/typescript/commonjs/package.json +1 -0
  144. package/lib/typescript/commonjs/src/CodePush.d.ts +24 -0
  145. package/lib/typescript/commonjs/src/CodePush.d.ts.map +1 -0
  146. package/lib/typescript/commonjs/src/allowRestart.d.ts +5 -0
  147. package/lib/typescript/commonjs/src/allowRestart.d.ts.map +1 -0
  148. package/lib/typescript/commonjs/src/checkForUpdates.d.ts +9 -0
  149. package/lib/typescript/commonjs/src/checkForUpdates.d.ts.map +1 -0
  150. package/lib/typescript/commonjs/src/clearUpdates.d.ts +8 -0
  151. package/lib/typescript/commonjs/src/clearUpdates.d.ts.map +1 -0
  152. package/lib/typescript/commonjs/src/disallowRestart.d.ts +5 -0
  153. package/lib/typescript/commonjs/src/disallowRestart.d.ts.map +1 -0
  154. package/lib/typescript/commonjs/src/enums/CheckFrequency.enum.d.ts +18 -0
  155. package/lib/typescript/commonjs/src/enums/CheckFrequency.enum.d.ts.map +1 -0
  156. package/lib/typescript/commonjs/src/enums/DeploymentStatus.enum.d.ts +14 -0
  157. package/lib/typescript/commonjs/src/enums/DeploymentStatus.enum.d.ts.map +1 -0
  158. package/lib/typescript/commonjs/src/enums/InstallMode.enum.d.ts +27 -0
  159. package/lib/typescript/commonjs/src/enums/InstallMode.enum.d.ts.map +1 -0
  160. package/lib/typescript/commonjs/src/enums/SyncStatus.enum.d.ts +46 -0
  161. package/lib/typescript/commonjs/src/enums/SyncStatus.enum.d.ts.map +1 -0
  162. package/lib/typescript/commonjs/src/enums/UpdateState.enum.d.ts +21 -0
  163. package/lib/typescript/commonjs/src/enums/UpdateState.enum.d.ts.map +1 -0
  164. package/lib/typescript/commonjs/src/getUpdateMetadata.d.ts +9 -0
  165. package/lib/typescript/commonjs/src/getUpdateMetadata.d.ts.map +1 -0
  166. package/lib/typescript/commonjs/src/index.d.ts +17 -0
  167. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  168. package/lib/typescript/commonjs/src/internals/AcquisitionSdk.d.ts +3 -0
  169. package/lib/typescript/commonjs/src/internals/AcquisitionSdk.d.ts.map +1 -0
  170. package/lib/typescript/commonjs/src/internals/LocalPackageImplementation.d.ts +17 -0
  171. package/lib/typescript/commonjs/src/internals/LocalPackageImplementation.d.ts.map +1 -0
  172. package/lib/typescript/commonjs/src/internals/NativeRNAppZungCodePushModule.d.ts +3 -0
  173. package/lib/typescript/commonjs/src/internals/NativeRNAppZungCodePushModule.d.ts.map +1 -0
  174. package/lib/typescript/commonjs/src/internals/RNAppZungCodePushModuleSpec.d.ts +36 -0
  175. package/lib/typescript/commonjs/src/internals/RNAppZungCodePushModuleSpec.d.ts.map +1 -0
  176. package/lib/typescript/commonjs/src/internals/RemotePackageImplementation.d.ts +18 -0
  177. package/lib/typescript/commonjs/src/internals/RemotePackageImplementation.d.ts.map +1 -0
  178. package/lib/typescript/commonjs/src/internals/getConfiguration.d.ts +3 -0
  179. package/lib/typescript/commonjs/src/internals/getConfiguration.d.ts.map +1 -0
  180. package/lib/typescript/commonjs/src/internals/getCurrentPackage.d.ts +2 -0
  181. package/lib/typescript/commonjs/src/internals/getCurrentPackage.d.ts.map +1 -0
  182. package/lib/typescript/commonjs/src/internals/getPromisifiedSdk.d.ts +13 -0
  183. package/lib/typescript/commonjs/src/internals/getPromisifiedSdk.d.ts.map +1 -0
  184. package/lib/typescript/commonjs/src/internals/shouldUpdateBeIgnored.d.ts +3 -0
  185. package/lib/typescript/commonjs/src/internals/shouldUpdateBeIgnored.d.ts.map +1 -0
  186. package/lib/typescript/commonjs/src/internals/types.d.ts +16 -0
  187. package/lib/typescript/commonjs/src/internals/types.d.ts.map +1 -0
  188. package/lib/typescript/commonjs/src/internals/utils/log.d.ts +2 -0
  189. package/lib/typescript/commonjs/src/internals/utils/log.d.ts.map +1 -0
  190. package/lib/typescript/commonjs/src/internals/utils/request-fetch-adapter.d.ts +3 -0
  191. package/lib/typescript/commonjs/src/internals/utils/request-fetch-adapter.d.ts.map +1 -0
  192. package/lib/typescript/commonjs/src/internals/version.d.ts +2 -0
  193. package/lib/typescript/commonjs/src/internals/version.d.ts.map +1 -0
  194. package/lib/typescript/commonjs/src/notifyAppReady.d.ts +6 -0
  195. package/lib/typescript/commonjs/src/notifyAppReady.d.ts.map +1 -0
  196. package/lib/typescript/commonjs/src/restartApp.d.ts +7 -0
  197. package/lib/typescript/commonjs/src/restartApp.d.ts.map +1 -0
  198. package/lib/typescript/commonjs/src/sync.d.ts +17 -0
  199. package/lib/typescript/commonjs/src/sync.d.ts.map +1 -0
  200. package/lib/typescript/commonjs/src/types.d.ts +196 -0
  201. package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
  202. package/lib/typescript/module/package.json +1 -0
  203. package/lib/typescript/module/src/CodePush.d.ts +24 -0
  204. package/lib/typescript/module/src/CodePush.d.ts.map +1 -0
  205. package/lib/typescript/module/src/allowRestart.d.ts +5 -0
  206. package/lib/typescript/module/src/allowRestart.d.ts.map +1 -0
  207. package/lib/typescript/module/src/checkForUpdates.d.ts +9 -0
  208. package/lib/typescript/module/src/checkForUpdates.d.ts.map +1 -0
  209. package/lib/typescript/module/src/clearUpdates.d.ts +8 -0
  210. package/lib/typescript/module/src/clearUpdates.d.ts.map +1 -0
  211. package/lib/typescript/module/src/disallowRestart.d.ts +5 -0
  212. package/lib/typescript/module/src/disallowRestart.d.ts.map +1 -0
  213. package/lib/typescript/module/src/enums/CheckFrequency.enum.d.ts +18 -0
  214. package/lib/typescript/module/src/enums/CheckFrequency.enum.d.ts.map +1 -0
  215. package/lib/typescript/module/src/enums/DeploymentStatus.enum.d.ts +14 -0
  216. package/lib/typescript/module/src/enums/DeploymentStatus.enum.d.ts.map +1 -0
  217. package/lib/typescript/module/src/enums/InstallMode.enum.d.ts +27 -0
  218. package/lib/typescript/module/src/enums/InstallMode.enum.d.ts.map +1 -0
  219. package/lib/typescript/module/src/enums/SyncStatus.enum.d.ts +46 -0
  220. package/lib/typescript/module/src/enums/SyncStatus.enum.d.ts.map +1 -0
  221. package/lib/typescript/module/src/enums/UpdateState.enum.d.ts +21 -0
  222. package/lib/typescript/module/src/enums/UpdateState.enum.d.ts.map +1 -0
  223. package/lib/typescript/module/src/getUpdateMetadata.d.ts +9 -0
  224. package/lib/typescript/module/src/getUpdateMetadata.d.ts.map +1 -0
  225. package/lib/typescript/module/src/index.d.ts +17 -0
  226. package/lib/typescript/module/src/index.d.ts.map +1 -0
  227. package/lib/typescript/module/src/internals/AcquisitionSdk.d.ts +3 -0
  228. package/lib/typescript/module/src/internals/AcquisitionSdk.d.ts.map +1 -0
  229. package/lib/typescript/module/src/internals/LocalPackageImplementation.d.ts +17 -0
  230. package/lib/typescript/module/src/internals/LocalPackageImplementation.d.ts.map +1 -0
  231. package/lib/typescript/module/src/internals/NativeRNAppZungCodePushModule.d.ts +3 -0
  232. package/lib/typescript/module/src/internals/NativeRNAppZungCodePushModule.d.ts.map +1 -0
  233. package/lib/typescript/module/src/internals/RNAppZungCodePushModuleSpec.d.ts +36 -0
  234. package/lib/typescript/module/src/internals/RNAppZungCodePushModuleSpec.d.ts.map +1 -0
  235. package/lib/typescript/module/src/internals/RemotePackageImplementation.d.ts +18 -0
  236. package/lib/typescript/module/src/internals/RemotePackageImplementation.d.ts.map +1 -0
  237. package/lib/typescript/module/src/internals/getConfiguration.d.ts +3 -0
  238. package/lib/typescript/module/src/internals/getConfiguration.d.ts.map +1 -0
  239. package/lib/typescript/module/src/internals/getCurrentPackage.d.ts +2 -0
  240. package/lib/typescript/module/src/internals/getCurrentPackage.d.ts.map +1 -0
  241. package/lib/typescript/module/src/internals/getPromisifiedSdk.d.ts +13 -0
  242. package/lib/typescript/module/src/internals/getPromisifiedSdk.d.ts.map +1 -0
  243. package/lib/typescript/module/src/internals/shouldUpdateBeIgnored.d.ts +3 -0
  244. package/lib/typescript/module/src/internals/shouldUpdateBeIgnored.d.ts.map +1 -0
  245. package/lib/typescript/module/src/internals/types.d.ts +16 -0
  246. package/lib/typescript/module/src/internals/types.d.ts.map +1 -0
  247. package/lib/typescript/module/src/internals/utils/log.d.ts +2 -0
  248. package/lib/typescript/module/src/internals/utils/log.d.ts.map +1 -0
  249. package/lib/typescript/module/src/internals/utils/request-fetch-adapter.d.ts +3 -0
  250. package/lib/typescript/module/src/internals/utils/request-fetch-adapter.d.ts.map +1 -0
  251. package/lib/typescript/module/src/internals/version.d.ts +2 -0
  252. package/lib/typescript/module/src/internals/version.d.ts.map +1 -0
  253. package/lib/typescript/module/src/notifyAppReady.d.ts +6 -0
  254. package/lib/typescript/module/src/notifyAppReady.d.ts.map +1 -0
  255. package/lib/typescript/module/src/restartApp.d.ts +7 -0
  256. package/lib/typescript/module/src/restartApp.d.ts.map +1 -0
  257. package/lib/typescript/module/src/sync.d.ts +17 -0
  258. package/lib/typescript/module/src/sync.d.ts.map +1 -0
  259. package/lib/typescript/module/src/types.d.ts +196 -0
  260. package/lib/typescript/module/src/types.d.ts.map +1 -0
  261. package/package.json +58 -11
  262. package/react-native.config.js +8 -8
  263. package/src/CodePush.tsx +108 -0
  264. package/src/allowRestart.ts +6 -0
  265. package/src/checkForUpdates.ts +109 -0
  266. package/src/clearUpdates.ts +9 -0
  267. package/src/disallowRestart.ts +6 -0
  268. package/src/enums/CheckFrequency.enum.ts +19 -0
  269. package/src/enums/DeploymentStatus.enum.ts +14 -0
  270. package/src/enums/InstallMode.enum.ts +31 -0
  271. package/src/enums/SyncStatus.enum.ts +53 -0
  272. package/src/enums/UpdateState.enum.ts +24 -0
  273. package/src/getUpdateMetadata.ts +23 -0
  274. package/src/index.ts +18 -0
  275. package/src/internals/AcquisitionSdk.ts +3 -0
  276. package/src/internals/LocalPackageImplementation.ts +45 -0
  277. package/src/internals/NativeRNAppZungCodePushModule.ts +3 -0
  278. package/src/internals/RNAppZungCodePushModuleSpec.ts +54 -0
  279. package/src/internals/RemotePackageImplementation.ts +69 -0
  280. package/src/internals/getConfiguration.ts +12 -0
  281. package/src/internals/getCurrentPackage.ts +6 -0
  282. package/src/internals/getPromisifiedSdk.ts +72 -0
  283. package/src/internals/shouldUpdateBeIgnored.ts +76 -0
  284. package/src/internals/types.ts +18 -0
  285. package/{logging.js → src/internals/utils/log.ts} +1 -3
  286. package/src/internals/utils/request-fetch-adapter.ts +58 -0
  287. package/src/internals/version.ts +2 -0
  288. package/src/notifyAppReady.ts +94 -0
  289. package/src/reactNative.d.ts +34 -0
  290. package/src/restartApp.ts +10 -0
  291. package/src/sync.ts +272 -0
  292. package/src/types.ts +237 -0
  293. package/tsconfig.build.json +4 -0
  294. package/tsconfig.json +29 -12
  295. package/AlertAdapter.js +0 -24
  296. package/CONTRIBUTING.md +0 -134
  297. package/CodePush.js +0 -674
  298. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +0 -37
  299. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushDialog.java +0 -102
  300. package/package-mixins.js +0 -68
  301. package/request-fetch-adapter.js +0 -52
  302. package/tslint.json +0 -32
  303. package/typings/react-native-code-push.d.ts +0 -455
  304. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushConstants.java +0 -0
  305. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushInstallMode.java +0 -0
  306. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushInvalidPublicKeyException.java +0 -0
  307. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushInvalidUpdateException.java +0 -0
  308. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushMalformedDataException.java +0 -0
  309. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushNotInitializedException.java +0 -0
  310. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushTelemetryManager.java +0 -0
  311. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUnknownException.java +0 -0
  312. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUpdateState.java +0 -0
  313. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUpdateUtils.java +0 -0
  314. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUtils.java +0 -0
  315. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/DownloadProgress.java +0 -0
  316. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/DownloadProgressCallback.java +0 -0
  317. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/FileUtils.java +0 -0
  318. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/ReactInstanceHolder.java +0 -0
  319. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/SettingsManager.java +0 -0
  320. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/TLSSocketFactory.java +0 -0
package/CodePush.podspec CHANGED
@@ -16,6 +16,7 @@ Pod::Spec.new do |s|
16
16
  s.library = 'z'
17
17
  s.source_files = 'ios/CodePush/*.{h,m}'
18
18
  s.public_header_files = ['ios/CodePush/CodePush.h']
19
+ s.pod_target_xcconfig = { "DEFINES_MODULE" => "YES" }
19
20
 
20
21
  # Note: Even though there are copy/pasted versions of some of these dependencies in the repo,
21
22
  # we explicitly let CocoaPods pull in the versions below so all dependencies are resolved and
package/LICENSE.md CHANGED
@@ -2,7 +2,7 @@ AppZung CodePush Plugin for React Native
2
2
 
3
3
  Copyright (c) Louis Lagrange and Louis Lagrange Consulting
4
4
 
5
- All rights reserved.
5
+ All rights reserved.
6
6
 
7
7
  MIT License
8
8
 
@@ -10,4 +10,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
10
10
 
11
11
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
12
 
13
- THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13
+ THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -1,26 +1,27 @@
1
1
  # React Native Module for AppZung CodePush
2
2
 
3
- * [AppZung](#appzung)
4
- * [How does it work?](#how-does-it-work)
5
- * [Getting started](#getting-started)
6
- * [iOS Setup](docs/setup-ios.md)
7
- * [Android Setup](docs/setup-android.md)
8
- * [Windows Setup](docs/setup-windows.md)
9
- * [Migrating to AppZung CodePush](#migrating-to-appzung-codepush)
10
- * [Compatibility table](#compatibility-table)
11
- * [Usage](#usage)
12
- * [Advanced usage](./docs/advanced-usage.md)
13
- * [Releasing updates](#releasing-updates)
14
- * [Store guidelines compliance](#store-guidelines-compliance)
15
- * [API Reference](#api-reference)
16
- * [Debugging / Troubleshooting](#debugging--troubleshooting)
3
+ - [AppZung](#appzung)
4
+ - [How does it work?](#how-does-it-work)
5
+ - [Getting started](#getting-started)
6
+ - [iOS Setup](docs/setup-ios.md)
7
+ - [Android Setup](docs/setup-android.md)
8
+ - [Windows Setup](docs/setup-windows.md)
9
+ - [Code signing](docs/code-signing.md)
10
+ - [Migrating to AppZung CodePush](#migrating-to-appzung-codepush)
11
+ - [Compatibility table](#compatibility-table)
12
+ - [Usage](#usage)
13
+ - [Advanced usage](./docs/advanced-usage.md)
14
+ - [Releasing updates](#releasing-updates)
15
+ - [Store guidelines compliance](#store-guidelines-compliance)
16
+ - [API Reference](#api-reference)
17
+ - [Debugging / Troubleshooting](#debugging--troubleshooting)
17
18
 
18
19
  ## AppZung
19
20
 
20
- AppZung is a robust solution for CodePush functionality, created in response to AppCenter's retirement.
21
- CodePush allows you to easily add a dynamic update experience to your React Native app(s).
21
+ [AppZung](https://appzung.com) is a robust solution for CodePush functionality, created in response to AppCenter's retirement.
22
+ CodePush allows you to easily add a dynamic update experience to your React Native apps.
22
23
 
23
- We will offer feature-parity with the original CodePush and introduce advanced capabilities in:
24
+ We offer feature-parity with the original CodePush and will introduce advanced capabilities in:
24
25
 
25
26
  - Hosting
26
27
  - Delivery
@@ -32,7 +33,7 @@ Currently, AppZung is used in production by several private clients, serving ove
32
33
 
33
34
  AppZung may or may not expand the scope beyond CodePush features in the future.
34
35
 
35
- It is not yet available publicly - Email hello@appzung.com to join the platform.
36
+ Join the platform now: login and subscribe on the [AppZung console](https://console.appzung.com).
36
37
 
37
38
  ## How does it work?
38
39
 
@@ -42,23 +43,25 @@ The CodePush plugin helps get product improvements in front of your end users in
42
43
 
43
44
  In order to ensure that your end users always have a functioning version of your app, the CodePush plugin maintains a copy of the previous update, so that in the event that you accidentally push an update which includes a crash, it can automatically roll back. This way, you can rest assured that your newfound release agility won't result in users becoming blocked before you have a chance to roll back on the server. It's a win-win-win!
44
45
 
45
- *Note: Any product changes which touch native code (e.g. modifying your `AppDelegate.mm`/`MainActivity.kt` file, adding a new plugin, or changing an image or video not using `require()` syntax) cannot be distributed via CodePush, and therefore, must be updated via the appropriate store(s).*
46
+ _Note: Any product changes which touch native code (e.g. modifying your `AppDelegate.mm`/`MainActivity.kt` file, adding a new plugin, or changing an image or video not using `require()` syntax) cannot be distributed via CodePush, and therefore, must be updated via the appropriate store(s)._
46
47
 
47
48
  ## Getting started
48
49
 
49
50
  If you are migrating from `react-native-code-push`, see below ["Migrating to AppZung CodePush"](#migrating-to-appzung-codepush).
50
51
 
52
+ Otherwise:
53
+
51
54
  ```shell
52
55
  npm install --save @appzung/react-native-code-push
53
56
  ```
54
57
 
55
- *NOTE: For Expo apps a plugin will be made available soon. In the meantime, you may eject.*
58
+ _NOTE: For Expo apps a plugin will be made available soon. In the meantime, you may eject._
56
59
 
57
60
  Then continue with installing the native module:
58
61
 
59
- * [iOS Setup](docs/setup-ios.md)
60
- * [Android Setup](docs/setup-android.md)
61
- * [Windows Setup](docs/setup-windows.md)
62
+ - [iOS Setup](docs/setup-ios.md)
63
+ - [Android Setup](docs/setup-android.md)
64
+ - [Windows Setup](docs/setup-windows.md)
62
65
 
63
66
  ## Migrating to AppZung CodePush
64
67
 
@@ -66,7 +69,7 @@ This `@appzung/react-native-code-push` package aims to be a drop-in replacement
66
69
 
67
70
  This package will be updated with new features, that will only be available on `@appzung/react-native-code-push` v10+ (not the original `react-native-code-push` module).
68
71
 
69
- This package is compatible with the new architecture on iOS (tested on 0.76) with the interop layer, but not yet on Android. We started some work, but we are not focusing on it right now since there is no demand from our private clients for the moment. Note that there is ongoing work by the community on the original `react-native-code-push` repository so we will be able to integrate this faster in case it gets finished.
72
+ This package is compatible with the new architecture (iOS and Android) on v11+.
70
73
 
71
74
  Windows (UWP) won't be actively supported on v10+ except if there is demand for it (it will get stuck at the basic features of CodePush v9). Please contact hello@appzung.com to help us assess this demand. Thank you for your understanding.
72
75
 
@@ -93,46 +96,22 @@ You may also use the versions that we published based on the versions v5-v9 with
93
96
 
94
97
  If you are less in a hurry, you can migrate to `@appzung/react-native-code-push` v10+ where we will add new features in the future and actively support the module.
95
98
 
96
- #### Switch to @appzung/react-native-code-push npm package
97
-
98
- 1. Replace `react-native-code-push` in your package.json with `@appzung/react-native-code-push`: `@appzung/react-native-code-push: "^10.0.0"`
99
- 2. Run `npm install` (or `yarn` depending on your project)
100
-
101
- #### Change your JS code
102
-
103
- 1. Replace every `react-native-code-push` imports with `@appzung/react-native-code-push` imports
104
- 2. (optional) If you use a jest global mock, move the mock from `__mocks__/react-native-code-push.ts` to `__mocks__/@appzung/react-native-code-push.ts`
105
- 3. (optional) If you use dynamic deployment assignation, rename `deploymentKey` option to `releaseChannelPublicId` (TypeScript should catch that)
106
-
107
- #### Change your iOS setup
108
-
109
- 1. Run `bundle exec pod install`
110
- 2. Rename `CodePushDeploymentKey` to `CodePushReleaseChannelPublicId` in your `Info.plist`
111
- 3. (optional) If you already use code signing, rename `CodePushPublicKey` to `CodePushSigningPublicKey` in your `Info.plist`
112
-
113
- #### Change your Android setup
114
-
115
- 1. In `android/settings.gradle` change the lines about CodePush : `include ':appzung_react-native-code-push'` and `project(':appzung_react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/@appzung/react-native-code-push/android/app')`
116
- 2. In `android/app/build.gradle` change the line about CodePush: `apply from: "../../node_modules/@appzung/react-native-code-push/android/codepush.gradle"`
117
- 3. In your Android files (eg. `MainApplication.kt`), rename every `com.microsoft.codepush` prefix imports with `com.appzung.codepush`
118
- 4. Rename `CodePushDeploymentKey` to `CodePushReleaseChannelPublicId` in your strings resources (located either at strings.xml or app/build.gradle).
119
- 5. (optional) If you already use code signing, rename `CodePushPublicKey` to `CodePushSigningPublicKey` in your strings resources
99
+ See the [corresponding steps](./docs/migrating-to-v10.md).
120
100
 
121
101
  ## Compatibility table
122
102
 
123
103
  We try our best to maintain backwards compatibility of our plugin with previous versions of React Native, but due to the nature of the platform, and the existence of breaking changes between releases, it is possible that you need to use a specific version of the CodePush plugin in order to support the exact version of React Native you are using. The following table outlines which CodePush plugin versions officially support the respective React Native versions:
124
104
 
125
- | React Native version(s) | Android | iOS | Supporting CodePush version(s) |
126
- |-------------------------|-----------------|------|--------------------------------|
127
- | <0.59 | - | - | **Unsupported** |
128
- | v0.59 | 4.1+ (TLS 1.2+) | 7 | v5.7.1 |
129
- | v0.60-v0.61 | 4.1+ (TLS 1.2+) | 7 | v6.3.1 |
130
- | v0.62-v0.64 | 4.1+ (TLS 1.2+) | 7 | v6.4.2 |
131
- | v0.65-v0.70 | 4.1+ (TLS 1.2+) | 9 | v7.1.1 |
132
- | v0.71+ | 4.1+ (TLS 1.2+) | 9 | v8.3.2 |
133
- | v0.71+ | 4.1+ (TLS 1.2+) | 15.5 | v9.0.2 or v10+ |
134
-
135
- Our plugin will support new architecture but for the moment starting from 0.76 you will need to [opt out](https://reactnative.dev/blog/2024/10/23/the-new-architecture-is-here#opt-out) from new architecture.
105
+ | React Native version(s) | Android | iOS | Old arch | New arch | Supporting CodePush version(s) |
106
+ | ----------------------- | --------------- | ---- | -------- | -------- | ------------------------------ |
107
+ | <0.59 | - | - | ✅ | ❌ | **Unsupported** |
108
+ | v0.59 | 4.1+ (TLS 1.2+) | 7 | ✅ | ❌ | v5.7.1 |
109
+ | v0.60-v0.61 | 4.1+ (TLS 1.2+) | 7 | ✅ | ❌ | v6.3.1 |
110
+ | v0.62-v0.64 | 4.1+ (TLS 1.2+) | 7 | ✅ | ❌ | v6.4.2 |
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+ |
114
+ | v0.74+ | 4.1+ (TLS 1.2+) | 15.5 | ✅ | ✅ | v11+ |
136
115
 
137
116
  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.
138
117
 
@@ -148,12 +127,11 @@ With the CodePush plugin downloaded and linked, and your app asking CodePush whe
148
127
  The simplest way to do this is to "CodePush-ify" your app's root component:
149
128
 
150
129
  ```javascript
151
- import codePush from "@appzung/react-native-code-push";
130
+ import withCodePush from '@appzung/react-native-code-push';
152
131
 
153
- const MyApp = () => {
154
- }
132
+ const MyApp = () => {};
155
133
 
156
- export default codePush(MyApp);
134
+ export default withCodePush(MyApp);
157
135
  ```
158
136
 
159
137
  By default, and this is recommended for production environments, CodePush will check for updates on every app start. If an update is available, it will be silently downloaded, and installed the next time the app is restarted (either explicitly by the end user or by the OS), which ensures the least invasive experience for your end users. If an available update is mandatory, then it will be installed immediately, ensuring that the end user gets it as soon as possible.
@@ -161,34 +139,34 @@ By default, and this is recommended for production environments, CodePush will c
161
139
  If you would like your app to discover updates more quickly, you can also choose to sync up with the CodePush server every time the app resumes from the background.
162
140
 
163
141
  ```javascript
164
- codePush({ checkFrequency: codePush.CheckFrequency.ON_APP_RESUME })(MyApp);
142
+ withCodePush({ checkFrequency: CheckFrequency.ON_APP_RESUME })(MyApp);
165
143
  ```
166
144
 
167
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`:
168
146
 
169
147
  ```javascript
170
- import codePush from "@appzung/react-native-code-push";
148
+ import withCodePush, { CheckFrequency, InstallMode } from '@appzung/react-native-code-push';
171
149
 
172
150
  class MyApp extends Component {
173
- onButtonPress() {
174
- codePush.sync({
175
- updateDialog: true,
176
- installMode: codePush.InstallMode.IMMEDIATE
177
- });
178
- }
179
-
180
- render() {
181
- return (
182
- <View>
183
- <TouchableOpacity onPress={this.onButtonPress}>
184
- <Text>Check for updates</Text>
185
- </TouchableOpacity>
186
- </View>
187
- )
188
- }
151
+ onButtonPress() {
152
+ CodePush.sync({
153
+ updateDialog: true,
154
+ installMode: InstallMode.IMMEDIATE,
155
+ });
156
+ }
157
+
158
+ render() {
159
+ return (
160
+ <View>
161
+ <TouchableOpacity onPress={this.onButtonPress}>
162
+ <Text>Check for updates</Text>
163
+ </TouchableOpacity>
164
+ </View>
165
+ );
166
+ }
189
167
  }
190
168
 
191
- export default codePush({ checkFrequency: codePush.CheckFrequency.MANUAL })(MyApp);
169
+ export default withCodePush({ checkFrequency: CheckFrequency.MANUAL })(MyApp);
192
170
  ```
193
171
 
194
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.
@@ -199,7 +177,7 @@ Once your app is configured and distributed to your users, and you have made som
199
177
 
200
178
  ### Locally
201
179
 
202
- *NOTE: Before you can start releasing updates, please log into AppZung by running the `appzung auth login` command.*
180
+ _NOTE: Before you can start releasing updates, please log into AppZung by running the `appzung auth login` command._
203
181
 
204
182
  In its most basic form, this command looks like this:
205
183
 
@@ -213,7 +191,7 @@ The `appzung releases deploy-react-native` command enables such a simple workflo
213
191
  # Release a mandatory update with a changelog from the last git commit (useful for staging releases)
214
192
  appzung releases deploy-react-native -m --description-from-current-git-commit
215
193
 
216
- # Force using hermes since auto-detection is not always possible. In a future version of the CLI use hermes will be enabled by default and there will be a --no-hermes flag instead.
194
+ # Force using hermes since auto-detection is not always possible. There is the equivalent --use-jsc to force using JSC engine.
217
195
  appzung releases deploy-react-native --use-hermes
218
196
 
219
197
  # Auto detecting the release version might not be a good strategy in a production app with multiple environments so you can specify the version
@@ -229,7 +207,7 @@ For more details about how the `appzung releases deploy-react-native` command wo
229
207
 
230
208
  If you run into any issues, or have any questions/comments/feedback, you can check out the [troubleshooting](#debugging--troubleshooting) details below or email us at support@appzung.com.
231
209
 
232
- *NOTE: CodePush updates should be tested in modes other than Debug mode. In Debug mode, React Native app always downloads JS bundle generated by packager, so JS bundle downloaded by CodePush does not apply.*
210
+ _NOTE: CodePush updates should be tested in modes other than Debug mode. In Debug mode, React Native app always downloads JS bundle generated by packager, so JS bundle downloaded by CodePush does not apply._
233
211
 
234
212
  ### On CI
235
213
 
@@ -253,13 +231,14 @@ Android Google Play and iOS App Store have corresponding guidelines that have ru
253
231
  ### Google play
254
232
 
255
233
  Third paragraph of [Device and Network Abuse](https://support.google.com/googleplay/android-developer/answer/9888379?hl=en) topic describe that updating source code by any method other than Google Play's update mechanism is restricted. But this restriction does not apply to updating javascript bundles.
234
+
256
235
  > This restriction does not apply to code that runs in a virtual machine and has limited access to Android APIs (such as JavaScript in a webview or browser).
257
236
 
258
237
  That fully allow CodePush as it updates just JS bundles and can't update native code part.
259
238
 
260
239
  ### App Store
261
240
 
262
- Paragraph **3.3.2**, since back in 2015's [Apple Developer Program License Agreement](https://developer.apple.com/programs/ios/information/) fully allowed performing over-the-air updates of JavaScript and assets - and in its latest version (20170605) [downloadable here](https://developer.apple.com/terms/) this ruling is even broader:
241
+ Paragraph **3.3.2**, since back in 2015's [Apple Developer Program License Agreement](https://developer.apple.com/programs/ios/information/) fully allowed performing over-the-air updates of JavaScript and assets - and in its latest version (20170605) [downloadable here](https://developer.apple.com/terms/) this ruling is even broader:
263
242
 
264
243
  > Interpreted code may be downloaded to an Application but only so long as such code: (a) does not change the primary purpose of the Application by providing features or functionality that are inconsistent with the intended and advertised purpose of the Application as submitted to the App Store, (b) does not create a store or storefront for other code or applications, and (c) does not bypass signing, sandbox, or other security features of the OS.
265
244
 
@@ -273,9 +252,9 @@ This is not necessarily the case for `updateDialog`, since it won't force the us
273
252
 
274
253
  ## API Reference
275
254
 
276
- * [JavaScript API](docs/api-js.md)
277
- * [Objective-C API Reference (iOS)](docs/api-ios.md)
278
- * [Java API Reference (Android)](docs/api-android.md)
255
+ - [JavaScript API](docs/api-js.md)
256
+ - [Objective-C API Reference (iOS)](docs/api-ios.md)
257
+ - [Java API Reference (Android)](docs/api-android.md)
279
258
 
280
259
  ## Debugging / Troubleshooting
281
260
 
@@ -289,18 +268,18 @@ Note that by default, React Native logs are disabled on iOS in release builds, s
289
268
 
290
269
  2. Add the following statement to the top of your `application:didFinishLaunchingWithOptions` method:
291
270
 
292
- ```objective-c
293
- RCTSetLogThreshold(RCTLogLevelInfo);
294
- ```
271
+ ```objective-c
272
+ RCTSetLogThreshold(RCTLogLevelInfo);
273
+ ```
295
274
 
296
275
  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:
297
276
 
298
277
  | Issue / Symptom | Possible Solution |
299
- |------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
300
- | Compilation Error | Double-check that your version of React Native is [compatible](#compatibility-table) with the CodePush version you are using. |
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. |
301
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. |
302
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. |
303
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. |
304
- | Update not being displayed after restart | If you're not calling `sync` on app start (like within `componentDidMount` of your root component), then you need to explicitly call `notifyApplicationReady` on app start, otherwise, the plugin will think your update failed and roll it back. |
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. |
305
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 |
306
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. |
@@ -1,33 +1,77 @@
1
1
  apply plugin: "com.android.library"
2
2
 
3
- def DEFAULT_COMPILE_SDK_VERSION = 26
4
- def DEFAULT_BUILD_TOOLS_VERSION = "26.0.3"
5
- def DEFAULT_TARGET_SDK_VERSION = 26
6
- def DEFAULT_MIN_SDK_VERSION = 16
3
+ def getExtOrDefault(name) {
4
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["CodePush_" + name]
5
+ }
6
+
7
+ def getExtOrIntegerDefault(name) {
8
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["CodePush_" + name]).toInteger()
9
+ }
10
+
11
+ def supportsNamespace() {
12
+ def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
13
+ def major = parsed[0].toInteger()
14
+ def minor = parsed[1].toInteger()
15
+
16
+ // Namespace support was added in 7.3.0
17
+ return (major == 7 && minor >= 3) || major >= 8
18
+ }
7
19
 
8
20
  android {
21
+ if (supportsNamespace()) {
9
22
  namespace "com.appzung.codepush.react"
10
23
 
11
- compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
12
- buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
13
-
14
- defaultConfig {
15
- minSdkVersion rootProject.hasProperty('minSdkVersion') ? rootProject.minSdkVersion : DEFAULT_MIN_SDK_VERSION
16
- targetSdkVersion rootProject.hasProperty('targetSdkVersion') ? rootProject.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
17
- versionCode 1
18
- versionName "1.0"
24
+ sourceSets {
25
+ main {
26
+ manifest.srcFile "src/main/AndroidManifestNew.xml"
27
+ }
19
28
  }
29
+ }
20
30
 
21
- lintOptions {
22
- abortOnError false
23
- }
31
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
24
32
 
25
- defaultConfig {
26
- consumerProguardFiles 'proguard-rules.pro'
33
+ defaultConfig {
34
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
35
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
36
+
37
+ consumerProguardFiles 'proguard-rules.pro'
38
+ }
39
+
40
+ buildFeatures {
41
+ buildConfig true
42
+ }
43
+
44
+ buildTypes {
45
+ release {
46
+ minifyEnabled false
27
47
  }
48
+ }
49
+
50
+ lintOptions {
51
+ disable "GradleCompatible"
52
+ }
53
+
54
+ compileOptions {
55
+ sourceCompatibility JavaVersion.VERSION_1_8
56
+ targetCompatibility JavaVersion.VERSION_1_8
57
+ }
58
+ }
59
+
60
+ repositories {
61
+ mavenCentral()
62
+ google()
28
63
  }
29
64
 
65
+ def isInDevelopment = project.hasProperty('CodePush_development') && project.property('CodePush_development') == "true"
66
+
30
67
  dependencies {
68
+ if (isInDevelopment) {
69
+ implementation("com.facebook.react:react-android:0.71.+")
70
+ } else {
71
+ // For < 0.71, this will be from the local maven repo
72
+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
73
+ //noinspection GradleDynamicVersion
31
74
  implementation "com.facebook.react:react-native:+"
32
- implementation 'com.nimbusds:nimbus-jose-jwt:9.37.3'
75
+ }
76
+ implementation "com.nimbusds:nimbus-jose-jwt:9.37.3"
33
77
  }
@@ -1,5 +1,4 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
-
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.appzung.codepush.react">
3
3
  <uses-permission android:name="android.permission.INTERNET" />
4
-
5
4
  </manifest>
@@ -0,0 +1,3 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <uses-permission android:name="android.permission.INTERNET" />
3
+ </manifest>
@@ -3,15 +3,11 @@ package com.appzung.codepush.react;
3
3
  import android.content.Context;
4
4
  import android.content.pm.PackageInfo;
5
5
  import android.content.pm.PackageManager;
6
- import android.content.res.Resources;
7
6
 
8
7
  import com.facebook.react.ReactInstanceManager;
9
8
  import com.facebook.react.ReactPackage;
10
- import com.facebook.react.bridge.JavaScriptModule;
11
9
  import com.facebook.react.bridge.NativeModule;
12
10
  import com.facebook.react.bridge.ReactApplicationContext;
13
- import com.facebook.react.devsupport.interfaces.DevSupportManager;
14
- import com.facebook.react.modules.debug.interfaces.DeveloperSettings;
15
11
  import com.facebook.react.uimanager.ViewManager;
16
12
 
17
13
  import org.json.JSONException;
@@ -20,7 +16,6 @@ import org.json.JSONObject;
20
16
  import java.io.File;
21
17
  import java.util.ArrayList;
22
18
  import java.util.List;
23
- import java.lang.reflect.Method;
24
19
 
25
20
  public class CodePush implements ReactPackage {
26
21
 
@@ -43,30 +38,35 @@ public class CodePush implements ReactPackage {
43
38
  private static String mServerUrl = "https://codepush.appzung.com/";
44
39
 
45
40
  private Context mContext;
46
- private final boolean mIsDebugMode;
41
+ private final boolean mIsDebugMode = BuildConfig.DEBUG;
47
42
 
48
43
  private static String mPublicKey;
49
44
 
50
45
  private static ReactInstanceHolder mReactInstanceHolder;
51
46
  private static CodePush mCurrentInstance;
52
47
 
53
- public CodePush(String releaseChannelPublicId, Context context) {
54
- this(releaseChannelPublicId, context, false);
55
- }
56
-
57
48
  public static String getServiceUrl() {
58
49
  return mServerUrl;
59
50
  }
60
51
 
61
- public CodePush(String releaseChannelPublicId, Context context, boolean isDebugMode) {
52
+ public CodePush(Context context) {
62
53
  mContext = context.getApplicationContext();
63
54
 
55
+ String releaseChannelPublicIdFromStrings = getCustomPropertyFromStringsIfExist("ReleaseChannelPublicId");
56
+ if (releaseChannelPublicIdFromStrings == null) {
57
+ throw new CodePushUnknownException("Missing release channel public ID in strings resource");
58
+ }
59
+
60
+ mReleaseChannelPublicId = releaseChannelPublicIdFromStrings;
61
+
64
62
  mUpdateManager = new CodePushUpdateManager(context.getFilesDir().getAbsolutePath());
65
63
  mTelemetryManager = new CodePushTelemetryManager(mContext);
66
- mReleaseChannelPublicId = releaseChannelPublicId;
67
- mIsDebugMode = isDebugMode;
68
64
  mSettingsManager = new SettingsManager(mContext);
69
65
 
66
+ if (mIsDebugMode) {
67
+ CodePushUtils.log("Running in DEBUG mode");
68
+ }
69
+
70
70
  if (sAppVersion == null) {
71
71
  try {
72
72
  PackageInfo pInfo = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0);
@@ -85,52 +85,13 @@ public class CodePush implements ReactPackage {
85
85
  }
86
86
 
87
87
  String serverUrlFromStrings = getCustomPropertyFromStringsIfExist("ServerUrl");
88
- if (serverUrlFromStrings != null) mServerUrl = serverUrlFromStrings;
89
-
90
- clearDebugCacheIfNeeded(null);
91
- initializeUpdateAfterRestart();
92
- }
93
-
94
- public CodePush(String releaseChannelPublicId, Context context, boolean isDebugMode, String serverUrl) {
95
- this(releaseChannelPublicId, context, isDebugMode);
96
- mServerUrl = serverUrl;
97
- }
98
-
99
- public CodePush(String releaseChannelPublicId, Context context, boolean isDebugMode, int publicKeyResourceDescriptor) {
100
- this(releaseChannelPublicId, context, isDebugMode);
101
-
102
- mPublicKey = getPublicKeyByResourceDescriptor(publicKeyResourceDescriptor);
103
- }
104
-
105
- public CodePush(String releaseChannelPublicId, Context context, boolean isDebugMode, String serverUrl, Integer publicKeyResourceDescriptor) {
106
- this(releaseChannelPublicId, context, isDebugMode);
107
-
108
- if (publicKeyResourceDescriptor != null) {
109
- mPublicKey = getPublicKeyByResourceDescriptor(publicKeyResourceDescriptor);
88
+ if (serverUrlFromStrings != null) {
89
+ CodePushUtils.log("Executing CodePush with a custom server URL.");
90
+ mServerUrl = serverUrlFromStrings;
110
91
  }
111
92
 
112
- mServerUrl = serverUrl;
113
- }
114
-
115
- private String getPublicKeyByResourceDescriptor(int publicKeyResourceDescriptor){
116
- String publicKey;
117
- try {
118
- publicKey = mContext.getString(publicKeyResourceDescriptor);
119
- } catch (Resources.NotFoundException e) {
120
- throw new CodePushInvalidPublicKeyException(
121
- "Unable to get public key, related resource descriptor " +
122
- publicKeyResourceDescriptor +
123
- " can not be found", e
124
- );
125
- }
126
-
127
- if (publicKey.isEmpty()) {
128
- throw new CodePushInvalidPublicKeyException("Specified public key is empty");
129
- }
130
-
131
- CodePushUtils.log("Executing CodePush with a signing public key.");
132
-
133
- return publicKey;
93
+ clearDebugCacheIfNeeded(false);
94
+ initializeUpdateAfterRestart();
134
95
  }
135
96
 
136
97
  private String getCustomPropertyFromStringsIfExist(String propertyName) {
@@ -152,31 +113,9 @@ public class CodePush implements ReactPackage {
152
113
  return null;
153
114
  }
154
115
 
155
- private boolean isLiveReloadEnabled(ReactInstanceManager instanceManager) {
156
- // Use instanceManager for checking if we use LiveReload mode. In this case we should not remove ReactNativeDevBundle.js file
157
- // because we get error with trying to get this after reloading. Issue: https://github.com/microsoft/react-native-code-push/issues/1272
158
- if (instanceManager != null) {
159
- DevSupportManager devSupportManager = instanceManager.getDevSupportManager();
160
- if (devSupportManager != null) {
161
- DeveloperSettings devSettings = devSupportManager.getDevSettings();
162
- Method[] methods = devSettings.getClass().getMethods();
163
- for (Method m : methods) {
164
- if (m.getName().equals("isReloadOnJSChangeEnabled")) {
165
- try {
166
- return (boolean) m.invoke(devSettings);
167
- } catch (Exception x) {
168
- return false;
169
- }
170
- }
171
- }
172
- }
173
- }
174
-
175
- return false;
176
- }
177
-
178
- public void clearDebugCacheIfNeeded(ReactInstanceManager instanceManager) {
179
- if (mIsDebugMode && mSettingsManager.isPendingUpdate(null) && !isLiveReloadEnabled(instanceManager)) {
116
+ public void clearDebugCacheIfNeeded(boolean isLiveReloadEnabled) {
117
+ // Issue: https://github.com/microsoft/react-native-code-push/issues/1272
118
+ if (mIsDebugMode && mSettingsManager.isPendingUpdate(null) && !isLiveReloadEnabled) {
180
119
  // This needs to be kept in sync with https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManager.java#L78
181
120
  File cachedDevBundle = new File(mContext.getFilesDir(), "ReactNativeDevBundle.js");
182
121
  if (cachedDevBundle.exists()) {
@@ -427,19 +366,12 @@ public class CodePush implements ReactPackage {
427
366
  @Override
428
367
  public List<NativeModule> createNativeModules(ReactApplicationContext reactApplicationContext) {
429
368
  CodePushNativeModule codePushModule = new CodePushNativeModule(reactApplicationContext, this, mUpdateManager, mTelemetryManager, mSettingsManager);
430
- CodePushDialog dialogModule = new CodePushDialog(reactApplicationContext);
431
369
 
432
370
  List<NativeModule> nativeModules = new ArrayList<>();
433
371
  nativeModules.add(codePushModule);
434
- nativeModules.add(dialogModule);
435
372
  return nativeModules;
436
373
  }
437
374
 
438
- // Deprecated in RN v0.47.
439
- public List<Class<? extends JavaScriptModule>> createJSModules() {
440
- return new ArrayList<>();
441
- }
442
-
443
375
  @Override
444
376
  public List<ViewManager> createViewManagers(ReactApplicationContext reactApplicationContext) {
445
377
  return new ArrayList<>();