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

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 (191) hide show
  1. package/CodePush.js +22 -19
  2. package/LICENSE.md +1 -1
  3. package/README.md +159 -298
  4. package/android/app/.gradle/config.properties +2 -0
  5. package/android/app/build.gradle +1 -1
  6. package/android/app/local.properties +8 -0
  7. package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +27 -21
  8. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushBuilder.java +5 -5
  9. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +1 -1
  10. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushDialog.java +1 -1
  11. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInstallMode.java +2 -2
  12. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidPublicKeyException.java +2 -2
  13. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushInvalidUpdateException.java +1 -1
  14. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushMalformedDataException.java +2 -2
  15. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +5 -5
  16. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNotInitializedException.java +2 -2
  17. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushTelemetryManager.java +14 -14
  18. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUnknownException.java +2 -2
  19. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +1 -1
  20. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateState.java +2 -2
  21. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +1 -1
  22. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUtils.java +1 -1
  23. package/android/app/src/main/java/com/microsoft/codepush/react/DownloadProgress.java +1 -1
  24. package/android/app/src/main/java/com/microsoft/codepush/react/DownloadProgressCallback.java +1 -1
  25. package/android/app/src/main/java/com/microsoft/codepush/react/FileUtils.java +1 -1
  26. package/android/app/src/main/java/com/microsoft/codepush/react/ReactInstanceHolder.java +1 -1
  27. package/android/app/src/main/java/com/microsoft/codepush/react/SettingsManager.java +1 -1
  28. package/android/app/src/main/java/com/microsoft/codepush/react/TLSSocketFactory.java +1 -1
  29. package/android/build.gradle +1 -1
  30. package/android/codepush.gradle +3 -3
  31. package/docs/advanced-usage.md +56 -0
  32. package/docs/api-android.md +12 -75
  33. package/docs/api-ios.md +5 -17
  34. package/docs/api-js.md +18 -55
  35. package/docs/setup-android.md +15 -397
  36. package/docs/setup-ios.md +24 -198
  37. package/docs/setup-windows.md +7 -74
  38. package/ios/CodePush/CodePush.h +4 -4
  39. package/ios/CodePush/CodePush.m +8 -8
  40. package/ios/CodePush/CodePushConfig.m +14 -11
  41. package/ios/CodePush/CodePushPackage.m +60 -60
  42. package/ios/CodePush/CodePushTelemetryManager.m +13 -13
  43. package/ios/CodePush.xcodeproj/project.pbxproj +1 -562
  44. package/package.json +27 -24
  45. package/react-native.config.js +1 -1
  46. package/scripts/generateBundledResourcesHash.js +1 -1
  47. package/scripts/getFilesInFolder.js +1 -1
  48. package/scripts/recordFilesBeforeBundleCommand.js +1 -1
  49. package/typings/react-native-code-push.d.ts +22 -22
  50. package/windows/CodePush/CodePushConfig.cpp +3 -3
  51. package/windows/CodePush/CodePushConfig.h +3 -3
  52. package/windows/CodePush/CodePushNativeModule.cpp +27 -27
  53. package/windows/CodePush/CodePushNativeModule.h +4 -4
  54. package/windows/CodePush/CodePushTelemetryManager.cpp +12 -12
  55. package/windows/CodePush/CodePushTelemetryManager.h +1 -1
  56. package/.azurepipelines/build-rn-code-push-1es.yml +0 -104
  57. package/.azurepipelines/test-rn-code-push.yml +0 -94
  58. package/.config/CredScanSuppressions.json +0 -14
  59. package/SECURITY.md +0 -41
  60. package/docs/multi-deployment-testing-android.md +0 -148
  61. package/docs/multi-deployment-testing-ios.md +0 -59
  62. package/ios/CodePush/Base64/Base64/MF_Base64Additions.h +0 -34
  63. package/ios/CodePush/Base64/Base64/MF_Base64Additions.m +0 -252
  64. package/ios/CodePush/Base64/README.md +0 -47
  65. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithm.h +0 -69
  66. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.h +0 -16
  67. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmFactory.m +0 -51
  68. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.h +0 -15
  69. package/ios/CodePush/JWT/Core/Algorithms/Base/JWTAlgorithmNone.m +0 -55
  70. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.h +0 -24
  71. package/ios/CodePush/JWT/Core/Algorithms/ESFamily/JWTAlgorithmESBase.m +0 -41
  72. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.h +0 -28
  73. package/ios/CodePush/JWT/Core/Algorithms/HSFamily/JWTAlgorithmHSBase.m +0 -205
  74. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.h +0 -103
  75. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolder.m +0 -322
  76. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.h +0 -37
  77. package/ios/CodePush/JWT/Core/Algorithms/Holders/JWTAlgorithmDataHolderChain.m +0 -145
  78. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.h +0 -35
  79. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTAlgorithmRSBase.m +0 -551
  80. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/JWTRSAlgorithm.h +0 -23
  81. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.h +0 -43
  82. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKey.m +0 -230
  83. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.h +0 -31
  84. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoKeyExtractor.m +0 -113
  85. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.h +0 -38
  86. package/ios/CodePush/JWT/Core/Algorithms/RSFamily/RSKeys/JWTCryptoSecurity.m +0 -500
  87. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.h +0 -18
  88. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaim.m +0 -214
  89. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.h +0 -23
  90. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSet.m +0 -29
  91. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.h +0 -19
  92. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetSerializer.m +0 -68
  93. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.h +0 -18
  94. package/ios/CodePush/JWT/Core/ClaimSet/JWTClaimsSetVerifier.m +0 -72
  95. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.h +0 -67
  96. package/ios/CodePush/JWT/Core/Coding/JWTCoding+ResultTypes.m +0 -111
  97. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.h +0 -119
  98. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionOne.m +0 -307
  99. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.h +0 -94
  100. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionThree.m +0 -619
  101. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.h +0 -164
  102. package/ios/CodePush/JWT/Core/Coding/JWTCoding+VersionTwo.m +0 -514
  103. package/ios/CodePush/JWT/Core/Coding/JWTCoding.h +0 -24
  104. package/ios/CodePush/JWT/Core/Coding/JWTCoding.m +0 -11
  105. package/ios/CodePush/JWT/Core/FrameworkSupplement/JWT.h +0 -52
  106. package/ios/CodePush/JWT/Core/FrameworkSupplement/Map.modulemap +0 -5
  107. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.h +0 -28
  108. package/ios/CodePush/JWT/Core/Supplement/JWTBase64Coder.m +0 -70
  109. package/ios/CodePush/JWT/Core/Supplement/JWTDeprecations.h +0 -22
  110. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.h +0 -34
  111. package/ios/CodePush/JWT/Core/Supplement/JWTErrorDescription.m +0 -73
  112. package/ios/CodePush/JWT/LICENSE +0 -19
  113. package/ios/CodePush/JWT/README.md +0 -489
  114. package/ios/CodePush/SSZipArchive/Info.plist +0 -26
  115. package/ios/CodePush/SSZipArchive/README.md +0 -1
  116. package/ios/CodePush/SSZipArchive/SSZipArchive.h +0 -178
  117. package/ios/CodePush/SSZipArchive/SSZipArchive.m +0 -1496
  118. package/ios/CodePush/SSZipArchive/SSZipCommon.h +0 -71
  119. package/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy +0 -23
  120. package/ios/CodePush/SSZipArchive/include/ZipArchive.h +0 -25
  121. package/ios/CodePush/SSZipArchive/minizip/LICENSE +0 -17
  122. package/ios/CodePush/SSZipArchive/minizip/mz.h +0 -273
  123. package/ios/CodePush/SSZipArchive/minizip/mz_compat.c +0 -1306
  124. package/ios/CodePush/SSZipArchive/minizip/mz_compat.h +0 -346
  125. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.c +0 -187
  126. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.h +0 -65
  127. package/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c +0 -526
  128. package/ios/CodePush/SSZipArchive/minizip/mz_os.c +0 -348
  129. package/ios/CodePush/SSZipArchive/minizip/mz_os.h +0 -176
  130. package/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c +0 -350
  131. package/ios/CodePush/SSZipArchive/minizip/mz_strm.c +0 -556
  132. package/ios/CodePush/SSZipArchive/minizip/mz_strm.h +0 -132
  133. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c +0 -383
  134. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h +0 -42
  135. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c +0 -269
  136. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h +0 -48
  137. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h +0 -40
  138. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c +0 -203
  139. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c +0 -334
  140. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h +0 -46
  141. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c +0 -429
  142. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h +0 -43
  143. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c +0 -360
  144. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h +0 -46
  145. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c +0 -389
  146. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h +0 -43
  147. package/ios/CodePush/SSZipArchive/minizip/mz_zip.c +0 -2782
  148. package/ios/CodePush/SSZipArchive/minizip/mz_zip.h +0 -262
  149. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c +0 -1942
  150. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h +0 -285
  151. package/scripts/postlink/android/postlink.js +0 -87
  152. package/scripts/postlink/ios/postlink.js +0 -116
  153. package/scripts/postlink/run.js +0 -11
  154. package/scripts/postunlink/android/postunlink.js +0 -74
  155. package/scripts/postunlink/ios/postunlink.js +0 -87
  156. package/scripts/postunlink/run.js +0 -11
  157. package/scripts/tools/linkToolsAndroid.js +0 -57
  158. package/scripts/tools/linkToolsIos.js +0 -130
  159. package/windows-legacy/CodePush/CodePush.csproj +0 -128
  160. package/windows-legacy/CodePush/CodePushUtils.cs +0 -47
  161. package/windows-legacy/CodePush/FileUtils.cs +0 -40
  162. package/windows-legacy/CodePush/Properties/AssemblyInfo.cs +0 -29
  163. package/windows-legacy/CodePush/Properties/CodePush.rd.xml +0 -33
  164. package/windows-legacy/CodePush/UpdateManager.cs +0 -305
  165. package/windows-legacy/CodePush/UpdateUtils.cs +0 -46
  166. package/windows-legacy/CodePush.Net46/Adapters/Http/HttpProgress.cs +0 -28
  167. package/windows-legacy/CodePush.Net46/Adapters/Storage/ApplicationDataContainer.cs +0 -106
  168. package/windows-legacy/CodePush.Net46/CodePush.Net46.csproj +0 -103
  169. package/windows-legacy/CodePush.Net46/CodePushUtils.cs +0 -158
  170. package/windows-legacy/CodePush.Net46/FileUtils.cs +0 -55
  171. package/windows-legacy/CodePush.Net46/Properties/AssemblyInfo.cs +0 -36
  172. package/windows-legacy/CodePush.Net46/UpdateManager.cs +0 -330
  173. package/windows-legacy/CodePush.Net46/UpdateUtils.cs +0 -70
  174. package/windows-legacy/CodePush.Net46/packages.config +0 -5
  175. package/windows-legacy/CodePush.Net46.Test/ApplicationDataContainerTest.cs +0 -105
  176. package/windows-legacy/CodePush.Net46.Test/CodePush.Net46.Test.csproj +0 -137
  177. package/windows-legacy/CodePush.Net46.Test/Properties/AssemblyInfo.cs +0 -36
  178. package/windows-legacy/CodePush.Net46.Test/TelemetryManagerTest.cs +0 -117
  179. package/windows-legacy/CodePush.Net46.Test/app.config +0 -11
  180. package/windows-legacy/CodePush.Net46.Test/packages.config +0 -4
  181. package/windows-legacy/CodePush.Shared/CodePush.Shared.projitems +0 -22
  182. package/windows-legacy/CodePush.Shared/CodePush.Shared.shproj +0 -13
  183. package/windows-legacy/CodePush.Shared/CodePushConstants.cs +0 -35
  184. package/windows-legacy/CodePush.Shared/CodePushNativeModule.cs +0 -329
  185. package/windows-legacy/CodePush.Shared/CodePushReactPackage.cs +0 -235
  186. package/windows-legacy/CodePush.Shared/CodePushUtils.cs +0 -70
  187. package/windows-legacy/CodePush.Shared/InstallMode.cs +0 -9
  188. package/windows-legacy/CodePush.Shared/MinimumBackgroundListener.cs +0 -44
  189. package/windows-legacy/CodePush.Shared/SettingsManager.cs +0 -148
  190. package/windows-legacy/CodePush.Shared/TelemetryManager.cs +0 -250
  191. package/windows-legacy/CodePush.Shared/UpdateState.cs +0 -9
@@ -0,0 +1,2 @@
1
+ #Wed Jan 22 01:48:35 CET 2025
2
+ java.home=/Users/louislagrange/Applications/Android Studio.app/Contents/jbr/Contents/Home
@@ -6,7 +6,7 @@ def DEFAULT_TARGET_SDK_VERSION = 26
6
6
  def DEFAULT_MIN_SDK_VERSION = 16
7
7
 
8
8
  android {
9
- namespace "com.microsoft.codepush.react"
9
+ namespace "com.appzung.codepush.react"
10
10
 
11
11
  compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
12
12
  buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
@@ -0,0 +1,8 @@
1
+ ## This file must *NOT* be checked into Version Control Systems,
2
+ # as it contains information specific to your local configuration.
3
+ #
4
+ # Location of the SDK. This is only used by Gradle.
5
+ # For customization when using a Version Control System, please read the
6
+ # header note.
7
+ #Wed Jan 22 01:48:35 CET 2025
8
+ sdk.dir=/Users/louislagrange/Library/Android/sdk
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  import android.content.Context;
4
4
  import android.content.pm.PackageInfo;
@@ -39,7 +39,7 @@ public class CodePush implements ReactPackage {
39
39
  private SettingsManager mSettingsManager;
40
40
 
41
41
  // Config properties.
42
- private String mDeploymentKey;
42
+ private String mReleaseChannelPublicId;
43
43
  private static String mServerUrl = "https://codepush.appzung.com/";
44
44
 
45
45
  private Context mContext;
@@ -50,20 +50,20 @@ public class CodePush implements ReactPackage {
50
50
  private static ReactInstanceHolder mReactInstanceHolder;
51
51
  private static CodePush mCurrentInstance;
52
52
 
53
- public CodePush(String deploymentKey, Context context) {
54
- this(deploymentKey, context, false);
53
+ public CodePush(String releaseChannelPublicId, Context context) {
54
+ this(releaseChannelPublicId, context, false);
55
55
  }
56
56
 
57
57
  public static String getServiceUrl() {
58
58
  return mServerUrl;
59
59
  }
60
60
 
61
- public CodePush(String deploymentKey, Context context, boolean isDebugMode) {
61
+ public CodePush(String releaseChannelPublicId, Context context, boolean isDebugMode) {
62
62
  mContext = context.getApplicationContext();
63
63
 
64
64
  mUpdateManager = new CodePushUpdateManager(context.getFilesDir().getAbsolutePath());
65
65
  mTelemetryManager = new CodePushTelemetryManager(mContext);
66
- mDeploymentKey = deploymentKey;
66
+ mReleaseChannelPublicId = releaseChannelPublicId;
67
67
  mIsDebugMode = isDebugMode;
68
68
  mSettingsManager = new SettingsManager(mContext);
69
69
 
@@ -78,8 +78,11 @@ public class CodePush implements ReactPackage {
78
78
 
79
79
  mCurrentInstance = this;
80
80
 
81
- String publicKeyFromStrings = getCustomPropertyFromStringsIfExist("PublicKey");
82
- if (publicKeyFromStrings != null) mPublicKey = publicKeyFromStrings;
81
+ String publicKeyFromStrings = getCustomPropertyFromStringsIfExist("SigningPublicKey");
82
+ if (publicKeyFromStrings != null) {
83
+ CodePushUtils.log("Executing CodePush with a signing public key.");
84
+ mPublicKey = publicKeyFromStrings;
85
+ }
83
86
 
84
87
  String serverUrlFromStrings = getCustomPropertyFromStringsIfExist("ServerUrl");
85
88
  if (serverUrlFromStrings != null) mServerUrl = serverUrlFromStrings;
@@ -88,19 +91,19 @@ public class CodePush implements ReactPackage {
88
91
  initializeUpdateAfterRestart();
89
92
  }
90
93
 
91
- public CodePush(String deploymentKey, Context context, boolean isDebugMode, String serverUrl) {
92
- this(deploymentKey, context, isDebugMode);
94
+ public CodePush(String releaseChannelPublicId, Context context, boolean isDebugMode, String serverUrl) {
95
+ this(releaseChannelPublicId, context, isDebugMode);
93
96
  mServerUrl = serverUrl;
94
97
  }
95
98
 
96
- public CodePush(String deploymentKey, Context context, boolean isDebugMode, int publicKeyResourceDescriptor) {
97
- this(deploymentKey, context, isDebugMode);
99
+ public CodePush(String releaseChannelPublicId, Context context, boolean isDebugMode, int publicKeyResourceDescriptor) {
100
+ this(releaseChannelPublicId, context, isDebugMode);
98
101
 
99
102
  mPublicKey = getPublicKeyByResourceDescriptor(publicKeyResourceDescriptor);
100
103
  }
101
104
 
102
- public CodePush(String deploymentKey, Context context, boolean isDebugMode, String serverUrl, Integer publicKeyResourceDescriptor) {
103
- this(deploymentKey, context, isDebugMode);
105
+ public CodePush(String releaseChannelPublicId, Context context, boolean isDebugMode, String serverUrl, Integer publicKeyResourceDescriptor) {
106
+ this(releaseChannelPublicId, context, isDebugMode);
104
107
 
105
108
  if (publicKeyResourceDescriptor != null) {
106
109
  mPublicKey = getPublicKeyByResourceDescriptor(publicKeyResourceDescriptor);
@@ -124,15 +127,18 @@ public class CodePush implements ReactPackage {
124
127
  if (publicKey.isEmpty()) {
125
128
  throw new CodePushInvalidPublicKeyException("Specified public key is empty");
126
129
  }
130
+
131
+ CodePushUtils.log("Executing CodePush with a signing public key.");
132
+
127
133
  return publicKey;
128
134
  }
129
135
 
130
136
  private String getCustomPropertyFromStringsIfExist(String propertyName) {
131
137
  String property;
132
-
138
+
133
139
  String packageName = mContext.getPackageName();
134
140
  int resId = mContext.getResources().getIdentifier("CodePush" + propertyName, "string", packageName);
135
-
141
+
136
142
  if (resId != 0) {
137
143
  property = mContext.getString(resId);
138
144
 
@@ -140,7 +146,7 @@ public class CodePush implements ReactPackage {
140
146
  return property;
141
147
  } else {
142
148
  CodePushUtils.log("Specified " + propertyName + " is empty");
143
- }
149
+ }
144
150
  }
145
151
 
146
152
  return null;
@@ -230,8 +236,8 @@ public class CodePush implements ReactPackage {
230
236
  return mContext;
231
237
  }
232
238
 
233
- public String getDeploymentKey() {
234
- return mDeploymentKey;
239
+ public String getReleaseChannelPublicId() {
240
+ return mReleaseChannelPublicId;
235
241
  }
236
242
 
237
243
  public static String getJSBundleFile() {
@@ -393,8 +399,8 @@ public class CodePush implements ReactPackage {
393
399
  return sTestConfigurationFlag;
394
400
  }
395
401
 
396
- public void setDeploymentKey(String deploymentKey) {
397
- mDeploymentKey = deploymentKey;
402
+ public void setReleaseChannelPublicId(String releaseChannelPublicId) {
403
+ mReleaseChannelPublicId = releaseChannelPublicId;
398
404
  }
399
405
 
400
406
  public static void setUsingTestConfiguration(boolean shouldUseTestConfiguration) {
@@ -1,17 +1,17 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  import android.content.Context;
4
4
 
5
5
  public class CodePushBuilder {
6
- private String mDeploymentKey;
6
+ private String mReleaseChannelPublicId;
7
7
  private Context mContext;
8
8
 
9
9
  private boolean mIsDebugMode;
10
10
  private String mServerUrl;
11
11
  private Integer mPublicKeyResourceDescriptor;
12
12
 
13
- public CodePushBuilder(String deploymentKey, Context context) {
14
- this.mDeploymentKey = deploymentKey;
13
+ public CodePushBuilder(String releaseChannelPublicId, Context context) {
14
+ this.mReleaseChannelPublicId = releaseChannelPublicId;
15
15
  this.mContext = context;
16
16
  this.mServerUrl = CodePush.getServiceUrl();
17
17
  }
@@ -32,6 +32,6 @@ public class CodePushBuilder {
32
32
  }
33
33
 
34
34
  public CodePush build() {
35
- return new CodePush(this.mDeploymentKey, this.mContext, this.mIsDebugMode, this.mServerUrl, this.mPublicKeyResourceDescriptor);
35
+ return new CodePush(this.mReleaseChannelPublicId, this.mContext, this.mIsDebugMode, this.mServerUrl, this.mPublicKeyResourceDescriptor);
36
36
  }
37
37
  }
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  public class CodePushConstants {
4
4
  public static final String ASSETS_BUNDLE_PREFIX = "assets://";
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  import android.app.Activity;
4
4
  import android.app.AlertDialog;
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  public enum CodePushInstallMode {
4
4
  IMMEDIATE(0),
@@ -13,4 +13,4 @@ public enum CodePushInstallMode {
13
13
  public int getValue() {
14
14
  return this.value;
15
15
  }
16
- }
16
+ }
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  class CodePushInvalidPublicKeyException extends RuntimeException {
4
4
 
@@ -9,4 +9,4 @@ class CodePushInvalidPublicKeyException extends RuntimeException {
9
9
  public CodePushInvalidPublicKeyException(String message) {
10
10
  super(message);
11
11
  }
12
- }
12
+ }
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  public class CodePushInvalidUpdateException extends RuntimeException {
4
4
  public CodePushInvalidUpdateException(String message) {
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  import java.net.MalformedURLException;
4
4
 
@@ -9,4 +9,4 @@ public class CodePushMalformedDataException extends RuntimeException {
9
9
  public CodePushMalformedDataException(String url, MalformedURLException cause) {
10
10
  super("The package has an invalid downloadUrl: " + url, cause);
11
11
  }
12
- }
12
+ }
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  import android.app.Activity;
4
4
  import android.content.SharedPreferences;
@@ -156,7 +156,7 @@ public class CodePushNativeModule extends ReactContextBaseJavaModule {
156
156
  @Override
157
157
  public void run() {
158
158
  try {
159
- // We don't need to resetReactRootViews anymore
159
+ // We don't need to resetReactRootViews anymore
160
160
  // due the issue https://github.com/facebook/react-native/issues/14533
161
161
  // has been fixed in RN 0.46.0
162
162
  //resetReactRootViews(instanceManager);
@@ -365,7 +365,7 @@ public class CodePushNativeModule extends ReactContextBaseJavaModule {
365
365
  WritableMap configMap = Arguments.createMap();
366
366
  configMap.putString("appVersion", mCodePush.getAppVersion());
367
367
  configMap.putString("clientUniqueId", mClientUniqueId);
368
- configMap.putString("deploymentKey", mCodePush.getDeploymentKey());
368
+ configMap.putString("releaseChannelPublicId", mCodePush.getReleaseChannelPublicId());
369
369
  configMap.putString("serverUrl", mCodePush.getServerUrl());
370
370
 
371
371
  // The binary hash may be null in debug builds
@@ -492,7 +492,7 @@ public class CodePushNativeModule extends ReactContextBaseJavaModule {
492
492
  return null;
493
493
  }
494
494
  }
495
-
495
+
496
496
  promise.resolve("");
497
497
  } catch(CodePushUnknownException e) {
498
498
  CodePushUtils.log(e);
@@ -691,7 +691,7 @@ public class CodePushNativeModule extends ReactContextBaseJavaModule {
691
691
 
692
692
  /**
693
693
  * This method clears CodePush's downloaded updates.
694
- * It is needed to switch to a different deployment if the current deployment is more recent.
694
+ * It is needed to switch to a different release channel if the current release channel is more recent.
695
695
  * Note: we don’t recommend to use this method in scenarios other than that (CodePush will call
696
696
  * this method automatically when needed in other cases) as it could lead to unpredictable
697
697
  * behavior.
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  public final class CodePushNotInitializedException extends RuntimeException {
4
4
 
@@ -9,4 +9,4 @@ public final class CodePushNotInitializedException extends RuntimeException {
9
9
  public CodePushNotInitializedException(String message) {
10
10
  super(message);
11
11
  }
12
- }
12
+ }
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  import android.content.Context;
4
4
  import android.content.SharedPreferences;
@@ -14,12 +14,12 @@ public class CodePushTelemetryManager {
14
14
  private SharedPreferences mSettings;
15
15
  private final String APP_VERSION_KEY = "appVersion";
16
16
  private final String DEPLOYMENT_FAILED_STATUS = "DeploymentFailed";
17
- private final String DEPLOYMENT_KEY_KEY = "deploymentKey";
17
+ private final String RELEASE_CHANNEL_PUBLIC_ID_KEY = "releaseChannelPublicId";
18
18
  private final String DEPLOYMENT_SUCCEEDED_STATUS = "DeploymentSucceeded";
19
19
  private final String LABEL_KEY = "label";
20
20
  private final String LAST_DEPLOYMENT_REPORT_KEY = "CODE_PUSH_LAST_DEPLOYMENT_REPORT";
21
21
  private final String PACKAGE_KEY = "package";
22
- private final String PREVIOUS_DEPLOYMENT_KEY_KEY = "previousDeploymentKey";
22
+ private final String PREVIOUS_RELEASE_CHANNEL_PUBLIC_ID_KEY = "previousReleaseChannelPublicId";
23
23
  private final String PREVIOUS_LABEL_OR_APP_VERSION_KEY = "previousLabelOrAppVersion";
24
24
  private final String RETRY_DEPLOYMENT_REPORT_KEY = "CODE_PUSH_RETRY_DEPLOYMENT_REPORT";
25
25
  private final String STATUS_KEY = "status";
@@ -39,10 +39,10 @@ public class CodePushTelemetryManager {
39
39
  this.clearRetryStatusReport();
40
40
  reportMap = Arguments.createMap();
41
41
  if (this.isStatusReportIdentifierCodePushLabel(previousStatusReportIdentifier)) {
42
- String previousDeploymentKey = this.getDeploymentKeyFromStatusReportIdentifier(previousStatusReportIdentifier);
42
+ String previousReleaseChannelPublicId = this.getReleaseChannelPublicIdFromStatusReportIdentifier(previousStatusReportIdentifier);
43
43
  String previousLabel = this.getVersionLabelFromStatusReportIdentifier(previousStatusReportIdentifier);
44
44
  reportMap.putString(APP_VERSION_KEY, appVersion);
45
- reportMap.putString(PREVIOUS_DEPLOYMENT_KEY_KEY, previousDeploymentKey);
45
+ reportMap.putString(PREVIOUS_RELEASE_CHANNEL_PUBLIC_ID_KEY, previousReleaseChannelPublicId);
46
46
  reportMap.putString(PREVIOUS_LABEL_OR_APP_VERSION_KEY, previousLabel);
47
47
  } else {
48
48
  // Previous status report was with a binary app version.
@@ -90,11 +90,11 @@ public class CodePushTelemetryManager {
90
90
  this.clearRetryStatusReport();
91
91
  reportMap = Arguments.createMap();
92
92
  if (this.isStatusReportIdentifierCodePushLabel(previousStatusReportIdentifier)) {
93
- String previousDeploymentKey = this.getDeploymentKeyFromStatusReportIdentifier(previousStatusReportIdentifier);
93
+ String previousReleaseChannelPublicId = this.getReleaseChannelPublicIdFromStatusReportIdentifier(previousStatusReportIdentifier);
94
94
  String previousLabel = this.getVersionLabelFromStatusReportIdentifier(previousStatusReportIdentifier);
95
95
  reportMap.putMap(PACKAGE_KEY, currentPackage);
96
96
  reportMap.putString(STATUS_KEY, DEPLOYMENT_SUCCEEDED_STATUS);
97
- reportMap.putString(PREVIOUS_DEPLOYMENT_KEY_KEY, previousDeploymentKey);
97
+ reportMap.putString(PREVIOUS_RELEASE_CHANNEL_PUBLIC_ID_KEY, previousReleaseChannelPublicId);
98
98
  reportMap.putString(PREVIOUS_LABEL_OR_APP_VERSION_KEY, previousLabel);
99
99
  } else {
100
100
  // Previous status report was with a binary app version.
@@ -113,7 +113,7 @@ public class CodePushTelemetryManager {
113
113
  if (statusReport.hasKey(STATUS_KEY) && DEPLOYMENT_FAILED_STATUS.equals(statusReport.getString(STATUS_KEY))) {
114
114
  return;
115
115
  }
116
-
116
+
117
117
  if (statusReport.hasKey(APP_VERSION_KEY)) {
118
118
  saveStatusReportedForIdentifier(statusReport.getString(APP_VERSION_KEY));
119
119
  } else if (statusReport.hasKey(PACKAGE_KEY)) {
@@ -131,7 +131,7 @@ public class CodePushTelemetryManager {
131
131
  mSettings.edit().remove(RETRY_DEPLOYMENT_REPORT_KEY).commit();
132
132
  }
133
133
 
134
- private String getDeploymentKeyFromStatusReportIdentifier(String statusReportIdentifier) {
134
+ private String getReleaseChannelPublicIdFromStatusReportIdentifier(String statusReportIdentifier) {
135
135
  String[] parsedIdentifier = statusReportIdentifier.split(":");
136
136
  if (parsedIdentifier.length > 0) {
137
137
  return parsedIdentifier[0];
@@ -141,12 +141,12 @@ public class CodePushTelemetryManager {
141
141
  }
142
142
 
143
143
  private String getPackageStatusReportIdentifier(ReadableMap updatePackage) {
144
- // Because deploymentKeys can be dynamically switched, we use a
145
- // combination of the deploymentKey and label as the packageIdentifier.
146
- String deploymentKey = CodePushUtils.tryGetString(updatePackage, DEPLOYMENT_KEY_KEY);
144
+ // Because release channels can be dynamically switched, we use a
145
+ // combination of the releaseChannelPublicId and label as the packageIdentifier.
146
+ String releaseChannelPublicId = CodePushUtils.tryGetString(updatePackage, RELEASE_CHANNEL_PUBLIC_ID_KEY);
147
147
  String label = CodePushUtils.tryGetString(updatePackage, LABEL_KEY);
148
- if (deploymentKey != null && label != null) {
149
- return deploymentKey + ":" + label;
148
+ if (releaseChannelPublicId != null && label != null) {
149
+ return releaseChannelPublicId + ":" + label;
150
150
  } else {
151
151
  return null;
152
152
  }
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  class CodePushUnknownException extends RuntimeException {
4
4
 
@@ -9,4 +9,4 @@ class CodePushUnknownException extends RuntimeException {
9
9
  public CodePushUnknownException(String message) {
10
10
  super(message);
11
11
  }
12
- }
12
+ }
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  import android.os.Build;
4
4
 
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  public enum CodePushUpdateState {
4
4
  RUNNING(0),
@@ -12,4 +12,4 @@ public enum CodePushUpdateState {
12
12
  public int getValue() {
13
13
  return this.value;
14
14
  }
15
- }
15
+ }
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  import android.content.Context;
4
4
  import android.util.Base64;
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  import android.util.Log;
4
4
 
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  import com.facebook.react.bridge.WritableMap;
4
4
  import com.facebook.react.bridge.WritableNativeMap;
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  interface DownloadProgressCallback {
4
4
  void call(DownloadProgress downloadProgress);
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  import java.io.BufferedInputStream;
4
4
  import java.io.BufferedReader;
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  import com.facebook.react.ReactInstanceManager;
4
4
 
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  import android.content.Context;
4
4
  import android.content.SharedPreferences;
@@ -1,4 +1,4 @@
1
- package com.microsoft.codepush.react;
1
+ package com.appzung.codepush.react;
2
2
 
3
3
  import java.io.IOException;
4
4
  import java.net.InetAddress;
@@ -15,7 +15,7 @@ buildscript {
15
15
 
16
16
  allprojects {
17
17
  android {
18
- namespace "com.microsoft.codepush.react"
18
+ namespace "com.appzung.codepush.react"
19
19
  }
20
20
  repositories {
21
21
  mavenLocal()
@@ -69,9 +69,9 @@ gradle.projectsEvaluated {
69
69
 
70
70
  def nodeModulesPath;
71
71
  if (project.hasProperty('nodeModulesPath')) {
72
- nodeModulesPath = "${project.nodeModulesPath}/react-native-code-push"
72
+ nodeModulesPath = "${project.nodeModulesPath}/@appzung/react-native-code-push"
73
73
  } else {
74
- nodeModulesPath = findNodeModulePath(projectDir, "react-native-code-push")
74
+ nodeModulesPath = findNodeModulePath(projectDir, "@appzung/react-native-code-push")
75
75
  }
76
76
 
77
77
  def targetName = variant.name.capitalize()
@@ -95,7 +95,7 @@ gradle.projectsEvaluated {
95
95
 
96
96
  // mitigates Resource and asset merger: Duplicate resources error
97
97
  project.delete(files("${jsBundleDir}"))
98
-
98
+
99
99
  jsBundleDir.mkdirs()
100
100
  resourcesDir.mkdirs()
101
101
 
@@ -0,0 +1,56 @@
1
+ ## Advanced usage
2
+
3
+ ### Multiple environments
4
+
5
+ #### Staging / Production
6
+
7
+ In a real-world scenario you would have `Staging` and `Production` apps that are different binaries, each using specific environment config (different package name, bundle identifier, API, feature flags etc). Create a release channel for each of these environments with `appzung release-channels create` and change the `CodePushReleaseChannelPublicId` on the native side with environment variables. You might want to use a module like [react-native-config](https://github.com/lugg/react-native-config) (or do it manually using build variants and configurations).
8
+
9
+ ```groovy
10
+ // android/app/build.gradle
11
+ android {
12
+ // ...
13
+ defaultConfig {
14
+ // ...
15
+ resValue 'string', "CodePushReleaseChannelPublicId", project.env.get("CODEPUSH_RELEASE_CHANNEL_PUBLIC_ID_ANDROID")
16
+ }
17
+ }
18
+ ```
19
+
20
+ ```
21
+ // ios/myapp/Info.plist
22
+
23
+ <key>CodePushReleaseChannelPublicId</key>
24
+ <string>$(CODEPUSH_RELEASE_CHANNEL_PUBLIC_ID_IOS)</string>
25
+ ```
26
+
27
+ #### QA / Production
28
+
29
+ In the case where you have a `QA` environment that is completely iso-prod (meaning you can swap the JS bundle between those two apps), you may take advantage of the `promote` feature:
30
+
31
+ 1. Release a CodePush update to your `QA` release channel using the `appzung releases deploy-react-native` command (or `appzung releases deploy` if you need more control)
32
+ 2. Let QA test the build
33
+ 3. Promote the tested release from `QA` to `Production` using the `appzung releases promote` command
34
+
35
+ *NOTE: If you want to take a more cautious approach, you can even choose to perform a "staged rollout" as part of #3, which allows you to mitigate additional potential risk with the update (like did your testing in #2 touch all possible devices/conditions?) by only making the production update available to a percentage of your users (for example `appzung releases promote -r 20`). Then, after waiting for a reasonable amount of time to see if any crash reports or customer feedback comes in, you can expand it to your entire audience by running `appzung releases edit -r 100`.*
36
+
37
+ ### Dynamic release channel assignment
38
+
39
+ The above section illustrated how you can leverage multiple CodePush release channels in order to effectively test your updates before broadly releasing them to your end users. However, since that workflow statically embeds the release channel assignment into the actual binary, a staging or production build will only ever sync updates from that release channel. In many cases, this is sufficient, since you only want your team, customers, stakeholders, etc. to sync with your pre-production releases, and therefore, only they need a build that knows how to sync with staging. However, if you want to be able to perform A/B tests, or provide early access of your app to certain users, it can prove very useful to be able to dynamically place specific users (or audiences) into specific release channels at runtime.
40
+
41
+ In order to achieve this kind of workflow, all you need to do is specify the release channel public ID you want the current user to synchronize with when calling the `codePush` method. When specified, this key will override the "default" one that was provided in your app's `Info.plist` (iOS) or strings resources (Android) files. This allows you to produce a build for staging or production, that is also capable of being dynamically "redirected" as needed.
42
+
43
+ ```javascript
44
+ // Imagine that "userProfile" is a prop that this component received
45
+ // which includes the release channel public ID that the current user should use.
46
+ codePush.sync({ releaseChannelPublicId: userProfile.RELEASE_CHANNEL_PUBLIC_ID });
47
+ ```
48
+
49
+ With that change in place, now it's just a matter of choosing how your app determines the right release channel for the current user. In practice, there are typically two solutions for this:
50
+
51
+ 1. Expose a user-visible mechanism for changing release channels at any time. For example, your settings page could have a toggle for enabling "beta" access. This model works well if you're not concerned with the privacy of your pre-production updates, and you have power users that may want to opt-in to earlier (and potentially buggy) updates at their own will (kind of like Chrome channels). However, this solution puts the decision in the hands of your users, which doesn't help you perform A/B tests transparently.
52
+ 2. Annotate the server-side profile of your users with an additional piece of metadata that indicates the release channel they should sync with. By default, your app could just use the binary-embedded key, but after a user has authenticated, your server can choose to "redirect" them to a different release channel, which allows you to incrementally place certain users or groups in different release channels as needed. You could even choose to store the server-response in local storage so that it becomes the new default. How you store the key alongside your user's profiles is entirely up to your authentication solution (for example Auth0, Firebase, custom DB + REST API), but is generally pretty trivial to do.
53
+
54
+ *NOTE: If needed, you could also implement a hybrid solution that allowed your end-users to toggle between different release channels, while also allowing your server to override that decision. This way, you have a hierarchy of "release channel resolution" that ensures your app has the ability to update itself out-of-the-box, your end users can feel rewarded by getting early access to bits, but you also have the ability to run A/B tests on your users as needed.*
55
+
56
+ Are you using dynamic release channel assignments? Contact us at hello@appzung.com so that we may provide better integration.