@onekeyfe/react-native-range-downloader 3.0.81 → 3.0.82
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.
- package/ReactNativeRangeDownloader.podspec +7 -0
- package/android/src/main/java/com/margelo/nitro/reactnativerangedownloader/FirmwareArchiveRules.kt +291 -0
- package/android/src/main/java/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactOrphanSweep.kt +111 -0
- package/android/src/main/java/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactStore.kt +822 -0
- package/android/src/main/java/com/margelo/nitro/reactnativerangedownloader/ReactNativeRangeDownloader.kt +148 -0
- package/android/src/test/java/com/margelo/nitro/reactnativerangedownloader/FirmwareArchiveRulesTest.kt +114 -0
- package/android/src/test/java/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactDeadlineTest.kt +26 -0
- package/android/src/test/java/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactOrphanSweepTest.kt +107 -0
- package/ios/FirmwareArchiveMinizipBridge.h +33 -0
- package/ios/FirmwareArchiveMinizipBridge.mm +213 -0
- package/ios/FirmwareArtifactStore.swift +1508 -0
- package/ios/RangeDownloadLogic.swift +317 -0
- package/ios/ReactNativeRangeDownloader.swift +214 -6
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/ReactNativeRangeDownloader.nitro.d.ts +92 -1
- package/lib/typescript/src/ReactNativeRangeDownloader.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JDownloadChannel.hpp +8 -6
- package/nitrogen/generated/android/c++/JFirmwareArchiveExpectedEntry.hpp +69 -0
- package/nitrogen/generated/android/c++/JFirmwareArchiveMaterializeParams.hpp +87 -0
- package/nitrogen/generated/android/c++/JFirmwareArchiveMaterializeResult.hpp +80 -0
- package/nitrogen/generated/android/c++/JFirmwareArchiveMaterializedArtifact.hpp +63 -0
- package/nitrogen/generated/android/c++/JFirmwareArtifactCancelParams.hpp +57 -0
- package/nitrogen/generated/android/c++/JFirmwareArtifactCapabilities.hpp +88 -0
- package/nitrogen/generated/android/c++/JFirmwareArtifactDownloadParams.hpp +98 -0
- package/nitrogen/generated/android/c++/JFirmwareArtifactLease.hpp +57 -0
- package/nitrogen/generated/android/c++/JFirmwareArtifactLeaseCreateParams.hpp +57 -0
- package/nitrogen/generated/android/c++/JFirmwareArtifactLeaseReleaseParams.hpp +61 -0
- package/nitrogen/generated/android/c++/JFirmwareArtifactLeaseRetainParams.hpp +61 -0
- package/nitrogen/generated/android/c++/JFirmwareArtifactReaderCloseParams.hpp +57 -0
- package/nitrogen/generated/android/c++/JFirmwareArtifactReaderInfo.hpp +61 -0
- package/nitrogen/generated/android/c++/JFirmwareArtifactReaderReadParams.hpp +65 -0
- package/nitrogen/generated/android/c++/JFirmwareArtifactReceipt.hpp +69 -0
- package/nitrogen/generated/android/c++/JFirmwareArtifactRefParams.hpp +57 -0
- package/nitrogen/generated/android/c++/JFirmwareArtifactSweepResult.hpp +61 -0
- package/nitrogen/generated/android/c++/JFunc_void_RangeDownloadEvent.hpp +3 -3
- package/nitrogen/generated/android/c++/JHybridReactNativeRangeDownloaderSpec.cpp +274 -25
- package/nitrogen/generated/android/c++/JHybridReactNativeRangeDownloaderSpec.hpp +32 -22
- package/nitrogen/generated/android/c++/JRangeDownloadEvent.hpp +2 -2
- package/nitrogen/generated/android/c++/JRangeDownloadOutcome.hpp +6 -7
- package/nitrogen/generated/android/c++/JRangeDownloadParams.hpp +2 -2
- package/nitrogen/generated/android/c++/JRangeDownloadResult.hpp +2 -2
- package/nitrogen/generated/android/c++/JRangeFallbackKind.hpp +12 -13
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/DownloadChannel.kt +5 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArchiveExpectedEntry.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArchiveMaterializeParams.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArchiveMaterializeResult.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArchiveMaterializedArtifact.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactCancelParams.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactCapabilities.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactDownloadParams.kt +68 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactLease.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactLeaseCreateParams.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactLeaseReleaseParams.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactLeaseRetainParams.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactReaderCloseParams.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactReaderInfo.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactReaderReadParams.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactReceipt.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactRefParams.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/FirmwareArtifactSweepResult.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/Func_void_RangeDownloadEvent.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/HybridReactNativeRangeDownloaderSpec.kt +65 -19
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/RangeDownloadEvent.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/RangeDownloadOutcome.kt +3 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/RangeDownloadParams.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/RangeDownloadResult.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/RangeFallbackKind.kt +3 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/reactnativerangedownloaderOnLoad.kt +1 -1
- package/nitrogen/generated/android/reactnativerangedownloader+autolinking.cmake +1 -1
- package/nitrogen/generated/android/reactnativerangedownloader+autolinking.gradle +1 -1
- package/nitrogen/generated/android/reactnativerangedownloaderOnLoad.cpp +28 -18
- package/nitrogen/generated/android/reactnativerangedownloaderOnLoad.hpp +14 -5
- package/nitrogen/generated/ios/ReactNativeRangeDownloader+autolinking.rb +2 -2
- package/nitrogen/generated/ios/ReactNativeRangeDownloader-Swift-Cxx-Bridge.cpp +49 -1
- package/nitrogen/generated/ios/ReactNativeRangeDownloader-Swift-Cxx-Bridge.hpp +348 -4
- package/nitrogen/generated/ios/ReactNativeRangeDownloader-Swift-Cxx-Umbrella.hpp +54 -1
- package/nitrogen/generated/ios/ReactNativeRangeDownloaderAutolinking.mm +1 -1
- package/nitrogen/generated/ios/ReactNativeRangeDownloaderAutolinking.swift +9 -8
- package/nitrogen/generated/ios/c++/HybridReactNativeRangeDownloaderSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridReactNativeRangeDownloaderSpecSwift.hpp +159 -1
- package/nitrogen/generated/ios/swift/DownloadChannel.swift +5 -1
- package/nitrogen/generated/ios/swift/FirmwareArchiveExpectedEntry.swift +44 -0
- package/nitrogen/generated/ios/swift/FirmwareArchiveMaterializeParams.swift +58 -0
- package/nitrogen/generated/ios/swift/FirmwareArchiveMaterializeResult.swift +35 -0
- package/nitrogen/generated/ios/swift/FirmwareArchiveMaterializedArtifact.swift +34 -0
- package/nitrogen/generated/ios/swift/FirmwareArtifactCancelParams.swift +29 -0
- package/nitrogen/generated/ios/swift/FirmwareArtifactCapabilities.swift +50 -0
- package/nitrogen/generated/ios/swift/FirmwareArtifactDownloadParams.swift +131 -0
- package/nitrogen/generated/ios/swift/FirmwareArtifactLease.swift +29 -0
- package/nitrogen/generated/ios/swift/FirmwareArtifactLeaseCreateParams.swift +29 -0
- package/nitrogen/generated/ios/swift/FirmwareArtifactLeaseReleaseParams.swift +34 -0
- package/nitrogen/generated/ios/swift/FirmwareArtifactLeaseRetainParams.swift +34 -0
- package/nitrogen/generated/ios/swift/FirmwareArtifactReaderCloseParams.swift +29 -0
- package/nitrogen/generated/ios/swift/FirmwareArtifactReaderInfo.swift +34 -0
- package/nitrogen/generated/ios/swift/FirmwareArtifactReaderReadParams.swift +39 -0
- package/nitrogen/generated/ios/swift/FirmwareArtifactReceipt.swift +44 -0
- package/nitrogen/generated/ios/swift/FirmwareArtifactRefParams.swift +29 -0
- package/nitrogen/generated/ios/swift/FirmwareArtifactSweepResult.swift +34 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_FirmwareArchiveMaterializeResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_FirmwareArtifactLease.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_FirmwareArtifactReaderInfo.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_FirmwareArtifactReceipt.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_FirmwareArtifactSweepResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_RangeDownloadEvent.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_RangeDownloadResult.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_ArrayBuffer_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeRangeDownloaderSpec.swift +15 -4
- package/nitrogen/generated/ios/swift/HybridReactNativeRangeDownloaderSpec_cxx.swift +230 -2
- package/nitrogen/generated/ios/swift/RangeDownloadEvent.swift +11 -42
- package/nitrogen/generated/ios/swift/RangeDownloadOutcome.swift +1 -1
- package/nitrogen/generated/ios/swift/RangeDownloadParams.swift +72 -139
- package/nitrogen/generated/ios/swift/RangeDownloadResult.swift +16 -53
- package/nitrogen/generated/ios/swift/RangeFallbackKind.swift +1 -1
- package/nitrogen/generated/shared/c++/DownloadChannel.hpp +5 -1
- package/nitrogen/generated/shared/c++/FirmwareArchiveExpectedEntry.hpp +95 -0
- package/nitrogen/generated/shared/c++/FirmwareArchiveMaterializeParams.hpp +95 -0
- package/nitrogen/generated/shared/c++/FirmwareArchiveMaterializeResult.hpp +85 -0
- package/nitrogen/generated/shared/c++/FirmwareArchiveMaterializedArtifact.hpp +89 -0
- package/nitrogen/generated/shared/c++/FirmwareArtifactCancelParams.hpp +83 -0
- package/nitrogen/generated/shared/c++/FirmwareArtifactCapabilities.hpp +96 -0
- package/nitrogen/generated/shared/c++/FirmwareArtifactDownloadParams.hpp +124 -0
- package/nitrogen/generated/shared/c++/FirmwareArtifactLease.hpp +83 -0
- package/nitrogen/generated/shared/c++/FirmwareArtifactLeaseCreateParams.hpp +83 -0
- package/nitrogen/generated/shared/c++/FirmwareArtifactLeaseReleaseParams.hpp +87 -0
- package/nitrogen/generated/shared/c++/FirmwareArtifactLeaseRetainParams.hpp +87 -0
- package/nitrogen/generated/shared/c++/FirmwareArtifactReaderCloseParams.hpp +83 -0
- package/nitrogen/generated/shared/c++/FirmwareArtifactReaderInfo.hpp +87 -0
- package/nitrogen/generated/shared/c++/FirmwareArtifactReaderReadParams.hpp +91 -0
- package/nitrogen/generated/shared/c++/FirmwareArtifactReceipt.hpp +95 -0
- package/nitrogen/generated/shared/c++/FirmwareArtifactRefParams.hpp +83 -0
- package/nitrogen/generated/shared/c++/FirmwareArtifactSweepResult.hpp +87 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeRangeDownloaderSpec.cpp +13 -1
- package/nitrogen/generated/shared/c++/HybridReactNativeRangeDownloaderSpec.hpp +59 -1
- package/nitrogen/generated/shared/c++/RangeDownloadEvent.hpp +25 -17
- package/nitrogen/generated/shared/c++/RangeDownloadOutcome.hpp +1 -1
- package/nitrogen/generated/shared/c++/RangeDownloadParams.hpp +43 -35
- package/nitrogen/generated/shared/c++/RangeDownloadResult.hpp +22 -14
- package/nitrogen/generated/shared/c++/RangeFallbackKind.hpp +1 -1
- package/package.json +4 -4
- package/src/ReactNativeRangeDownloader.nitro.ts +130 -1
- package/src/index.tsx +3 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// FirmwareArtifactReaderReadParams.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 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
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::reactnativerangedownloader {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (FirmwareArtifactReaderReadParams).
|
|
39
|
+
*/
|
|
40
|
+
struct FirmwareArtifactReaderReadParams final {
|
|
41
|
+
public:
|
|
42
|
+
std::string readerId SWIFT_PRIVATE;
|
|
43
|
+
double offset SWIFT_PRIVATE;
|
|
44
|
+
double length SWIFT_PRIVATE;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
FirmwareArtifactReaderReadParams() = default;
|
|
48
|
+
explicit FirmwareArtifactReaderReadParams(std::string readerId, double offset, double length): readerId(readerId), offset(offset), length(length) {}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
friend bool operator==(const FirmwareArtifactReaderReadParams& lhs, const FirmwareArtifactReaderReadParams& rhs) = default;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::reactnativerangedownloader
|
|
55
|
+
|
|
56
|
+
namespace margelo::nitro {
|
|
57
|
+
|
|
58
|
+
// C++ FirmwareArtifactReaderReadParams <> JS FirmwareArtifactReaderReadParams (object)
|
|
59
|
+
template <>
|
|
60
|
+
struct JSIConverter<margelo::nitro::reactnativerangedownloader::FirmwareArtifactReaderReadParams> final {
|
|
61
|
+
static inline margelo::nitro::reactnativerangedownloader::FirmwareArtifactReaderReadParams fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
62
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
63
|
+
return margelo::nitro::reactnativerangedownloader::FirmwareArtifactReaderReadParams(
|
|
64
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "readerId"))),
|
|
65
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "offset"))),
|
|
66
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "length")))
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativerangedownloader::FirmwareArtifactReaderReadParams& arg) {
|
|
70
|
+
jsi::Object obj(runtime);
|
|
71
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "readerId"), JSIConverter<std::string>::toJSI(runtime, arg.readerId));
|
|
72
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "offset"), JSIConverter<double>::toJSI(runtime, arg.offset));
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "length"), JSIConverter<double>::toJSI(runtime, arg.length));
|
|
74
|
+
return obj;
|
|
75
|
+
}
|
|
76
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
77
|
+
if (!value.isObject()) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
jsi::Object obj = value.getObject(runtime);
|
|
81
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "readerId")))) return false;
|
|
85
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "offset")))) return false;
|
|
86
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "length")))) return false;
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// FirmwareArtifactReceipt.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 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
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::reactnativerangedownloader {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (FirmwareArtifactReceipt).
|
|
39
|
+
*/
|
|
40
|
+
struct FirmwareArtifactReceipt final {
|
|
41
|
+
public:
|
|
42
|
+
std::string artifactRef SWIFT_PRIVATE;
|
|
43
|
+
double size SWIFT_PRIVATE;
|
|
44
|
+
std::string sha256 SWIFT_PRIVATE;
|
|
45
|
+
bool expectedSha256Verified SWIFT_PRIVATE;
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
FirmwareArtifactReceipt() = default;
|
|
49
|
+
explicit FirmwareArtifactReceipt(std::string artifactRef, double size, std::string sha256, bool expectedSha256Verified): artifactRef(artifactRef), size(size), sha256(sha256), expectedSha256Verified(expectedSha256Verified) {}
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
friend bool operator==(const FirmwareArtifactReceipt& lhs, const FirmwareArtifactReceipt& rhs) = default;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
} // namespace margelo::nitro::reactnativerangedownloader
|
|
56
|
+
|
|
57
|
+
namespace margelo::nitro {
|
|
58
|
+
|
|
59
|
+
// C++ FirmwareArtifactReceipt <> JS FirmwareArtifactReceipt (object)
|
|
60
|
+
template <>
|
|
61
|
+
struct JSIConverter<margelo::nitro::reactnativerangedownloader::FirmwareArtifactReceipt> final {
|
|
62
|
+
static inline margelo::nitro::reactnativerangedownloader::FirmwareArtifactReceipt fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
63
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
64
|
+
return margelo::nitro::reactnativerangedownloader::FirmwareArtifactReceipt(
|
|
65
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "artifactRef"))),
|
|
66
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "size"))),
|
|
67
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sha256"))),
|
|
68
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "expectedSha256Verified")))
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativerangedownloader::FirmwareArtifactReceipt& arg) {
|
|
72
|
+
jsi::Object obj(runtime);
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "artifactRef"), JSIConverter<std::string>::toJSI(runtime, arg.artifactRef));
|
|
74
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "size"), JSIConverter<double>::toJSI(runtime, arg.size));
|
|
75
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sha256"), JSIConverter<std::string>::toJSI(runtime, arg.sha256));
|
|
76
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "expectedSha256Verified"), JSIConverter<bool>::toJSI(runtime, arg.expectedSha256Verified));
|
|
77
|
+
return obj;
|
|
78
|
+
}
|
|
79
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
80
|
+
if (!value.isObject()) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
jsi::Object obj = value.getObject(runtime);
|
|
84
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "artifactRef")))) return false;
|
|
88
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "size")))) return false;
|
|
89
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sha256")))) return false;
|
|
90
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "expectedSha256Verified")))) return false;
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// FirmwareArtifactRefParams.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 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
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::reactnativerangedownloader {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (FirmwareArtifactRefParams).
|
|
39
|
+
*/
|
|
40
|
+
struct FirmwareArtifactRefParams final {
|
|
41
|
+
public:
|
|
42
|
+
std::string artifactRef SWIFT_PRIVATE;
|
|
43
|
+
|
|
44
|
+
public:
|
|
45
|
+
FirmwareArtifactRefParams() = default;
|
|
46
|
+
explicit FirmwareArtifactRefParams(std::string artifactRef): artifactRef(artifactRef) {}
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
friend bool operator==(const FirmwareArtifactRefParams& lhs, const FirmwareArtifactRefParams& rhs) = default;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
} // namespace margelo::nitro::reactnativerangedownloader
|
|
53
|
+
|
|
54
|
+
namespace margelo::nitro {
|
|
55
|
+
|
|
56
|
+
// C++ FirmwareArtifactRefParams <> JS FirmwareArtifactRefParams (object)
|
|
57
|
+
template <>
|
|
58
|
+
struct JSIConverter<margelo::nitro::reactnativerangedownloader::FirmwareArtifactRefParams> final {
|
|
59
|
+
static inline margelo::nitro::reactnativerangedownloader::FirmwareArtifactRefParams fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
60
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
61
|
+
return margelo::nitro::reactnativerangedownloader::FirmwareArtifactRefParams(
|
|
62
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "artifactRef")))
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativerangedownloader::FirmwareArtifactRefParams& arg) {
|
|
66
|
+
jsi::Object obj(runtime);
|
|
67
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "artifactRef"), JSIConverter<std::string>::toJSI(runtime, arg.artifactRef));
|
|
68
|
+
return obj;
|
|
69
|
+
}
|
|
70
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
71
|
+
if (!value.isObject()) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
jsi::Object obj = value.getObject(runtime);
|
|
75
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "artifactRef")))) return false;
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// FirmwareArtifactSweepResult.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 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
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::reactnativerangedownloader {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (FirmwareArtifactSweepResult).
|
|
39
|
+
*/
|
|
40
|
+
struct FirmwareArtifactSweepResult final {
|
|
41
|
+
public:
|
|
42
|
+
double deletedFiles SWIFT_PRIVATE;
|
|
43
|
+
double deletedBytes SWIFT_PRIVATE;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
FirmwareArtifactSweepResult() = default;
|
|
47
|
+
explicit FirmwareArtifactSweepResult(double deletedFiles, double deletedBytes): deletedFiles(deletedFiles), deletedBytes(deletedBytes) {}
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
friend bool operator==(const FirmwareArtifactSweepResult& lhs, const FirmwareArtifactSweepResult& rhs) = default;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
} // namespace margelo::nitro::reactnativerangedownloader
|
|
54
|
+
|
|
55
|
+
namespace margelo::nitro {
|
|
56
|
+
|
|
57
|
+
// C++ FirmwareArtifactSweepResult <> JS FirmwareArtifactSweepResult (object)
|
|
58
|
+
template <>
|
|
59
|
+
struct JSIConverter<margelo::nitro::reactnativerangedownloader::FirmwareArtifactSweepResult> final {
|
|
60
|
+
static inline margelo::nitro::reactnativerangedownloader::FirmwareArtifactSweepResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
61
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
62
|
+
return margelo::nitro::reactnativerangedownloader::FirmwareArtifactSweepResult(
|
|
63
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deletedFiles"))),
|
|
64
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deletedBytes")))
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativerangedownloader::FirmwareArtifactSweepResult& arg) {
|
|
68
|
+
jsi::Object obj(runtime);
|
|
69
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "deletedFiles"), JSIConverter<double>::toJSI(runtime, arg.deletedFiles));
|
|
70
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "deletedBytes"), JSIConverter<double>::toJSI(runtime, arg.deletedBytes));
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
73
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
74
|
+
if (!value.isObject()) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
jsi::Object obj = value.getObject(runtime);
|
|
78
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deletedFiles")))) return false;
|
|
82
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "deletedBytes")))) return false;
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
} // namespace margelo::nitro
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridReactNativeRangeDownloaderSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridReactNativeRangeDownloaderSpec.hpp"
|
|
@@ -20,6 +20,18 @@ namespace margelo::nitro::reactnativerangedownloader {
|
|
|
20
20
|
prototype.registerHybridMethod("addDownloadListener", &HybridReactNativeRangeDownloaderSpec::addDownloadListener);
|
|
21
21
|
prototype.registerHybridMethod("removeDownloadListener", &HybridReactNativeRangeDownloaderSpec::removeDownloadListener);
|
|
22
22
|
prototype.registerHybridMethod("getDownloadsDir", &HybridReactNativeRangeDownloaderSpec::getDownloadsDir);
|
|
23
|
+
prototype.registerHybridMethod("getFirmwareArtifactCapabilities", &HybridReactNativeRangeDownloaderSpec::getFirmwareArtifactCapabilities);
|
|
24
|
+
prototype.registerHybridMethod("downloadFirmwareArtifact", &HybridReactNativeRangeDownloaderSpec::downloadFirmwareArtifact);
|
|
25
|
+
prototype.registerHybridMethod("cancelFirmwareArtifactDownloads", &HybridReactNativeRangeDownloaderSpec::cancelFirmwareArtifactDownloads);
|
|
26
|
+
prototype.registerHybridMethod("discardFirmwareArtifact", &HybridReactNativeRangeDownloaderSpec::discardFirmwareArtifact);
|
|
27
|
+
prototype.registerHybridMethod("openFirmwareArtifact", &HybridReactNativeRangeDownloaderSpec::openFirmwareArtifact);
|
|
28
|
+
prototype.registerHybridMethod("readFirmwareArtifact", &HybridReactNativeRangeDownloaderSpec::readFirmwareArtifact);
|
|
29
|
+
prototype.registerHybridMethod("closeFirmwareArtifact", &HybridReactNativeRangeDownloaderSpec::closeFirmwareArtifact);
|
|
30
|
+
prototype.registerHybridMethod("materializeFirmwareArchive", &HybridReactNativeRangeDownloaderSpec::materializeFirmwareArchive);
|
|
31
|
+
prototype.registerHybridMethod("createFirmwareArtifactLease", &HybridReactNativeRangeDownloaderSpec::createFirmwareArtifactLease);
|
|
32
|
+
prototype.registerHybridMethod("retainFirmwareArtifact", &HybridReactNativeRangeDownloaderSpec::retainFirmwareArtifact);
|
|
33
|
+
prototype.registerHybridMethod("releaseFirmwareArtifactLease", &HybridReactNativeRangeDownloaderSpec::releaseFirmwareArtifactLease);
|
|
34
|
+
prototype.registerHybridMethod("sweepFirmwareArtifactOrphans", &HybridReactNativeRangeDownloaderSpec::sweepFirmwareArtifactOrphans);
|
|
23
35
|
});
|
|
24
36
|
}
|
|
25
37
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridReactNativeRangeDownloaderSpec.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -21,6 +21,36 @@ namespace margelo::nitro::reactnativerangedownloader { struct RangeDownloadParam
|
|
|
21
21
|
namespace margelo::nitro::reactnativerangedownloader { enum class DownloadChannel; }
|
|
22
22
|
// Forward declaration of `RangeDownloadEvent` to properly resolve imports.
|
|
23
23
|
namespace margelo::nitro::reactnativerangedownloader { struct RangeDownloadEvent; }
|
|
24
|
+
// Forward declaration of `FirmwareArtifactCapabilities` to properly resolve imports.
|
|
25
|
+
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactCapabilities; }
|
|
26
|
+
// Forward declaration of `FirmwareArtifactReceipt` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactReceipt; }
|
|
28
|
+
// Forward declaration of `FirmwareArtifactDownloadParams` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactDownloadParams; }
|
|
30
|
+
// Forward declaration of `FirmwareArtifactCancelParams` to properly resolve imports.
|
|
31
|
+
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactCancelParams; }
|
|
32
|
+
// Forward declaration of `FirmwareArtifactRefParams` to properly resolve imports.
|
|
33
|
+
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactRefParams; }
|
|
34
|
+
// Forward declaration of `FirmwareArtifactReaderInfo` to properly resolve imports.
|
|
35
|
+
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactReaderInfo; }
|
|
36
|
+
// Forward declaration of `FirmwareArtifactReaderReadParams` to properly resolve imports.
|
|
37
|
+
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactReaderReadParams; }
|
|
38
|
+
// Forward declaration of `FirmwareArtifactReaderCloseParams` to properly resolve imports.
|
|
39
|
+
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactReaderCloseParams; }
|
|
40
|
+
// Forward declaration of `FirmwareArchiveMaterializeResult` to properly resolve imports.
|
|
41
|
+
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArchiveMaterializeResult; }
|
|
42
|
+
// Forward declaration of `FirmwareArchiveMaterializeParams` to properly resolve imports.
|
|
43
|
+
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArchiveMaterializeParams; }
|
|
44
|
+
// Forward declaration of `FirmwareArtifactLease` to properly resolve imports.
|
|
45
|
+
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLease; }
|
|
46
|
+
// Forward declaration of `FirmwareArtifactLeaseCreateParams` to properly resolve imports.
|
|
47
|
+
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLeaseCreateParams; }
|
|
48
|
+
// Forward declaration of `FirmwareArtifactLeaseRetainParams` to properly resolve imports.
|
|
49
|
+
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLeaseRetainParams; }
|
|
50
|
+
// Forward declaration of `FirmwareArtifactLeaseReleaseParams` to properly resolve imports.
|
|
51
|
+
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactLeaseReleaseParams; }
|
|
52
|
+
// Forward declaration of `FirmwareArtifactSweepResult` to properly resolve imports.
|
|
53
|
+
namespace margelo::nitro::reactnativerangedownloader { struct FirmwareArtifactSweepResult; }
|
|
24
54
|
|
|
25
55
|
#include "RangeDownloadResult.hpp"
|
|
26
56
|
#include <NitroModules/Promise.hpp>
|
|
@@ -29,6 +59,22 @@ namespace margelo::nitro::reactnativerangedownloader { struct RangeDownloadEvent
|
|
|
29
59
|
#include <string>
|
|
30
60
|
#include "RangeDownloadEvent.hpp"
|
|
31
61
|
#include <functional>
|
|
62
|
+
#include "FirmwareArtifactCapabilities.hpp"
|
|
63
|
+
#include "FirmwareArtifactReceipt.hpp"
|
|
64
|
+
#include "FirmwareArtifactDownloadParams.hpp"
|
|
65
|
+
#include "FirmwareArtifactCancelParams.hpp"
|
|
66
|
+
#include "FirmwareArtifactRefParams.hpp"
|
|
67
|
+
#include "FirmwareArtifactReaderInfo.hpp"
|
|
68
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
69
|
+
#include "FirmwareArtifactReaderReadParams.hpp"
|
|
70
|
+
#include "FirmwareArtifactReaderCloseParams.hpp"
|
|
71
|
+
#include "FirmwareArchiveMaterializeResult.hpp"
|
|
72
|
+
#include "FirmwareArchiveMaterializeParams.hpp"
|
|
73
|
+
#include "FirmwareArtifactLease.hpp"
|
|
74
|
+
#include "FirmwareArtifactLeaseCreateParams.hpp"
|
|
75
|
+
#include "FirmwareArtifactLeaseRetainParams.hpp"
|
|
76
|
+
#include "FirmwareArtifactLeaseReleaseParams.hpp"
|
|
77
|
+
#include "FirmwareArtifactSweepResult.hpp"
|
|
32
78
|
|
|
33
79
|
namespace margelo::nitro::reactnativerangedownloader {
|
|
34
80
|
|
|
@@ -67,6 +113,18 @@ namespace margelo::nitro::reactnativerangedownloader {
|
|
|
67
113
|
virtual double addDownloadListener(const std::function<void(const RangeDownloadEvent& /* event */)>& callback) = 0;
|
|
68
114
|
virtual void removeDownloadListener(double id) = 0;
|
|
69
115
|
virtual std::string getDownloadsDir() = 0;
|
|
116
|
+
virtual FirmwareArtifactCapabilities getFirmwareArtifactCapabilities() = 0;
|
|
117
|
+
virtual std::shared_ptr<Promise<FirmwareArtifactReceipt>> downloadFirmwareArtifact(const FirmwareArtifactDownloadParams& params) = 0;
|
|
118
|
+
virtual std::shared_ptr<Promise<void>> cancelFirmwareArtifactDownloads(const FirmwareArtifactCancelParams& params) = 0;
|
|
119
|
+
virtual std::shared_ptr<Promise<void>> discardFirmwareArtifact(const FirmwareArtifactRefParams& params) = 0;
|
|
120
|
+
virtual std::shared_ptr<Promise<FirmwareArtifactReaderInfo>> openFirmwareArtifact(const FirmwareArtifactRefParams& params) = 0;
|
|
121
|
+
virtual std::shared_ptr<Promise<std::shared_ptr<ArrayBuffer>>> readFirmwareArtifact(const FirmwareArtifactReaderReadParams& params) = 0;
|
|
122
|
+
virtual std::shared_ptr<Promise<void>> closeFirmwareArtifact(const FirmwareArtifactReaderCloseParams& params) = 0;
|
|
123
|
+
virtual std::shared_ptr<Promise<FirmwareArchiveMaterializeResult>> materializeFirmwareArchive(const FirmwareArchiveMaterializeParams& params) = 0;
|
|
124
|
+
virtual std::shared_ptr<Promise<FirmwareArtifactLease>> createFirmwareArtifactLease(const FirmwareArtifactLeaseCreateParams& params) = 0;
|
|
125
|
+
virtual std::shared_ptr<Promise<void>> retainFirmwareArtifact(const FirmwareArtifactLeaseRetainParams& params) = 0;
|
|
126
|
+
virtual std::shared_ptr<Promise<void>> releaseFirmwareArtifactLease(const FirmwareArtifactLeaseReleaseParams& params) = 0;
|
|
127
|
+
virtual std::shared_ptr<Promise<FirmwareArtifactSweepResult>> sweepFirmwareArtifactOrphans() = 0;
|
|
70
128
|
|
|
71
129
|
protected:
|
|
72
130
|
// Hybrid Setup
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// RangeDownloadEvent.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -22,6 +22,11 @@
|
|
|
22
22
|
#else
|
|
23
23
|
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
24
|
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
25
30
|
|
|
26
31
|
// Forward declaration of `DownloadChannel` to properly resolve imports.
|
|
27
32
|
namespace margelo::nitro::reactnativerangedownloader { enum class DownloadChannel; }
|
|
@@ -34,7 +39,7 @@ namespace margelo::nitro::reactnativerangedownloader {
|
|
|
34
39
|
/**
|
|
35
40
|
* A struct which can be represented as a JavaScript object (RangeDownloadEvent).
|
|
36
41
|
*/
|
|
37
|
-
struct RangeDownloadEvent {
|
|
42
|
+
struct RangeDownloadEvent final {
|
|
38
43
|
public:
|
|
39
44
|
DownloadChannel channel SWIFT_PRIVATE;
|
|
40
45
|
std::string taskId SWIFT_PRIVATE;
|
|
@@ -45,6 +50,9 @@ namespace margelo::nitro::reactnativerangedownloader {
|
|
|
45
50
|
public:
|
|
46
51
|
RangeDownloadEvent() = default;
|
|
47
52
|
explicit RangeDownloadEvent(DownloadChannel channel, std::string taskId, std::string type, double progress, std::string message): channel(channel), taskId(taskId), type(type), progress(progress), message(message) {}
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
friend bool operator==(const RangeDownloadEvent& lhs, const RangeDownloadEvent& rhs) = default;
|
|
48
56
|
};
|
|
49
57
|
|
|
50
58
|
} // namespace margelo::nitro::reactnativerangedownloader
|
|
@@ -57,20 +65,20 @@ namespace margelo::nitro {
|
|
|
57
65
|
static inline margelo::nitro::reactnativerangedownloader::RangeDownloadEvent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
58
66
|
jsi::Object obj = arg.asObject(runtime);
|
|
59
67
|
return margelo::nitro::reactnativerangedownloader::RangeDownloadEvent(
|
|
60
|
-
JSIConverter<margelo::nitro::reactnativerangedownloader::DownloadChannel>::fromJSI(runtime, obj.getProperty(runtime, "channel")),
|
|
61
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "taskId")),
|
|
62
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "type")),
|
|
63
|
-
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "progress")),
|
|
64
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "message"))
|
|
68
|
+
JSIConverter<margelo::nitro::reactnativerangedownloader::DownloadChannel>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "channel"))),
|
|
69
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "taskId"))),
|
|
70
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
|
|
71
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "progress"))),
|
|
72
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "message")))
|
|
65
73
|
);
|
|
66
74
|
}
|
|
67
75
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativerangedownloader::RangeDownloadEvent& arg) {
|
|
68
76
|
jsi::Object obj(runtime);
|
|
69
|
-
obj.setProperty(runtime, "channel", JSIConverter<margelo::nitro::reactnativerangedownloader::DownloadChannel>::toJSI(runtime, arg.channel));
|
|
70
|
-
obj.setProperty(runtime, "taskId", JSIConverter<std::string>::toJSI(runtime, arg.taskId));
|
|
71
|
-
obj.setProperty(runtime, "type", JSIConverter<std::string>::toJSI(runtime, arg.type));
|
|
72
|
-
obj.setProperty(runtime, "progress", JSIConverter<double>::toJSI(runtime, arg.progress));
|
|
73
|
-
obj.setProperty(runtime, "message", JSIConverter<std::string>::toJSI(runtime, arg.message));
|
|
77
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "channel"), JSIConverter<margelo::nitro::reactnativerangedownloader::DownloadChannel>::toJSI(runtime, arg.channel));
|
|
78
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "taskId"), JSIConverter<std::string>::toJSI(runtime, arg.taskId));
|
|
79
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<std::string>::toJSI(runtime, arg.type));
|
|
80
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "progress"), JSIConverter<double>::toJSI(runtime, arg.progress));
|
|
81
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "message"), JSIConverter<std::string>::toJSI(runtime, arg.message));
|
|
74
82
|
return obj;
|
|
75
83
|
}
|
|
76
84
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -81,11 +89,11 @@ namespace margelo::nitro {
|
|
|
81
89
|
if (!nitro::isPlainObject(runtime, obj)) {
|
|
82
90
|
return false;
|
|
83
91
|
}
|
|
84
|
-
if (!JSIConverter<margelo::nitro::reactnativerangedownloader::DownloadChannel>::canConvert(runtime, obj.getProperty(runtime, "channel"))) return false;
|
|
85
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "taskId"))) return false;
|
|
86
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "type"))) return false;
|
|
87
|
-
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "progress"))) return false;
|
|
88
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "message"))) return false;
|
|
92
|
+
if (!JSIConverter<margelo::nitro::reactnativerangedownloader::DownloadChannel>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "channel")))) return false;
|
|
93
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "taskId")))) return false;
|
|
94
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
|
|
95
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "progress")))) return false;
|
|
96
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "message")))) return false;
|
|
89
97
|
return true;
|
|
90
98
|
}
|
|
91
99
|
};
|