@appzung/react-native-code-push 9.0.2 → 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 (473) hide show
  1. package/CodePush.podspec +1 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +169 -329
  4. package/android/app/.gradle/config.properties +2 -0
  5. package/android/app/build.gradle +63 -19
  6. package/android/app/local.properties +8 -0
  7. package/android/app/src/main/AndroidManifest.xml +2 -3
  8. package/android/app/src/main/AndroidManifestNew.xml +3 -0
  9. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePush.java +35 -97
  10. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushConstants.java +1 -1
  11. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushInstallMode.java +2 -2
  12. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushInvalidPublicKeyException.java +2 -2
  13. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushInvalidUpdateException.java +1 -1
  14. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushMalformedDataException.java +2 -2
  15. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushNativeModule.java +37 -8
  16. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushNotInitializedException.java +2 -2
  17. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushTelemetryManager.java +14 -14
  18. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUnknownException.java +2 -2
  19. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUpdateManager.java +3 -3
  20. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUpdateState.java +2 -2
  21. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUpdateUtils.java +1 -1
  22. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/CodePushUtils.java +1 -1
  23. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/DownloadProgress.java +1 -1
  24. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/DownloadProgressCallback.java +1 -1
  25. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/FileUtils.java +1 -1
  26. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/ReactInstanceHolder.java +1 -1
  27. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/SettingsManager.java +1 -1
  28. package/android/app/src/main/java/com/{microsoft → appzung}/codepush/react/TLSSocketFactory.java +1 -1
  29. package/android/build.gradle +1 -11
  30. package/android/codepush.gradle +3 -3
  31. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  32. package/android/gradle.properties +4 -20
  33. package/docs/advanced-usage.md +56 -0
  34. package/docs/api-android.md +16 -77
  35. package/docs/api-ios.md +9 -21
  36. package/docs/api-js.md +184 -219
  37. package/docs/code-signing.md +62 -0
  38. package/docs/migrating-to-v10.md +31 -0
  39. package/docs/setup-android.md +54 -463
  40. package/docs/setup-ios.md +37 -208
  41. package/docs/setup-windows.md +8 -74
  42. package/ios/CodePush/CodePush.h +4 -4
  43. package/ios/CodePush/CodePush.m +21 -65
  44. package/ios/CodePush/CodePushConfig.m +14 -11
  45. package/ios/CodePush/CodePushPackage.m +60 -60
  46. package/ios/CodePush/CodePushTelemetryManager.m +13 -13
  47. package/ios/CodePush.xcodeproj/project.pbxproj +1 -562
  48. package/lib/commonjs/CodePush.js +90 -0
  49. package/lib/commonjs/CodePush.js.map +1 -0
  50. package/lib/commonjs/allowRestart.js +12 -0
  51. package/lib/commonjs/allowRestart.js.map +1 -0
  52. package/lib/commonjs/checkForUpdates.js +105 -0
  53. package/lib/commonjs/checkForUpdates.js.map +1 -0
  54. package/lib/commonjs/clearUpdates.js +15 -0
  55. package/lib/commonjs/clearUpdates.js.map +1 -0
  56. package/lib/commonjs/disallowRestart.js +12 -0
  57. package/lib/commonjs/disallowRestart.js.map +1 -0
  58. package/lib/commonjs/enums/CheckFrequency.enum.js +25 -0
  59. package/lib/commonjs/enums/CheckFrequency.enum.js.map +1 -0
  60. package/lib/commonjs/enums/DeploymentStatus.enum.js +21 -0
  61. package/lib/commonjs/enums/DeploymentStatus.enum.js.map +1 -0
  62. package/lib/commonjs/enums/InstallMode.enum.js +35 -0
  63. package/lib/commonjs/enums/InstallMode.enum.js.map +1 -0
  64. package/lib/commonjs/enums/SyncStatus.enum.js +53 -0
  65. package/lib/commonjs/enums/SyncStatus.enum.js.map +1 -0
  66. package/lib/commonjs/enums/UpdateState.enum.js +29 -0
  67. package/lib/commonjs/enums/UpdateState.enum.js.map +1 -0
  68. package/lib/commonjs/getUpdateMetadata.js +25 -0
  69. package/lib/commonjs/getUpdateMetadata.js.map +1 -0
  70. package/lib/commonjs/index.js +195 -0
  71. package/lib/commonjs/index.js.map +1 -0
  72. package/lib/commonjs/internals/AcquisitionSdk.js +9 -0
  73. package/lib/commonjs/internals/AcquisitionSdk.js.map +1 -0
  74. package/lib/commonjs/internals/LocalPackageImplementation.js +29 -0
  75. package/lib/commonjs/internals/LocalPackageImplementation.js.map +1 -0
  76. package/lib/commonjs/internals/NativeRNAppZungCodePushModule.js +8 -0
  77. package/lib/commonjs/internals/NativeRNAppZungCodePushModule.js.map +1 -0
  78. package/lib/commonjs/internals/RNAppZungCodePushModuleSpec.js +6 -0
  79. package/lib/commonjs/internals/RNAppZungCodePushModuleSpec.js.map +1 -0
  80. package/lib/commonjs/internals/RemotePackageImplementation.js +49 -0
  81. package/lib/commonjs/internals/RemotePackageImplementation.js.map +1 -0
  82. package/lib/commonjs/internals/getConfiguration.js +15 -0
  83. package/lib/commonjs/internals/getConfiguration.js.map +1 -0
  84. package/lib/commonjs/internals/getCurrentPackage.js +12 -0
  85. package/lib/commonjs/internals/getCurrentPackage.js.map +1 -0
  86. package/lib/commonjs/internals/getPromisifiedSdk.js +49 -0
  87. package/lib/commonjs/internals/getPromisifiedSdk.js.map +1 -0
  88. package/lib/commonjs/internals/shouldUpdateBeIgnored.js +62 -0
  89. package/lib/commonjs/internals/shouldUpdateBeIgnored.js.map +1 -0
  90. package/lib/commonjs/internals/types.js +6 -0
  91. package/lib/commonjs/internals/types.js.map +1 -0
  92. package/lib/commonjs/internals/utils/log.js +11 -0
  93. package/lib/commonjs/internals/utils/log.js.map +1 -0
  94. package/lib/commonjs/internals/utils/request-fetch-adapter.js +50 -0
  95. package/lib/commonjs/internals/utils/request-fetch-adapter.js.map +1 -0
  96. package/lib/commonjs/internals/version.js +9 -0
  97. package/lib/commonjs/internals/version.js.map +1 -0
  98. package/lib/commonjs/notifyAppReady.js +83 -0
  99. package/lib/commonjs/notifyAppReady.js.map +1 -0
  100. package/lib/commonjs/reactNative.d.js +2 -0
  101. package/lib/commonjs/reactNative.d.js.map +1 -0
  102. package/lib/commonjs/restartApp.js +16 -0
  103. package/lib/commonjs/restartApp.js.map +1 -0
  104. package/lib/commonjs/sync.js +219 -0
  105. package/lib/commonjs/sync.js.map +1 -0
  106. package/lib/commonjs/types.js +6 -0
  107. package/lib/commonjs/types.js.map +1 -0
  108. package/lib/module/CodePush.js +84 -0
  109. package/lib/module/CodePush.js.map +1 -0
  110. package/lib/module/allowRestart.js +9 -0
  111. package/lib/module/allowRestart.js.map +1 -0
  112. package/lib/module/checkForUpdates.js +101 -0
  113. package/lib/module/checkForUpdates.js.map +1 -0
  114. package/lib/module/clearUpdates.js +12 -0
  115. package/lib/module/clearUpdates.js.map +1 -0
  116. package/lib/module/disallowRestart.js +9 -0
  117. package/lib/module/disallowRestart.js.map +1 -0
  118. package/lib/module/enums/CheckFrequency.enum.js +21 -0
  119. package/lib/module/enums/CheckFrequency.enum.js.map +1 -0
  120. package/lib/module/enums/DeploymentStatus.enum.js +17 -0
  121. package/lib/module/enums/DeploymentStatus.enum.js.map +1 -0
  122. package/lib/module/enums/InstallMode.enum.js +32 -0
  123. package/lib/module/enums/InstallMode.enum.js.map +1 -0
  124. package/lib/module/enums/SyncStatus.enum.js +49 -0
  125. package/lib/module/enums/SyncStatus.enum.js.map +1 -0
  126. package/lib/module/enums/UpdateState.enum.js +26 -0
  127. package/lib/module/enums/UpdateState.enum.js.map +1 -0
  128. package/lib/module/getUpdateMetadata.js +21 -0
  129. package/lib/module/getUpdateMetadata.js.map +1 -0
  130. package/lib/module/index.js +19 -0
  131. package/lib/module/index.js.map +1 -0
  132. package/lib/module/internals/AcquisitionSdk.js +5 -0
  133. package/lib/module/internals/AcquisitionSdk.js.map +1 -0
  134. package/lib/module/internals/LocalPackageImplementation.js +24 -0
  135. package/lib/module/internals/LocalPackageImplementation.js.map +1 -0
  136. package/lib/module/internals/NativeRNAppZungCodePushModule.js +4 -0
  137. package/lib/module/internals/NativeRNAppZungCodePushModule.js.map +1 -0
  138. package/lib/module/internals/RNAppZungCodePushModuleSpec.js +4 -0
  139. package/lib/module/internals/RNAppZungCodePushModuleSpec.js.map +1 -0
  140. package/lib/module/internals/RemotePackageImplementation.js +44 -0
  141. package/lib/module/internals/RemotePackageImplementation.js.map +1 -0
  142. package/lib/module/internals/getConfiguration.js +11 -0
  143. package/lib/module/internals/getConfiguration.js.map +1 -0
  144. package/lib/module/internals/getCurrentPackage.js +8 -0
  145. package/lib/module/internals/getCurrentPackage.js.map +1 -0
  146. package/lib/module/internals/getPromisifiedSdk.js +45 -0
  147. package/lib/module/internals/getPromisifiedSdk.js.map +1 -0
  148. package/lib/module/internals/shouldUpdateBeIgnored.js +58 -0
  149. package/lib/module/internals/shouldUpdateBeIgnored.js.map +1 -0
  150. package/lib/module/internals/types.js +4 -0
  151. package/lib/module/internals/types.js.map +1 -0
  152. package/lib/module/internals/utils/log.js +7 -0
  153. package/lib/module/internals/utils/log.js.map +1 -0
  154. package/lib/module/internals/utils/request-fetch-adapter.js +46 -0
  155. package/lib/module/internals/utils/request-fetch-adapter.js.map +1 -0
  156. package/lib/module/internals/version.js +5 -0
  157. package/lib/module/internals/version.js.map +1 -0
  158. package/lib/module/notifyAppReady.js +79 -0
  159. package/lib/module/notifyAppReady.js.map +1 -0
  160. package/lib/module/reactNative.d.js +2 -0
  161. package/lib/module/reactNative.d.js.map +1 -0
  162. package/lib/module/restartApp.js +13 -0
  163. package/lib/module/restartApp.js.map +1 -0
  164. package/lib/module/sync.js +215 -0
  165. package/lib/module/sync.js.map +1 -0
  166. package/lib/module/types.js +4 -0
  167. package/lib/module/types.js.map +1 -0
  168. package/lib/typescript/commonjs/package.json +1 -0
  169. package/lib/typescript/commonjs/src/CodePush.d.ts +24 -0
  170. package/lib/typescript/commonjs/src/CodePush.d.ts.map +1 -0
  171. package/lib/typescript/commonjs/src/allowRestart.d.ts +5 -0
  172. package/lib/typescript/commonjs/src/allowRestart.d.ts.map +1 -0
  173. package/lib/typescript/commonjs/src/checkForUpdates.d.ts +9 -0
  174. package/lib/typescript/commonjs/src/checkForUpdates.d.ts.map +1 -0
  175. package/lib/typescript/commonjs/src/clearUpdates.d.ts +8 -0
  176. package/lib/typescript/commonjs/src/clearUpdates.d.ts.map +1 -0
  177. package/lib/typescript/commonjs/src/disallowRestart.d.ts +5 -0
  178. package/lib/typescript/commonjs/src/disallowRestart.d.ts.map +1 -0
  179. package/lib/typescript/commonjs/src/enums/CheckFrequency.enum.d.ts +18 -0
  180. package/lib/typescript/commonjs/src/enums/CheckFrequency.enum.d.ts.map +1 -0
  181. package/lib/typescript/commonjs/src/enums/DeploymentStatus.enum.d.ts +14 -0
  182. package/lib/typescript/commonjs/src/enums/DeploymentStatus.enum.d.ts.map +1 -0
  183. package/lib/typescript/commonjs/src/enums/InstallMode.enum.d.ts +27 -0
  184. package/lib/typescript/commonjs/src/enums/InstallMode.enum.d.ts.map +1 -0
  185. package/lib/typescript/commonjs/src/enums/SyncStatus.enum.d.ts +46 -0
  186. package/lib/typescript/commonjs/src/enums/SyncStatus.enum.d.ts.map +1 -0
  187. package/lib/typescript/commonjs/src/enums/UpdateState.enum.d.ts +21 -0
  188. package/lib/typescript/commonjs/src/enums/UpdateState.enum.d.ts.map +1 -0
  189. package/lib/typescript/commonjs/src/getUpdateMetadata.d.ts +9 -0
  190. package/lib/typescript/commonjs/src/getUpdateMetadata.d.ts.map +1 -0
  191. package/lib/typescript/commonjs/src/index.d.ts +17 -0
  192. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  193. package/lib/typescript/commonjs/src/internals/AcquisitionSdk.d.ts +3 -0
  194. package/lib/typescript/commonjs/src/internals/AcquisitionSdk.d.ts.map +1 -0
  195. package/lib/typescript/commonjs/src/internals/LocalPackageImplementation.d.ts +17 -0
  196. package/lib/typescript/commonjs/src/internals/LocalPackageImplementation.d.ts.map +1 -0
  197. package/lib/typescript/commonjs/src/internals/NativeRNAppZungCodePushModule.d.ts +3 -0
  198. package/lib/typescript/commonjs/src/internals/NativeRNAppZungCodePushModule.d.ts.map +1 -0
  199. package/lib/typescript/commonjs/src/internals/RNAppZungCodePushModuleSpec.d.ts +36 -0
  200. package/lib/typescript/commonjs/src/internals/RNAppZungCodePushModuleSpec.d.ts.map +1 -0
  201. package/lib/typescript/commonjs/src/internals/RemotePackageImplementation.d.ts +18 -0
  202. package/lib/typescript/commonjs/src/internals/RemotePackageImplementation.d.ts.map +1 -0
  203. package/lib/typescript/commonjs/src/internals/getConfiguration.d.ts +3 -0
  204. package/lib/typescript/commonjs/src/internals/getConfiguration.d.ts.map +1 -0
  205. package/lib/typescript/commonjs/src/internals/getCurrentPackage.d.ts +2 -0
  206. package/lib/typescript/commonjs/src/internals/getCurrentPackage.d.ts.map +1 -0
  207. package/lib/typescript/commonjs/src/internals/getPromisifiedSdk.d.ts +13 -0
  208. package/lib/typescript/commonjs/src/internals/getPromisifiedSdk.d.ts.map +1 -0
  209. package/lib/typescript/commonjs/src/internals/shouldUpdateBeIgnored.d.ts +3 -0
  210. package/lib/typescript/commonjs/src/internals/shouldUpdateBeIgnored.d.ts.map +1 -0
  211. package/lib/typescript/commonjs/src/internals/types.d.ts +16 -0
  212. package/lib/typescript/commonjs/src/internals/types.d.ts.map +1 -0
  213. package/lib/typescript/commonjs/src/internals/utils/log.d.ts +2 -0
  214. package/lib/typescript/commonjs/src/internals/utils/log.d.ts.map +1 -0
  215. package/lib/typescript/commonjs/src/internals/utils/request-fetch-adapter.d.ts +3 -0
  216. package/lib/typescript/commonjs/src/internals/utils/request-fetch-adapter.d.ts.map +1 -0
  217. package/lib/typescript/commonjs/src/internals/version.d.ts +2 -0
  218. package/lib/typescript/commonjs/src/internals/version.d.ts.map +1 -0
  219. package/lib/typescript/commonjs/src/notifyAppReady.d.ts +6 -0
  220. package/lib/typescript/commonjs/src/notifyAppReady.d.ts.map +1 -0
  221. package/lib/typescript/commonjs/src/restartApp.d.ts +7 -0
  222. package/lib/typescript/commonjs/src/restartApp.d.ts.map +1 -0
  223. package/lib/typescript/commonjs/src/sync.d.ts +17 -0
  224. package/lib/typescript/commonjs/src/sync.d.ts.map +1 -0
  225. package/lib/typescript/commonjs/src/types.d.ts +196 -0
  226. package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
  227. package/lib/typescript/module/package.json +1 -0
  228. package/lib/typescript/module/src/CodePush.d.ts +24 -0
  229. package/lib/typescript/module/src/CodePush.d.ts.map +1 -0
  230. package/lib/typescript/module/src/allowRestart.d.ts +5 -0
  231. package/lib/typescript/module/src/allowRestart.d.ts.map +1 -0
  232. package/lib/typescript/module/src/checkForUpdates.d.ts +9 -0
  233. package/lib/typescript/module/src/checkForUpdates.d.ts.map +1 -0
  234. package/lib/typescript/module/src/clearUpdates.d.ts +8 -0
  235. package/lib/typescript/module/src/clearUpdates.d.ts.map +1 -0
  236. package/lib/typescript/module/src/disallowRestart.d.ts +5 -0
  237. package/lib/typescript/module/src/disallowRestart.d.ts.map +1 -0
  238. package/lib/typescript/module/src/enums/CheckFrequency.enum.d.ts +18 -0
  239. package/lib/typescript/module/src/enums/CheckFrequency.enum.d.ts.map +1 -0
  240. package/lib/typescript/module/src/enums/DeploymentStatus.enum.d.ts +14 -0
  241. package/lib/typescript/module/src/enums/DeploymentStatus.enum.d.ts.map +1 -0
  242. package/lib/typescript/module/src/enums/InstallMode.enum.d.ts +27 -0
  243. package/lib/typescript/module/src/enums/InstallMode.enum.d.ts.map +1 -0
  244. package/lib/typescript/module/src/enums/SyncStatus.enum.d.ts +46 -0
  245. package/lib/typescript/module/src/enums/SyncStatus.enum.d.ts.map +1 -0
  246. package/lib/typescript/module/src/enums/UpdateState.enum.d.ts +21 -0
  247. package/lib/typescript/module/src/enums/UpdateState.enum.d.ts.map +1 -0
  248. package/lib/typescript/module/src/getUpdateMetadata.d.ts +9 -0
  249. package/lib/typescript/module/src/getUpdateMetadata.d.ts.map +1 -0
  250. package/lib/typescript/module/src/index.d.ts +17 -0
  251. package/lib/typescript/module/src/index.d.ts.map +1 -0
  252. package/lib/typescript/module/src/internals/AcquisitionSdk.d.ts +3 -0
  253. package/lib/typescript/module/src/internals/AcquisitionSdk.d.ts.map +1 -0
  254. package/lib/typescript/module/src/internals/LocalPackageImplementation.d.ts +17 -0
  255. package/lib/typescript/module/src/internals/LocalPackageImplementation.d.ts.map +1 -0
  256. package/lib/typescript/module/src/internals/NativeRNAppZungCodePushModule.d.ts +3 -0
  257. package/lib/typescript/module/src/internals/NativeRNAppZungCodePushModule.d.ts.map +1 -0
  258. package/lib/typescript/module/src/internals/RNAppZungCodePushModuleSpec.d.ts +36 -0
  259. package/lib/typescript/module/src/internals/RNAppZungCodePushModuleSpec.d.ts.map +1 -0
  260. package/lib/typescript/module/src/internals/RemotePackageImplementation.d.ts +18 -0
  261. package/lib/typescript/module/src/internals/RemotePackageImplementation.d.ts.map +1 -0
  262. package/lib/typescript/module/src/internals/getConfiguration.d.ts +3 -0
  263. package/lib/typescript/module/src/internals/getConfiguration.d.ts.map +1 -0
  264. package/lib/typescript/module/src/internals/getCurrentPackage.d.ts +2 -0
  265. package/lib/typescript/module/src/internals/getCurrentPackage.d.ts.map +1 -0
  266. package/lib/typescript/module/src/internals/getPromisifiedSdk.d.ts +13 -0
  267. package/lib/typescript/module/src/internals/getPromisifiedSdk.d.ts.map +1 -0
  268. package/lib/typescript/module/src/internals/shouldUpdateBeIgnored.d.ts +3 -0
  269. package/lib/typescript/module/src/internals/shouldUpdateBeIgnored.d.ts.map +1 -0
  270. package/lib/typescript/module/src/internals/types.d.ts +16 -0
  271. package/lib/typescript/module/src/internals/types.d.ts.map +1 -0
  272. package/lib/typescript/module/src/internals/utils/log.d.ts +2 -0
  273. package/lib/typescript/module/src/internals/utils/log.d.ts.map +1 -0
  274. package/lib/typescript/module/src/internals/utils/request-fetch-adapter.d.ts +3 -0
  275. package/lib/typescript/module/src/internals/utils/request-fetch-adapter.d.ts.map +1 -0
  276. package/lib/typescript/module/src/internals/version.d.ts +2 -0
  277. package/lib/typescript/module/src/internals/version.d.ts.map +1 -0
  278. package/lib/typescript/module/src/notifyAppReady.d.ts +6 -0
  279. package/lib/typescript/module/src/notifyAppReady.d.ts.map +1 -0
  280. package/lib/typescript/module/src/restartApp.d.ts +7 -0
  281. package/lib/typescript/module/src/restartApp.d.ts.map +1 -0
  282. package/lib/typescript/module/src/sync.d.ts +17 -0
  283. package/lib/typescript/module/src/sync.d.ts.map +1 -0
  284. package/lib/typescript/module/src/types.d.ts +196 -0
  285. package/lib/typescript/module/src/types.d.ts.map +1 -0
  286. package/package.json +79 -29
  287. package/react-native.config.js +8 -8
  288. package/scripts/generateBundledResourcesHash.js +1 -1
  289. package/scripts/getFilesInFolder.js +1 -1
  290. package/scripts/recordFilesBeforeBundleCommand.js +1 -1
  291. package/src/CodePush.tsx +108 -0
  292. package/src/allowRestart.ts +6 -0
  293. package/src/checkForUpdates.ts +109 -0
  294. package/src/clearUpdates.ts +9 -0
  295. package/src/disallowRestart.ts +6 -0
  296. package/src/enums/CheckFrequency.enum.ts +19 -0
  297. package/src/enums/DeploymentStatus.enum.ts +14 -0
  298. package/src/enums/InstallMode.enum.ts +31 -0
  299. package/src/enums/SyncStatus.enum.ts +53 -0
  300. package/src/enums/UpdateState.enum.ts +24 -0
  301. package/src/getUpdateMetadata.ts +23 -0
  302. package/src/index.ts +18 -0
  303. package/src/internals/AcquisitionSdk.ts +3 -0
  304. package/src/internals/LocalPackageImplementation.ts +45 -0
  305. package/src/internals/NativeRNAppZungCodePushModule.ts +3 -0
  306. package/src/internals/RNAppZungCodePushModuleSpec.ts +54 -0
  307. package/src/internals/RemotePackageImplementation.ts +69 -0
  308. package/src/internals/getConfiguration.ts +12 -0
  309. package/src/internals/getCurrentPackage.ts +6 -0
  310. package/src/internals/getPromisifiedSdk.ts +72 -0
  311. package/src/internals/shouldUpdateBeIgnored.ts +76 -0
  312. package/src/internals/types.ts +18 -0
  313. package/{logging.js → src/internals/utils/log.ts} +1 -3
  314. package/src/internals/utils/request-fetch-adapter.ts +58 -0
  315. package/src/internals/version.ts +2 -0
  316. package/src/notifyAppReady.ts +94 -0
  317. package/src/reactNative.d.ts +34 -0
  318. package/src/restartApp.ts +10 -0
  319. package/src/sync.ts +272 -0
  320. package/src/types.ts +237 -0
  321. package/tsconfig.build.json +4 -0
  322. package/tsconfig.json +29 -12
  323. package/windows/CodePush/CodePushConfig.cpp +3 -3
  324. package/windows/CodePush/CodePushConfig.h +3 -3
  325. package/windows/CodePush/CodePushNativeModule.cpp +27 -27
  326. package/windows/CodePush/CodePushNativeModule.h +4 -4
  327. package/windows/CodePush/CodePushTelemetryManager.cpp +12 -12
  328. package/windows/CodePush/CodePushTelemetryManager.h +1 -1
  329. package/.azurepipelines/build-rn-code-push-1es.yml +0 -104
  330. package/.azurepipelines/test-rn-code-push.yml +0 -94
  331. package/.config/CredScanSuppressions.json +0 -14
  332. package/AlertAdapter.js +0 -24
  333. package/CONTRIBUTING.md +0 -134
  334. package/CodePush.js +0 -671
  335. package/SECURITY.md +0 -41
  336. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +0 -37
  337. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushDialog.java +0 -102
  338. package/docs/multi-deployment-testing-android.md +0 -148
  339. package/docs/multi-deployment-testing-ios.md +0 -59
  340. package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +0 -34
  341. package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +0 -252
  342. package/ios/CodePush/Base64/README.md +0 -47
  343. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +0 -69
  344. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +0 -16
  345. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +0 -51
  346. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +0 -15
  347. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +0 -55
  348. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +0 -24
  349. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +0 -41
  350. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +0 -28
  351. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +0 -205
  352. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +0 -103
  353. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +0 -322
  354. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +0 -37
  355. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +0 -145
  356. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +0 -35
  357. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +0 -551
  358. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +0 -23
  359. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +0 -43
  360. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +0 -230
  361. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +0 -31
  362. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +0 -113
  363. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +0 -38
  364. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +0 -500
  365. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +0 -18
  366. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +0 -214
  367. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +0 -23
  368. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +0 -29
  369. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +0 -19
  370. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +0 -68
  371. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +0 -18
  372. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +0 -72
  373. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +0 -67
  374. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +0 -111
  375. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +0 -119
  376. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +0 -307
  377. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +0 -94
  378. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +0 -619
  379. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +0 -164
  380. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +0 -514
  381. package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +0 -24
  382. package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +0 -11
  383. package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +0 -52
  384. package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +0 -5
  385. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +0 -28
  386. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +0 -70
  387. package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +0 -22
  388. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +0 -34
  389. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +0 -73
  390. package/ios/CodePush/JWT/LICENSE +0 -19
  391. package/ios/CodePush/JWT/README.md +0 -489
  392. package/ios/CodePush/SSZipArchive/Info.plist +0 -26
  393. package/ios/CodePush/SSZipArchive/README.md +0 -1
  394. package/ios/CodePush/SSZipArchive/SSZipArchive.h +0 -178
  395. package/ios/CodePush/SSZipArchive/SSZipArchive.m +0 -1496
  396. package/ios/CodePush/SSZipArchive/SSZipCommon.h +0 -71
  397. package/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy +0 -23
  398. package/ios/CodePush/SSZipArchive/include/ZipArchive.h +0 -25
  399. package/ios/CodePush/SSZipArchive/minizip/LICENSE +0 -17
  400. package/ios/CodePush/SSZipArchive/minizip/mz.h +0 -273
  401. package/ios/CodePush/SSZipArchive/minizip/mz_compat.c +0 -1306
  402. package/ios/CodePush/SSZipArchive/minizip/mz_compat.h +0 -346
  403. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.c +0 -187
  404. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.h +0 -65
  405. package/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c +0 -526
  406. package/ios/CodePush/SSZipArchive/minizip/mz_os.c +0 -348
  407. package/ios/CodePush/SSZipArchive/minizip/mz_os.h +0 -176
  408. package/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c +0 -350
  409. package/ios/CodePush/SSZipArchive/minizip/mz_strm.c +0 -556
  410. package/ios/CodePush/SSZipArchive/minizip/mz_strm.h +0 -132
  411. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c +0 -383
  412. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h +0 -42
  413. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c +0 -269
  414. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h +0 -48
  415. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h +0 -40
  416. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c +0 -203
  417. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c +0 -334
  418. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h +0 -46
  419. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c +0 -429
  420. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h +0 -43
  421. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c +0 -360
  422. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h +0 -46
  423. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c +0 -389
  424. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h +0 -43
  425. package/ios/CodePush/SSZipArchive/minizip/mz_zip.c +0 -2782
  426. package/ios/CodePush/SSZipArchive/minizip/mz_zip.h +0 -262
  427. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c +0 -1942
  428. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h +0 -285
  429. package/package-mixins.js +0 -68
  430. package/request-fetch-adapter.js +0 -52
  431. package/scripts/postlink/android/postlink.js +0 -87
  432. package/scripts/postlink/ios/postlink.js +0 -116
  433. package/scripts/postlink/run.js +0 -11
  434. package/scripts/postunlink/android/postunlink.js +0 -74
  435. package/scripts/postunlink/ios/postunlink.js +0 -87
  436. package/scripts/postunlink/run.js +0 -11
  437. package/scripts/tools/linkToolsAndroid.js +0 -57
  438. package/scripts/tools/linkToolsIos.js +0 -130
  439. package/tslint.json +0 -32
  440. package/typings/react-native-code-push.d.ts +0 -455
  441. package/windows-legacy/CodePush/CodePush.csproj +0 -128
  442. package/windows-legacy/CodePush/CodePushUtils.cs +0 -47
  443. package/windows-legacy/CodePush/FileUtils.cs +0 -40
  444. package/windows-legacy/CodePush/Properties/AssemblyInfo.cs +0 -29
  445. package/windows-legacy/CodePush/Properties/CodePush.rd.xml +0 -33
  446. package/windows-legacy/CodePush/UpdateManager.cs +0 -305
  447. package/windows-legacy/CodePush/UpdateUtils.cs +0 -46
  448. package/windows-legacy/CodePush.Net46/Adapters/Http/HttpProgress.cs +0 -28
  449. package/windows-legacy/CodePush.Net46/Adapters/Storage/ApplicationDataContainer.cs +0 -106
  450. package/windows-legacy/CodePush.Net46/CodePush.Net46.csproj +0 -103
  451. package/windows-legacy/CodePush.Net46/CodePushUtils.cs +0 -158
  452. package/windows-legacy/CodePush.Net46/FileUtils.cs +0 -55
  453. package/windows-legacy/CodePush.Net46/Properties/AssemblyInfo.cs +0 -36
  454. package/windows-legacy/CodePush.Net46/UpdateManager.cs +0 -330
  455. package/windows-legacy/CodePush.Net46/UpdateUtils.cs +0 -70
  456. package/windows-legacy/CodePush.Net46/packages.config +0 -5
  457. package/windows-legacy/CodePush.Net46.Test/ApplicationDataContainerTest.cs +0 -105
  458. package/windows-legacy/CodePush.Net46.Test/CodePush.Net46.Test.csproj +0 -137
  459. package/windows-legacy/CodePush.Net46.Test/Properties/AssemblyInfo.cs +0 -36
  460. package/windows-legacy/CodePush.Net46.Test/TelemetryManagerTest.cs +0 -117
  461. package/windows-legacy/CodePush.Net46.Test/app.config +0 -11
  462. package/windows-legacy/CodePush.Net46.Test/packages.config +0 -4
  463. package/windows-legacy/CodePush.Shared/CodePush.Shared.projitems +0 -22
  464. package/windows-legacy/CodePush.Shared/CodePush.Shared.shproj +0 -13
  465. package/windows-legacy/CodePush.Shared/CodePushConstants.cs +0 -35
  466. package/windows-legacy/CodePush.Shared/CodePushNativeModule.cs +0 -329
  467. package/windows-legacy/CodePush.Shared/CodePushReactPackage.cs +0 -235
  468. package/windows-legacy/CodePush.Shared/CodePushUtils.cs +0 -70
  469. package/windows-legacy/CodePush.Shared/InstallMode.cs +0 -9
  470. package/windows-legacy/CodePush.Shared/MinimumBackgroundListener.cs +0 -44
  471. package/windows-legacy/CodePush.Shared/SettingsManager.cs +0 -148
  472. package/windows-legacy/CodePush.Shared/TelemetryManager.cs +0 -250
  473. package/windows-legacy/CodePush.Shared/UpdateState.cs +0 -9
package/docs/api-js.md CHANGED
@@ -12,25 +12,22 @@ The following sections describe the shape and behavior of these APIs in detail:
12
12
 
13
13
  When you require `react-native-code-push`, the module object provides the following top-level methods in addition to the root-level [component decorator](#codepush):
14
14
 
15
- * [allowRestart](#codepushallowrestart): Re-allows programmatic restarts to occur as a result of an update being installed, and optionally, immediately restarts the app if a pending update had attempted to restart the app while restarts were disallowed. This is an advanced API and is only necessary if your app explicitly disallowed restarts via the `disallowRestart` method.
15
+ - [allowRestart](#codepushallowrestart): Re-allows programmatic restarts to occur as a result of an update being installed, and optionally, immediately restarts the app if a pending update had attempted to restart the app while restarts were disallowed. This is an advanced API and is only necessary if your app explicitly disallowed restarts via the `disallowRestart` method.
16
16
 
17
- * [checkForUpdate](#codepushcheckforupdate): Asks the CodePush service whether the configured app deployment has an update available.
17
+ - [checkForUpdate](#codepushcheckforupdate): Asks the CodePush service whether the configured app release channel has an update available.
18
18
 
19
- * [disallowRestart](#codepushdisallowrestart): Temporarily disallows any programmatic restarts to occur as a result of a CodePush update being installed. This is an advanced API, and is useful when a component within your app (for example an onboarding process) needs to ensure that no end-user interruptions can occur during its lifetime.
19
+ - [disallowRestart](#codepushdisallowrestart): Temporarily disallows any programmatic restarts to occur as a result of a CodePush update being installed. This is an advanced API, and is useful when a component within your app (for example an onboarding process) needs to ensure that no end-user interruptions can occur during its lifetime.
20
20
 
21
- * [getCurrentPackage](#codepushgetcurrentpackage): Retrieves the metadata about the currently installed update (like description, installation time, size). *NOTE: As of `v1.10.3-beta` of the CodePush module, this method is deprecated in favor of [`getUpdateMetadata`](#codepushgetupdatemetadata)*.
21
+ - [getUpdateMetadata](#codepushgetupdatemetadata): Retrieves the metadata for an installed update (like description, mandatory).
22
22
 
23
- * [getUpdateMetadata](#codepushgetupdatemetadata): Retrieves the metadata for an installed update (like description, mandatory).
23
+ - [notifyAppReady](#codepushnotifyappready): Notifies the CodePush runtime that an installed update is considered successful. If you are manually checking for and installing updates (i.e. not using the [sync](#codepushsync) method to handle it all for you), then this method **MUST** be called; otherwise CodePush will treat the update as failed and rollback to the previous version when the app next restarts.
24
24
 
25
- * [notifyAppReady](#codepushnotifyappready): Notifies the CodePush runtime that an installed update is considered successful. If you are manually checking for and installing updates (i.e. not using the [sync](#codepushsync) method to handle it all for you), then this method **MUST** be called; otherwise CodePush will treat the update as failed and rollback to the previous version when the app next restarts.
25
+ - [restartApp](#codepushrestartapp): Immediately restarts the app. If there is an update pending, it will be immediately displayed to the end user. Otherwise, calling this method simply has the same behavior as the end user killing and restarting the process.
26
26
 
27
- * [restartApp](#codepushrestartapp): Immediately restarts the app. If there is an update pending, it will be immediately displayed to the end user. Otherwise, calling this method simply has the same behavior as the end user killing and restarting the process.
27
+ - [sync](#codepushsync): Allows checking for an update, downloading it and installing it, all with a single call. Unless you need custom UI and/or behavior, we recommend most developers to use this method when integrating CodePush into their apps
28
28
 
29
- * [sync](#codepushsync): Allows checking for an update, downloading it and installing it, all with a single call. Unless you need custom UI and/or behavior, we recommend most developers to use this method when integrating CodePush into their apps
30
-
31
- * [clearUpdates](#clearupdates): Clear all downloaded CodePush updates. This is useful when switching to a different deployment which may have an older release than the current package.
32
-
33
- _Note: we don’t recommend to use this method in scenarios other than that (CodePush will call this method automatically when needed in other cases) as it could lead to unpredictable behavior._
29
+ - [clearUpdates](#clearupdates): Clear all downloaded CodePush updates. This is useful when switching to a different release channel which may have an older release than the current package.
30
+ _Note: we don’t recommend to use this method in scenarios other than that (CodePush will call this method automatically when needed in other cases) as it could lead to unpredictable behavior._
34
31
 
35
32
  #### codePush
36
33
 
@@ -39,6 +36,7 @@ When you require `react-native-code-push`, the module object provides the follow
39
36
  codePush(rootComponent: React.Component): React.Component;
40
37
  codePush(options: CodePushOptions)(rootComponent: React.Component): React.Component;
41
38
  ```
39
+
42
40
  ```javascript
43
41
  // Decorator; Requires ES7 support
44
42
  @codePush
@@ -49,112 +47,112 @@ Used to wrap a React component inside a "higher order" React component that know
49
47
 
50
48
  This decorator provides support for letting you customize its behaviour to easily enable apps with different requirements. Below are some examples of ways you can use it (you can pick one or even use a combination):
51
49
 
52
- 1. **Silent sync on app start** *(the simplest, default behavior)*. Your app will automatically download available updates, and apply them the next time the app restarts (like the OS or end user killed it, or the device was restarted). This way, the entire update experience is "silent" to the end user, since they don't see any update prompt and/or "synthetic" app restarts.
50
+ 1. **Silent sync on app start** _(the simplest, default behavior)_. Your app will automatically download available updates, and apply them the next time the app restarts (like the OS or end user killed it, or the device was restarted). This way, the entire update experience is "silent" to the end user, since they don't see any update prompt and/or "synthetic" app restarts.
53
51
 
54
- ```javascript
55
- // Fully silent update which keeps the app in
56
- // sync with the server, without ever
57
- // interrupting the end user
58
- class MyApp extends Component<{}> {}
59
- MyApp = codePush(MyApp);
60
- export default MyApp;
61
- ```
52
+ ```javascript
53
+ // Fully silent update which keeps the app in
54
+ // sync with the server, without ever
55
+ // interrupting the end user
56
+ class MyApp extends Component<{}> {}
57
+ MyApp = codePush(MyApp);
58
+ export default MyApp;
59
+ ```
62
60
 
63
61
  2. **Silent sync every time the app resumes**. Same as 1, except we check for updates, or apply an update if one exists every time the app returns to the foreground after being "backgrounded".
64
62
 
65
- ```javascript
66
- // Sync for updates every time the app resumes.
67
- class MyApp extends Component<{}> {}
68
- MyApp = codePush({ checkFrequency: codePush.CheckFrequency.ON_APP_RESUME, installMode: codePush.InstallMode.ON_NEXT_RESUME })(MyApp);
69
- export default MyApp;
70
- ```
63
+ ```javascript
64
+ // Sync for updates every time the app resumes.
65
+ class MyApp extends Component<{}> {}
66
+ MyApp = codePush({ checkFrequency: codePush.CheckFrequency.ON_APP_RESUME, installMode: codePush.InstallMode.ON_NEXT_RESUME })(MyApp);
67
+ export default MyApp;
68
+ ```
71
69
 
72
70
  3. **Interactive**. When an update is available, prompt the end user for permission before downloading it, and then immediately apply the update. If an update was released using the `mandatory` flag, the end user would still be notified about the update, but they wouldn't have the choice to ignore it.
73
71
 
74
- ```javascript
75
- // Active update, which lets the end user know
76
- // about each update, and displays it to them
77
- // immediately after downloading it
78
- class MyApp extends Component<{}> {}
79
- MyApp = codePush({ updateDialog: true, installMode: codePush.InstallMode.IMMEDIATE })(MyApp);
80
- export default MyApp;
81
- ```
72
+ ```javascript
73
+ // Active update, which lets the end user know
74
+ // about each update, and displays it to them
75
+ // immediately after downloading it
76
+ class MyApp extends Component<{}> {}
77
+ MyApp = codePush({ updateDialog: true, installMode: codePush.InstallMode.IMMEDIATE })(MyApp);
78
+ export default MyApp;
79
+ ```
82
80
 
83
81
  4. **Log/display progress**. While the app is syncing with the server for updates, make use of the `codePushStatusDidChange` and/or `codePushDownloadDidProgress` event hooks to log down the different stages of this process, or even display a progress bar to the user.
84
82
 
85
- ```javascript
86
- // Make use of the event hooks to keep track of
87
- // the different stages of the sync process.
88
- class MyApp extends Component<{}> {
89
- codePushStatusDidChange(status) {
90
- switch(status) {
91
- case codePush.SyncStatus.CHECKING_FOR_UPDATE:
92
- console.log("Checking for updates.");
93
- break;
94
- case codePush.SyncStatus.DOWNLOADING_PACKAGE:
95
- console.log("Downloading package.");
96
- break;
97
- case codePush.SyncStatus.INSTALLING_UPDATE:
98
- console.log("Installing update.");
99
- break;
100
- case codePush.SyncStatus.UP_TO_DATE:
101
- console.log("Up-to-date.");
102
- break;
103
- case codePush.SyncStatus.UPDATE_INSTALLED:
104
- console.log("Update installed.");
105
- break;
106
- }
107
- }
108
-
109
- codePushDownloadDidProgress(progress) {
110
- console.log(progress.receivedBytes + " of " + progress.totalBytes + " received.");
111
- }
112
- }
113
- MyApp = codePush(MyApp);
114
- export default MyApp;
115
- ```
83
+ ```javascript
84
+ // Make use of the event hooks to keep track of
85
+ // the different stages of the sync process.
86
+ class MyApp extends Component<{}> {
87
+ codePushStatusDidChange(status) {
88
+ switch(status) {
89
+ case codePush.SyncStatus.CHECKING_FOR_UPDATE:
90
+ console.log("Checking for updates.");
91
+ break;
92
+ case codePush.SyncStatus.DOWNLOADING_PACKAGE:
93
+ console.log("Downloading package.");
94
+ break;
95
+ case codePush.SyncStatus.INSTALLING_UPDATE:
96
+ console.log("Installing update.");
97
+ break;
98
+ case codePush.SyncStatus.UP_TO_DATE:
99
+ console.log("Up-to-date.");
100
+ break;
101
+ case codePush.SyncStatus.UPDATE_INSTALLED:
102
+ console.log("Update installed.");
103
+ break;
104
+ }
105
+ }
106
+
107
+ codePushDownloadDidProgress(progress) {
108
+ console.log(progress.receivedBytes + " of " + progress.totalBytes + " received.");
109
+ }
110
+ }
111
+ MyApp = codePush(MyApp);
112
+ export default MyApp;
113
+ ```
116
114
 
117
115
  ##### CodePushOptions
118
116
 
119
117
  The `codePush` decorator accepts an "options" object that allows you to customize numerous aspects of the default behavior mentioned above:
120
118
 
121
- * __checkFrequency__ *(codePush.CheckFrequency)* - Specifies when you would like to check for updates. Defaults to `codePush.CheckFrequency.ON_APP_START`. Refer to the [`CheckFrequency`](#checkfrequency) enum reference for a description of the available options and what they do.
119
+ - **checkFrequency** _(codePush.CheckFrequency)_ - Specifies when you would like to check for updates. Defaults to `codePush.CheckFrequency.ON_APP_START`. Refer to the [`CheckFrequency`](#checkfrequency) enum reference for a description of the available options and what they do.
122
120
 
123
- * __deploymentKey__ *(String)* - Specifies the deployment key you want to query for an update against. By default, this value is derived from the `Info.plist` file (iOS) and `MainActivity.java` file (Android), but this option allows you to override it from the script-side if you need to dynamically use a different deployment.
121
+ - **releaseChannelPublicId** _(String)_ - Specifies the release channel public ID you want to query for an update against. By default, this value is derived from the `Info.plist` file (iOS) and strings resources (Android), but this option allows you to override it from the script-side if you need to dynamically use a different release channel.
124
122
 
125
- * __installMode__ *(codePush.InstallMode)* - Specifies when you would like to install optional updates (i.e. those that aren't marked as mandatory). Defaults to `codePush.InstallMode.ON_NEXT_RESTART`. Refer to the [`InstallMode`](#installmode) enum reference for a description of the available options and what they do.
123
+ - **installMode** _(codePush.InstallMode)_ - Specifies when you would like to install optional updates (i.e. those that aren't marked as mandatory). Defaults to `codePush.InstallMode.ON_NEXT_RESTART`. Refer to the [`InstallMode`](#installmode) enum reference for a description of the available options and what they do.
126
124
 
127
- * __mandatoryInstallMode__ *(codePush.InstallMode)* - Specifies when you would like to install updates which are marked as mandatory. Defaults to `codePush.InstallMode.IMMEDIATE`. Refer to the [`InstallMode`](#installmode) enum reference for a description of the available options and what they do.
125
+ - **mandatoryInstallMode** _(codePush.InstallMode)_ - Specifies when you would like to install updates which are marked as mandatory. Defaults to `codePush.InstallMode.IMMEDIATE`. Refer to the [`InstallMode`](#installmode) enum reference for a description of the available options and what they do.
128
126
 
129
- * __minimumBackgroundDuration__ *(Number)* - Specifies the minimum number of seconds that the app needs to have been in the background before restarting the app. This property only applies to updates which are installed using `InstallMode.ON_NEXT_RESUME` or `InstallMode.ON_NEXT_SUSPEND`, and can be useful for getting your update in front of end users sooner, without being too obtrusive. Defaults to `0`, which has the effect of applying the update immediately after a resume or unless the app suspension is long enough to not matter, regardless how long it was in the background.
127
+ - **minimumBackgroundDuration** _(Number)_ - Specifies the minimum number of seconds that the app needs to have been in the background before restarting the app. This property only applies to updates which are installed using `InstallMode.ON_NEXT_RESUME` or `InstallMode.ON_NEXT_SUSPEND`, and can be useful for getting your update in front of end users sooner, without being too obtrusive. Defaults to `0`, which has the effect of applying the update immediately after a resume or unless the app suspension is long enough to not matter, regardless how long it was in the background.
130
128
 
131
- * __updateDialog__ *(UpdateDialogOptions)* - An "options" object used to determine whether a confirmation dialog should be displayed to the end user when an update is available, and if so, what strings to use. Defaults to `null`, which has the effect of disabling the dialog completely. Setting this to any truthy value will enable the dialog with the default strings, and passing an object to this parameter allows enabling the dialog as well as overriding one or more of the default strings. Before enabling this option within an App Store-distributed app, please refer to [this note](https://github.com/microsoft/react-native-code-push#app-store).
129
+ - **updateDialog** _(UpdateDialogOptions)_ - An "options" object used to determine whether a confirmation dialog should be displayed to the end user when an update is available, and if so, what strings to use. Defaults to `null`, which has the effect of disabling the dialog completely. Setting this to any truthy value will enable the dialog with the default strings, and passing an object to this parameter allows enabling the dialog as well as overriding one or more of the default strings. Before enabling this option within an App Store-distributed app, please refer to [this note](https://github.com/appzung/react-native-code-push#app-store).
132
130
 
133
- The following list represents the available options and their defaults:
131
+ The following list represents the available options and their defaults:
134
132
 
135
- * __appendReleaseDescription__ *(Boolean)* - Indicates whether you would like to append the description of an available release to the notification message which is displayed to the end user. Defaults to `false`.
133
+ - **appendReleaseDescription** _(Boolean)_ - Indicates whether you would like to append the description of an available release to the notification message which is displayed to the end user. Defaults to `false`.
136
134
 
137
- * __descriptionPrefix__ *(String)* - Indicates the string you would like to prefix the release description with, if any, when displaying the update notification to the end user. Defaults to `" Description: "`
135
+ - **descriptionPrefix** _(String)_ - Indicates the string you would like to prefix the release description with, if any, when displaying the update notification to the end user. Defaults to `" Description: "`
138
136
 
139
- * __mandatoryContinueButtonLabel__ *(String)* - The text to use for the button the end user must press in order to install a mandatory update. Defaults to `"Continue"`.
137
+ - **mandatoryContinueButtonLabel** _(String)_ - The text to use for the button the end user must press in order to install a mandatory update. Defaults to `"Continue"`.
140
138
 
141
- * __mandatoryUpdateMessage__ *(String)* - The text used as the body of an update notification, when the update is specified as mandatory. Defaults to `"An update is available that must be installed."`.
139
+ - **mandatoryUpdateMessage** _(String)_ - The text used as the body of an update notification, when the update is specified as mandatory. Defaults to `"An update is available that must be installed."`.
142
140
 
143
- * __optionalIgnoreButtonLabel__ *(String)* - The text to use for the button the end user can press in order to ignore an optional update that is available. Defaults to `"Ignore"`.
141
+ - **optionalIgnoreButtonLabel** _(String)_ - The text to use for the button the end user can press in order to ignore an optional update that is available. Defaults to `"Ignore"`.
144
142
 
145
- * __optionalInstallButtonLabel__ *(String)* - The text to use for the button the end user can press in order to install an optional update. Defaults to `"Install"`.
143
+ - **optionalInstallButtonLabel** _(String)_ - The text to use for the button the end user can press in order to install an optional update. Defaults to `"Install"`.
146
144
 
147
- * __optionalUpdateMessage__ *(String)* - The text used as the body of an update notification, when the update is optional. Defaults to `"An update is available. Would you like to install it?"`.
145
+ - **optionalUpdateMessage** _(String)_ - The text used as the body of an update notification, when the update is optional. Defaults to `"An update is available. Would you like to install it?"`.
148
146
 
149
- * __title__ *(String)* - The text used as the header of an update notification that is displayed to the end user. Defaults to `"Update available"`.
147
+ - **title** _(String)_ - The text used as the header of an update notification that is displayed to the end user. Defaults to `"Update available"`.
150
148
 
151
- * __rollbackRetryOptions__ *(RollbackRetryOptions)* - The rollback retry mechanism allows the application to attempt to reinstall an update that was previously rolled back (with the restrictions specified in the options). It is an "options" object used to determine whether a rollback retry should occur, and if so, what settings to use for the rollback retry. This defaults to null, which has the effect of disabling the retry mechanism. Setting this to any truthy value will enable the retry mechanism with the default settings, and passing an object to this parameter allows enabling the rollback retry as well as overriding one or more of the default values.
149
+ - **rollbackRetryOptions** _(RollbackRetryOptions)_ - The rollback retry mechanism allows the application to attempt to reinstall an update that was previously rolled back (with the restrictions specified in the options). It is an "options" object used to determine whether a rollback retry should occur, and if so, what settings to use for the rollback retry. This defaults to null, which has the effect of disabling the retry mechanism. Setting this to any truthy value will enable the retry mechanism with the default settings, and passing an object to this parameter allows enabling the rollback retry as well as overriding one or more of the default values.
152
150
 
153
- The following list represents the available options and their defaults:
151
+ The following list represents the available options and their defaults:
154
152
 
155
- * __delayInHours__ *(Number)* - Specifies the minimum time in hours that the app will wait after the latest rollback before attempting to reinstall the same rolled-back package. Defaults to `24`.
153
+ - **delayInHours** _(Number)_ - Specifies the minimum time in hours that the app will wait after the latest rollback before attempting to reinstall the same rolled-back package. Defaults to `24`.
156
154
 
157
- * __maxRetryAttempts__ *(Number)* - Specifies the maximum number of retry attempts that the app can make before it stops trying. Cannot be less than `1`. Defaults to `1`.
155
+ - **maxRetryAttempts** _(Number)_ - Specifies the maximum number of retry attempts that the app can make before it stops trying. Cannot be less than `1`. Defaults to `1`.
158
156
 
159
157
  ##### codePushStatusDidChange (event hook)
160
158
 
@@ -164,9 +162,9 @@ Called when the sync process moves from one stage to another in the overall upda
164
162
 
165
163
  Called periodically when an available update is being downloaded from the CodePush server. The method is called with a `DownloadProgress` object, which contains the following two properties:
166
164
 
167
- * __totalBytes__ *(Number)* - The total number of bytes expected to be received for this update (i.e. the size of the set of files which changed from the previous release).
165
+ - **totalBytes** _(Number)_ - The total number of bytes expected to be received for this update (i.e. the size of the set of files which changed from the previous release).
168
166
 
169
- * __receivedBytes__ *(Number)* - The number of bytes downloaded thus far, which can be used to track download progress.
167
+ - **receivedBytes** _(Number)_ - The number of bytes downloaded thus far, which can be used to track download progress.
170
168
 
171
169
  #### codePush.allowRestart
172
170
 
@@ -195,40 +193,40 @@ See [disallowRestart](#codepushdisallowrestart) for an example of how this metho
195
193
  #### codePush.checkForUpdate
196
194
 
197
195
  ```javascript
198
- codePush.checkForUpdate(deploymentKey: String = null, handleBinaryVersionMismatchCallback: (update: RemotePackage) => void): Promise<RemotePackage>;
196
+ codePush.checkForUpdate(releaseChannelPublicId: String = null, handleBinaryVersionMismatchCallback: (update: RemotePackage) => void): Promise<RemotePackage>;
199
197
  ```
200
198
 
201
- Queries the CodePush service to see whether the configured app deployment has an update available. By default, it will use the deployment key that is configured in your `Info.plist` file (iOS), or `MainActivity.java` file (Android), but you can override that by specifying a value via the optional `deploymentKey` parameter. This can be useful when you want to dynamically "redirect" a user to a specific deployment, such as allowing "early access" via an easter egg or a user setting switch.
199
+ Queries the CodePush service to see whether the configured app release channel has an update available. By default, it will use the release channel public ID that is configured in your `Info.plist` file (iOS), or strings resources (Android), but you can override that by specifying a value via the optional `releaseChannelPublicId` parameter. This can be useful when you want to dynamically "redirect" a user to a specific release channel, such as allowing "early access" via an easter egg or a user setting switch.
202
200
 
203
201
  Second optional parameter `handleBinaryVersionMismatchCallback` is an optional callback function that can be used to notify user if there are any binary update.
204
202
  E.g. consider a use-case where currently installed binary version is 1.0.1 with label(codepush label) v1. Later native code was changed in the dev cycle and binary version was updated to 1.0.2. When code-push update check is triggered we ignore updates having binary version mismatch (because the update is not targeting to the binary version of currently installed app). In this case installed app (1.0.1) will ignore the update targeting version 1.0.2. You can use `handleBinaryVersionMismatchCallback` to provide a hook to handle such situations.
205
203
 
206
204
  **NOTE:**
207
- Be cautious to use Alerts within this callback if you are developing iOS application, due to [App Store](https://developer.apple.com/app-store/review/guidelines/) review process:
205
+ Be cautious to use Alerts within this callback if you are developing iOS application, due to [App Store](https://developer.apple.com/app-store/review/guidelines/) review process:
206
+
208
207
  > Apps must not force users to rate the app, review the app, download other apps, or other similar actions in order to access functionality, content, or use of the app.
209
208
 
210
209
  This method returns a `Promise` which resolves to one of two possible values:
211
210
 
212
211
  1. `null` if there is no update available. This can occur in the following scenarios:
213
212
 
214
- 1. The configured deployment doesn't contain any releases, and therefore, nothing to update.
215
- 2. The latest release within the configured deployment is targeting a different binary version than what you're currently running (either older or newer).
216
- 3. The currently running app already has the latest release from the configured deployment, and therefore, doesn't need it again.
217
- 4. The latest release within the configured deployment is currently marked as disabled, and therefore, isn't allowed to be downloaded.
218
- 5. The latest release within the configured deployment is in an "active rollout" state, and the requesting device doesn't fall within the percentage of users who are eligible for it.
213
+ 1. The configured release channel doesn't contain any releases, and therefore, nothing to update.
214
+ 2. The latest release within the configured release channel is targeting a different binary version than what you're currently running (either older or newer).
215
+ 3. The currently running app already has the latest release from the configured release channel, and therefore, doesn't need it again.
216
+ 4. The latest release within the configured release channel is currently marked as disabled, and therefore, isn't allowed to be downloaded.
217
+ 5. The latest release within the configured release channel is in an "active rollout" state, and the requesting device doesn't fall within the percentage of users who are eligible for it.
219
218
 
220
219
  2. A [`RemotePackage`](#remotepackage) instance which represents an available update that can be inspected and/or subsequently downloaded.
221
220
 
222
221
  Example Usage:
223
222
 
224
223
  ```javascript
225
- codePush.checkForUpdate()
226
- .then((update) => {
227
- if (!update) {
228
- console.log("The app is up to date!");
229
- } else {
230
- console.log("An update is available! Should we download it?");
231
- }
224
+ codePush.checkForUpdate().then((update) => {
225
+ if (!update) {
226
+ console.log('The app is up to date!');
227
+ } else {
228
+ console.log('An update is available! Should we download it?');
229
+ }
232
230
  });
233
231
  ```
234
232
 
@@ -244,7 +242,7 @@ Temporarily disallows programmatic restarts to occur as a result of either of fo
244
242
  2. A CodePush update is installed using `InstallMode.ON_NEXT_RESUME` and the app is resumed from the background (optionally being throttled by the `minimumBackgroundDuration` property)
245
243
  3. The `restartApp` method was called
246
244
 
247
- *NOTE: #1 and #2 effectively work by calling `restartApp` for you, so you can think of `disallowRestart` as blocking any call to `restartApp`, regardless if your app calls it directly or indirectly.*
245
+ _NOTE: #1 and #2 effectively work by calling `restartApp` for you, so you can think of `disallowRestart` as blocking any call to `restartApp`, regardless if your app calls it directly or indirectly._
248
246
 
249
247
  After calling this method, any calls to `sync` would still be allowed to check for an update, download it and install it, but an attempt to restart the app would be queued until `allowRestart` is called. This way, the restart request is captured and can be "flushed" whenever you want to allow it to occur.
250
248
 
@@ -275,39 +273,6 @@ class OnboardingProcess extends Component {
275
273
  }
276
274
  ```
277
275
 
278
- #### codePush.getCurrentPackage
279
-
280
- *NOTE: This method is considered deprecated as of `v1.10.3-beta` of the CodePush module. If you're running this version (or newer), we would recommend using the [`codePush.getUpdateMetadata`](#codepushgetupdatemetadata) instead, since it has more predictable behavior.*
281
-
282
- ```javascript
283
- codePush.getCurrentPackage(): Promise<LocalPackage>;
284
- ```
285
-
286
- Retrieves the metadata about the currently installed "package" (like description, installation time). This can be useful for scenarios such as displaying a "what's new?" dialog after an update has been applied or checking whether there is a pending update that is waiting to be applied via a resume or restart.
287
-
288
- This method returns a `Promise` which resolves to one of two possible values:
289
-
290
- 1. `null` if the app is currently running the JS bundle from the binary and not a CodePush update. This occurs in the following scenarios:
291
-
292
- 1. The end-user installed the app binary and has yet to install a CodePush update
293
- 1. The end-user installed an update of the binary (for example from the store), which cleared away the old CodePush updates, and gave precedence back to the JS binary in the binary.
294
-
295
- 2. A [`LocalPackage`](#localpackage) instance which represents the metadata for the currently running CodePush update.
296
-
297
- Example Usage:
298
-
299
- ```javascript
300
- codePush.getCurrentPackage()
301
- .then((update) => {
302
- // If the current app "session" represents the first time
303
- // this update has run, and it had a description provided
304
- // with it upon release, let's show it to the end user
305
- if (update.isFirstRun && update.description) {
306
- // Display a "what's new?" modal
307
- }
308
- });
309
- ```
310
-
311
276
  #### codePush.getUpdateMetadata
312
277
 
313
278
  ```javascript
@@ -320,13 +285,13 @@ This method returns a `Promise` which resolves to one of two possible values:
320
285
 
321
286
  1. `null` if an update with the specified state doesn't currently exist. This occurs in the following scenarios:
322
287
 
323
- 1. The end-user hasn't installed any CodePush updates yet, and therefore, no metadata is available for any updates, regardless what you specify as the `updateState` parameter.
288
+ 1. The end-user hasn't installed any CodePush updates yet, and therefore, no metadata is available for any updates, regardless what you specify as the `updateState` parameter.
324
289
 
325
- 2. The end-user installed an update of the binary (for example from the store), which cleared away the old CodePush updates, and gave precedence back to the JS binary in the binary. Therefore, it would exhibit the same behavior as #1
290
+ 2. The end-user installed an update of the binary (for example from the store), which cleared away the old CodePush updates, and gave precedence back to the JS binary in the binary. Therefore, it would exhibit the same behavior as #1
326
291
 
327
- 3. The `updateState` parameter is set to `UpdateState.RUNNING`, but the app isn't currently running a CodePush update. There may be a pending update, but the app hasn't been restarted yet in order to make it active.
292
+ 3. The `updateState` parameter is set to `UpdateState.RUNNING`, but the app isn't currently running a CodePush update. There may be a pending update, but the app hasn't been restarted yet in order to make it active.
328
293
 
329
- 4. The `updateState` parameter is set to `UpdateState.PENDING`, but the app doesn't have any currently pending updates.
294
+ 4. The `updateState` parameter is set to `UpdateState.PENDING`, but the app doesn't have any currently pending updates.
330
295
 
331
296
  2. A [`LocalPackage`](#localpackage) instance which represents the metadata for the currently requested CodePush update (either the running or pending).
332
297
 
@@ -337,16 +302,16 @@ Example Usage:
337
302
  // so, register it with the HockeyApp SDK (https://github.com/slowpath/react-native-hockeyapp)
338
303
  // so that crash reports will correctly display the JS bundle version the user was running.
339
304
  codePush.getUpdateMetadata().then((update) => {
340
- if (update) {
341
- hockeyApp.addMetadata({ CodePushRelease: update.label });
342
- }
305
+ if (update) {
306
+ hockeyApp.addMetadata({ CodePushRelease: update.label });
307
+ }
343
308
  });
344
309
 
345
310
  // Check to see if there is still an update pending.
346
311
  codePush.getUpdateMetadata(UpdateState.PENDING).then((update) => {
347
- if (update) {
348
- // There's a pending update, do we want to force a restart?
349
- }
312
+ if (update) {
313
+ // There's a pending update, do we want to force a restart?
314
+ }
350
315
  });
351
316
  ```
352
317
 
@@ -360,8 +325,6 @@ Notifies the CodePush runtime that a freshly installed update should be consider
360
325
 
361
326
  If you are using the `sync` function, and doing your update check on app start, then you don't need to manually call `notifyAppReady` since `sync` will call it for you. This behavior exists due to the assumption that the point at which `sync` is called in your app represents a good approximation of a successful startup.
362
327
 
363
- *NOTE: This method is also aliased as `notifyApplicationReady` (for backwards compatibility).*
364
-
365
328
  #### codePush.restartApp
366
329
 
367
330
  ```javascript
@@ -372,7 +335,7 @@ Immediately restarts the app. If a truthy value is provided to the `onlyIfUpdate
372
335
 
373
336
  This method is for advanced scenarios, and is primarily useful when the following conditions are true:
374
337
 
375
- 1. Your app is specifying an install mode value of `ON_NEXT_RESTART` or `ON_NEXT_RESUME` when calling the `sync` or `LocalPackage.install` methods. This has the effect of not applying your update until the app has been restarted (by either the end user or OS) or resumed, and therefore, the update won't be immediately displayed to the end user.
338
+ 1. Your app is specifying an install mode value of `ON_NEXT_RESTART` or `ON_NEXT_RESUME` when calling the `sync` or `LocalPackage.install` methods. This has the effect of not applying your update until the app has been restarted (by either the end user or OS) or resumed, and therefore, the update won't be immediately displayed to the end user.
376
339
 
377
340
  2. You have an app-specific user event (like the end user navigated back to the app's home route) that allows you to apply the update in an unobtrusive way, and potentially gets the update in front of the end user sooner then waiting until the next restart or resume.
378
341
 
@@ -382,11 +345,11 @@ This method is for advanced scenarios, and is primarily useful when the followin
382
345
  codePush.sync(options: Object, syncStatusChangeCallback: function(syncStatus: Number), downloadProgressCallback: function(progress: DownloadProgress), handleBinaryVersionMismatchCallback: function(update: RemotePackage)): Promise<Number>;
383
346
  ```
384
347
 
385
- Synchronizes your app's JavaScript bundle and image assets with the latest release to the configured deployment. Unlike the [checkForUpdate](#codepushcheckforupdate) method, which simply checks for the presence of an update, and let's you control what to do next, `sync` handles the update check, download and installation experience for you.
348
+ Synchronizes your app's JavaScript bundle and image assets with the latest release to the configured release channel. Unlike the [checkForUpdate](#codepushcheckforupdate) method, which simply checks for the presence of an update, and let's you control what to do next, `sync` handles the update check, download and installation experience for you.
386
349
 
387
350
  This method provides support for two different (but customizable) "modes" to easily enable apps with different requirements:
388
351
 
389
- 1. **Silent mode** *(the default behavior)*, which automatically downloads available updates, and applies them the next time the app restarts (for example the OS or end user killed it, or the device was restarted). This way, the entire update experience is "silent" to the end user, since they don't see any update prompt and/or "synthetic" app restarts.
352
+ 1. **Silent mode** _(the default behavior)_, which automatically downloads available updates, and applies them the next time the app restarts (for example the OS or end user killed it, or the device was restarted). This way, the entire update experience is "silent" to the end user, since they don't see any update prompt and/or "synthetic" app restarts.
390
353
 
391
354
  2. **Active mode**, which when an update is available, prompts the end user for permission before downloading it, and then immediately applies the update. If an update was released using the `mandatory` flag, the end user would still be notified about the update, but they wouldn't have the choice to ignore it.
392
355
 
@@ -404,29 +367,29 @@ codePush.sync();
404
367
  codePush.sync({ updateDialog: true, installMode: codePush.InstallMode.IMMEDIATE });
405
368
  ```
406
369
 
407
- *Note: If you want to decide whether you check and/or download an available update based on the end user's device battery level, network conditions, etc. then simply wrap the call to `sync` in a condition that ensures you only call it when desired.*
370
+ _Note: If you want to decide whether you check and/or download an available update based on the end user's device battery level, network conditions, etc. then simply wrap the call to `sync` in a condition that ensures you only call it when desired._
408
371
 
409
372
  ##### SyncOptions
410
373
 
411
374
  While the `sync` method tries to make it easy to perform silent and active updates with little configuration, it accepts an "options" object that allows you to customize numerous aspects of the default behavior mentioned above. The options available are identical to the [CodePushOptions](#codepushoptions), with the exception of the `checkFrequency` option:
412
375
 
413
- * __deploymentKey__ *(String)* - Refer to [`CodePushOptions`](#codepushoptions).
376
+ - **releaseChannelPublicId** _(String)_ - Refer to [`CodePushOptions`](#codepushoptions).
414
377
 
415
- * __installMode__ *(codePush.InstallMode)* - Refer to [`CodePushOptions`](#codepushoptions).
378
+ - **installMode** _(codePush.InstallMode)_ - Refer to [`CodePushOptions`](#codepushoptions).
416
379
 
417
- * __mandatoryInstallMode__ *(codePush.InstallMode)* - Refer to [`CodePushOptions`](#codepushoptions).
380
+ - **mandatoryInstallMode** _(codePush.InstallMode)_ - Refer to [`CodePushOptions`](#codepushoptions).
418
381
 
419
- * __minimumBackgroundDuration__ *(Number)* - Refer to [`CodePushOptions`](#codepushoptions).
382
+ - **minimumBackgroundDuration** _(Number)_ - Refer to [`CodePushOptions`](#codepushoptions).
420
383
 
421
- * __updateDialog__ *(UpdateDialogOptions)* - Refer to [`CodePushOptions`](#codepushoptions).
384
+ - **updateDialog** _(UpdateDialogOptions)_ - Refer to [`CodePushOptions`](#codepushoptions).
422
385
 
423
386
  Example Usage:
424
387
 
425
388
  ```javascript
426
- // Use a different deployment key for this
389
+ // Use a different release channel public ID for this
427
390
  // specific call, instead of the one configured
428
391
  // in the Info.plist file
429
- codePush.sync({ deploymentKey: "KEY" });
392
+ codePush.sync({ releaseChannelPublicId: 'KEY' });
430
393
 
431
394
  // Download the update silently, but install it on
432
395
  // the next resume, as long as at least 5 minutes
@@ -439,63 +402,64 @@ codePush.sync({ mandatoryInstallMode: codePush.InstallMode.ON_NEXT_RESUME });
439
402
 
440
403
  // Changing the title displayed in the
441
404
  // confirmation dialog of an "active" update
442
- codePush.sync({ updateDialog: { title: "An update is available!" } });
405
+ codePush.sync({ updateDialog: { title: 'An update is available!' } });
443
406
 
444
407
  // Displaying an update prompt which includes the
445
408
  // description associated with the CodePush release
446
409
  codePush.sync({
447
- updateDialog: {
410
+ updateDialog: {
448
411
  appendReleaseDescription: true,
449
- descriptionPrefix: "\n\nChange log:\n"
450
- },
451
- installMode: codePush.InstallMode.IMMEDIATE
412
+ descriptionPrefix: '\n\nChange log:\n',
413
+ },
414
+ installMode: codePush.InstallMode.IMMEDIATE,
452
415
  });
453
416
  ```
454
417
 
455
418
  In addition to the options, the `sync` method also accepts several optional function parameters which allow you to subscribe to the lifecycle of the `sync` "pipeline" in order to display additional UI as needed (like a "checking for update modal or a download progress modal):
456
419
 
457
- * __syncStatusChangedCallback__ *((syncStatus: Number) => void)* - Called when the sync process moves from one stage to another in the overall update process. The method is called with a status code which represents the current state, and can be any of the [`SyncStatus`](#syncstatus) values.
420
+ - **syncStatusChangedCallback** _((syncStatus: Number) => void)_ - Called when the sync process moves from one stage to another in the overall update process. The method is called with a status code which represents the current state, and can be any of the [`SyncStatus`](#syncstatus) values.
458
421
 
459
- * __downloadProgressCallback__ *((progress: DownloadProgress) => void)* - Called periodically when an available update is being downloaded from the CodePush server. The method is called with a `DownloadProgress` object, which contains the following two properties:
422
+ - **downloadProgressCallback** _((progress: DownloadProgress) => void)_ - Called periodically when an available update is being downloaded from the CodePush server. The method is called with a `DownloadProgress` object, which contains the following two properties:
460
423
 
461
- * __totalBytes__ *(Number)* - The total number of bytes expected to be received for this update (i.e. the size of the set of files which changed from the previous release).
424
+ - **totalBytes** _(Number)_ - The total number of bytes expected to be received for this update (i.e. the size of the set of files which changed from the previous release).
462
425
 
463
- * __receivedBytes__ *(Number)* - The number of bytes downloaded thus far, which can be used to track download progress.
426
+ - **receivedBytes** _(Number)_ - The number of bytes downloaded thus far, which can be used to track download progress.
464
427
 
465
- * __handleBinaryVersionMismatchCallback__ *((update: RemotePackage) => void)* -
466
- Called when there are any binary update available. The method is called with a [`RemotePackage`](#remotepackage) object. Refer to [codePush.checkForUpdate](#codepushcheckforupdate) section for more details.
428
+ - **handleBinaryVersionMismatchCallback** _((update: RemotePackage) => void)_ -
429
+ Called when there are any binary update available. The method is called with a [`RemotePackage`](#remotepackage) object. Refer to [codePush.checkForUpdate](#codepushcheckforupdate) section for more details.
467
430
 
468
431
  Example Usage:
469
432
 
470
433
  ```javascript
471
434
  // Prompt the user when an update is available
472
435
  // and then display a "downloading" modal
473
- codePush.sync({ updateDialog: true },
436
+ codePush.sync(
437
+ { updateDialog: true },
474
438
  (status) => {
475
- switch (status) {
476
- case codePush.SyncStatus.DOWNLOADING_PACKAGE:
477
- // Show "downloading" modal
478
- break;
479
- case codePush.SyncStatus.INSTALLING_UPDATE:
480
- // Hide "downloading" modal
481
- break;
482
- }
439
+ switch (status) {
440
+ case codePush.SyncStatus.DOWNLOADING_PACKAGE:
441
+ // Show "downloading" modal
442
+ break;
443
+ case codePush.SyncStatus.INSTALLING_UPDATE:
444
+ // Hide "downloading" modal
445
+ break;
446
+ }
483
447
  },
484
- ({ receivedBytes, totalBytes, }) => {
448
+ ({ receivedBytes, totalBytes }) => {
485
449
  /* Update download modal progress */
486
- }
450
+ },
487
451
  );
488
452
  ```
489
453
 
490
454
  This method returns a `Promise` which is resolved to a `SyncStatus` code that indicates why the `sync` call succeeded. This code can be one of the following `SyncStatus` values:
491
455
 
492
- * __codePush.SyncStatus.UP_TO_DATE__ *(0)* - The app is up-to-date with the CodePush server.
456
+ - **codePush.SyncStatus.UP_TO_DATE** _(0)_ - The app is up-to-date with the CodePush server.
493
457
 
494
- * __codePush.SyncStatus.UPDATE_IGNORED__ *(2)* - The app had an optional update which the end user chose to ignore. (This is only applicable when the `updateDialog` is used)
458
+ - **codePush.SyncStatus.UPDATE_IGNORED** _(2)_ - The app had an optional update which the end user chose to ignore. (This is only applicable when the `updateDialog` is used)
495
459
 
496
- * __codePush.SyncStatus.UPDATE_INSTALLED__ *(1)* - The update has been installed and will be run either immediately after the `syncStatusChangedCallback` function returns or the next time the app resumes/restarts, depending on the `InstallMode` specified in `SyncOptions`.
460
+ - **codePush.SyncStatus.UPDATE_INSTALLED** _(1)_ - The update has been installed and will be run either immediately after the `syncStatusChangedCallback` function returns or the next time the app resumes/restarts, depending on the `InstallMode` specified in `SyncOptions`.
497
461
 
498
- * __codePush.SyncStatus.SYNC_IN_PROGRESS__ *(4)* - There is an ongoing `sync` operation running which prevents the current call from being executed.
462
+ - **codePush.SyncStatus.SYNC_IN_PROGRESS** _(4)_ - There is an ongoing `sync` operation running which prevents the current call from being executed.
499
463
 
500
464
  The `sync` method can be called anywhere you'd like to check for an update. That could be in the `componentWillMount` lifecycle event of your root component, the onPress handler of a `<TouchableHighlight>` component, in the callback of a periodic timer, or whatever else makes sense for your needs. Just like the `checkForUpdate` method, it will perform the network request to check for an update in the background, so it won't impact your UI thread and/or JavaScript thread's responsiveness.
501
465
 
@@ -503,29 +467,30 @@ The `sync` method can be called anywhere you'd like to check for an update. That
503
467
 
504
468
  The `checkForUpdate` and `getUpdateMetadata` methods return `Promise` objects, that when resolved, provide acces to "package" objects. The package represents your code update as well as any extra metadata (like description, mandatory?). The CodePush API has the distinction between the following types of packages:
505
469
 
506
- * [LocalPackage](#localpackage): Represents a downloaded update that is either already running, or has been installed and is pending an app restart.
470
+ - [LocalPackage](#localpackage): Represents a downloaded update that is either already running, or has been installed and is pending an app restart.
507
471
 
508
- * [RemotePackage](#remotepackage): Represents an available update on the CodePush server that hasn't been downloaded yet.
472
+ - [RemotePackage](#remotepackage): Represents an available update on the CodePush server that hasn't been downloaded yet.
509
473
 
510
474
  ##### LocalPackage
511
475
 
512
476
  Contains details about an update that has been downloaded locally or already installed. You can get a reference to an instance of this object either by calling the module-level `getUpdateMetadata` method, or as the value of the promise returned by the `RemotePackage.download` method.
513
477
 
514
478
  ###### Properties
515
- - __appVersion__: The app binary version that this update is dependent on. This is the value that was specified via the `appStoreVersion` parameter when calling the CLI's `release` command. *(String)*
516
- - __deploymentKey__: The deployment key that was used to originally download this update. *(String)*
517
- - __description__: The description of the update. This is the same value that you specified in the CLI when you released the update. *(String)*
518
- - __failedInstall__: Indicates whether this update has been previously installed but was rolled back. The `sync` method will automatically ignore updates which have previously failed, so you only need to worry about this property if using `checkForUpdate`. *(Boolean)*
519
- - __isFirstRun__: Indicates whether this is the first time the update has been run after being installed. This is useful for determining whether you would like to show a "What's New?" UI to the end user after installing an update. *(Boolean)*
520
- - __isMandatory__: Indicates whether the update is considered mandatory. This is the value that was specified in the CLI when the update was released. *(Boolean)*
521
- - __isPending__: Indicates whether this update is in a "pending" state. When `true`, that means the update has been downloaded and installed, but the app restart needed to apply it hasn't occurred yet, and therefore, it's changes aren't currently visible to the end-user. *(Boolean)*
522
- - __label__: The internal label automatically given to the update by the CodePush server, such as `v5`. This value uniquely identifies the update within it's deployment. *(String)*
523
- - __packageHash__: The SHA hash value of the update. *(String)*
524
- - __packageSize__: The size of the code contained within the update, in bytes. *(Number)*
479
+
480
+ - **appVersion**: The app binary version that this update is dependent on. This is the value that was specified via the `appStoreVersion` parameter when calling the CLI's `release` command. _(String)_
481
+ - **releaseChannelPublicId**: The release channel that was used to originally download this update. _(String)_
482
+ - **description**: The description of the update. This is the same value that you specified in the CLI when you released the update. _(String)_
483
+ - **failedInstall**: Indicates whether this update has been previously installed but was rolled back. The `sync` method will automatically ignore updates which have previously failed, so you only need to worry about this property if using `checkForUpdate`. _(Boolean)_
484
+ - **isFirstRun**: Indicates whether this is the first time the update has been run after being installed. This is useful for determining whether you would like to show a "What's New?" UI to the end user after installing an update. _(Boolean)_
485
+ - **isMandatory**: Indicates whether the update is considered mandatory. This is the value that was specified in the CLI when the update was released. _(Boolean)_
486
+ - **isPending**: Indicates whether this update is in a "pending" state. When `true`, that means the update has been downloaded and installed, but the app restart needed to apply it hasn't occurred yet, and therefore, it's changes aren't currently visible to the end-user. _(Boolean)_
487
+ - **label**: The internal label automatically given to the update by the CodePush server, such as `v5`. This value uniquely identifies the update within its release channel. _(String)_
488
+ - **packageHash**: The SHA hash value of the update. _(String)_
489
+ - **packageSize**: The size of the code contained within the update, in bytes. _(Number)_
525
490
 
526
491
  ###### Methods
527
492
 
528
- - __install(installMode: codePush.InstallMode = codePush.InstallMode.ON_NEXT_RESTART, minimumBackgroundDuration = 0): Promise&lt;void&gt;__: Installs the update by saving it to the location on disk where the runtime expects to find the latest version of the app. The `installMode` parameter controls when the changes are actually presented to the end user. The default value is to wait until the next app restart to display the changes, but you can refer to the [`InstallMode`](#installmode) enum reference for a description of the available options and what they do. If the `installMode` parameter is set to `InstallMode.ON_NEXT_RESUME`, then the `minimumBackgroundDuration` parameter allows you to control how long the app must have been in the background before forcing the install after it is resumed.
493
+ - **install(installMode: codePush.InstallMode = codePush.InstallMode.ON_NEXT_RESTART, minimumBackgroundDuration = 0): Promise&lt;void&gt;**: Installs the update by saving it to the location on disk where the runtime expects to find the latest version of the app. The `installMode` parameter controls when the changes are actually presented to the end user. The default value is to wait until the next app restart to display the changes, but you can refer to the [`InstallMode`](#installmode) enum reference for a description of the available options and what they do. If the `installMode` parameter is set to `InstallMode.ON_NEXT_RESUME`, then the `minimumBackgroundDuration` parameter allows you to control how long the app must have been in the background before forcing the install after it is resumed.
529
494
 
530
495
  ##### RemotePackage
531
496
 
@@ -535,11 +500,11 @@ Contains details about an update that is available for download from the CodePus
535
500
 
536
501
  The `RemotePackage` inherits all of the same properties as the `LocalPackage`, but includes one additional one:
537
502
 
538
- - __downloadUrl__: The URL at which the package is available for download. This property is only needed for advanced usage, since the `download` method will automatically handle the acquisition of updates for you. *(String)*
503
+ - **downloadUrl**: The URL at which the package is available for download. This property is only needed for advanced usage, since the `download` method will automatically handle the acquisition of updates for you. _(String)_
539
504
 
540
505
  ###### Methods
541
506
 
542
- - __download(downloadProgressCallback?: Function): Promise&lt;LocalPackage&gt;__: Downloads the available update from the CodePush service. If a `downloadProgressCallback` is specified, it will be called periodically with a `DownloadProgress` object (`{ totalBytes: Number, receivedBytes: Number }`) that reports the progress of the download until it completes. Returns a Promise that resolves with the `LocalPackage`.
507
+ - **download(downloadProgressCallback?: Function): Promise&lt;LocalPackage&gt;**: Downloads the available update from the CodePush service. If a `downloadProgressCallback` is specified, it will be called periodically with a `DownloadProgress` object (`{ totalBytes: Number, receivedBytes: Number }`) that reports the progress of the download until it completes. Returns a Promise that resolves with the `LocalPackage`.
543
508
 
544
509
  #### Enums
545
510
 
@@ -549,44 +514,44 @@ The CodePush API includes the following enums which can be used to customize the
549
514
 
550
515
  This enum specifies when you would like an installed update to actually be applied, and can be passed to either the `sync` or `LocalPackage.install` methods. It includes the following values:
551
516
 
552
- * __codePush.InstallMode.IMMEDIATE__ *(0)* - Indicates that you want to install the update and restart the app immediately. This value is appropriate for debugging scenarios as well as when displaying an update prompt to the user, since they would expect to see the changes immediately after accepting the installation. Additionally, this mode can be used to enforce mandatory updates, since it removes the potentially undesired latency between the update installation and the next time the end user restarts or resumes the app.
517
+ - **codePush.InstallMode.IMMEDIATE** _(0)_ - Indicates that you want to install the update and restart the app immediately. This value is appropriate for debugging scenarios as well as when displaying an update prompt to the user, since they would expect to see the changes immediately after accepting the installation. Additionally, this mode can be used to enforce mandatory updates, since it removes the potentially undesired latency between the update installation and the next time the end user restarts or resumes the app.
553
518
 
554
- * __codePush.InstallMode.ON_NEXT_RESTART__ *(1)* - Indicates that you want to install the update, but not forcibly restart the app. When the app is "naturally" restarted (due the OS or end user killing it), the update will be seamlessly picked up. This value is appropriate when performing silent updates, since it would likely be disruptive to the end user if the app suddenly restarted out of nowhere, since they wouldn't have realized an update was even downloaded. This is the default mode used for both the `sync` and `LocalPackage.install` methods.
519
+ - **codePush.InstallMode.ON_NEXT_RESTART** _(1)_ - Indicates that you want to install the update, but not forcibly restart the app. When the app is "naturally" restarted (due the OS or end user killing it), the update will be seamlessly picked up. This value is appropriate when performing silent updates, since it would likely be disruptive to the end user if the app suddenly restarted out of nowhere, since they wouldn't have realized an update was even downloaded. This is the default mode used for both the `sync` and `LocalPackage.install` methods.
555
520
 
556
- * __codePush.InstallMode.ON_NEXT_RESUME__ *(2)* - Indicates that you want to install the update, but don't want to restart the app until the next time the end user resumes it from the background. This way, you don't disrupt their current session, but you can get the update in front of them sooner then having to wait for the next natural restart. This value is appropriate for silent installs that can be applied on resume in a non-invasive way.
521
+ - **codePush.InstallMode.ON_NEXT_RESUME** _(2)_ - Indicates that you want to install the update, but don't want to restart the app until the next time the end user resumes it from the background. This way, you don't disrupt their current session, but you can get the update in front of them sooner then having to wait for the next natural restart. This value is appropriate for silent installs that can be applied on resume in a non-invasive way.
557
522
 
558
- * __codePush.InstallMode.ON_NEXT_SUSPEND__ *(3)* - Indicates that you want to install the update _while_ it is in the background, but only after it has been in the background for `minimumBackgroundDuration` seconds (0 by default), so that user context isn't lost unless the app suspension is long enough to not matter.
523
+ - **codePush.InstallMode.ON_NEXT_SUSPEND** _(3)_ - Indicates that you want to install the update _while_ it is in the background, but only after it has been in the background for `minimumBackgroundDuration` seconds (0 by default), so that user context isn't lost unless the app suspension is long enough to not matter.
559
524
 
560
525
  ##### CheckFrequency
561
526
 
562
527
  This enum specifies when you would like your app to sync with the server for updates, and can be passed to the `codePushify` decorator. It includes the following values:
563
528
 
564
- * __codePush.CheckFrequency.ON_APP_START__ *(0)* - Indicates that you want to check for updates whenever the app's process is started.
529
+ - **codePush.CheckFrequency.ON_APP_START** _(0)_ - Indicates that you want to check for updates whenever the app's process is started.
565
530
 
566
- * __codePush.CheckFrequency.ON_APP_RESUME__ *(1)* - Indicates that you want to check for updates whenever the app is brought back to the foreground after being "backgrounded" (user pressed the home button, app launches a seperate payment process, etc).
531
+ - **codePush.CheckFrequency.ON_APP_RESUME** _(1)_ - Indicates that you want to check for updates whenever the app is brought back to the foreground after being "backgrounded" (user pressed the home button, app launches a seperate payment process, etc).
567
532
 
568
- * __codePush.CheckFrequency.MANUAL__ *(2)* - Disable automatic checking for updates, but only check when [`codePush.sync()`](#codepushsync) is called in app code.
533
+ - **codePush.CheckFrequency.MANUAL** _(2)_ - Disable automatic checking for updates, but only check when [`codePush.sync()`](#codepushsync) is called in app code.
569
534
 
570
535
  ##### SyncStatus
571
536
 
572
537
  This enum is provided to the `syncStatusChangedCallback` function that can be passed to the `sync` method, in order to hook into the overall update process. It includes the following values:
573
538
 
574
- * __codePush.SyncStatus.UP_TO_DATE__ *(0)* - The app is fully up-to-date with the configured deployment.
575
- * __codePush.SyncStatus.UPDATE_INSTALLED__ *(1)* - An available update has been installed and will be run either immediately after the `syncStatusChangedCallback` function returns or the next time the app resumes/restarts, depending on the `InstallMode` specified in `SyncOptions`.
576
- * __codePush.SyncStatus.UPDATE_IGNORED__ *(2)* - The app has an optional update, which the end user chose to ignore. (This is only applicable when the `updateDialog` is used)
577
- * __codePush.SyncStatus.UNKNOWN_ERROR__ *(3)* - The sync operation encountered an unknown error.
578
- * __codePush.SyncStatus.SYNC_IN_PROGRESS__ *(4)* - There is an ongoing `sync` operation running which prevents the current call from being executed.
579
- * __codePush.SyncStatus.CHECKING_FOR_UPDATE__ *(5)* - The CodePush server is being queried for an update.
580
- * __codePush.SyncStatus.AWAITING_USER_ACTION__ *(6)* - An update is available, and a confirmation dialog was shown to the end user. (This is only applicable when the `updateDialog` is used)
581
- * __codePush.SyncStatus.DOWNLOADING_PACKAGE__ *(7)* - An available update is being downloaded from the CodePush server.
582
- * __codePush.SyncStatus.INSTALLING_UPDATE__ *(8)* - An available update was downloaded and is about to be installed.
539
+ - **codePush.SyncStatus.UP_TO_DATE** _(0)_ - The app is fully up-to-date with the configured release channel.
540
+ - **codePush.SyncStatus.UPDATE_INSTALLED** _(1)_ - An available update has been installed and will be run either immediately after the `syncStatusChangedCallback` function returns or the next time the app resumes/restarts, depending on the `InstallMode` specified in `SyncOptions`.
541
+ - **codePush.SyncStatus.UPDATE_IGNORED** _(2)_ - The app has an optional update, which the end user chose to ignore. (This is only applicable when the `updateDialog` is used)
542
+ - **codePush.SyncStatus.UNKNOWN_ERROR** _(3)_ - The sync operation encountered an unknown error.
543
+ - **codePush.SyncStatus.SYNC_IN_PROGRESS** _(4)_ - There is an ongoing `sync` operation running which prevents the current call from being executed.
544
+ - **codePush.SyncStatus.CHECKING_FOR_UPDATE** _(5)_ - The CodePush server is being queried for an update.
545
+ - **codePush.SyncStatus.AWAITING_USER_ACTION** _(6)_ - An update is available, and a confirmation dialog was shown to the end user. (This is only applicable when the `updateDialog` is used)
546
+ - **codePush.SyncStatus.DOWNLOADING_PACKAGE** _(7)_ - An available update is being downloaded from the CodePush server.
547
+ - **codePush.SyncStatus.INSTALLING_UPDATE** _(8)_ - An available update was downloaded and is about to be installed.
583
548
 
584
549
  ##### UpdateState
585
550
 
586
551
  This enum specifies the state that an update is currently in, and can be specified when calling the `getUpdateMetadata` method. It includes the following values:
587
552
 
588
- * __codePush.UpdateState.RUNNING__ *(0)* - Indicates that an update represents the version of the app that is currently running. This can be useful for identifying attributes about the app, for scenarios such as displaying the release description in a "what's new?" dialog or reporting the latest version to an analytics and/or crash reporting service.
553
+ - **codePush.UpdateState.RUNNING** _(0)_ - Indicates that an update represents the version of the app that is currently running. This can be useful for identifying attributes about the app, for scenarios such as displaying the release description in a "what's new?" dialog or reporting the latest version to an analytics and/or crash reporting service.
589
554
 
590
- * __codePush.UpdateState.PENDING__ *(1)* - Indicates than an update has been installed, but the app hasn't been restarted yet in order to apply it. This can be useful for determining whether there is a pending update, which you may want to force a programmatic restart (via `restartApp`) in order to apply.
555
+ - **codePush.UpdateState.PENDING** _(1)_ - Indicates than an update has been installed, but the app hasn't been restarted yet in order to apply it. This can be useful for determining whether there is a pending update, which you may want to force a programmatic restart (via `restartApp`) in order to apply.
591
556
 
592
- * __codePush.UpdateState.LATEST__ *(2)* - Indicates than an update represents the latest available release, and can be either currently running or pending.
557
+ - **codePush.UpdateState.LATEST** _(2)_ - Indicates than an update represents the latest available release, and can be either currently running or pending.