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

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 (322) 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/.gradle/config.properties +0 -2
  299. package/android/app/local.properties +0 -8
  300. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +0 -37
  301. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushDialog.java +0 -102
  302. package/package-mixins.js +0 -68
  303. package/request-fetch-adapter.js +0 -52
  304. package/tslint.json +0 -32
  305. package/typings/react-native-code-push.d.ts +0 -455
  306. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushConstants.java +0 -0
  307. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushInstallMode.java +0 -0
  308. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushInvalidPublicKeyException.java +0 -0
  309. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushInvalidUpdateException.java +0 -0
  310. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushMalformedDataException.java +0 -0
  311. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushNotInitializedException.java +0 -0
  312. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushTelemetryManager.java +0 -0
  313. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUnknownException.java +0 -0
  314. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUpdateState.java +0 -0
  315. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUpdateUtils.java +0 -0
  316. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUtils.java +0 -0
  317. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/DownloadProgress.java +0 -0
  318. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/DownloadProgressCallback.java +0 -0
  319. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/FileUtils.java +0 -0
  320. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/ReactInstanceHolder.java +0 -0
  321. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/SettingsManager.java +0 -0
  322. /package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/TLSSocketFactory.java +0 -0
package/CodePush.js DELETED
@@ -1,674 +0,0 @@
1
- import { AcquisitionManager as Sdk } from "code-push/script/acquisition-sdk";
2
- import { Alert } from "./AlertAdapter";
3
- import requestFetchAdapter from "./request-fetch-adapter";
4
- import { AppState, Platform } from "react-native";
5
- import log from "./logging";
6
- import hoistStatics from 'hoist-non-react-statics';
7
-
8
- let NativeCodePush = require("react-native").NativeModules.CodePush;
9
- const PackageMixins = require("./package-mixins")(NativeCodePush);
10
-
11
- async function checkForUpdate(releaseChannelPublicId = null, handleBinaryVersionMismatchCallback = null) {
12
- /*
13
- * Before we ask the server if an update exists, we
14
- * need to retrieve three pieces of information from the
15
- * native side: release channel, app version (e.g. 1.0.1)
16
- * and the hash of the currently running update (if there is one).
17
- * This allows the client to only receive updates which are targetted
18
- * for their specific release channel and version and which are actually
19
- * different from the CodePush update they have already installed.
20
- */
21
- const nativeConfig = await getConfiguration();
22
- /*
23
- * If a release channel was explicitly provided,
24
- * then let's override the one we retrieved
25
- * from the native-side of the app. This allows
26
- * dynamically "redirecting" end-users at different
27
- * release channels (e.g. an early access release channel for insiders).
28
- */
29
- const config = releaseChannelPublicId ? { ...nativeConfig, ...{ releaseChannelPublicId } } : nativeConfig;
30
- const sdk = getPromisifiedSdk(requestFetchAdapter, config);
31
-
32
- // Use dynamically overridden getCurrentPackage() during tests.
33
- const localPackage = await module.exports.getCurrentPackage();
34
-
35
- /*
36
- * If the app has a previously installed update, and that update
37
- * was targetted at the same app version that is currently running,
38
- * then we want to use its package hash to determine whether a new
39
- * release has been made on the server. Otherwise, we only need
40
- * to send the app version to the server, since we are interested
41
- * in any updates for current binary version, regardless of hash.
42
- */
43
- let queryPackage;
44
- if (localPackage) {
45
- queryPackage = localPackage;
46
- } else {
47
- queryPackage = { appVersion: config.appVersion };
48
- if (Platform.OS === "ios" && config.packageHash) {
49
- queryPackage.packageHash = config.packageHash;
50
- }
51
- }
52
-
53
- const update = await sdk.queryUpdateWithCurrentPackage(queryPackage);
54
-
55
- /*
56
- * There are four cases where checkForUpdate will resolve to null:
57
- * ----------------------------------------------------------------
58
- * 1) The server said there isn't an update. This is the most common case.
59
- * 2) The server said there is an update but it requires a newer binary version.
60
- * This would occur when end-users are running an older binary version than
61
- * is available, and CodePush is making sure they don't get an update that
62
- * potentially wouldn't be compatible with what they are running.
63
- * 3) The server said there is an update, but the update's hash is the same as
64
- * the currently running update. This should _never_ happen, unless there is a
65
- * bug in the server, but we're adding this check just to double-check that the
66
- * client app is resilient to a potential issue with the update check.
67
- * 4) The server said there is an update, but the update's hash is the same as that
68
- * of the binary's currently running version. This should only happen in Android -
69
- * unlike iOS, we don't attach the binary's hash to the updateCheck request
70
- * because we want to avoid having to install diff updates against the binary's
71
- * version, which we can't do yet on Android.
72
- */
73
- if (!update || update.updateAppVersion ||
74
- localPackage && (update.packageHash === localPackage.packageHash) ||
75
- (!localPackage || localPackage._isDebugOnly) && config.packageHash === update.packageHash) {
76
- if (update && update.updateAppVersion) {
77
- log("An update is available but it is not targeting the binary version of your app.");
78
- if (handleBinaryVersionMismatchCallback && typeof handleBinaryVersionMismatchCallback === "function") {
79
- handleBinaryVersionMismatchCallback(update)
80
- }
81
- }
82
-
83
- return null;
84
- } else {
85
- const remotePackage = { ...update, ...PackageMixins.remote(sdk.reportStatusDownload) };
86
- remotePackage.failedInstall = await NativeCodePush.isFailedUpdate(remotePackage.packageHash);
87
- remotePackage.releaseChannelPublicId = releaseChannelPublicId || nativeConfig.releaseChannelPublicId;
88
- return remotePackage;
89
- }
90
- }
91
-
92
- const getConfiguration = (() => {
93
- let config;
94
- return async function getConfiguration() {
95
- if (config) {
96
- return config;
97
- } else if (testConfig) {
98
- return testConfig;
99
- } else {
100
- config = await NativeCodePush.getConfiguration();
101
- return config;
102
- }
103
- }
104
- })();
105
-
106
- async function getCurrentPackage() {
107
- return await getUpdateMetadata(CodePush.UpdateState.LATEST);
108
- }
109
-
110
- async function getUpdateMetadata(updateState) {
111
- let updateMetadata = await NativeCodePush.getUpdateMetadata(updateState || CodePush.UpdateState.RUNNING);
112
- if (updateMetadata) {
113
- updateMetadata = {...PackageMixins.local, ...updateMetadata};
114
- updateMetadata.failedInstall = await NativeCodePush.isFailedUpdate(updateMetadata.packageHash);
115
- updateMetadata.isFirstRun = await NativeCodePush.isFirstRun(updateMetadata.packageHash);
116
- }
117
- return updateMetadata;
118
- }
119
-
120
- function getPromisifiedSdk(requestFetchAdapter, config) {
121
- // TODO MIGRATION Temporary retro-compat while we still use code-push module
122
- config.deploymentKey = config.releaseChannelPublicId;
123
-
124
- // Use dynamically overridden AcquisitionSdk during tests.
125
- const sdk = new module.exports.AcquisitionSdk(requestFetchAdapter, config);
126
- sdk.queryUpdateWithCurrentPackage = (queryPackage) => {
127
- return new Promise((resolve, reject) => {
128
- module.exports.AcquisitionSdk.prototype.queryUpdateWithCurrentPackage.call(sdk, queryPackage, (err, update) => {
129
- if (err) {
130
- reject(err);
131
- } else {
132
- resolve(update);
133
- }
134
- });
135
- });
136
- };
137
-
138
- sdk.reportStatusDeploy = (deployedPackage, status, previousLabelOrAppVersion, previousReleaseChannelPublicId) => {
139
- return new Promise((resolve, reject) => {
140
- module.exports.AcquisitionSdk.prototype.reportStatusDeploy.call(sdk, deployedPackage, status, previousLabelOrAppVersion, previousReleaseChannelPublicId, (err) => {
141
- if (err) {
142
- reject(err);
143
- } else {
144
- resolve();
145
- }
146
- });
147
- });
148
- };
149
-
150
- sdk.reportStatusDownload = (downloadedPackage) => {
151
- return new Promise((resolve, reject) => {
152
- module.exports.AcquisitionSdk.prototype.reportStatusDownload.call(sdk, downloadedPackage, (err) => {
153
- if (err) {
154
- reject(err);
155
- } else {
156
- resolve();
157
- }
158
- });
159
- });
160
- };
161
-
162
- return sdk;
163
- }
164
-
165
- // This ensures that notifyApplicationReadyInternal is only called once
166
- // in the lifetime of this module instance.
167
- const notifyApplicationReady = (() => {
168
- let notifyApplicationReadyPromise;
169
- return () => {
170
- if (!notifyApplicationReadyPromise) {
171
- notifyApplicationReadyPromise = notifyApplicationReadyInternal();
172
- }
173
-
174
- return notifyApplicationReadyPromise;
175
- };
176
- })();
177
-
178
- async function notifyApplicationReadyInternal() {
179
- await NativeCodePush.notifyApplicationReady();
180
- const statusReport = await NativeCodePush.getNewStatusReport();
181
- statusReport && tryReportStatus(statusReport); // Don't wait for this to complete.
182
-
183
- return statusReport;
184
- }
185
-
186
- async function tryReportStatus(statusReport, retryOnAppResume) {
187
- const config = await getConfiguration();
188
- const previousLabelOrAppVersion = statusReport.previousLabelOrAppVersion;
189
- const previousReleaseChannelPublicId = statusReport.previousReleaseChannelPublicId || config.releaseChannelPublicId;
190
- try {
191
- if (statusReport.appVersion) {
192
- log(`Reporting binary update (${statusReport.appVersion})`);
193
-
194
- if (!config.releaseChannelPublicId) {
195
- throw new Error("Release channel is missing");
196
- }
197
-
198
- const sdk = getPromisifiedSdk(requestFetchAdapter, config);
199
- await sdk.reportStatusDeploy(/* deployedPackage */ null, /* status */ null, previousLabelOrAppVersion, previousReleaseChannelPublicId);
200
- } else {
201
- const label = statusReport.package.label;
202
- if (statusReport.status === "DeploymentSucceeded") {
203
- log(`Reporting CodePush update success (${label})`);
204
- } else {
205
- log(`Reporting CodePush update rollback (${label})`);
206
- await NativeCodePush.setLatestRollbackInfo(statusReport.package.packageHash);
207
- }
208
-
209
- config.releaseChannelPublicId = statusReport.package.releaseChannelPublicId;
210
- const sdk = getPromisifiedSdk(requestFetchAdapter, config);
211
- await sdk.reportStatusDeploy(statusReport.package, statusReport.status, previousLabelOrAppVersion, previousReleaseChannelPublicId);
212
- }
213
-
214
- NativeCodePush.recordStatusReported(statusReport);
215
- retryOnAppResume && retryOnAppResume.remove();
216
- } catch (e) {
217
- log(`Report status failed: ${JSON.stringify(statusReport)}`);
218
- NativeCodePush.saveStatusReportForRetry(statusReport);
219
- // Try again when the app resumes
220
- if (!retryOnAppResume) {
221
- const resumeListener = AppState.addEventListener("change", async (newState) => {
222
- if (newState !== "active") return;
223
- const refreshedStatusReport = await NativeCodePush.getNewStatusReport();
224
- if (refreshedStatusReport) {
225
- tryReportStatus(refreshedStatusReport, resumeListener);
226
- } else {
227
- resumeListener && resumeListener.remove();
228
- }
229
- });
230
- }
231
- }
232
- }
233
-
234
- async function shouldUpdateBeIgnored(remotePackage, syncOptions) {
235
- let { rollbackRetryOptions } = syncOptions;
236
-
237
- const isFailedPackage = remotePackage && remotePackage.failedInstall;
238
- if (!isFailedPackage || !syncOptions.ignoreFailedUpdates) {
239
- return false;
240
- }
241
-
242
- if (!rollbackRetryOptions) {
243
- return true;
244
- }
245
-
246
- if (typeof rollbackRetryOptions !== "object") {
247
- rollbackRetryOptions = CodePush.DEFAULT_ROLLBACK_RETRY_OPTIONS;
248
- } else {
249
- rollbackRetryOptions = { ...CodePush.DEFAULT_ROLLBACK_RETRY_OPTIONS, ...rollbackRetryOptions };
250
- }
251
-
252
- if (!validateRollbackRetryOptions(rollbackRetryOptions)) {
253
- return true;
254
- }
255
-
256
- const latestRollbackInfo = await NativeCodePush.getLatestRollbackInfo();
257
- if (!validateLatestRollbackInfo(latestRollbackInfo, remotePackage.packageHash)) {
258
- log("The latest rollback info is not valid.");
259
- return true;
260
- }
261
-
262
- const { delayInHours, maxRetryAttempts } = rollbackRetryOptions;
263
- const hoursSinceLatestRollback = (Date.now() - latestRollbackInfo.time) / (1000 * 60 * 60);
264
- if (hoursSinceLatestRollback >= delayInHours && maxRetryAttempts >= latestRollbackInfo.count) {
265
- log("Previous rollback should be ignored due to rollback retry options.");
266
- return false;
267
- }
268
-
269
- return true;
270
- }
271
-
272
- function validateLatestRollbackInfo(latestRollbackInfo, packageHash) {
273
- return latestRollbackInfo &&
274
- latestRollbackInfo.time &&
275
- latestRollbackInfo.count &&
276
- latestRollbackInfo.packageHash &&
277
- latestRollbackInfo.packageHash === packageHash;
278
- }
279
-
280
- function validateRollbackRetryOptions(rollbackRetryOptions) {
281
- if (typeof rollbackRetryOptions.delayInHours !== "number") {
282
- log("The 'delayInHours' rollback retry parameter must be a number.");
283
- return false;
284
- }
285
-
286
- if (typeof rollbackRetryOptions.maxRetryAttempts !== "number") {
287
- log("The 'maxRetryAttempts' rollback retry parameter must be a number.");
288
- return false;
289
- }
290
-
291
- if (rollbackRetryOptions.maxRetryAttempts < 1) {
292
- log("The 'maxRetryAttempts' rollback retry parameter cannot be less then 1.");
293
- return false;
294
- }
295
-
296
- return true;
297
- }
298
-
299
- var testConfig;
300
-
301
- // This function is only used for tests. Replaces the default SDK, configuration and native bridge
302
- function setUpTestDependencies(testSdk, providedTestConfig, testNativeBridge) {
303
- if (testSdk) module.exports.AcquisitionSdk = testSdk;
304
- if (providedTestConfig) testConfig = providedTestConfig;
305
- if (testNativeBridge) NativeCodePush = testNativeBridge;
306
- }
307
-
308
- async function restartApp(onlyIfUpdateIsPending = false) {
309
- NativeCodePush.restartApp(onlyIfUpdateIsPending);
310
- }
311
-
312
- // This function allows only one syncInternal operation to proceed at any given time.
313
- // Parallel calls to sync() while one is ongoing yields CodePush.SyncStatus.SYNC_IN_PROGRESS.
314
- const sync = (() => {
315
- let syncInProgress = false;
316
- const setSyncCompleted = () => { syncInProgress = false; };
317
-
318
- return (options = {}, syncStatusChangeCallback, downloadProgressCallback, handleBinaryVersionMismatchCallback) => {
319
- let syncStatusCallbackWithTryCatch, downloadProgressCallbackWithTryCatch;
320
- if (typeof syncStatusChangeCallback === "function") {
321
- syncStatusCallbackWithTryCatch = (...args) => {
322
- try {
323
- syncStatusChangeCallback(...args);
324
- } catch (error) {
325
- log(`An error has occurred : ${error.stack}`);
326
- }
327
- }
328
- }
329
-
330
- if (typeof downloadProgressCallback === "function") {
331
- downloadProgressCallbackWithTryCatch = (...args) => {
332
- try {
333
- downloadProgressCallback(...args);
334
- } catch (error) {
335
- log(`An error has occurred: ${error.stack}`);
336
- }
337
- }
338
- }
339
-
340
- if (syncInProgress) {
341
- typeof syncStatusCallbackWithTryCatch === "function"
342
- ? syncStatusCallbackWithTryCatch(CodePush.SyncStatus.SYNC_IN_PROGRESS)
343
- : log("Sync already in progress.");
344
- return Promise.resolve(CodePush.SyncStatus.SYNC_IN_PROGRESS);
345
- }
346
-
347
- syncInProgress = true;
348
- const syncPromise = syncInternal(options, syncStatusCallbackWithTryCatch, downloadProgressCallbackWithTryCatch, handleBinaryVersionMismatchCallback);
349
- syncPromise
350
- .then(setSyncCompleted)
351
- .catch(setSyncCompleted);
352
-
353
- return syncPromise;
354
- };
355
- })();
356
-
357
- /*
358
- * The syncInternal method provides a simple, one-line experience for
359
- * incorporating the check, download and installation of an update.
360
- *
361
- * It simply composes the existing API methods together and adds additional
362
- * support for respecting mandatory updates, ignoring previously failed
363
- * releases, and displaying a standard confirmation UI to the end-user
364
- * when an update is available.
365
- */
366
- async function syncInternal(options = {}, syncStatusChangeCallback, downloadProgressCallback, handleBinaryVersionMismatchCallback) {
367
- let resolvedInstallMode;
368
- const syncOptions = {
369
- releaseChannelPublicId: null,
370
- ignoreFailedUpdates: true,
371
- rollbackRetryOptions: null,
372
- installMode: CodePush.InstallMode.ON_NEXT_RESTART,
373
- mandatoryInstallMode: CodePush.InstallMode.IMMEDIATE,
374
- minimumBackgroundDuration: 0,
375
- updateDialog: null,
376
- ...options
377
- };
378
-
379
- syncStatusChangeCallback = typeof syncStatusChangeCallback === "function"
380
- ? syncStatusChangeCallback
381
- : (syncStatus) => {
382
- switch(syncStatus) {
383
- case CodePush.SyncStatus.CHECKING_FOR_UPDATE:
384
- log("Checking for update.");
385
- break;
386
- case CodePush.SyncStatus.AWAITING_USER_ACTION:
387
- log("Awaiting user action.");
388
- break;
389
- case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
390
- log("Downloading package.");
391
- break;
392
- case CodePush.SyncStatus.INSTALLING_UPDATE:
393
- log("Installing update.");
394
- break;
395
- case CodePush.SyncStatus.UP_TO_DATE:
396
- log("App is up to date.");
397
- break;
398
- case CodePush.SyncStatus.UPDATE_IGNORED:
399
- log("User cancelled the update.");
400
- break;
401
- case CodePush.SyncStatus.UPDATE_INSTALLED:
402
- if (resolvedInstallMode == CodePush.InstallMode.ON_NEXT_RESTART) {
403
- log("Update is installed and will be run on the next app restart.");
404
- } else if (resolvedInstallMode == CodePush.InstallMode.ON_NEXT_RESUME) {
405
- if (syncOptions.minimumBackgroundDuration > 0) {
406
- log(`Update is installed and will be run after the app has been in the background for at least ${syncOptions.minimumBackgroundDuration} seconds.`);
407
- } else {
408
- log("Update is installed and will be run when the app next resumes.");
409
- }
410
- }
411
- break;
412
- case CodePush.SyncStatus.UNKNOWN_ERROR:
413
- log("An unknown error occurred.");
414
- break;
415
- }
416
- };
417
-
418
- try {
419
- await CodePush.notifyApplicationReady();
420
-
421
- syncStatusChangeCallback(CodePush.SyncStatus.CHECKING_FOR_UPDATE);
422
- const remotePackage = await checkForUpdate(syncOptions.releaseChannelPublicId, handleBinaryVersionMismatchCallback);
423
-
424
- const doDownloadAndInstall = async () => {
425
- syncStatusChangeCallback(CodePush.SyncStatus.DOWNLOADING_PACKAGE);
426
- const localPackage = await remotePackage.download(downloadProgressCallback);
427
-
428
- // Determine the correct install mode based on whether the update is mandatory or not.
429
- resolvedInstallMode = localPackage.isMandatory ? syncOptions.mandatoryInstallMode : syncOptions.installMode;
430
-
431
- syncStatusChangeCallback(CodePush.SyncStatus.INSTALLING_UPDATE);
432
- await localPackage.install(resolvedInstallMode, syncOptions.minimumBackgroundDuration, () => {
433
- syncStatusChangeCallback(CodePush.SyncStatus.UPDATE_INSTALLED);
434
- });
435
-
436
- return CodePush.SyncStatus.UPDATE_INSTALLED;
437
- };
438
-
439
- const updateShouldBeIgnored = await shouldUpdateBeIgnored(remotePackage, syncOptions);
440
-
441
- if (!remotePackage || updateShouldBeIgnored) {
442
- if (updateShouldBeIgnored) {
443
- log("An update is available, but it is being ignored due to having been previously rolled back.");
444
- }
445
-
446
- const currentPackage = await CodePush.getCurrentPackage();
447
- if (currentPackage && currentPackage.isPending) {
448
- syncStatusChangeCallback(CodePush.SyncStatus.UPDATE_INSTALLED);
449
- return CodePush.SyncStatus.UPDATE_INSTALLED;
450
- } else {
451
- syncStatusChangeCallback(CodePush.SyncStatus.UP_TO_DATE);
452
- return CodePush.SyncStatus.UP_TO_DATE;
453
- }
454
- } else if (syncOptions.updateDialog) {
455
- // updateDialog supports any truthy value (e.g. true, "goo", 12),
456
- // but we should treat a non-object value as just the default dialog
457
- if (typeof syncOptions.updateDialog !== "object") {
458
- syncOptions.updateDialog = CodePush.DEFAULT_UPDATE_DIALOG;
459
- } else {
460
- syncOptions.updateDialog = { ...CodePush.DEFAULT_UPDATE_DIALOG, ...syncOptions.updateDialog };
461
- }
462
-
463
- return await new Promise((resolve, reject) => {
464
- let message = null;
465
- let installButtonText = null;
466
-
467
- const dialogButtons = [];
468
-
469
- if (remotePackage.isMandatory) {
470
- message = syncOptions.updateDialog.mandatoryUpdateMessage;
471
- installButtonText = syncOptions.updateDialog.mandatoryContinueButtonLabel;
472
- } else {
473
- message = syncOptions.updateDialog.optionalUpdateMessage;
474
- installButtonText = syncOptions.updateDialog.optionalInstallButtonLabel;
475
- // Since this is an optional update, add a button
476
- // to allow the end-user to ignore it
477
- dialogButtons.push({
478
- text: syncOptions.updateDialog.optionalIgnoreButtonLabel,
479
- onPress: () => {
480
- syncStatusChangeCallback(CodePush.SyncStatus.UPDATE_IGNORED);
481
- resolve(CodePush.SyncStatus.UPDATE_IGNORED);
482
- }
483
- });
484
- }
485
-
486
- // Since the install button should be placed to the
487
- // right of any other button, add it last
488
- dialogButtons.push({
489
- text: installButtonText,
490
- onPress:() => {
491
- doDownloadAndInstall()
492
- .then(resolve, reject);
493
- }
494
- })
495
-
496
- // If the update has a description, and the developer
497
- // explicitly chose to display it, then set that as the message
498
- if (syncOptions.updateDialog.appendReleaseDescription && remotePackage.description) {
499
- message += `${syncOptions.updateDialog.descriptionPrefix} ${remotePackage.description}`;
500
- }
501
-
502
- syncStatusChangeCallback(CodePush.SyncStatus.AWAITING_USER_ACTION);
503
- Alert.alert(syncOptions.updateDialog.title, message, dialogButtons);
504
- });
505
- } else {
506
- return await doDownloadAndInstall();
507
- }
508
- } catch (error) {
509
- syncStatusChangeCallback(CodePush.SyncStatus.UNKNOWN_ERROR);
510
- log(error.message);
511
- throw error;
512
- }
513
- };
514
-
515
- let CodePush;
516
-
517
- function codePushify(options = {}) {
518
- let React;
519
- let ReactNative = require("react-native");
520
-
521
- try { React = require("react"); } catch (e) { }
522
- if (!React) {
523
- try { React = ReactNative.React; } catch (e) { }
524
- if (!React) {
525
- throw new Error("Unable to find the 'React' module.");
526
- }
527
- }
528
-
529
- if (!React.Component) {
530
- throw new Error(
531
- `Unable to find the "Component" class, please either:
532
- 1. Upgrade to a newer version of React Native that supports it, or
533
- 2. Call the codePush.sync API in your component instead of using the @codePush decorator`
534
- );
535
- }
536
-
537
- const decorator = (RootComponent) => {
538
- class CodePushComponent extends React.Component {
539
- constructor(props) {
540
- super(props);
541
- this.rootComponentRef = React.createRef();
542
- }
543
-
544
- componentDidMount() {
545
- if (options.checkFrequency === CodePush.CheckFrequency.MANUAL) {
546
- CodePush.notifyAppReady();
547
- } else {
548
- const rootComponentInstance = this.rootComponentRef.current;
549
-
550
- let syncStatusCallback;
551
- if (rootComponentInstance && rootComponentInstance.codePushStatusDidChange) {
552
- syncStatusCallback = rootComponentInstance.codePushStatusDidChange.bind(rootComponentInstance);
553
- }
554
-
555
- let downloadProgressCallback;
556
- if (rootComponentInstance && rootComponentInstance.codePushDownloadDidProgress) {
557
- downloadProgressCallback = rootComponentInstance.codePushDownloadDidProgress.bind(rootComponentInstance);
558
- }
559
-
560
- let handleBinaryVersionMismatchCallback;
561
- if (rootComponentInstance && rootComponentInstance.codePushOnBinaryVersionMismatch) {
562
- handleBinaryVersionMismatchCallback = rootComponentInstance.codePushOnBinaryVersionMismatch.bind(rootComponentInstance);
563
- }
564
-
565
- CodePush.sync(options, syncStatusCallback, downloadProgressCallback, handleBinaryVersionMismatchCallback);
566
-
567
- if (options.checkFrequency === CodePush.CheckFrequency.ON_APP_RESUME) {
568
- ReactNative.AppState.addEventListener("change", (newState) => {
569
- if (newState === "active") {
570
- CodePush.sync(options, syncStatusCallback, downloadProgressCallback);
571
- }
572
- });
573
- }
574
- }
575
- }
576
-
577
- render() {
578
- const props = {...this.props};
579
-
580
- // We can set ref property on class components only (not stateless)
581
- // Check it by render method
582
- if (RootComponent.prototype && RootComponent.prototype.render) {
583
- props.ref = this.rootComponentRef;
584
- }
585
-
586
- return <RootComponent {...props} />
587
- }
588
- }
589
-
590
- return hoistStatics(CodePushComponent, RootComponent);
591
- }
592
-
593
- if (typeof options === "function") {
594
- // Infer that the root component was directly passed to us.
595
- return decorator(options);
596
- } else {
597
- return decorator;
598
- }
599
- }
600
-
601
- // If the "NativeCodePush" variable isn't defined, then
602
- // the app didn't properly install the native module,
603
- // and therefore, it doesn't make sense initializing
604
- // the JS interface when it wouldn't work anyways.
605
- if (NativeCodePush) {
606
- CodePush = codePushify;
607
- Object.assign(CodePush, {
608
- AcquisitionSdk: Sdk,
609
- checkForUpdate,
610
- getConfiguration,
611
- getCurrentPackage,
612
- getUpdateMetadata,
613
- log,
614
- notifyAppReady: notifyApplicationReady,
615
- notifyApplicationReady,
616
- restartApp,
617
- setUpTestDependencies,
618
- sync,
619
- disallowRestart: NativeCodePush.disallow,
620
- allowRestart: NativeCodePush.allow,
621
- clearUpdates: NativeCodePush.clearUpdates,
622
- InstallMode: {
623
- IMMEDIATE: NativeCodePush.codePushInstallModeImmediate, // Restart the app immediately
624
- ON_NEXT_RESTART: NativeCodePush.codePushInstallModeOnNextRestart, // Don't artificially restart the app. Allow the update to be "picked up" on the next app restart
625
- ON_NEXT_RESUME: NativeCodePush.codePushInstallModeOnNextResume, // Restart the app the next time it is resumed from the background
626
- ON_NEXT_SUSPEND: NativeCodePush.codePushInstallModeOnNextSuspend // Restart the app _while_ it is in the background,
627
- // but only after it has been in the background for "minimumBackgroundDuration" seconds (0 by default),
628
- // so that user context isn't lost unless the app suspension is long enough to not matter
629
- },
630
- SyncStatus: {
631
- UP_TO_DATE: 0, // The running app is up-to-date
632
- UPDATE_INSTALLED: 1, // The app had an optional/mandatory update that was successfully downloaded and is about to be installed.
633
- UPDATE_IGNORED: 2, // The app had an optional update and the end-user chose to ignore it
634
- UNKNOWN_ERROR: 3,
635
- SYNC_IN_PROGRESS: 4, // There is an ongoing "sync" operation in progress.
636
- CHECKING_FOR_UPDATE: 5,
637
- AWAITING_USER_ACTION: 6,
638
- DOWNLOADING_PACKAGE: 7,
639
- INSTALLING_UPDATE: 8
640
- },
641
- CheckFrequency: {
642
- ON_APP_START: 0,
643
- ON_APP_RESUME: 1,
644
- MANUAL: 2
645
- },
646
- UpdateState: {
647
- RUNNING: NativeCodePush.codePushUpdateStateRunning,
648
- PENDING: NativeCodePush.codePushUpdateStatePending,
649
- LATEST: NativeCodePush.codePushUpdateStateLatest
650
- },
651
- DeploymentStatus: {
652
- FAILED: "DeploymentFailed",
653
- SUCCEEDED: "DeploymentSucceeded",
654
- },
655
- DEFAULT_UPDATE_DIALOG: {
656
- appendReleaseDescription: false,
657
- descriptionPrefix: " Description: ",
658
- mandatoryContinueButtonLabel: "Continue",
659
- mandatoryUpdateMessage: "An update is available that must be installed.",
660
- optionalIgnoreButtonLabel: "Ignore",
661
- optionalInstallButtonLabel: "Install",
662
- optionalUpdateMessage: "An update is available. Would you like to install it?",
663
- title: "Update available"
664
- },
665
- DEFAULT_ROLLBACK_RETRY_OPTIONS: {
666
- delayInHours: 24,
667
- maxRetryAttempts: 1
668
- }
669
- });
670
- } else {
671
- log("The CodePush module doesn't appear to be properly installed. Please double-check that everything is setup correctly.");
672
- }
673
-
674
- module.exports = CodePush;
@@ -1,2 +0,0 @@
1
- #Wed Jan 22 01:48:35 CET 2025
2
- java.home=/Users/louislagrange/Applications/Android Studio.app/Contents/jbr/Contents/Home
@@ -1,8 +0,0 @@
1
- ## This file must *NOT* be checked into Version Control Systems,
2
- # as it contains information specific to your local configuration.
3
- #
4
- # Location of the SDK. This is only used by Gradle.
5
- # For customization when using a Version Control System, please read the
6
- # header note.
7
- #Wed Jan 22 01:48:35 CET 2025
8
- sdk.dir=/Users/louislagrange/Library/Android/sdk