@onekeyfe/react-native-bundle-update 1.1.26 → 1.1.28

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.
@@ -21,6 +21,15 @@ Pod::Spec.new do |s|
21
21
 
22
22
  s.vendored_frameworks = 'ios/Frameworks/Gopenpgp.xcframework'
23
23
 
24
+ # When ONEKEY_ALLOW_SKIP_GPG_VERIFICATION env var is set to a non-empty, non-'false' value,
25
+ # enable the ALLOW_SKIP_GPG_VERIFICATION Swift compilation condition.
26
+ # Without this flag, all skip-GPG code paths are compiled out (dead code elimination).
27
+ if ENV['ONEKEY_ALLOW_SKIP_GPG_VERIFICATION'] && ENV['ONEKEY_ALLOW_SKIP_GPG_VERIFICATION'] != '' && ENV['ONEKEY_ALLOW_SKIP_GPG_VERIFICATION'] != 'false'
28
+ s.pod_target_xcconfig = {
29
+ 'SWIFT_ACTIVE_COMPILATION_CONDITIONS' => '$(inherited) ALLOW_SKIP_GPG_VERIFICATION'
30
+ }
31
+ end
32
+
24
33
  s.dependency 'React-jsi'
25
34
  s.dependency 'React-callinvoker'
26
35
  s.dependency 'ReactNativeNativeLogger'
@@ -39,6 +39,14 @@ android {
39
39
  minSdkVersion getExtOrIntegerDefault("minSdkVersion")
40
40
  targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
41
41
 
42
+ // When ONEKEY_ALLOW_SKIP_GPG_VERIFICATION env var is set to a non-empty, non-'false' value,
43
+ // enable the skip-GPG code paths. Without this flag, BuildConfig.ALLOW_SKIP_GPG_VERIFICATION
44
+ // is false and all skip-GPG logic is gated behind an immutable compile-time constant.
45
+ def allowSkipGPG = System.getenv('ONEKEY_ALLOW_SKIP_GPG_VERIFICATION') != null &&
46
+ System.getenv('ONEKEY_ALLOW_SKIP_GPG_VERIFICATION') != '' &&
47
+ System.getenv('ONEKEY_ALLOW_SKIP_GPG_VERIFICATION') != 'false'
48
+ buildConfigField("boolean", "ALLOW_SKIP_GPG_VERIFICATION", allowSkipGPG.toString())
49
+
42
50
  externalNativeBuild {
43
51
  cmake {
44
52
  cppFlags "-frtti -fexceptions -Wall -fstack-protector-all"
@@ -528,7 +528,7 @@ object BundleUpdateStoreAndroid {
528
528
  val signature = readSignatureFile(context, currentBundleVersion)
529
529
  OneKeyLog.debug("BundleUpdate", "getJsBundlePath: signatureLength=${signature.length}")
530
530
 
531
- val devSettingsEnabled = isDevSettingsEnabled(context)
531
+ val devSettingsEnabled = if (BuildConfig.ALLOW_SKIP_GPG_VERIFICATION) isDevSettingsEnabled(context) else false
532
532
  if (devSettingsEnabled) {
533
533
  OneKeyLog.warn("BundleUpdate", "Startup SHA256 validation skipped (DevSettings enabled)")
534
534
  }
@@ -591,8 +591,10 @@ object BundleUpdateStoreAndroid {
591
591
  * Returns true if the skip-GPG-verification toggle is enabled in developer settings.
592
592
  * Reads the persisted value from MMKV storage (key: onekey_bundle_skip_gpg_verification,
593
593
  * instance: onekey-app-dev-setting).
594
+ * Gated by BuildConfig.ALLOW_SKIP_GPG_VERIFICATION — always returns false in production builds.
594
595
  */
595
596
  fun isSkipGPGEnabled(context: Context): Boolean {
597
+ if (!BuildConfig.ALLOW_SKIP_GPG_VERIFICATION) return false
596
598
  return try {
597
599
  MMKV.initialize(context)
598
600
  val mmkv = MMKV.mmkvWithID("onekey-app-dev-setting") ?: return false
@@ -720,8 +722,10 @@ class ReactNativeBundleUpdate : HybridReactNativeBundleUpdateSpec() {
720
722
  }
721
723
  }
722
724
 
723
- /** Returns true if the skip-GPG-verification toggle is enabled via MMKV storage. */
725
+ /** Returns true if the skip-GPG-verification toggle is enabled via MMKV storage.
726
+ * Gated by BuildConfig.ALLOW_SKIP_GPG_VERIFICATION — always returns false in production builds. */
724
727
  private fun isSkipGPGEnabled(): Boolean {
728
+ if (!BuildConfig.ALLOW_SKIP_GPG_VERIFICATION) return false
725
729
  return try {
726
730
  val context = NitroModules.applicationContext ?: return false
727
731
  BundleUpdateStoreAndroid.isSkipGPGEnabled(context)
@@ -891,10 +895,8 @@ class ReactNativeBundleUpdate : HybridReactNativeBundleUpdateSpec() {
891
895
  OneKeyLog.info("BundleUpdate", "verifyBundleASC: appVersion=$appVersion, bundleVersion=$bundleVersion, file=$filePath, signatureLength=${signature.length}")
892
896
 
893
897
  // GPG verification skipped only when both DevSettings and skip-GPG toggle are enabled
894
- val devSettings = isDevSettingsEnabled()
895
- val skipGPGToggle = isSkipGPGEnabled()
896
- val skipGPG = devSettings && skipGPGToggle
897
- OneKeyLog.info("BundleUpdate", "verifyBundleASC: GPG check: devSettings=$devSettings, skipGPGToggle=$skipGPGToggle, skipGPG=$skipGPG")
898
+ val skipGPG = BuildConfig.ALLOW_SKIP_GPG_VERIFICATION && isDevSettingsEnabled() && isSkipGPGEnabled()
899
+ OneKeyLog.info("BundleUpdate", "verifyBundleASC: GPG check: skipGPG=$skipGPG")
898
900
 
899
901
  if (!skipGPG) {
900
902
  OneKeyLog.info("BundleUpdate", "verifyBundleASC: verifying SHA256 of downloaded file...")
@@ -987,10 +989,8 @@ class ReactNativeBundleUpdate : HybridReactNativeBundleUpdateSpec() {
987
989
  OneKeyLog.info("BundleUpdate", "installBundle: appVersion=$appVersion, bundleVersion=$bundleVersion, signatureLength=${signature.length}")
988
990
 
989
991
  // GPG verification skipped only when both DevSettings and skip-GPG toggle are enabled
990
- val devSettings = isDevSettingsEnabled()
991
- val skipGPGToggle = isSkipGPGEnabled()
992
- val skipGPG = devSettings && skipGPGToggle
993
- OneKeyLog.info("BundleUpdate", "installBundle: GPG check: devSettings=$devSettings, skipGPGToggle=$skipGPGToggle, skipGPG=$skipGPG")
992
+ val skipGPG = BuildConfig.ALLOW_SKIP_GPG_VERIFICATION && isDevSettingsEnabled() && isSkipGPGEnabled()
993
+ OneKeyLog.info("BundleUpdate", "installBundle: GPG check: skipGPG=$skipGPG")
994
994
 
995
995
  val folderName = "$appVersion-$bundleVersion"
996
996
  val currentFolderName = BundleUpdateStoreAndroid.getCurrentBundleVersion(context)
@@ -1116,10 +1116,9 @@ class ReactNativeBundleUpdate : HybridReactNativeBundleUpdateSpec() {
1116
1116
  }
1117
1117
 
1118
1118
  // Verify GPG signature is valid (skipped when both DevSettings and skip-GPG toggle are enabled)
1119
- val devSettings = isDevSettingsEnabled()
1120
- val skipGPGToggle = isSkipGPGEnabled()
1121
- OneKeyLog.info("BundleUpdate", "setCurrentUpdateBundleData: GPG check: devSettings=$devSettings, skipGPGToggle=$skipGPGToggle")
1122
- if (!(devSettings && skipGPGToggle)) {
1119
+ val skipGPGSwitch = BuildConfig.ALLOW_SKIP_GPG_VERIFICATION && isDevSettingsEnabled() && isSkipGPGEnabled()
1120
+ OneKeyLog.info("BundleUpdate", "setCurrentUpdateBundleData: GPG check: skipGPG=$skipGPGSwitch")
1121
+ if (!skipGPGSwitch) {
1123
1122
  if (params.signature.isEmpty() ||
1124
1123
  !BundleUpdateStoreAndroid.validateMetadataFileSha256(context, bundleVersion, params.signature)) {
1125
1124
  OneKeyLog.error("BundleUpdate", "setCurrentUpdateBundleData: GPG signature verification failed")
@@ -1217,6 +1216,18 @@ n2DMz6gqk326W6SFynYtvuiXo7wG4Cmn3SuIU8xfv9rJqunpZGYchMd7nZektmEJ
1217
1216
  }
1218
1217
  }
1219
1218
 
1219
+ override fun testSkipVerification(): Promise<Boolean> {
1220
+ return Promise.async {
1221
+ val result = if (BuildConfig.ALLOW_SKIP_GPG_VERIFICATION) {
1222
+ isDevSettingsEnabled() && isSkipGPGEnabled()
1223
+ } else {
1224
+ false
1225
+ }
1226
+ OneKeyLog.info("BundleUpdate", "testSkipVerification: result=$result")
1227
+ result
1228
+ }
1229
+ }
1230
+
1220
1231
  override fun isBundleExists(appVersion: String, bundleVersion: String): Promise<Boolean> {
1221
1232
  return Promise.async {
1222
1233
  val context = getContext()
@@ -205,10 +205,15 @@ public class BundleUpdateStore: NSObject {
205
205
  /// Returns true if the skip-GPG-verification toggle is enabled in developer settings.
206
206
  /// Reads the persisted value from MMKV storage (key: onekey_bundle_skip_gpg_verification,
207
207
  /// instance: onekey-app-dev-setting).
208
+ /// Gated by ALLOW_SKIP_GPG_VERIFICATION compile flag — always returns false in production builds.
208
209
  public static func isSkipGPGEnabled() -> Bool {
210
+ #if ALLOW_SKIP_GPG_VERIFICATION
209
211
  MMKV.initialize(rootDir: nil)
210
212
  guard let mmkv = MMKV(mmapID: "onekey-app-dev-setting") else { return false }
211
213
  return mmkv.bool(forKey: "onekey_bundle_skip_gpg_verification", defaultValue: false)
214
+ #else
215
+ return false
216
+ #endif
212
217
  }
213
218
 
214
219
  public static func readMetadataFileSha256(_ signature: String) -> String? {
@@ -410,10 +415,14 @@ public class BundleUpdateStore: NSObject {
410
415
  let signature = readSignatureFile(currentBundleVer)
411
416
  OneKeyLog.debug("BundleUpdate", "getJsBundlePath: signatureLength=\(signature.count)")
412
417
 
418
+ #if ALLOW_SKIP_GPG_VERIFICATION
413
419
  let devSettingsEnabled = isDevSettingsEnabled()
414
420
  if devSettingsEnabled {
415
421
  OneKeyLog.warn("BundleUpdate", "Startup SHA256 validation skipped (DevSettings enabled)")
416
422
  }
423
+ #else
424
+ let devSettingsEnabled = false
425
+ #endif
417
426
  if !devSettingsEnabled && !validateMetadataFileSha256(currentBundleVer, signature: signature) {
418
427
  OneKeyLog.warn("BundleUpdate", "getJsBundlePath: validateMetadataFileSha256 failed, signatureLength=\(signature.count)")
419
428
  return nil
@@ -817,10 +826,12 @@ class ReactNativeBundleUpdate: HybridReactNativeBundleUpdateSpec {
817
826
  OneKeyLog.info("BundleUpdate", "verifyBundleASC: appVersion=\(appVersion), bundleVersion=\(bundleVersion), file=\(filePath), signatureLength=\(signature.count)")
818
827
 
819
828
  // GPG verification skipped only when both DevSettings and skip-GPG toggle are enabled
820
- let devSettings = BundleUpdateStore.isDevSettingsEnabled()
821
- let skipGPGToggle = BundleUpdateStore.isSkipGPGEnabled()
822
- let skipGPG = devSettings && skipGPGToggle
823
- OneKeyLog.info("BundleUpdate", "verifyBundleASC: GPG check: devSettings=\(devSettings), skipGPGToggle=\(skipGPGToggle), skipGPG=\(skipGPG)")
829
+ #if ALLOW_SKIP_GPG_VERIFICATION
830
+ let skipGPG = BundleUpdateStore.isDevSettingsEnabled() && BundleUpdateStore.isSkipGPGEnabled()
831
+ #else
832
+ let skipGPG = false
833
+ #endif
834
+ OneKeyLog.info("BundleUpdate", "verifyBundleASC: GPG check: skipGPG=\(skipGPG)")
824
835
 
825
836
  if !skipGPG {
826
837
  OneKeyLog.info("BundleUpdate", "verifyBundleASC: verifying SHA256 of downloaded file...")
@@ -936,10 +947,12 @@ class ReactNativeBundleUpdate: HybridReactNativeBundleUpdateSpec {
936
947
  OneKeyLog.info("BundleUpdate", "installBundle: appVersion=\(appVersion), bundleVersion=\(bundleVersion), signatureLength=\(signature.count)")
937
948
 
938
949
  // GPG verification skipped only when both DevSettings and skip-GPG toggle are enabled
939
- let devSettings = BundleUpdateStore.isDevSettingsEnabled()
940
- let skipGPGToggle = BundleUpdateStore.isSkipGPGEnabled()
941
- let skipGPG = devSettings && skipGPGToggle
942
- OneKeyLog.info("BundleUpdate", "installBundle: GPG check: devSettings=\(devSettings), skipGPGToggle=\(skipGPGToggle), skipGPG=\(skipGPG)")
950
+ #if ALLOW_SKIP_GPG_VERIFICATION
951
+ let skipGPG = BundleUpdateStore.isDevSettingsEnabled() && BundleUpdateStore.isSkipGPGEnabled()
952
+ #else
953
+ let skipGPG = false
954
+ #endif
955
+ OneKeyLog.info("BundleUpdate", "installBundle: GPG check: skipGPG=\(skipGPG)")
943
956
 
944
957
  let folderName = "\(appVersion)-\(bundleVersion)"
945
958
  let currentFolderName = BundleUpdateStore.currentBundleVersion()
@@ -1065,10 +1078,13 @@ class ReactNativeBundleUpdate: HybridReactNativeBundleUpdateSpec {
1065
1078
  }
1066
1079
 
1067
1080
  // Verify GPG signature is valid (skipped when both DevSettings and skip-GPG toggle are enabled)
1068
- let devSettings = BundleUpdateStore.isDevSettingsEnabled()
1069
- let skipGPGToggle = BundleUpdateStore.isSkipGPGEnabled()
1070
- OneKeyLog.info("BundleUpdate", "setCurrentUpdateBundleData: GPG check: devSettings=\(devSettings), skipGPGToggle=\(skipGPGToggle)")
1071
- if !(devSettings && skipGPGToggle) {
1081
+ #if ALLOW_SKIP_GPG_VERIFICATION
1082
+ let skipGPGSwitch = BundleUpdateStore.isDevSettingsEnabled() && BundleUpdateStore.isSkipGPGEnabled()
1083
+ #else
1084
+ let skipGPGSwitch = false
1085
+ #endif
1086
+ OneKeyLog.info("BundleUpdate", "setCurrentUpdateBundleData: GPG check: skipGPG=\(skipGPGSwitch)")
1087
+ if !skipGPGSwitch {
1072
1088
  guard !params.signature.isEmpty,
1073
1089
  BundleUpdateStore.validateMetadataFileSha256(bundleVersion, signature: params.signature) else {
1074
1090
  OneKeyLog.error("BundleUpdate", "setCurrentUpdateBundleData: GPG signature verification failed")
@@ -1162,6 +1178,18 @@ class ReactNativeBundleUpdate: HybridReactNativeBundleUpdateSpec {
1162
1178
  }
1163
1179
  }
1164
1180
 
1181
+ func testSkipVerification() throws -> Promise<Bool> {
1182
+ return Promise.async {
1183
+ #if ALLOW_SKIP_GPG_VERIFICATION
1184
+ let result = BundleUpdateStore.isDevSettingsEnabled() && BundleUpdateStore.isSkipGPGEnabled()
1185
+ #else
1186
+ let result = false
1187
+ #endif
1188
+ OneKeyLog.info("BundleUpdate", "testSkipVerification: result=\(result)")
1189
+ return result
1190
+ }
1191
+ }
1192
+
1165
1193
  func isBundleExists(appVersion: String, bundleVersion: String) throws -> Promise<Bool> {
1166
1194
  return Promise.async {
1167
1195
  let folderName = "\(appVersion)-\(bundleVersion)"
@@ -87,6 +87,7 @@ export interface ReactNativeBundleUpdate extends HybridObject<{
87
87
  getJsBundlePathAsync(): Promise<string>;
88
88
  getNativeAppVersion(): Promise<string>;
89
89
  testVerification(): Promise<boolean>;
90
+ testSkipVerification(): Promise<boolean>;
90
91
  isBundleExists(appVersion: string, bundleVersion: string): Promise<boolean>;
91
92
  verifyExtractedBundle(appVersion: string, bundleVersion: string): Promise<void>;
92
93
  listLocalBundles(): Promise<LocalBundleInfo[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"ReactNativeBundleUpdate.nitro.d.ts","sourceRoot":"","sources":["../../../src/ReactNativeBundleUpdate.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,a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AAE,MAAM,GACpB,OAAO,CAAC,UAAU,CAAC,CAAC;IAGvB,mBAAmB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,GAAG,MAAM,CAAC;IAC5E,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1C"}
1
+ {"version":3,"file":"ReactNativeBundleUpdate.nitro.d.ts","sourceRoot":"","sources":["../../../src/ReactNativeBundleUpdate.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MA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M,GACpB,OAAO,CAAC,UAAU,CAAC,CAAC;IACvB,sBAAsB,CACpB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,UAAU,CAAC,CAAC;IACvB,0BAA0B,CACxB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,UAAU,CAAC,CAAC;IAGvB,mBAAmB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,GAAG,MAAM,CAAC;IAC5E,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1C"}
@@ -317,6 +317,22 @@ namespace margelo::nitro::reactnativebundleupdate {
317
317
  return __promise;
318
318
  }();
319
319
  }
320
+ std::shared_ptr<Promise<bool>> JHybridReactNativeBundleUpdateSpec::testSkipVerification() {
321
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("testSkipVerification");
322
+ auto __result = method(_javaPart);
323
+ return [&]() {
324
+ auto __promise = Promise<bool>::create();
325
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
326
+ auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
327
+ __promise->resolve(static_cast<bool>(__result->value()));
328
+ });
329
+ __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
330
+ jni::JniException __jniError(__throwable);
331
+ __promise->reject(std::make_exception_ptr(__jniError));
332
+ });
333
+ return __promise;
334
+ }();
335
+ }
320
336
  std::shared_ptr<Promise<bool>> JHybridReactNativeBundleUpdateSpec::isBundleExists(const std::string& appVersion, const std::string& bundleVersion) {
321
337
  static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* appVersion */, jni::alias_ref<jni::JString> /* bundleVersion */)>("isBundleExists");
322
338
  auto __result = method(_javaPart, jni::make_jstring(appVersion), jni::make_jstring(bundleVersion));
@@ -69,6 +69,7 @@ namespace margelo::nitro::reactnativebundleupdate {
69
69
  std::shared_ptr<Promise<std::string>> getJsBundlePathAsync() override;
70
70
  std::shared_ptr<Promise<std::string>> getNativeAppVersion() override;
71
71
  std::shared_ptr<Promise<bool>> testVerification() override;
72
+ std::shared_ptr<Promise<bool>> testSkipVerification() override;
72
73
  std::shared_ptr<Promise<bool>> isBundleExists(const std::string& appVersion, const std::string& bundleVersion) override;
73
74
  std::shared_ptr<Promise<void>> verifyExtractedBundle(const std::string& appVersion, const std::string& bundleVersion) override;
74
75
  std::shared_ptr<Promise<std::vector<LocalBundleInfo>>> listLocalBundles() override;
@@ -106,6 +106,10 @@ abstract class HybridReactNativeBundleUpdateSpec: HybridObject() {
106
106
  @Keep
107
107
  abstract fun testVerification(): Promise<Boolean>
108
108
 
109
+ @DoNotStrip
110
+ @Keep
111
+ abstract fun testSkipVerification(): Promise<Boolean>
112
+
109
113
  @DoNotStrip
110
114
  @Keep
111
115
  abstract fun isBundleExists(appVersion: String, bundleVersion: String): Promise<Boolean>
@@ -218,6 +218,14 @@ namespace margelo::nitro::reactnativebundleupdate {
218
218
  auto __value = std::move(__result.value());
219
219
  return __value;
220
220
  }
221
+ inline std::shared_ptr<Promise<bool>> testSkipVerification() override {
222
+ auto __result = _swiftPart.testSkipVerification();
223
+ if (__result.hasError()) [[unlikely]] {
224
+ std::rethrow_exception(__result.error());
225
+ }
226
+ auto __value = std::move(__result.value());
227
+ return __value;
228
+ }
221
229
  inline std::shared_ptr<Promise<bool>> isBundleExists(const std::string& appVersion, const std::string& bundleVersion) override {
222
230
  auto __result = _swiftPart.isBundleExists(appVersion, bundleVersion);
223
231
  if (__result.hasError()) [[unlikely]] {
@@ -29,6 +29,7 @@ public protocol HybridReactNativeBundleUpdateSpec_protocol: HybridObject {
29
29
  func getJsBundlePathAsync() throws -> Promise<String>
30
30
  func getNativeAppVersion() throws -> Promise<String>
31
31
  func testVerification() throws -> Promise<Bool>
32
+ func testSkipVerification() throws -> Promise<Bool>
32
33
  func isBundleExists(appVersion: String, bundleVersion: String) throws -> Promise<Bool>
33
34
  func verifyExtractedBundle(appVersion: String, bundleVersion: String) throws -> Promise<Void>
34
35
  func listLocalBundles() throws -> Promise<[LocalBundleInfo]>
@@ -394,6 +394,25 @@ open class HybridReactNativeBundleUpdateSpec_cxx {
394
394
  }
395
395
  }
396
396
 
397
+ @inline(__always)
398
+ public final func testSkipVerification() -> bridge.Result_std__shared_ptr_Promise_bool___ {
399
+ do {
400
+ let __result = try self.__implementation.testSkipVerification()
401
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
402
+ let __promise = bridge.create_std__shared_ptr_Promise_bool__()
403
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
404
+ __result
405
+ .then({ __result in __promiseHolder.resolve(__result) })
406
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
407
+ return __promise
408
+ }()
409
+ return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
410
+ } catch (let __error) {
411
+ let __exceptionPtr = __error.toCpp()
412
+ return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
413
+ }
414
+ }
415
+
397
416
  @inline(__always)
398
417
  public final func isBundleExists(appVersion: std.string, bundleVersion: std.string) -> bridge.Result_std__shared_ptr_Promise_bool___ {
399
418
  do {
@@ -29,6 +29,7 @@ namespace margelo::nitro::reactnativebundleupdate {
29
29
  prototype.registerHybridMethod("getJsBundlePathAsync", &HybridReactNativeBundleUpdateSpec::getJsBundlePathAsync);
30
30
  prototype.registerHybridMethod("getNativeAppVersion", &HybridReactNativeBundleUpdateSpec::getNativeAppVersion);
31
31
  prototype.registerHybridMethod("testVerification", &HybridReactNativeBundleUpdateSpec::testVerification);
32
+ prototype.registerHybridMethod("testSkipVerification", &HybridReactNativeBundleUpdateSpec::testSkipVerification);
32
33
  prototype.registerHybridMethod("isBundleExists", &HybridReactNativeBundleUpdateSpec::isBundleExists);
33
34
  prototype.registerHybridMethod("verifyExtractedBundle", &HybridReactNativeBundleUpdateSpec::verifyExtractedBundle);
34
35
  prototype.registerHybridMethod("listLocalBundles", &HybridReactNativeBundleUpdateSpec::listLocalBundles);
@@ -101,6 +101,7 @@ namespace margelo::nitro::reactnativebundleupdate {
101
101
  virtual std::shared_ptr<Promise<std::string>> getJsBundlePathAsync() = 0;
102
102
  virtual std::shared_ptr<Promise<std::string>> getNativeAppVersion() = 0;
103
103
  virtual std::shared_ptr<Promise<bool>> testVerification() = 0;
104
+ virtual std::shared_ptr<Promise<bool>> testSkipVerification() = 0;
104
105
  virtual std::shared_ptr<Promise<bool>> isBundleExists(const std::string& appVersion, const std::string& bundleVersion) = 0;
105
106
  virtual std::shared_ptr<Promise<void>> verifyExtractedBundle(const std::string& appVersion, const std::string& bundleVersion) = 0;
106
107
  virtual std::shared_ptr<Promise<std::vector<LocalBundleInfo>>> listLocalBundles() = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-bundle-update",
3
- "version": "1.1.26",
3
+ "version": "1.1.28",
4
4
  "description": "react-native-bundle-update",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -111,6 +111,7 @@ export interface ReactNativeBundleUpdate
111
111
 
112
112
  // Verification & testing
113
113
  testVerification(): Promise<boolean>;
114
+ testSkipVerification(): Promise<boolean>;
114
115
  isBundleExists(appVersion: string, bundleVersion: string): Promise<boolean>;
115
116
  verifyExtractedBundle(
116
117
  appVersion: string,