@onekeyfe/react-native-range-downloader 3.0.81-alpha.0 → 3.0.81-alpha.2

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 (22) hide show
  1. package/android/src/main/java/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactStore.kt +59 -127
  2. package/android/src/main/java/com/margelo/nitro/reactnativerangedownloader/ReactNativeRangeDownloader.kt +1 -9
  3. package/android/src/test/java/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactDeadlineTest.kt +26 -0
  4. package/ios/FirmwareArtifactStore.swift +68 -146
  5. package/ios/ReactNativeRangeDownloader.swift +15 -29
  6. package/lib/typescript/src/ReactNativeRangeDownloader.nitro.d.ts +0 -4
  7. package/lib/typescript/src/ReactNativeRangeDownloader.nitro.d.ts.map +1 -1
  8. package/nitrogen/generated/android/c++/JHybridReactNativeRangeDownloaderSpec.cpp +0 -19
  9. package/nitrogen/generated/android/c++/JHybridReactNativeRangeDownloaderSpec.hpp +0 -1
  10. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/HybridReactNativeRangeDownloaderSpec.kt +0 -4
  11. package/nitrogen/generated/ios/ReactNativeRangeDownloader-Swift-Cxx-Umbrella.hpp +0 -3
  12. package/nitrogen/generated/ios/c++/HybridReactNativeRangeDownloaderSpecSwift.hpp +0 -11
  13. package/nitrogen/generated/ios/swift/HybridReactNativeRangeDownloaderSpec.swift +0 -1
  14. package/nitrogen/generated/ios/swift/HybridReactNativeRangeDownloaderSpec_cxx.swift +0 -19
  15. package/nitrogen/generated/shared/c++/HybridReactNativeRangeDownloaderSpec.cpp +0 -1
  16. package/nitrogen/generated/shared/c++/HybridReactNativeRangeDownloaderSpec.hpp +0 -4
  17. package/package.json +2 -2
  18. package/src/ReactNativeRangeDownloader.nitro.ts +1 -8
  19. package/nitrogen/generated/android/c++/JFirmwareArtifactLeaseReconcileParams.hpp +0 -76
  20. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactLeaseReconcileParams.kt +0 -38
  21. package/nitrogen/generated/ios/swift/FirmwareArtifactLeaseReconcileParams.swift +0 -48
  22. package/nitrogen/generated/shared/c++/FirmwareArtifactLeaseReconcileParams.hpp +0 -76
@@ -416,25 +416,6 @@ open class HybridReactNativeRangeDownloaderSpec_cxx {
416
416
  }
417
417
  }
418
418
 
419
- @inline(__always)
420
- public final func reconcileFirmwareArtifactLeases(params: FirmwareArtifactLeaseReconcileParams) -> bridge.Result_std__shared_ptr_Promise_void___ {
421
- do {
422
- let __result = try self.__implementation.reconcileFirmwareArtifactLeases(params: params)
423
- let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
424
- let __promise = bridge.create_std__shared_ptr_Promise_void__()
425
- let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
426
- __result
427
- .then({ __result in __promiseHolder.resolve() })
428
- .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
429
- return __promise
430
- }()
431
- return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
432
- } catch (let __error) {
433
- let __exceptionPtr = __error.toCpp()
434
- return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
435
- }
436
- }
437
-
438
419
  @inline(__always)
439
420
  public final func sweepFirmwareArtifactOrphans() -> bridge.Result_std__shared_ptr_Promise_FirmwareArtifactSweepResult___ {
440
421
  do {
@@ -31,7 +31,6 @@ namespace margelo::nitro::reactnativerangedownloader {
31
31
  prototype.registerHybridMethod("createFirmwareArtifactLease", &HybridReactNativeRangeDownloaderSpec::createFirmwareArtifactLease);
32
32
  prototype.registerHybridMethod("retainFirmwareArtifact", &HybridReactNativeRangeDownloaderSpec::retainFirmwareArtifact);
33
33
  prototype.registerHybridMethod("releaseFirmwareArtifactLease", &HybridReactNativeRangeDownloaderSpec::releaseFirmwareArtifactLease);
34
- prototype.registerHybridMethod("reconcileFirmwareArtifactLeases", &HybridReactNativeRangeDownloaderSpec::reconcileFirmwareArtifactLeases);
35
34
  prototype.registerHybridMethod("sweepFirmwareArtifactOrphans", &HybridReactNativeRangeDownloaderSpec::sweepFirmwareArtifactOrphans);
36
35
  });
37
36
  }
@@ -49,8 +49,6 @@ namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLe
49
49
  namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLeaseRetainParams; }
50
50
  // Forward declaration of `FirmwareArtifactLeaseReleaseParams` to properly resolve imports.
51
51
  namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLeaseReleaseParams; }
52
- // Forward declaration of `FirmwareArtifactLeaseReconcileParams` to properly resolve imports.
53
- namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLeaseReconcileParams; }
54
52
  // Forward declaration of `FirmwareArtifactSweepResult` to properly resolve imports.
55
53
  namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactSweepResult; }
56
54
 
@@ -76,7 +74,6 @@ namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactSw
76
74
  #include "FirmwareArtifactLeaseCreateParams.hpp"
77
75
  #include "FirmwareArtifactLeaseRetainParams.hpp"
78
76
  #include "FirmwareArtifactLeaseReleaseParams.hpp"
79
- #include "FirmwareArtifactLeaseReconcileParams.hpp"
80
77
  #include "FirmwareArtifactSweepResult.hpp"
81
78
 
82
79
  namespace margelo::nitro::reactnativerangedownloader {
@@ -127,7 +124,6 @@ namespace margelo::nitro::reactnativerangedownloader {
127
124
  virtual std::shared_ptr<Promise<FirmwareArtifactLease>> createFirmwareArtifactLease(const FirmwareArtifactLeaseCreateParams& params) = 0;
128
125
  virtual std::shared_ptr<Promise<void>> retainFirmwareArtifact(const FirmwareArtifactLeaseRetainParams& params) = 0;
129
126
  virtual std::shared_ptr<Promise<void>> releaseFirmwareArtifactLease(const FirmwareArtifactLeaseReleaseParams& params) = 0;
130
- virtual std::shared_ptr<Promise<void>> reconcileFirmwareArtifactLeases(const FirmwareArtifactLeaseReconcileParams& params) = 0;
131
127
  virtual std::shared_ptr<Promise<FirmwareArtifactSweepResult>> sweepFirmwareArtifactOrphans() = 0;
132
128
 
133
129
  protected:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-range-downloader",
3
- "version": "3.0.81-alpha.0",
3
+ "version": "3.0.81-alpha.2",
4
4
  "description": "react-native-range-downloader",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -88,7 +88,7 @@
88
88
  "typescript": "^5.9.2"
89
89
  },
90
90
  "peerDependencies": {
91
- "@onekeyfe/react-native-sni-connect": "3.0.81",
91
+ "@onekeyfe/react-native-sni-connect": "3.0.81-alpha.2",
92
92
  "react": "*",
93
93
  "react-native": "*",
94
94
  "react-native-nitro-modules": "0.33.2"
@@ -79,7 +79,7 @@ export interface FirmwareArtifactDownloadParams {
79
79
  expectedSize: number;
80
80
  expectedSha256: string;
81
81
  maxBytes: number;
82
- overallDeadlineSeconds?: number;
82
+ overallDeadlineSeconds?: number; // defaults to 180; must be > 0 and <= 24 hours
83
83
  }
84
84
 
85
85
  export interface FirmwareArtifactReceipt {
@@ -158,10 +158,6 @@ export interface FirmwareArtifactLeaseReleaseParams {
158
158
  disposition: string;
159
159
  }
160
160
 
161
- export interface FirmwareArtifactLeaseReconcileParams {
162
- activeLeaseRefs: string[];
163
- }
164
-
165
161
  export interface FirmwareArtifactSweepResult {
166
162
  deletedFiles: number;
167
163
  deletedBytes: number;
@@ -231,8 +227,5 @@ export interface ReactNativeRangeDownloader
231
227
  releaseFirmwareArtifactLease(
232
228
  params: FirmwareArtifactLeaseReleaseParams
233
229
  ): Promise<void>;
234
- reconcileFirmwareArtifactLeases(
235
- params: FirmwareArtifactLeaseReconcileParams
236
- ): Promise<void>;
237
230
  sweepFirmwareArtifactOrphans(): Promise<FirmwareArtifactSweepResult>;
238
231
  }
@@ -1,76 +0,0 @@
1
- ///
2
- /// JFirmwareArtifactLeaseReconcileParams.hpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- #pragma once
9
-
10
- #include <fbjni/fbjni.h>
11
- #include "FirmwareArtifactLeaseReconcileParams.hpp"
12
-
13
- #include <string>
14
- #include <vector>
15
-
16
- namespace margelo::nitro::reactnativerangedownloader {
17
-
18
- using namespace facebook;
19
-
20
- /**
21
- * The C++ JNI bridge between the C++ struct "FirmwareArtifactLeaseReconcileParams" and the the Kotlin data class "FirmwareArtifactLeaseReconcileParams".
22
- */
23
- struct JFirmwareArtifactLeaseReconcileParams final: public jni::JavaClass<JFirmwareArtifactLeaseReconcileParams> {
24
- public:
25
- static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/reactnativerangedownloader/FirmwareArtifactLeaseReconcileParams;";
26
-
27
- public:
28
- /**
29
- * Convert this Java/Kotlin-based struct to the C++ struct FirmwareArtifactLeaseReconcileParams by copying all values to C++.
30
- */
31
- [[maybe_unused]]
32
- [[nodiscard]]
33
- FirmwareArtifactLeaseReconcileParams toCpp() const {
34
- static const auto clazz = javaClassStatic();
35
- static const auto fieldActiveLeaseRefs = clazz->getField<jni::JArrayClass<jni::JString>>("activeLeaseRefs");
36
- jni::local_ref<jni::JArrayClass<jni::JString>> activeLeaseRefs = this->getFieldValue(fieldActiveLeaseRefs);
37
- return FirmwareArtifactLeaseReconcileParams(
38
- [&]() {
39
- size_t __size = activeLeaseRefs->size();
40
- std::vector<std::string> __vector;
41
- __vector.reserve(__size);
42
- for (size_t __i = 0; __i < __size; __i++) {
43
- auto __element = activeLeaseRefs->getElement(__i);
44
- __vector.push_back(__element->toStdString());
45
- }
46
- return __vector;
47
- }()
48
- );
49
- }
50
-
51
- public:
52
- /**
53
- * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
54
- */
55
- [[maybe_unused]]
56
- static jni::local_ref<JFirmwareArtifactLeaseReconcileParams::javaobject> fromCpp(const FirmwareArtifactLeaseReconcileParams& value) {
57
- using JSignature = JFirmwareArtifactLeaseReconcileParams(jni::alias_ref<jni::JArrayClass<jni::JString>>);
58
- static const auto clazz = javaClassStatic();
59
- static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
60
- return create(
61
- clazz,
62
- [&]() {
63
- size_t __size = value.activeLeaseRefs.size();
64
- jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
65
- for (size_t __i = 0; __i < __size; __i++) {
66
- const auto& __element = value.activeLeaseRefs[__i];
67
- auto __elementJni = jni::make_jstring(__element);
68
- __array->setElement(__i, *__elementJni);
69
- }
70
- return __array;
71
- }()
72
- );
73
- }
74
- };
75
-
76
- } // namespace margelo::nitro::reactnativerangedownloader
@@ -1,38 +0,0 @@
1
- ///
2
- /// FirmwareArtifactLeaseReconcileParams.kt
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- package com.margelo.nitro.reactnativerangedownloader
9
-
10
- import androidx.annotation.Keep
11
- import com.facebook.proguard.annotations.DoNotStrip
12
-
13
-
14
- /**
15
- * Represents the JavaScript object/struct "FirmwareArtifactLeaseReconcileParams".
16
- */
17
- @DoNotStrip
18
- @Keep
19
- data class FirmwareArtifactLeaseReconcileParams(
20
- @DoNotStrip
21
- @Keep
22
- val activeLeaseRefs: Array<String>
23
- ) {
24
- /* primary constructor */
25
-
26
- private companion object {
27
- /**
28
- * Constructor called from C++
29
- */
30
- @DoNotStrip
31
- @Keep
32
- @Suppress("unused")
33
- @JvmStatic
34
- private fun fromCpp(activeLeaseRefs: Array<String>): FirmwareArtifactLeaseReconcileParams {
35
- return FirmwareArtifactLeaseReconcileParams(activeLeaseRefs)
36
- }
37
- }
38
- }
@@ -1,48 +0,0 @@
1
- ///
2
- /// FirmwareArtifactLeaseReconcileParams.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- import Foundation
9
- import NitroModules
10
-
11
- /**
12
- * Represents an instance of `FirmwareArtifactLeaseReconcileParams`, backed by a C++ struct.
13
- */
14
- public typealias FirmwareArtifactLeaseReconcileParams = margelo.nitro.reactnativerangedownloader.FirmwareArtifactLeaseReconcileParams
15
-
16
- public extension FirmwareArtifactLeaseReconcileParams {
17
- private typealias bridge = margelo.nitro.reactnativerangedownloader.bridge.swift
18
-
19
- /**
20
- * Create a new instance of `FirmwareArtifactLeaseReconcileParams`.
21
- */
22
- init(activeLeaseRefs: [String]) {
23
- self.init({ () -> bridge.std__vector_std__string_ in
24
- var __vector = bridge.create_std__vector_std__string_(activeLeaseRefs.count)
25
- for __item in activeLeaseRefs {
26
- __vector.push_back(std.string(__item))
27
- }
28
- return __vector
29
- }())
30
- }
31
-
32
- var activeLeaseRefs: [String] {
33
- @inline(__always)
34
- get {
35
- return self.__activeLeaseRefs.map({ __item in String(__item) })
36
- }
37
- @inline(__always)
38
- set {
39
- self.__activeLeaseRefs = { () -> bridge.std__vector_std__string_ in
40
- var __vector = bridge.create_std__vector_std__string_(newValue.count)
41
- for __item in newValue {
42
- __vector.push_back(std.string(__item))
43
- }
44
- return __vector
45
- }()
46
- }
47
- }
48
- }
@@ -1,76 +0,0 @@
1
- ///
2
- /// FirmwareArtifactLeaseReconcileParams.hpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2026 Marc Rousavy @ Margelo
6
- ///
7
-
8
- #pragma once
9
-
10
- #if __has_include(<NitroModules/JSIConverter.hpp>)
11
- #include <NitroModules/JSIConverter.hpp>
12
- #else
13
- #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
- #endif
15
- #if __has_include(<NitroModules/NitroDefines.hpp>)
16
- #include <NitroModules/NitroDefines.hpp>
17
- #else
18
- #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
- #endif
20
- #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
- #include <NitroModules/JSIHelpers.hpp>
22
- #else
23
- #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
- #endif
25
-
26
-
27
-
28
- #include <string>
29
- #include <vector>
30
-
31
- namespace margelo::nitro::reactnativerangedownloader {
32
-
33
- /**
34
- * A struct which can be represented as a JavaScript object (FirmwareArtifactLeaseReconcileParams).
35
- */
36
- struct FirmwareArtifactLeaseReconcileParams {
37
- public:
38
- std::vector<std::string> activeLeaseRefs SWIFT_PRIVATE;
39
-
40
- public:
41
- FirmwareArtifactLeaseReconcileParams() = default;
42
- explicit FirmwareArtifactLeaseReconcileParams(std::vector<std::string> activeLeaseRefs): activeLeaseRefs(activeLeaseRefs) {}
43
- };
44
-
45
- } // namespace margelo::nitro::reactnativerangedownloader
46
-
47
- namespace margelo::nitro {
48
-
49
- // C++ FirmwareArtifactLeaseReconcileParams <> JS FirmwareArtifactLeaseReconcileParams (object)
50
- template <>
51
- struct JSIConverter<margelo::nitro::reactnativerangedownloader::FirmwareArtifactLeaseReconcileParams> final {
52
- static inline margelo::nitro::reactnativerangedownloader::FirmwareArtifactLeaseReconcileParams fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
53
- jsi::Object obj = arg.asObject(runtime);
54
- return margelo::nitro::reactnativerangedownloader::FirmwareArtifactLeaseReconcileParams(
55
- JSIConverter<std::vector<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "activeLeaseRefs"))
56
- );
57
- }
58
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativerangedownloader::FirmwareArtifactLeaseReconcileParams& arg) {
59
- jsi::Object obj(runtime);
60
- obj.setProperty(runtime, "activeLeaseRefs", JSIConverter<std::vector<std::string>>::toJSI(runtime, arg.activeLeaseRefs));
61
- return obj;
62
- }
63
- static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
64
- if (!value.isObject()) {
65
- return false;
66
- }
67
- jsi::Object obj = value.getObject(runtime);
68
- if (!nitro::isPlainObject(runtime, obj)) {
69
- return false;
70
- }
71
- if (!JSIConverter<std::vector<std::string>>::canConvert(runtime, obj.getProperty(runtime, "activeLeaseRefs"))) return false;
72
- return true;
73
- }
74
- };
75
-
76
- } // namespace margelo::nitro