@onekeyfe/react-native-range-downloader 3.0.39
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/LICENSE +21 -0
- package/README.md +36 -0
- package/ReactNativeRangeDownloader.podspec +30 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +132 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/reactnativerangedownloader/ConcurrentRangeDownloader.kt +340 -0
- package/android/src/main/java/com/margelo/nitro/reactnativerangedownloader/ReactNativeRangeDownloader.kt +233 -0
- package/android/src/main/java/com/margelo/nitro/reactnativerangedownloader/ReactNativeRangeDownloaderPackage.kt +24 -0
- package/ios/ReactNativeRangeDownloader.swift +732 -0
- package/lib/module/ReactNativeRangeDownloader.nitro.js +4 -0
- package/lib/module/ReactNativeRangeDownloader.nitro.js.map +1 -0
- package/lib/module/index.js +15 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/ReactNativeRangeDownloader.nitro.d.ts +35 -0
- package/lib/typescript/src/ReactNativeRangeDownloader.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +9 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/c++/JDownloadChannel.hpp +62 -0
- package/nitrogen/generated/android/c++/JFunc_void_RangeDownloadEvent.hpp +80 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeRangeDownloaderSpec.cpp +117 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeRangeDownloaderSpec.hpp +69 -0
- package/nitrogen/generated/android/c++/JRangeDownloadEvent.hpp +75 -0
- package/nitrogen/generated/android/c++/JRangeDownloadOutcome.hpp +59 -0
- package/nitrogen/generated/android/c++/JRangeDownloadParams.hpp +84 -0
- package/nitrogen/generated/android/c++/JRangeDownloadResult.hpp +68 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/DownloadChannel.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/Func_void_RangeDownloadEvent.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/HybridReactNativeRangeDownloaderSpec.kt +79 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/RangeDownloadEvent.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/RangeDownloadOutcome.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/RangeDownloadParams.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/RangeDownloadResult.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativerangedownloader/reactnativerangedownloaderOnLoad.kt +35 -0
- package/nitrogen/generated/android/reactnativerangedownloader+autolinking.cmake +81 -0
- package/nitrogen/generated/android/reactnativerangedownloader+autolinking.gradle +27 -0
- package/nitrogen/generated/android/reactnativerangedownloaderOnLoad.cpp +46 -0
- package/nitrogen/generated/android/reactnativerangedownloaderOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/ReactNativeRangeDownloader+autolinking.rb +60 -0
- package/nitrogen/generated/ios/ReactNativeRangeDownloader-Swift-Cxx-Bridge.cpp +65 -0
- package/nitrogen/generated/ios/ReactNativeRangeDownloader-Swift-Cxx-Bridge.hpp +246 -0
- package/nitrogen/generated/ios/ReactNativeRangeDownloader-Swift-Cxx-Umbrella.hpp +62 -0
- package/nitrogen/generated/ios/ReactNativeRangeDownloaderAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ReactNativeRangeDownloaderAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeRangeDownloaderSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeRangeDownloaderSpecSwift.hpp +123 -0
- package/nitrogen/generated/ios/swift/DownloadChannel.swift +44 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_RangeDownloadEvent.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_RangeDownloadResult.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeRangeDownloaderSpec.swift +60 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeRangeDownloaderSpec_cxx.swift +197 -0
- package/nitrogen/generated/ios/swift/RangeDownloadEvent.swift +80 -0
- package/nitrogen/generated/ios/swift/RangeDownloadOutcome.swift +40 -0
- package/nitrogen/generated/ios/swift/RangeDownloadParams.swift +145 -0
- package/nitrogen/generated/ios/swift/RangeDownloadResult.swift +77 -0
- package/nitrogen/generated/shared/c++/DownloadChannel.hpp +80 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeRangeDownloaderSpec.cpp +25 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeRangeDownloaderSpec.hpp +79 -0
- package/nitrogen/generated/shared/c++/RangeDownloadEvent.hpp +93 -0
- package/nitrogen/generated/shared/c++/RangeDownloadOutcome.hpp +76 -0
- package/nitrogen/generated/shared/c++/RangeDownloadParams.hpp +102 -0
- package/nitrogen/generated/shared/c++/RangeDownloadResult.hpp +86 -0
- package/package.json +169 -0
- package/src/ReactNativeRangeDownloader.nitro.ts +60 -0
- package/src/index.tsx +20 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#
|
|
2
|
+
# ReactNativeRangeDownloader+autolinking.rb
|
|
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
|
+
# This is a Ruby script that adds all files generated by Nitrogen
|
|
9
|
+
# to the given podspec.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your .podspec:
|
|
12
|
+
# ```ruby
|
|
13
|
+
# Pod::Spec.new do |spec|
|
|
14
|
+
# # ...
|
|
15
|
+
#
|
|
16
|
+
# # Add all files generated by Nitrogen
|
|
17
|
+
# load 'nitrogen/generated/ios/ReactNativeRangeDownloader+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 ReactNativeRangeDownloader is boosted by nitro!"
|
|
24
|
+
|
|
25
|
+
spec.dependency "NitroModules"
|
|
26
|
+
|
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
|
28
|
+
spec.source_files = current_source_files + [
|
|
29
|
+
# Generated cross-platform specs
|
|
30
|
+
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
|
31
|
+
# Generated bridges for the cross-platform specs
|
|
32
|
+
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
|
36
|
+
spec.public_header_files = current_public_header_files + [
|
|
37
|
+
# Generated specs
|
|
38
|
+
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
|
+
# Swift to C++ bridging helpers
|
|
40
|
+
"nitrogen/generated/ios/ReactNativeRangeDownloader-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
44
|
+
spec.private_header_files = current_private_header_files + [
|
|
45
|
+
# iOS specific specs
|
|
46
|
+
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
52
|
+
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
|
+
# Use C++ 20
|
|
54
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only C)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
})
|
|
60
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeRangeDownloader-Swift-Cxx-Bridge.cpp
|
|
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
|
+
#include "ReactNativeRangeDownloader-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridReactNativeRangeDownloaderSpecSwift.hpp"
|
|
12
|
+
#include "ReactNativeRangeDownloader-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::reactnativerangedownloader::bridge::swift {
|
|
16
|
+
|
|
17
|
+
// pragma MARK: std::function<void(const RangeDownloadResult& /* result */)>
|
|
18
|
+
Func_void_RangeDownloadResult create_Func_void_RangeDownloadResult(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
19
|
+
auto swiftClosure = ReactNativeRangeDownloader::Func_void_RangeDownloadResult::fromUnsafe(swiftClosureWrapper);
|
|
20
|
+
return [swiftClosure = std::move(swiftClosure)](const RangeDownloadResult& result) mutable -> void {
|
|
21
|
+
swiftClosure.call(result);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
26
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
27
|
+
auto swiftClosure = ReactNativeRangeDownloader::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
|
|
28
|
+
return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
|
|
29
|
+
swiftClosure.call(error);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// pragma MARK: std::function<void()>
|
|
34
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
35
|
+
auto swiftClosure = ReactNativeRangeDownloader::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
36
|
+
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
37
|
+
swiftClosure.call();
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// pragma MARK: std::function<void(const RangeDownloadEvent& /* event */)>
|
|
42
|
+
Func_void_RangeDownloadEvent create_Func_void_RangeDownloadEvent(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
43
|
+
auto swiftClosure = ReactNativeRangeDownloader::Func_void_RangeDownloadEvent::fromUnsafe(swiftClosureWrapper);
|
|
44
|
+
return [swiftClosure = std::move(swiftClosure)](const RangeDownloadEvent& event) mutable -> void {
|
|
45
|
+
swiftClosure.call(event);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// pragma MARK: std::shared_ptr<HybridReactNativeRangeDownloaderSpec>
|
|
50
|
+
std::shared_ptr<HybridReactNativeRangeDownloaderSpec> create_std__shared_ptr_HybridReactNativeRangeDownloaderSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
51
|
+
ReactNativeRangeDownloader::HybridReactNativeRangeDownloaderSpec_cxx swiftPart = ReactNativeRangeDownloader::HybridReactNativeRangeDownloaderSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
52
|
+
return std::make_shared<margelo::nitro::reactnativerangedownloader::HybridReactNativeRangeDownloaderSpecSwift>(swiftPart);
|
|
53
|
+
}
|
|
54
|
+
void* NON_NULL get_std__shared_ptr_HybridReactNativeRangeDownloaderSpec_(std__shared_ptr_HybridReactNativeRangeDownloaderSpec_ cppType) {
|
|
55
|
+
std::shared_ptr<margelo::nitro::reactnativerangedownloader::HybridReactNativeRangeDownloaderSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::reactnativerangedownloader::HybridReactNativeRangeDownloaderSpecSwift>(cppType);
|
|
56
|
+
#ifdef NITRO_DEBUG
|
|
57
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
58
|
+
throw std::runtime_error("Class \"HybridReactNativeRangeDownloaderSpec\" is not implemented in Swift!");
|
|
59
|
+
}
|
|
60
|
+
#endif
|
|
61
|
+
ReactNativeRangeDownloader::HybridReactNativeRangeDownloaderSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
62
|
+
return swiftPart.toUnsafe();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
} // namespace margelo::nitro::reactnativerangedownloader::bridge::swift
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeRangeDownloader-Swift-Cxx-Bridge.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
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `DownloadChannel` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::reactnativerangedownloader { enum class DownloadChannel; }
|
|
13
|
+
// Forward declaration of `HybridReactNativeRangeDownloaderSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::reactnativerangedownloader { class HybridReactNativeRangeDownloaderSpec; }
|
|
15
|
+
// Forward declaration of `RangeDownloadEvent` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::reactnativerangedownloader { struct RangeDownloadEvent; }
|
|
17
|
+
// Forward declaration of `RangeDownloadOutcome` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::reactnativerangedownloader { enum class RangeDownloadOutcome; }
|
|
19
|
+
// Forward declaration of `RangeDownloadResult` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::reactnativerangedownloader { struct RangeDownloadResult; }
|
|
21
|
+
|
|
22
|
+
// Forward declarations of Swift defined types
|
|
23
|
+
// Forward declaration of `HybridReactNativeRangeDownloaderSpec_cxx` to properly resolve imports.
|
|
24
|
+
namespace ReactNativeRangeDownloader { class HybridReactNativeRangeDownloaderSpec_cxx; }
|
|
25
|
+
|
|
26
|
+
// Include C++ defined types
|
|
27
|
+
#include "DownloadChannel.hpp"
|
|
28
|
+
#include "HybridReactNativeRangeDownloaderSpec.hpp"
|
|
29
|
+
#include "RangeDownloadEvent.hpp"
|
|
30
|
+
#include "RangeDownloadOutcome.hpp"
|
|
31
|
+
#include "RangeDownloadResult.hpp"
|
|
32
|
+
#include <NitroModules/Promise.hpp>
|
|
33
|
+
#include <NitroModules/PromiseHolder.hpp>
|
|
34
|
+
#include <NitroModules/Result.hpp>
|
|
35
|
+
#include <exception>
|
|
36
|
+
#include <functional>
|
|
37
|
+
#include <memory>
|
|
38
|
+
#include <optional>
|
|
39
|
+
#include <string>
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
43
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
44
|
+
*/
|
|
45
|
+
namespace margelo::nitro::reactnativerangedownloader::bridge::swift {
|
|
46
|
+
|
|
47
|
+
// pragma MARK: std::optional<std::string>
|
|
48
|
+
/**
|
|
49
|
+
* Specialized version of `std::optional<std::string>`.
|
|
50
|
+
*/
|
|
51
|
+
using std__optional_std__string_ = std::optional<std::string>;
|
|
52
|
+
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
53
|
+
return std::optional<std::string>(value);
|
|
54
|
+
}
|
|
55
|
+
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
56
|
+
return optional.has_value();
|
|
57
|
+
}
|
|
58
|
+
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
59
|
+
return *optional;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// pragma MARK: std::shared_ptr<Promise<RangeDownloadResult>>
|
|
63
|
+
/**
|
|
64
|
+
* Specialized version of `std::shared_ptr<Promise<RangeDownloadResult>>`.
|
|
65
|
+
*/
|
|
66
|
+
using std__shared_ptr_Promise_RangeDownloadResult__ = std::shared_ptr<Promise<RangeDownloadResult>>;
|
|
67
|
+
inline std::shared_ptr<Promise<RangeDownloadResult>> create_std__shared_ptr_Promise_RangeDownloadResult__() noexcept {
|
|
68
|
+
return Promise<RangeDownloadResult>::create();
|
|
69
|
+
}
|
|
70
|
+
inline PromiseHolder<RangeDownloadResult> wrap_std__shared_ptr_Promise_RangeDownloadResult__(std::shared_ptr<Promise<RangeDownloadResult>> promise) noexcept {
|
|
71
|
+
return PromiseHolder<RangeDownloadResult>(std::move(promise));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// pragma MARK: std::function<void(const RangeDownloadResult& /* result */)>
|
|
75
|
+
/**
|
|
76
|
+
* Specialized version of `std::function<void(const RangeDownloadResult&)>`.
|
|
77
|
+
*/
|
|
78
|
+
using Func_void_RangeDownloadResult = std::function<void(const RangeDownloadResult& /* result */)>;
|
|
79
|
+
/**
|
|
80
|
+
* Wrapper class for a `std::function<void(const RangeDownloadResult& / * result * /)>`, this can be used from Swift.
|
|
81
|
+
*/
|
|
82
|
+
class Func_void_RangeDownloadResult_Wrapper final {
|
|
83
|
+
public:
|
|
84
|
+
explicit Func_void_RangeDownloadResult_Wrapper(std::function<void(const RangeDownloadResult& /* result */)>&& func): _function(std::make_unique<std::function<void(const RangeDownloadResult& /* result */)>>(std::move(func))) {}
|
|
85
|
+
inline void call(RangeDownloadResult result) const noexcept {
|
|
86
|
+
_function->operator()(result);
|
|
87
|
+
}
|
|
88
|
+
private:
|
|
89
|
+
std::unique_ptr<std::function<void(const RangeDownloadResult& /* result */)>> _function;
|
|
90
|
+
} SWIFT_NONCOPYABLE;
|
|
91
|
+
Func_void_RangeDownloadResult create_Func_void_RangeDownloadResult(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
92
|
+
inline Func_void_RangeDownloadResult_Wrapper wrap_Func_void_RangeDownloadResult(Func_void_RangeDownloadResult value) noexcept {
|
|
93
|
+
return Func_void_RangeDownloadResult_Wrapper(std::move(value));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
97
|
+
/**
|
|
98
|
+
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
99
|
+
*/
|
|
100
|
+
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
101
|
+
/**
|
|
102
|
+
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
103
|
+
*/
|
|
104
|
+
class Func_void_std__exception_ptr_Wrapper final {
|
|
105
|
+
public:
|
|
106
|
+
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
|
|
107
|
+
inline void call(std::exception_ptr error) const noexcept {
|
|
108
|
+
_function->operator()(error);
|
|
109
|
+
}
|
|
110
|
+
private:
|
|
111
|
+
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
112
|
+
} SWIFT_NONCOPYABLE;
|
|
113
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
114
|
+
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
115
|
+
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// pragma MARK: std::optional<double>
|
|
119
|
+
/**
|
|
120
|
+
* Specialized version of `std::optional<double>`.
|
|
121
|
+
*/
|
|
122
|
+
using std__optional_double_ = std::optional<double>;
|
|
123
|
+
inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
|
|
124
|
+
return std::optional<double>(value);
|
|
125
|
+
}
|
|
126
|
+
inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
127
|
+
return optional.has_value();
|
|
128
|
+
}
|
|
129
|
+
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
130
|
+
return *optional;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// pragma MARK: std::shared_ptr<Promise<void>>
|
|
134
|
+
/**
|
|
135
|
+
* Specialized version of `std::shared_ptr<Promise<void>>`.
|
|
136
|
+
*/
|
|
137
|
+
using std__shared_ptr_Promise_void__ = std::shared_ptr<Promise<void>>;
|
|
138
|
+
inline std::shared_ptr<Promise<void>> create_std__shared_ptr_Promise_void__() noexcept {
|
|
139
|
+
return Promise<void>::create();
|
|
140
|
+
}
|
|
141
|
+
inline PromiseHolder<void> wrap_std__shared_ptr_Promise_void__(std::shared_ptr<Promise<void>> promise) noexcept {
|
|
142
|
+
return PromiseHolder<void>(std::move(promise));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// pragma MARK: std::function<void()>
|
|
146
|
+
/**
|
|
147
|
+
* Specialized version of `std::function<void()>`.
|
|
148
|
+
*/
|
|
149
|
+
using Func_void = std::function<void()>;
|
|
150
|
+
/**
|
|
151
|
+
* Wrapper class for a `std::function<void()>`, this can be used from Swift.
|
|
152
|
+
*/
|
|
153
|
+
class Func_void_Wrapper final {
|
|
154
|
+
public:
|
|
155
|
+
explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
|
|
156
|
+
inline void call() const noexcept {
|
|
157
|
+
_function->operator()();
|
|
158
|
+
}
|
|
159
|
+
private:
|
|
160
|
+
std::unique_ptr<std::function<void()>> _function;
|
|
161
|
+
} SWIFT_NONCOPYABLE;
|
|
162
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
163
|
+
inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
|
|
164
|
+
return Func_void_Wrapper(std::move(value));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// pragma MARK: std::function<void(const RangeDownloadEvent& /* event */)>
|
|
168
|
+
/**
|
|
169
|
+
* Specialized version of `std::function<void(const RangeDownloadEvent&)>`.
|
|
170
|
+
*/
|
|
171
|
+
using Func_void_RangeDownloadEvent = std::function<void(const RangeDownloadEvent& /* event */)>;
|
|
172
|
+
/**
|
|
173
|
+
* Wrapper class for a `std::function<void(const RangeDownloadEvent& / * event * /)>`, this can be used from Swift.
|
|
174
|
+
*/
|
|
175
|
+
class Func_void_RangeDownloadEvent_Wrapper final {
|
|
176
|
+
public:
|
|
177
|
+
explicit Func_void_RangeDownloadEvent_Wrapper(std::function<void(const RangeDownloadEvent& /* event */)>&& func): _function(std::make_unique<std::function<void(const RangeDownloadEvent& /* event */)>>(std::move(func))) {}
|
|
178
|
+
inline void call(RangeDownloadEvent event) const noexcept {
|
|
179
|
+
_function->operator()(event);
|
|
180
|
+
}
|
|
181
|
+
private:
|
|
182
|
+
std::unique_ptr<std::function<void(const RangeDownloadEvent& /* event */)>> _function;
|
|
183
|
+
} SWIFT_NONCOPYABLE;
|
|
184
|
+
Func_void_RangeDownloadEvent create_Func_void_RangeDownloadEvent(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
185
|
+
inline Func_void_RangeDownloadEvent_Wrapper wrap_Func_void_RangeDownloadEvent(Func_void_RangeDownloadEvent value) noexcept {
|
|
186
|
+
return Func_void_RangeDownloadEvent_Wrapper(std::move(value));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// pragma MARK: std::shared_ptr<HybridReactNativeRangeDownloaderSpec>
|
|
190
|
+
/**
|
|
191
|
+
* Specialized version of `std::shared_ptr<HybridReactNativeRangeDownloaderSpec>`.
|
|
192
|
+
*/
|
|
193
|
+
using std__shared_ptr_HybridReactNativeRangeDownloaderSpec_ = std::shared_ptr<HybridReactNativeRangeDownloaderSpec>;
|
|
194
|
+
std::shared_ptr<HybridReactNativeRangeDownloaderSpec> create_std__shared_ptr_HybridReactNativeRangeDownloaderSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
195
|
+
void* NON_NULL get_std__shared_ptr_HybridReactNativeRangeDownloaderSpec_(std__shared_ptr_HybridReactNativeRangeDownloaderSpec_ cppType);
|
|
196
|
+
|
|
197
|
+
// pragma MARK: std::weak_ptr<HybridReactNativeRangeDownloaderSpec>
|
|
198
|
+
using std__weak_ptr_HybridReactNativeRangeDownloaderSpec_ = std::weak_ptr<HybridReactNativeRangeDownloaderSpec>;
|
|
199
|
+
inline std__weak_ptr_HybridReactNativeRangeDownloaderSpec_ weakify_std__shared_ptr_HybridReactNativeRangeDownloaderSpec_(const std::shared_ptr<HybridReactNativeRangeDownloaderSpec>& strong) noexcept { return strong; }
|
|
200
|
+
|
|
201
|
+
// pragma MARK: Result<std::shared_ptr<Promise<RangeDownloadResult>>>
|
|
202
|
+
using Result_std__shared_ptr_Promise_RangeDownloadResult___ = Result<std::shared_ptr<Promise<RangeDownloadResult>>>;
|
|
203
|
+
inline Result_std__shared_ptr_Promise_RangeDownloadResult___ create_Result_std__shared_ptr_Promise_RangeDownloadResult___(const std::shared_ptr<Promise<RangeDownloadResult>>& value) noexcept {
|
|
204
|
+
return Result<std::shared_ptr<Promise<RangeDownloadResult>>>::withValue(value);
|
|
205
|
+
}
|
|
206
|
+
inline Result_std__shared_ptr_Promise_RangeDownloadResult___ create_Result_std__shared_ptr_Promise_RangeDownloadResult___(const std::exception_ptr& error) noexcept {
|
|
207
|
+
return Result<std::shared_ptr<Promise<RangeDownloadResult>>>::withError(error);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// pragma MARK: Result<std::shared_ptr<Promise<void>>>
|
|
211
|
+
using Result_std__shared_ptr_Promise_void___ = Result<std::shared_ptr<Promise<void>>>;
|
|
212
|
+
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::shared_ptr<Promise<void>>& value) noexcept {
|
|
213
|
+
return Result<std::shared_ptr<Promise<void>>>::withValue(value);
|
|
214
|
+
}
|
|
215
|
+
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::exception_ptr& error) noexcept {
|
|
216
|
+
return Result<std::shared_ptr<Promise<void>>>::withError(error);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// pragma MARK: Result<double>
|
|
220
|
+
using Result_double_ = Result<double>;
|
|
221
|
+
inline Result_double_ create_Result_double_(double value) noexcept {
|
|
222
|
+
return Result<double>::withValue(std::move(value));
|
|
223
|
+
}
|
|
224
|
+
inline Result_double_ create_Result_double_(const std::exception_ptr& error) noexcept {
|
|
225
|
+
return Result<double>::withError(error);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// pragma MARK: Result<void>
|
|
229
|
+
using Result_void_ = Result<void>;
|
|
230
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
231
|
+
return Result<void>::withValue();
|
|
232
|
+
}
|
|
233
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
234
|
+
return Result<void>::withError(error);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// pragma MARK: Result<std::string>
|
|
238
|
+
using Result_std__string_ = Result<std::string>;
|
|
239
|
+
inline Result_std__string_ create_Result_std__string_(const std::string& value) noexcept {
|
|
240
|
+
return Result<std::string>::withValue(value);
|
|
241
|
+
}
|
|
242
|
+
inline Result_std__string_ create_Result_std__string_(const std::exception_ptr& error) noexcept {
|
|
243
|
+
return Result<std::string>::withError(error);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
} // namespace margelo::nitro::reactnativerangedownloader::bridge::swift
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeRangeDownloader-Swift-Cxx-Umbrella.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
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `DownloadChannel` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::reactnativerangedownloader { enum class DownloadChannel; }
|
|
13
|
+
// Forward declaration of `HybridReactNativeRangeDownloaderSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::reactnativerangedownloader { class HybridReactNativeRangeDownloaderSpec; }
|
|
15
|
+
// Forward declaration of `RangeDownloadEvent` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::reactnativerangedownloader { struct RangeDownloadEvent; }
|
|
17
|
+
// Forward declaration of `RangeDownloadOutcome` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::reactnativerangedownloader { enum class RangeDownloadOutcome; }
|
|
19
|
+
// Forward declaration of `RangeDownloadParams` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::reactnativerangedownloader { struct RangeDownloadParams; }
|
|
21
|
+
// Forward declaration of `RangeDownloadResult` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::reactnativerangedownloader { struct RangeDownloadResult; }
|
|
23
|
+
|
|
24
|
+
// Include C++ defined types
|
|
25
|
+
#include "DownloadChannel.hpp"
|
|
26
|
+
#include "HybridReactNativeRangeDownloaderSpec.hpp"
|
|
27
|
+
#include "RangeDownloadEvent.hpp"
|
|
28
|
+
#include "RangeDownloadOutcome.hpp"
|
|
29
|
+
#include "RangeDownloadParams.hpp"
|
|
30
|
+
#include "RangeDownloadResult.hpp"
|
|
31
|
+
#include <NitroModules/Promise.hpp>
|
|
32
|
+
#include <NitroModules/Result.hpp>
|
|
33
|
+
#include <exception>
|
|
34
|
+
#include <functional>
|
|
35
|
+
#include <memory>
|
|
36
|
+
#include <optional>
|
|
37
|
+
#include <string>
|
|
38
|
+
|
|
39
|
+
// C++ helpers for Swift
|
|
40
|
+
#include "ReactNativeRangeDownloader-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
|
|
42
|
+
// Common C++ types used in Swift
|
|
43
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
44
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
45
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
46
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
47
|
+
|
|
48
|
+
// Forward declarations of Swift defined types
|
|
49
|
+
// Forward declaration of `HybridReactNativeRangeDownloaderSpec_cxx` to properly resolve imports.
|
|
50
|
+
namespace ReactNativeRangeDownloader { class HybridReactNativeRangeDownloaderSpec_cxx; }
|
|
51
|
+
|
|
52
|
+
// Include Swift defined types
|
|
53
|
+
#if __has_include("ReactNativeRangeDownloader-Swift.h")
|
|
54
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
55
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "ReactNativeRangeDownloader".
|
|
56
|
+
#include "ReactNativeRangeDownloader-Swift.h"
|
|
57
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
58
|
+
#elif __has_include(<ReactNativeRangeDownloader/ReactNativeRangeDownloader-Swift.h>)
|
|
59
|
+
#include <ReactNativeRangeDownloader/ReactNativeRangeDownloader-Swift.h>
|
|
60
|
+
#else
|
|
61
|
+
#error ReactNativeRangeDownloader's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "ReactNativeRangeDownloader", and try building the app first.
|
|
62
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeRangeDownloaderAutolinking.mm
|
|
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/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "ReactNativeRangeDownloader-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridReactNativeRangeDownloaderSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface ReactNativeRangeDownloaderAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation ReactNativeRangeDownloaderAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::reactnativerangedownloader;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"ReactNativeRangeDownloader",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridReactNativeRangeDownloaderSpec> hybridObject = ReactNativeRangeDownloader::ReactNativeRangeDownloaderAutolinking::createReactNativeRangeDownloader();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeRangeDownloaderAutolinking.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
|
+
public final class ReactNativeRangeDownloaderAutolinking {
|
|
9
|
+
public typealias bridge = margelo.nitro.reactnativerangedownloader.bridge.swift
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of a Swift class that implements `HybridReactNativeRangeDownloaderSpec`,
|
|
13
|
+
* and wraps it in a Swift class that can directly interop with C++ (`HybridReactNativeRangeDownloaderSpec_cxx`)
|
|
14
|
+
*
|
|
15
|
+
* This is generated by Nitrogen and will initialize the class specified
|
|
16
|
+
* in the `"autolinking"` property of `nitro.json` (in this case, `ReactNativeRangeDownloader`).
|
|
17
|
+
*/
|
|
18
|
+
public static func createReactNativeRangeDownloader() -> bridge.std__shared_ptr_HybridReactNativeRangeDownloaderSpec_ {
|
|
19
|
+
let hybridObject = ReactNativeRangeDownloader()
|
|
20
|
+
return { () -> bridge.std__shared_ptr_HybridReactNativeRangeDownloaderSpec_ in
|
|
21
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
22
|
+
return __cxxWrapped.getCxxPart()
|
|
23
|
+
}()
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReactNativeRangeDownloaderSpecSwift.cpp
|
|
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
|
+
#include "HybridReactNativeRangeDownloaderSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::reactnativerangedownloader {
|
|
11
|
+
} // namespace margelo::nitro::reactnativerangedownloader
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReactNativeRangeDownloaderSpecSwift.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 "HybridReactNativeRangeDownloaderSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridReactNativeRangeDownloaderSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace ReactNativeRangeDownloader { class HybridReactNativeRangeDownloaderSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `RangeDownloadResult` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::reactnativerangedownloader { struct RangeDownloadResult; }
|
|
17
|
+
// Forward declaration of `RangeDownloadOutcome` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::reactnativerangedownloader { enum class RangeDownloadOutcome; }
|
|
19
|
+
// Forward declaration of `RangeDownloadParams` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::reactnativerangedownloader { struct RangeDownloadParams; }
|
|
21
|
+
// Forward declaration of `DownloadChannel` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::reactnativerangedownloader { enum class DownloadChannel; }
|
|
23
|
+
// Forward declaration of `RangeDownloadEvent` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::reactnativerangedownloader { struct RangeDownloadEvent; }
|
|
25
|
+
|
|
26
|
+
#include "RangeDownloadResult.hpp"
|
|
27
|
+
#include <NitroModules/Promise.hpp>
|
|
28
|
+
#include "RangeDownloadOutcome.hpp"
|
|
29
|
+
#include <string>
|
|
30
|
+
#include <optional>
|
|
31
|
+
#include "RangeDownloadParams.hpp"
|
|
32
|
+
#include "DownloadChannel.hpp"
|
|
33
|
+
#include "RangeDownloadEvent.hpp"
|
|
34
|
+
#include <functional>
|
|
35
|
+
|
|
36
|
+
#include "ReactNativeRangeDownloader-Swift-Cxx-Umbrella.hpp"
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro::reactnativerangedownloader {
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The C++ part of HybridReactNativeRangeDownloaderSpec_cxx.swift.
|
|
42
|
+
*
|
|
43
|
+
* HybridReactNativeRangeDownloaderSpecSwift (C++) accesses HybridReactNativeRangeDownloaderSpec_cxx (Swift), and might
|
|
44
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
45
|
+
*
|
|
46
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
47
|
+
* the future, HybridReactNativeRangeDownloaderSpec_cxx can directly inherit from the C++ class HybridReactNativeRangeDownloaderSpec
|
|
48
|
+
* to simplify the whole structure and memory management.
|
|
49
|
+
*/
|
|
50
|
+
class HybridReactNativeRangeDownloaderSpecSwift: public virtual HybridReactNativeRangeDownloaderSpec {
|
|
51
|
+
public:
|
|
52
|
+
// Constructor from a Swift instance
|
|
53
|
+
explicit HybridReactNativeRangeDownloaderSpecSwift(const ReactNativeRangeDownloader::HybridReactNativeRangeDownloaderSpec_cxx& swiftPart):
|
|
54
|
+
HybridObject(HybridReactNativeRangeDownloaderSpec::TAG),
|
|
55
|
+
_swiftPart(swiftPart) { }
|
|
56
|
+
|
|
57
|
+
public:
|
|
58
|
+
// Get the Swift part
|
|
59
|
+
inline ReactNativeRangeDownloader::HybridReactNativeRangeDownloaderSpec_cxx& getSwiftPart() noexcept {
|
|
60
|
+
return _swiftPart;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
65
|
+
return _swiftPart.getMemorySize();
|
|
66
|
+
}
|
|
67
|
+
void dispose() noexcept override {
|
|
68
|
+
_swiftPart.dispose();
|
|
69
|
+
}
|
|
70
|
+
std::string toString() override {
|
|
71
|
+
return _swiftPart.toString();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public:
|
|
75
|
+
// Properties
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
public:
|
|
79
|
+
// Methods
|
|
80
|
+
inline std::shared_ptr<Promise<RangeDownloadResult>> download(const RangeDownloadParams& params) override {
|
|
81
|
+
auto __result = _swiftPart.download(std::forward<decltype(params)>(params));
|
|
82
|
+
if (__result.hasError()) [[unlikely]] {
|
|
83
|
+
std::rethrow_exception(__result.error());
|
|
84
|
+
}
|
|
85
|
+
auto __value = std::move(__result.value());
|
|
86
|
+
return __value;
|
|
87
|
+
}
|
|
88
|
+
inline std::shared_ptr<Promise<void>> discardArtifacts(DownloadChannel channel, const std::string& taskId, const std::string& destFilePath) override {
|
|
89
|
+
auto __result = _swiftPart.discardArtifacts(static_cast<int>(channel), taskId, destFilePath);
|
|
90
|
+
if (__result.hasError()) [[unlikely]] {
|
|
91
|
+
std::rethrow_exception(__result.error());
|
|
92
|
+
}
|
|
93
|
+
auto __value = std::move(__result.value());
|
|
94
|
+
return __value;
|
|
95
|
+
}
|
|
96
|
+
inline double addDownloadListener(const std::function<void(const RangeDownloadEvent& /* event */)>& callback) override {
|
|
97
|
+
auto __result = _swiftPart.addDownloadListener(callback);
|
|
98
|
+
if (__result.hasError()) [[unlikely]] {
|
|
99
|
+
std::rethrow_exception(__result.error());
|
|
100
|
+
}
|
|
101
|
+
auto __value = std::move(__result.value());
|
|
102
|
+
return __value;
|
|
103
|
+
}
|
|
104
|
+
inline void removeDownloadListener(double id) override {
|
|
105
|
+
auto __result = _swiftPart.removeDownloadListener(std::forward<decltype(id)>(id));
|
|
106
|
+
if (__result.hasError()) [[unlikely]] {
|
|
107
|
+
std::rethrow_exception(__result.error());
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
inline std::string getDownloadsDir() override {
|
|
111
|
+
auto __result = _swiftPart.getDownloadsDir();
|
|
112
|
+
if (__result.hasError()) [[unlikely]] {
|
|
113
|
+
std::rethrow_exception(__result.error());
|
|
114
|
+
}
|
|
115
|
+
auto __value = std::move(__result.value());
|
|
116
|
+
return __value;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private:
|
|
120
|
+
ReactNativeRangeDownloader::HybridReactNativeRangeDownloaderSpec_cxx _swiftPart;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
} // namespace margelo::nitro::reactnativerangedownloader
|