@bravemobile/react-native-code-push 10.0.0 → 12.0.0-beta.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 (84) hide show
  1. package/CodePush.podspec +5 -5
  2. package/README.md +2 -10
  3. package/android/app/build.gradle +2 -0
  4. package/android/app/proguard-rules.pro +0 -4
  5. package/android/app/src/debug/AndroidManifest.xml +1 -2
  6. package/android/app/src/main/AndroidManifest.xml +1 -2
  7. package/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java +1 -22
  8. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +0 -2
  9. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +14 -37
  10. package/android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java +15 -8
  11. package/android/build.gradle +3 -0
  12. package/expo/plugin/withCodePushAndroid.js +1 -22
  13. package/ios/CodePush/SSZipArchive/Info.plist +26 -0
  14. package/ios/CodePush/SSZipArchive/README.md +1 -1
  15. package/ios/CodePush/SSZipArchive/SSZipArchive.h +129 -27
  16. package/ios/CodePush/SSZipArchive/SSZipArchive.m +1119 -314
  17. package/ios/CodePush/SSZipArchive/SSZipCommon.h +71 -0
  18. package/ios/CodePush/SSZipArchive/Supporting Files/PrivacyInfo.xcprivacy +23 -0
  19. package/ios/CodePush/SSZipArchive/include/ZipArchive.h +25 -0
  20. package/ios/CodePush/SSZipArchive/minizip/LICENSE +17 -0
  21. package/ios/CodePush/SSZipArchive/minizip/mz.h +273 -0
  22. package/ios/CodePush/SSZipArchive/minizip/mz_compat.c +1306 -0
  23. package/ios/CodePush/SSZipArchive/minizip/mz_compat.h +346 -0
  24. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.c +187 -0
  25. package/ios/CodePush/SSZipArchive/minizip/mz_crypt.h +65 -0
  26. package/ios/CodePush/SSZipArchive/minizip/mz_crypt_apple.c +526 -0
  27. package/ios/CodePush/SSZipArchive/minizip/mz_os.c +348 -0
  28. package/ios/CodePush/SSZipArchive/minizip/mz_os.h +176 -0
  29. package/ios/CodePush/SSZipArchive/minizip/mz_os_posix.c +350 -0
  30. package/ios/CodePush/SSZipArchive/minizip/mz_strm.c +556 -0
  31. package/ios/CodePush/SSZipArchive/minizip/mz_strm.h +132 -0
  32. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.c +383 -0
  33. package/ios/CodePush/SSZipArchive/minizip/mz_strm_buf.h +42 -0
  34. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.c +269 -0
  35. package/ios/CodePush/SSZipArchive/minizip/mz_strm_mem.h +48 -0
  36. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os.h +40 -0
  37. package/ios/CodePush/SSZipArchive/minizip/mz_strm_os_posix.c +203 -0
  38. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.c +334 -0
  39. package/ios/CodePush/SSZipArchive/minizip/mz_strm_pkcrypt.h +46 -0
  40. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.c +429 -0
  41. package/ios/CodePush/SSZipArchive/minizip/mz_strm_split.h +43 -0
  42. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.c +360 -0
  43. package/ios/CodePush/SSZipArchive/minizip/mz_strm_wzaes.h +46 -0
  44. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.c +389 -0
  45. package/ios/CodePush/SSZipArchive/minizip/mz_strm_zlib.h +43 -0
  46. package/ios/CodePush/SSZipArchive/minizip/mz_zip.c +2782 -0
  47. package/ios/CodePush/SSZipArchive/minizip/mz_zip.h +262 -0
  48. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.c +1942 -0
  49. package/ios/CodePush/SSZipArchive/minizip/mz_zip_rw.h +285 -0
  50. package/ios/CodePush.xcodeproj/project.pbxproj +245 -130
  51. package/ios/PrivacyInfo.xcprivacy +31 -0
  52. package/package.json +1 -1
  53. package/android/codepush.gradle +0 -162
  54. package/ios/CodePush/SSZipArchive/Common.h +0 -81
  55. package/ios/CodePush/SSZipArchive/aes/aes.h +0 -198
  56. package/ios/CodePush/SSZipArchive/aes/aes_via_ace.h +0 -541
  57. package/ios/CodePush/SSZipArchive/aes/aescrypt.c +0 -294
  58. package/ios/CodePush/SSZipArchive/aes/aeskey.c +0 -548
  59. package/ios/CodePush/SSZipArchive/aes/aesopt.h +0 -739
  60. package/ios/CodePush/SSZipArchive/aes/aestab.c +0 -391
  61. package/ios/CodePush/SSZipArchive/aes/aestab.h +0 -173
  62. package/ios/CodePush/SSZipArchive/aes/brg_endian.h +0 -126
  63. package/ios/CodePush/SSZipArchive/aes/brg_types.h +0 -219
  64. package/ios/CodePush/SSZipArchive/aes/entropy.c +0 -54
  65. package/ios/CodePush/SSZipArchive/aes/entropy.h +0 -16
  66. package/ios/CodePush/SSZipArchive/aes/fileenc.c +0 -144
  67. package/ios/CodePush/SSZipArchive/aes/fileenc.h +0 -121
  68. package/ios/CodePush/SSZipArchive/aes/hmac.c +0 -145
  69. package/ios/CodePush/SSZipArchive/aes/hmac.h +0 -103
  70. package/ios/CodePush/SSZipArchive/aes/prng.c +0 -155
  71. package/ios/CodePush/SSZipArchive/aes/prng.h +0 -82
  72. package/ios/CodePush/SSZipArchive/aes/pwd2key.c +0 -103
  73. package/ios/CodePush/SSZipArchive/aes/pwd2key.h +0 -57
  74. package/ios/CodePush/SSZipArchive/aes/sha1.c +0 -258
  75. package/ios/CodePush/SSZipArchive/aes/sha1.h +0 -73
  76. package/ios/CodePush/SSZipArchive/minizip/crypt.h +0 -130
  77. package/ios/CodePush/SSZipArchive/minizip/ioapi.c +0 -369
  78. package/ios/CodePush/SSZipArchive/minizip/ioapi.h +0 -175
  79. package/ios/CodePush/SSZipArchive/minizip/mztools.c +0 -284
  80. package/ios/CodePush/SSZipArchive/minizip/mztools.h +0 -31
  81. package/ios/CodePush/SSZipArchive/minizip/unzip.c +0 -1839
  82. package/ios/CodePush/SSZipArchive/minizip/unzip.h +0 -248
  83. package/ios/CodePush/SSZipArchive/minizip/zip.c +0 -1910
  84. package/ios/CodePush/SSZipArchive/minizip/zip.h +0 -202
package/CodePush.podspec CHANGED
@@ -10,18 +10,18 @@ Pod::Spec.new do |s|
10
10
  s.license = package['license']
11
11
  s.homepage = package['homepage']
12
12
  s.source = { :git => 'https://github.com/Soomgo-Mobile/react-native-code-push.git', :tag => "v#{s.version}"}
13
- s.ios.deployment_target = '9.0'
14
- s.tvos.deployment_target = '9.0'
13
+ s.ios.deployment_target = '15.5'
14
+ s.tvos.deployment_target = '15.5'
15
15
  s.preserve_paths = '*.js'
16
16
  s.library = 'z'
17
17
  s.source_files = 'ios/CodePush/*.{h,m}'
18
18
  s.public_header_files = ['ios/CodePush/CodePush.h']
19
19
 
20
- # Note: Even though there are copy/pasted versions of some of these dependencies in the repo,
21
- # we explicitly let CocoaPods pull in the versions below so all dependencies are resolved and
20
+ # Note: Even though there are copy/pasted versions of some of these dependencies in the repo,
21
+ # we explicitly let CocoaPods pull in the versions below so all dependencies are resolved and
22
22
  # linked properly at a parent workspace level.
23
23
  s.dependency 'React-Core'
24
- s.dependency 'SSZipArchive', '~> 2.2.2'
24
+ s.dependency 'SSZipArchive', '~> 2.5.5'
25
25
  s.dependency 'JWT', '~> 3.0.0-beta.12'
26
26
  s.dependency 'Base64', '~> 1.1'
27
27
  end
package/README.md CHANGED
@@ -8,17 +8,9 @@
8
8
 
9
9
  ### 🚀 New Architecture support
10
10
 
11
- Tested on the React Native template apps
12
-
13
- | RN Version | Old Architecture | New Architecture | New Architecture Bridgeless |
14
- |--------|--------|--------|--------|
15
- | 0.73.11 | ✅ | ✅ | Unsupported |
16
- | 0.74.7 | ✅ | ✅ | ✅ |
17
- | 0.75.5 | ✅ | ✅ | ✅ |
18
- | 0.76.7 | ✅ | ✅ | ✅ |
19
- | 0.77.1 | ✅ | ✅ | ✅ |
20
- | 0.78.0 | ✅ | ✅ | ✅ |
11
+ Supports React Native 0.74 ~ 0.80.
21
12
 
13
+ (Tested on the React Native CLI template apps)
22
14
 
23
15
  ## 🚗 Migration Guide
24
16
 
@@ -6,6 +6,8 @@ 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"
10
+
9
11
  compileSdkVersion rootProject.hasProperty('compileSdkVersion') ? rootProject.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
10
12
  buildToolsVersion rootProject.hasProperty('buildToolsVersion') ? rootProject.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
11
13
 
@@ -24,10 +24,6 @@
24
24
  private ** mReactHost; # bridgeless
25
25
  public void reload(...); # RN 0.74 and above
26
26
  }
27
- # RN 0.74 and above
28
- -keepclassmembers class com.facebook.react.ReactActivity {
29
- public ** getReactDelegate(...);
30
- }
31
27
  # bridgeless
32
28
  -keepclassmembers class com.facebook.react.defaults.DefaultReactHostDelegate {
33
29
  private ** jsBundleLoader;
@@ -1,5 +1,4 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.microsoft.codepush.react">
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
2
 
4
3
  <uses-permission android:name="android.permission.INTERNET" />
5
4
 
@@ -1,5 +1,4 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.microsoft.codepush.react">
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
2
 
4
3
  <uses-permission android:name="android.permission.INTERNET" />
5
4
 
@@ -177,19 +177,6 @@ public class CodePush implements ReactPackage {
177
177
  return mPublicKey;
178
178
  }
179
179
 
180
- long getBinaryResourcesModifiedTime() {
181
- try {
182
- String packageName = this.mContext.getPackageName();
183
- int codePushApkBuildTimeId = this.mContext.getResources().getIdentifier(CodePushConstants.CODE_PUSH_APK_BUILD_TIME_KEY, "string", packageName);
184
- // replace double quotes needed for correct restoration of long value from strings.xml
185
- // https://github.com/microsoft/cordova-plugin-code-push/issues/264
186
- String codePushApkBuildTime = this.mContext.getResources().getString(codePushApkBuildTimeId).replaceAll("\"","");
187
- return Long.parseLong(codePushApkBuildTime);
188
- } catch (Exception e) {
189
- throw new CodePushUnknownException("Error in getting binary resources modified time", e);
190
- }
191
- }
192
-
193
180
  public String getPackageFolder() {
194
181
  JSONObject codePushLocalPackage = mUpdateManager.getCurrentPackage();
195
182
  if (codePushLocalPackage == null) {
@@ -331,16 +318,8 @@ public class CodePush implements ReactPackage {
331
318
 
332
319
  private boolean isPackageBundleLatest(JSONObject packageMetadata) {
333
320
  try {
334
- Long binaryModifiedDateDuringPackageInstall = null;
335
- String binaryModifiedDateDuringPackageInstallString = packageMetadata.optString(CodePushConstants.BINARY_MODIFIED_TIME_KEY, null);
336
- if (binaryModifiedDateDuringPackageInstallString != null) {
337
- binaryModifiedDateDuringPackageInstall = Long.parseLong(binaryModifiedDateDuringPackageInstallString);
338
- }
339
321
  String packageAppVersion = packageMetadata.optString("appVersion", null);
340
- long binaryResourcesModifiedTime = this.getBinaryResourcesModifiedTime();
341
- return binaryModifiedDateDuringPackageInstall != null &&
342
- binaryModifiedDateDuringPackageInstall == binaryResourcesModifiedTime &&
343
- (isUsingTestConfiguration() || sAppVersion.equals(packageAppVersion));
322
+ return (isUsingTestConfiguration() || sAppVersion.equals(packageAppVersion));
344
323
  } catch (NumberFormatException e) {
345
324
  throw new CodePushUnknownException("Error in reading binary modified date from package metadata", e);
346
325
  }
@@ -2,7 +2,6 @@ package com.microsoft.codepush.react;
2
2
 
3
3
  public class CodePushConstants {
4
4
  public static final String ASSETS_BUNDLE_PREFIX = "assets://";
5
- public static final String BINARY_MODIFIED_TIME_KEY = "binaryModifiedTime";
6
5
  public static final String CODE_PUSH_FOLDER_PREFIX = "CodePush";
7
6
  public static final String CODE_PUSH_HASH_FILE_NAME = "CodePushHash";
8
7
  public static final String CODE_PUSH_OLD_HASH_FILE_NAME = "CodePushHash.json";
@@ -25,7 +24,6 @@ public class CodePushConstants {
25
24
  public static final String RELATIVE_BUNDLE_PATH_KEY = "bundlePath";
26
25
  public static final String STATUS_FILE = "codepush.json";
27
26
  public static final String UNZIPPED_FOLDER_NAME = "unzipped";
28
- public static final String CODE_PUSH_APK_BUILD_TIME_KEY = "CODE_PUSH_APK_BUILD_TIME";
29
27
  public static final String BUNDLE_JWT_FILE = ".codepushrelease";
30
28
  public static final String LATEST_ROLLBACK_INFO_KEY = "LATEST_ROLLBACK_INFO";
31
29
  public static final String LATEST_ROLLBACK_PACKAGE_HASH_KEY = "packageHash";
@@ -6,6 +6,7 @@ import android.os.AsyncTask;
6
6
  import android.os.Handler;
7
7
  import android.os.Looper;
8
8
  import android.view.View;
9
+ import android.view.Choreographer;
9
10
 
10
11
  import androidx.annotation.OptIn;
11
12
 
@@ -25,7 +26,6 @@ import com.facebook.react.bridge.ReactMethod;
25
26
  import com.facebook.react.bridge.ReadableMap;
26
27
  import com.facebook.react.bridge.WritableMap;
27
28
  import com.facebook.react.common.annotations.UnstableReactNativeAPI;
28
- import com.facebook.react.modules.core.ChoreographerCompat;
29
29
  import com.facebook.react.modules.core.DeviceEventManagerModule;
30
30
  import com.facebook.react.modules.core.ReactChoreographer;
31
31
  import com.facebook.react.runtime.ReactHostDelegate;
@@ -36,7 +36,6 @@ import org.json.JSONObject;
36
36
 
37
37
  import java.io.IOException;
38
38
  import java.lang.reflect.Field;
39
- import java.lang.reflect.Method;
40
39
  import java.util.ArrayList;
41
40
  import java.util.Date;
42
41
  import java.util.HashMap;
@@ -99,7 +98,7 @@ public class CodePushNativeModule extends ReactContextBaseJavaModule {
99
98
  }
100
99
 
101
100
  private void loadBundleLegacy() {
102
- final Activity currentActivity = getCurrentActivity();
101
+ final Activity currentActivity = getReactApplicationContext().getCurrentActivity();
103
102
  if (currentActivity == null) {
104
103
  // The currentActivity can be null if it is backgrounded / destroyed, so we simply
105
104
  // no-op to prevent any null pointer exceptions.
@@ -128,7 +127,7 @@ public class CodePushNativeModule extends ReactContextBaseJavaModule {
128
127
 
129
128
  ReactHost reactHost = resolveReactHost();
130
129
  if (reactHost == null) {
131
- // Bridge, Old Architecture and RN < 0.74 (we support Bridgeless >= 0.74)
130
+ // Bridge, Old Architecture
132
131
  setJSBundleLoaderBridge(instanceManager, latestJSBundleLoader);
133
132
  return;
134
133
  }
@@ -184,29 +183,14 @@ public class CodePushNativeModule extends ReactContextBaseJavaModule {
184
183
  new Handler(Looper.getMainLooper()).post(new Runnable() {
185
184
  @Override
186
185
  public void run() {
187
- try {
188
- // reload method introduced in RN 0.74 (https://github.com/reactwg/react-native-new-architecture/discussions/174)
189
- // so, we need to check if reload method exists and call it
190
- try {
191
- ReactDelegate reactDelegate = resolveReactDelegate();
192
- if (reactDelegate == null) {
193
- throw new NoSuchMethodException("ReactDelegate doesn't have reload method in RN < 0.74");
194
- }
186
+ ReactDelegate reactDelegate = resolveReactDelegate();
187
+ assert reactDelegate != null;
195
188
 
196
- resetReactRootViews(reactDelegate);
189
+ resetReactRootViews(reactDelegate);
197
190
 
198
- Method reloadMethod = reactDelegate.getClass().getMethod("reload");
199
- reloadMethod.invoke(reactDelegate);
200
- } catch (NoSuchMethodException e) {
201
- // RN < 0.74 calls ReactInstanceManager.recreateReactContextInBackground() directly
202
- instanceManager.recreateReactContextInBackground();
203
- }
204
- mCodePush.initializeUpdateAfterRestart();
205
- } catch (Exception e) {
206
- // The recreation method threw an unknown exception
207
- // so just simply fallback to restarting the Activity (if it exists)
208
- loadBundleLegacy();
209
- }
191
+ reactDelegate.reload();
192
+
193
+ mCodePush.initializeUpdateAfterRestart();
210
194
  }
211
195
  });
212
196
 
@@ -223,7 +207,7 @@ public class CodePushNativeModule extends ReactContextBaseJavaModule {
223
207
  // React Native uses the id field to track react tags and will overwrite this field.
224
208
  // If that is fine, explicitly overwrite the id field to View.NO_ID before calling addRootView."
225
209
  private void resetReactRootViews(ReactDelegate reactDelegate) {
226
- ReactActivity currentActivity = (ReactActivity) getCurrentActivity();
210
+ ReactActivity currentActivity = (ReactActivity) getReactApplicationContext().getCurrentActivity();
227
211
  if (currentActivity != null) {
228
212
  ReactRootView reactRootView = reactDelegate.getReactRootView();
229
213
  if (reactRootView != null) {
@@ -242,18 +226,12 @@ public class CodePushNativeModule extends ReactContextBaseJavaModule {
242
226
  }
243
227
 
244
228
  private ReactDelegate resolveReactDelegate() {
245
- ReactActivity currentActivity = (ReactActivity) getCurrentActivity();
229
+ ReactActivity currentActivity = (ReactActivity) getReactApplicationContext().getCurrentActivity();
246
230
  if (currentActivity == null) {
247
231
  return null;
248
232
  }
249
233
 
250
- try {
251
- Method getReactDelegateMethod = currentActivity.getClass().getMethod("getReactDelegate");
252
- return (ReactDelegate) getReactDelegateMethod.invoke(currentActivity);
253
- } catch (Exception e) {
254
- // RN < 0.74 doesn't have getReactDelegate method
255
- return null;
256
- }
234
+ return currentActivity.getReactDelegate();
257
235
  }
258
236
 
259
237
  private ReactHost resolveReactHost() {
@@ -278,7 +256,7 @@ public class CodePushNativeModule extends ReactContextBaseJavaModule {
278
256
  return instanceManager;
279
257
  }
280
258
 
281
- final Activity currentActivity = getCurrentActivity();
259
+ final Activity currentActivity = getReactApplicationContext().getCurrentActivity();
282
260
  if (currentActivity == null) {
283
261
  return null;
284
262
  }
@@ -364,7 +342,6 @@ public class CodePushNativeModule extends ReactContextBaseJavaModule {
364
342
  protected Void doInBackground(Void... params) {
365
343
  try {
366
344
  JSONObject mutableUpdatePackage = CodePushUtils.convertReadableToJsonObject(updatePackage);
367
- CodePushUtils.setJSONValueForKey(mutableUpdatePackage, CodePushConstants.BINARY_MODIFIED_TIME_KEY, "" + mCodePush.getBinaryResourcesModifiedTime());
368
345
  mUpdateManager.downloadPackage(mutableUpdatePackage, mCodePush.getAssetsBundleFileName(), new DownloadProgressCallback() {
369
346
  private boolean hasScheduledNextFrame = false;
370
347
  private DownloadProgress latestDownloadProgress = null;
@@ -390,7 +367,7 @@ public class CodePushNativeModule extends ReactContextBaseJavaModule {
390
367
  getReactApplicationContext().runOnUiQueueThread(new Runnable() {
391
368
  @Override
392
369
  public void run() {
393
- ReactChoreographer.getInstance().postFrameCallback(ReactChoreographer.CallbackType.TIMERS_EVENTS, new ChoreographerCompat.FrameCallback() {
370
+ ReactChoreographer.getInstance().postFrameCallback(ReactChoreographer.CallbackType.TIMERS_EVENTS, new Choreographer.FrameCallback() {
394
371
  @Override
395
372
  public void doFrame(long frameTimeNanos) {
396
373
  if (!latestDownloadProgress.isCompleted()) {
@@ -9,7 +9,6 @@ import com.nimbusds.jwt.SignedJWT;
9
9
 
10
10
  import java.security.interfaces.*;
11
11
 
12
-
13
12
  import org.json.JSONArray;
14
13
  import org.json.JSONException;
15
14
  import org.json.JSONObject;
@@ -86,8 +85,12 @@ public class CodePushUpdateUtils {
86
85
  throw new CodePushUnknownException("Unable to compute hash of update contents.", e);
87
86
  } finally {
88
87
  try {
89
- if (digestInputStream != null) digestInputStream.close();
90
- if (dataStream != null) dataStream.close();
88
+ if (digestInputStream != null) {
89
+ digestInputStream.close();
90
+ }
91
+ if (dataStream != null) {
92
+ dataStream.close();
93
+ }
91
94
  } catch (IOException e) {
92
95
  e.printStackTrace();
93
96
  }
@@ -98,7 +101,11 @@ public class CodePushUpdateUtils {
98
101
  }
99
102
 
100
103
  public static void copyNecessaryFilesFromCurrentPackage(String diffManifestFilePath, String currentPackageFolderPath, String newPackageFolderPath) throws IOException {
101
- FileUtils.copyDirectoryContents(currentPackageFolderPath, newPackageFolderPath);
104
+ if (currentPackageFolderPath == null || !new File(currentPackageFolderPath).exists()) {
105
+ CodePushUtils.log("Unable to copy files from current package during diff update, because currentPackageFolderPath is invalid.");
106
+ return;
107
+ }
108
+ FileUtils.copyDirectoryContents(currentPackageFolderPath, newPackageFolderPath);
102
109
  JSONObject diffManifest = CodePushUtils.getJsonObjectFromFile(diffManifestFilePath);
103
110
  try {
104
111
  JSONArray deletedFiles = diffManifest.getJSONArray("deletedFiles");
@@ -184,7 +191,7 @@ public class CodePushUpdateUtils {
184
191
  public static Map<String, Object> verifyAndDecodeJWT(String jwt, PublicKey publicKey) {
185
192
  try {
186
193
  SignedJWT signedJWT = SignedJWT.parse(jwt);
187
- JWSVerifier verifier = new RSASSAVerifier((RSAPublicKey)publicKey);
194
+ JWSVerifier verifier = new RSASSAVerifier((RSAPublicKey) publicKey);
188
195
  if (signedJWT.verify(verifier)) {
189
196
  Map<String, Object> claims = signedJWT.getJWTClaimsSet().getClaims();
190
197
  CodePushUtils.log("JWT verification succeeded, payload content: " + claims.toString());
@@ -217,7 +224,7 @@ public class CodePushUpdateUtils {
217
224
  }
218
225
  }
219
226
 
220
- public static String getSignatureFilePath(String updateFolderPath){
227
+ public static String getSignatureFilePath(String updateFolderPath) {
221
228
  return CodePushUtils.appendPathComponent(
222
229
  CodePushUtils.appendPathComponent(updateFolderPath, CodePushConstants.CODE_PUSH_FOLDER_PREFIX),
223
230
  CodePushConstants.BUNDLE_JWT_FILE
@@ -254,7 +261,7 @@ public class CodePushUpdateUtils {
254
261
  throw new CodePushInvalidUpdateException("The update could not be verified because it was not signed by a trusted party.");
255
262
  }
256
263
 
257
- final String contentHash = (String)claims.get("contentHash");
264
+ final String contentHash = (String) claims.get("contentHash");
258
265
  if (contentHash == null) {
259
266
  throw new CodePushInvalidUpdateException("The update could not be verified because the signature did not specify a content hash.");
260
267
  }
@@ -265,4 +272,4 @@ public class CodePushUpdateUtils {
265
272
 
266
273
  CodePushUtils.log("The update contents succeeded the code signing check.");
267
274
  }
268
- }
275
+ }
@@ -14,6 +14,9 @@ buildscript {
14
14
  }
15
15
 
16
16
  allprojects {
17
+ android {
18
+ namespace "com.microsoft.codepush.react"
19
+ }
17
20
  repositories {
18
21
  mavenLocal()
19
22
  mavenCentral()
@@ -1,14 +1,4 @@
1
- const { withAppBuildGradle, withMainApplication, WarningAggregator } = require('expo/config-plugins');
2
-
3
- function androidApplyImplementation(appBuildGradle) {
4
- const codePushImplementation = `apply from: "../../node_modules/@bravemobile/react-native-code-push/android/codepush.gradle"`;
5
-
6
- if (!appBuildGradle.includes(codePushImplementation)) {
7
- return `${appBuildGradle.trimEnd()}\n${codePushImplementation}\n`;
8
- }
9
-
10
- return appBuildGradle;
11
- }
1
+ const { withMainApplication, WarningAggregator } = require('expo/config-plugins');
12
2
 
13
3
  function androidMainApplicationApplyImplementation(
14
4
  mainApplication,
@@ -38,16 +28,6 @@ function androidMainApplicationApplyImplementation(
38
28
  return mainApplication;
39
29
  }
40
30
 
41
- const withAndroidBuildScriptDependency = (config) => {
42
- return withAppBuildGradle(config, (action) => {
43
- action.modResults.contents = androidApplyImplementation(
44
- action.modResults.contents,
45
- );
46
-
47
- return action;
48
- });
49
- };
50
-
51
31
  const withAndroidMainApplicationDependency = (config) => {
52
32
  return withMainApplication(config, (action) => {
53
33
  action.modResults.contents = androidMainApplicationApplyImplementation(
@@ -67,6 +47,5 @@ const withAndroidMainApplicationDependency = (config) => {
67
47
  };
68
48
 
69
49
  module.exports = {
70
- withAndroidBuildScriptDependency,
71
50
  withAndroidMainApplicationDependency,
72
51
  };
@@ -0,0 +1,26 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDevelopmentRegion</key>
6
+ <string>en</string>
7
+ <key>CFBundleExecutable</key>
8
+ <string>$(EXECUTABLE_NAME)</string>
9
+ <key>CFBundleIdentifier</key>
10
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
+ <key>CFBundleInfoDictionaryVersion</key>
12
+ <string>6.0</string>
13
+ <key>CFBundleName</key>
14
+ <string>$(PRODUCT_NAME)</string>
15
+ <key>CFBundlePackageType</key>
16
+ <string>FMWK</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>1.0</string>
19
+ <key>CFBundleSignature</key>
20
+ <string>????</string>
21
+ <key>CFBundleVersion</key>
22
+ <string>$(CURRENT_PROJECT_VERSION)</string>
23
+ <key>NSPrincipalClass</key>
24
+ <string></string>
25
+ </dict>
26
+ </plist>
@@ -1 +1 @@
1
- The source code in this folder is taken from [https://github.com/ZipArchive/ZipArchive/tree/35fe9b6af48527cde0b5db52287474ed3a32d75f/SSZipArchive](https://github.com/ZipArchive/ZipArchive/tree/35fe9b6af48527cde0b5db52287474ed3a32d75f/SSZipArchive) which is [MIT licensed](https://github.com/ZipArchive/ZipArchive/blob/35fe9b6af48527cde0b5db52287474ed3a32d75f/LICENSE.txt).
1
+ The source code in this folder is taken from [https://github.com/ZipArchive/ZipArchive/tree/2.5.5/SSZipArchive](https://github.com/ZipArchive/ZipArchive/tree/2.5.5/SSZipArchive) which is [MIT licensed](https://github.com/ZipArchive/ZipArchive/blob/2.5.5/LICENSE.txt).
@@ -3,56 +3,157 @@
3
3
  // SSZipArchive
4
4
  //
5
5
  // Created by Sam Soffes on 7/21/10.
6
- // Copyright (c) Sam Soffes 2010-2015. All rights reserved.
7
6
  //
8
7
 
9
8
  #ifndef _SSZIPARCHIVE_H
10
9
  #define _SSZIPARCHIVE_H
11
10
 
12
11
  #import <Foundation/Foundation.h>
13
- #include "Common.h"
12
+
13
+ #import "SSZipCommon.h"
14
+
15
+ NS_ASSUME_NONNULL_BEGIN
16
+
17
+ extern NSString *const SSZipArchiveErrorDomain;
18
+ typedef NS_ENUM(NSInteger, SSZipArchiveErrorCode) {
19
+ SSZipArchiveErrorCodeFailedOpenZipFile = -1,
20
+ SSZipArchiveErrorCodeFailedOpenFileInZip = -2,
21
+ SSZipArchiveErrorCodeFileInfoNotLoadable = -3,
22
+ SSZipArchiveErrorCodeFileContentNotReadable = -4,
23
+ SSZipArchiveErrorCodeFailedToWriteFile = -5,
24
+ SSZipArchiveErrorCodeInvalidArguments = -6,
25
+ SSZipArchiveErrorCodeSymlinkEscapesTargetDirectory = -7,
26
+ };
14
27
 
15
28
  @protocol SSZipArchiveDelegate;
16
29
 
17
30
  @interface SSZipArchive : NSObject
18
31
 
32
+ // Password check
33
+ + (BOOL)isFilePasswordProtectedAtPath:(NSString *)path;
34
+ + (BOOL)isPasswordValidForArchiveAtPath:(NSString *)path password:(NSString *)pw error:(NSError * _Nullable * _Nullable)error NS_SWIFT_NOTHROW;
35
+
36
+ // Total payload size
37
+ + (NSNumber *)payloadSizeForArchiveAtPath:(NSString *)path error:(NSError **)error;
38
+
19
39
  // Unzip
20
40
  + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination;
21
- + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(id<SSZipArchiveDelegate>)delegate;
41
+ + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(nullable id<SSZipArchiveDelegate>)delegate;
42
+
43
+ + (BOOL)unzipFileAtPath:(NSString *)path
44
+ toDestination:(NSString *)destination
45
+ overwrite:(BOOL)overwrite
46
+ password:(nullable NSString *)password
47
+ error:(NSError * *)error;
48
+
49
+ + (BOOL)unzipFileAtPath:(NSString *)path
50
+ toDestination:(NSString *)destination
51
+ overwrite:(BOOL)overwrite
52
+ password:(nullable NSString *)password
53
+ error:(NSError * *)error
54
+ delegate:(nullable id<SSZipArchiveDelegate>)delegate NS_REFINED_FOR_SWIFT;
55
+
56
+ + (BOOL)unzipFileAtPath:(NSString *)path
57
+ toDestination:(NSString *)destination
58
+ preserveAttributes:(BOOL)preserveAttributes
59
+ overwrite:(BOOL)overwrite
60
+ password:(nullable NSString *)password
61
+ error:(NSError * *)error
62
+ delegate:(nullable id<SSZipArchiveDelegate>)delegate;
63
+
64
+ + (BOOL)unzipFileAtPath:(NSString *)path
65
+ toDestination:(NSString *)destination
66
+ progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
67
+ completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
22
68
 
23
- + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError * *)error;
24
- + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError * *)error delegate:(id<SSZipArchiveDelegate>)delegate;
69
+ + (BOOL)unzipFileAtPath:(NSString *)path
70
+ toDestination:(NSString *)destination
71
+ overwrite:(BOOL)overwrite
72
+ password:(nullable NSString *)password
73
+ progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
74
+ completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
25
75
 
26
76
  + (BOOL)unzipFileAtPath:(NSString *)path
27
- toDestination:(NSString *)destination
28
- progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
29
- completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler;
77
+ toDestination:(NSString *)destination
78
+ preserveAttributes:(BOOL)preserveAttributes
79
+ overwrite:(BOOL)overwrite
80
+ nestedZipLevel:(NSInteger)nestedZipLevel
81
+ password:(nullable NSString *)password
82
+ error:(NSError **)error
83
+ delegate:(nullable id<SSZipArchiveDelegate>)delegate
84
+ progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
85
+ completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
30
86
 
31
87
  + (BOOL)unzipFileAtPath:(NSString *)path
32
- toDestination:(NSString *)destination
33
- overwrite:(BOOL)overwrite
34
- password:(NSString *)password
35
- progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
36
- completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler;
88
+ toDestination:(NSString *)destination
89
+ preserveAttributes:(BOOL)preserveAttributes
90
+ overwrite:(BOOL)overwrite
91
+ symlinksValidWithin:(nullable NSString *)symlinksValidWithin
92
+ nestedZipLevel:(NSInteger)nestedZipLevel
93
+ password:(nullable NSString *)password
94
+ error:(NSError **)error
95
+ delegate:(nullable id<SSZipArchiveDelegate>)delegate
96
+ progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
97
+ completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
37
98
 
38
99
  // Zip
100
+ // default compression level is Z_DEFAULT_COMPRESSION (from "zlib.h")
101
+ // keepParentDirectory: if YES, then unzipping will give `directoryName/fileName`. If NO, then unzipping will just give `fileName`. Default is NO.
39
102
 
40
103
  // without password
41
- + (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths;
104
+ + (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths;
42
105
  + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath;
43
- + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirector;
44
106
 
45
- // with password, password could be nil
46
- + (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths withPassword:(NSString *)password;
47
- + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath withPassword:(NSString *)password;
48
- + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory withPassword:(NSString *)password;
49
-
50
- - (instancetype)initWithPath:(NSString *)path;
51
- @property (NS_NONATOMIC_IOSONLY, readonly, getter = isOpen) BOOL open;
52
- - (BOOL)writeFile:(NSString *)path withPassword:(NSString *)password;
53
- - (BOOL)writeFileAtPath:(NSString *)path withFileName:(NSString *)fileName withPassword:(NSString *)password;
54
- - (BOOL)writeData:(NSData *)data filename:(NSString *)filename withPassword:(NSString *)password;
55
- @property (NS_NONATOMIC_IOSONLY, readonly, getter = isClosed) BOOL close;
107
+ + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory;
108
+
109
+ // with optional password, default encryption is AES
110
+ // don't use AES if you need compatibility with native macOS unzip and Archive Utility
111
+ + (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths withPassword:(nullable NSString *)password;
112
+ + (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths withPassword:(nullable NSString *)password progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler;
113
+ + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath withPassword:(nullable NSString *)password;
114
+ + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory withPassword:(nullable NSString *)password;
115
+ + (BOOL)createZipFileAtPath:(NSString *)path
116
+ withContentsOfDirectory:(NSString *)directoryPath
117
+ keepParentDirectory:(BOOL)keepParentDirectory
118
+ withPassword:(nullable NSString *)password
119
+ andProgressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler;
120
+ + (BOOL)createZipFileAtPath:(NSString *)path
121
+ withContentsOfDirectory:(NSString *)directoryPath
122
+ keepParentDirectory:(BOOL)keepParentDirectory
123
+ compressionLevel:(int)compressionLevel
124
+ password:(nullable NSString *)password
125
+ AES:(BOOL)aes
126
+ progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler;
127
+ //suport symlink compress --file
128
+ + (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths withPassword:(nullable NSString *)password keepSymlinks:(BOOL)keeplinks;
129
+ //suport symlink compress --directory
130
+ + (BOOL)createZipFileAtPath:(NSString *)path
131
+ withContentsOfDirectory:(NSString *)directoryPath
132
+ keepParentDirectory:(BOOL)keepParentDirectory
133
+ compressionLevel:(int)compressionLevel
134
+ password:(nullable NSString *)password
135
+ AES:(BOOL)aes
136
+ progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler
137
+ keepSymlinks:(BOOL)keeplinks;
138
+
139
+ - (instancetype)init NS_UNAVAILABLE;
140
+ - (instancetype)initWithPath:(NSString *)path NS_DESIGNATED_INITIALIZER;
141
+ - (BOOL)open;
142
+ - (BOOL)openForAppending;
143
+
144
+ /// write empty folder
145
+ - (BOOL)writeFolderAtPath:(NSString *)path withFolderName:(NSString *)folderName withPassword:(nullable NSString *)password;
146
+ /// write file
147
+ - (BOOL)writeFile:(NSString *)path withPassword:(nullable NSString *)password;
148
+ - (BOOL)writeFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName withPassword:(nullable NSString *)password;
149
+ - (BOOL)writeFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes;
150
+ ///write symlink files
151
+ - (BOOL)writeSymlinkFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes;
152
+ /// write data
153
+ - (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename withPassword:(nullable NSString *)password;
154
+ - (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes;
155
+
156
+ - (BOOL)close;
56
157
 
57
158
  @end
58
159
 
@@ -69,8 +170,9 @@
69
170
  - (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath unzippedFilePath:(NSString *)unzippedFilePath;
70
171
 
71
172
  - (void)zipArchiveProgressEvent:(unsigned long long)loaded total:(unsigned long long)total;
72
- - (void)zipArchiveDidUnzipArchiveFile:(NSString *)zipFile entryPath:(NSString *)entryPath destPath:(NSString *)destPath;
73
173
 
74
174
  @end
75
175
 
176
+ NS_ASSUME_NONNULL_END
177
+
76
178
  #endif /* _SSZIPARCHIVE_H */