@onekeyfe/react-native-zip-archive 3.0.37 → 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/{ZipArchive.podspec → ReactNativeZipArchive.podspec} +12 -3
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +54 -3
- 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/reactnativeziparchive/ReactNativeZipArchive.kt +139 -0
- package/android/src/main/java/com/margelo/nitro/reactnativeziparchive/ReactNativeZipArchivePackage.kt +22 -0
- package/ios/ReactNativeZipArchive.swift +130 -0
- package/lib/module/ReactNativeZipArchive.nitro.js +4 -0
- package/lib/module/index.js +24 -3
- package/lib/typescript/src/{NativeZipArchive.d.ts → ReactNativeZipArchive.nitro.d.ts} +6 -5
- package/lib/typescript/src/index.d.ts +10 -2
- package/nitro.json +17 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeZipArchiveSpec.cpp +155 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeZipArchiveSpec.hpp +70 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeziparchive/HybridReactNativeZipArchiveSpec.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeziparchive/reactnativeziparchiveOnLoad.kt +35 -0
- package/nitrogen/generated/android/reactnativeziparchive+autolinking.cmake +81 -0
- package/nitrogen/generated/android/reactnativeziparchive+autolinking.gradle +27 -0
- package/nitrogen/generated/android/reactnativeziparchiveOnLoad.cpp +44 -0
- package/nitrogen/generated/android/reactnativeziparchiveOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/ReactNativeZipArchive+autolinking.rb +60 -0
- package/nitrogen/generated/ios/ReactNativeZipArchive-Swift-Cxx-Bridge.cpp +65 -0
- package/nitrogen/generated/ios/ReactNativeZipArchive-Swift-Cxx-Bridge.hpp +209 -0
- package/nitrogen/generated/ios/ReactNativeZipArchive-Swift-Cxx-Umbrella.hpp +46 -0
- package/nitrogen/generated/ios/ReactNativeZipArchiveAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ReactNativeZipArchiveAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeZipArchiveSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeZipArchiveSpecSwift.hpp +118 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeZipArchiveSpec.swift +61 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeZipArchiveSpec_cxx.swift +233 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeZipArchiveSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeZipArchiveSpec.hpp +69 -0
- package/package.json +22 -17
- package/src/ReactNativeZipArchive.nitro.ts +26 -0
- package/src/index.tsx +47 -4
- package/android/src/main/java/com/rnziparchive/RNZipArchiveModule.kt +0 -158
- package/android/src/main/java/com/rnziparchive/RNZipArchivePackage.kt +0 -33
- package/ios/ZipArchive.h +0 -10
- package/ios/ZipArchive.mm +0 -182
- package/lib/module/NativeZipArchive.js +0 -5
- package/src/NativeZipArchive.ts +0 -13
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeZipArchive-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 `HybridReactNativeZipArchiveSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::reactnativeziparchive { class HybridReactNativeZipArchiveSpec; }
|
|
13
|
+
|
|
14
|
+
// Forward declarations of Swift defined types
|
|
15
|
+
// Forward declaration of `HybridReactNativeZipArchiveSpec_cxx` to properly resolve imports.
|
|
16
|
+
namespace ReactNativeZipArchive { class HybridReactNativeZipArchiveSpec_cxx; }
|
|
17
|
+
|
|
18
|
+
// Include C++ defined types
|
|
19
|
+
#include "HybridReactNativeZipArchiveSpec.hpp"
|
|
20
|
+
#include <NitroModules/Promise.hpp>
|
|
21
|
+
#include <NitroModules/PromiseHolder.hpp>
|
|
22
|
+
#include <NitroModules/Result.hpp>
|
|
23
|
+
#include <exception>
|
|
24
|
+
#include <functional>
|
|
25
|
+
#include <memory>
|
|
26
|
+
#include <string>
|
|
27
|
+
#include <vector>
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
31
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
32
|
+
*/
|
|
33
|
+
namespace margelo::nitro::reactnativeziparchive::bridge::swift {
|
|
34
|
+
|
|
35
|
+
// pragma MARK: std::shared_ptr<Promise<bool>>
|
|
36
|
+
/**
|
|
37
|
+
* Specialized version of `std::shared_ptr<Promise<bool>>`.
|
|
38
|
+
*/
|
|
39
|
+
using std__shared_ptr_Promise_bool__ = std::shared_ptr<Promise<bool>>;
|
|
40
|
+
inline std::shared_ptr<Promise<bool>> create_std__shared_ptr_Promise_bool__() noexcept {
|
|
41
|
+
return Promise<bool>::create();
|
|
42
|
+
}
|
|
43
|
+
inline PromiseHolder<bool> wrap_std__shared_ptr_Promise_bool__(std::shared_ptr<Promise<bool>> promise) noexcept {
|
|
44
|
+
return PromiseHolder<bool>(std::move(promise));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// pragma MARK: std::function<void(bool /* result */)>
|
|
48
|
+
/**
|
|
49
|
+
* Specialized version of `std::function<void(bool)>`.
|
|
50
|
+
*/
|
|
51
|
+
using Func_void_bool = std::function<void(bool /* result */)>;
|
|
52
|
+
/**
|
|
53
|
+
* Wrapper class for a `std::function<void(bool / * result * /)>`, this can be used from Swift.
|
|
54
|
+
*/
|
|
55
|
+
class Func_void_bool_Wrapper final {
|
|
56
|
+
public:
|
|
57
|
+
explicit Func_void_bool_Wrapper(std::function<void(bool /* result */)>&& func): _function(std::make_unique<std::function<void(bool /* result */)>>(std::move(func))) {}
|
|
58
|
+
inline void call(bool result) const noexcept {
|
|
59
|
+
_function->operator()(result);
|
|
60
|
+
}
|
|
61
|
+
private:
|
|
62
|
+
std::unique_ptr<std::function<void(bool /* result */)>> _function;
|
|
63
|
+
} SWIFT_NONCOPYABLE;
|
|
64
|
+
Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
65
|
+
inline Func_void_bool_Wrapper wrap_Func_void_bool(Func_void_bool value) noexcept {
|
|
66
|
+
return Func_void_bool_Wrapper(std::move(value));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
70
|
+
/**
|
|
71
|
+
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
72
|
+
*/
|
|
73
|
+
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
74
|
+
/**
|
|
75
|
+
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
76
|
+
*/
|
|
77
|
+
class Func_void_std__exception_ptr_Wrapper final {
|
|
78
|
+
public:
|
|
79
|
+
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))) {}
|
|
80
|
+
inline void call(std::exception_ptr error) const noexcept {
|
|
81
|
+
_function->operator()(error);
|
|
82
|
+
}
|
|
83
|
+
private:
|
|
84
|
+
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
85
|
+
} SWIFT_NONCOPYABLE;
|
|
86
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
87
|
+
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
88
|
+
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// pragma MARK: std::shared_ptr<Promise<std::string>>
|
|
92
|
+
/**
|
|
93
|
+
* Specialized version of `std::shared_ptr<Promise<std::string>>`.
|
|
94
|
+
*/
|
|
95
|
+
using std__shared_ptr_Promise_std__string__ = std::shared_ptr<Promise<std::string>>;
|
|
96
|
+
inline std::shared_ptr<Promise<std::string>> create_std__shared_ptr_Promise_std__string__() noexcept {
|
|
97
|
+
return Promise<std::string>::create();
|
|
98
|
+
}
|
|
99
|
+
inline PromiseHolder<std::string> wrap_std__shared_ptr_Promise_std__string__(std::shared_ptr<Promise<std::string>> promise) noexcept {
|
|
100
|
+
return PromiseHolder<std::string>(std::move(promise));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// pragma MARK: std::function<void(const std::string& /* result */)>
|
|
104
|
+
/**
|
|
105
|
+
* Specialized version of `std::function<void(const std::string&)>`.
|
|
106
|
+
*/
|
|
107
|
+
using Func_void_std__string = std::function<void(const std::string& /* result */)>;
|
|
108
|
+
/**
|
|
109
|
+
* Wrapper class for a `std::function<void(const std::string& / * result * /)>`, this can be used from Swift.
|
|
110
|
+
*/
|
|
111
|
+
class Func_void_std__string_Wrapper final {
|
|
112
|
+
public:
|
|
113
|
+
explicit Func_void_std__string_Wrapper(std::function<void(const std::string& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::string& /* result */)>>(std::move(func))) {}
|
|
114
|
+
inline void call(std::string result) const noexcept {
|
|
115
|
+
_function->operator()(result);
|
|
116
|
+
}
|
|
117
|
+
private:
|
|
118
|
+
std::unique_ptr<std::function<void(const std::string& /* result */)>> _function;
|
|
119
|
+
} SWIFT_NONCOPYABLE;
|
|
120
|
+
Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
121
|
+
inline Func_void_std__string_Wrapper wrap_Func_void_std__string(Func_void_std__string value) noexcept {
|
|
122
|
+
return Func_void_std__string_Wrapper(std::move(value));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// pragma MARK: std::vector<std::string>
|
|
126
|
+
/**
|
|
127
|
+
* Specialized version of `std::vector<std::string>`.
|
|
128
|
+
*/
|
|
129
|
+
using std__vector_std__string_ = std::vector<std::string>;
|
|
130
|
+
inline std::vector<std::string> create_std__vector_std__string_(size_t size) noexcept {
|
|
131
|
+
std::vector<std::string> vector;
|
|
132
|
+
vector.reserve(size);
|
|
133
|
+
return vector;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// pragma MARK: std::shared_ptr<Promise<double>>
|
|
137
|
+
/**
|
|
138
|
+
* Specialized version of `std::shared_ptr<Promise<double>>`.
|
|
139
|
+
*/
|
|
140
|
+
using std__shared_ptr_Promise_double__ = std::shared_ptr<Promise<double>>;
|
|
141
|
+
inline std::shared_ptr<Promise<double>> create_std__shared_ptr_Promise_double__() noexcept {
|
|
142
|
+
return Promise<double>::create();
|
|
143
|
+
}
|
|
144
|
+
inline PromiseHolder<double> wrap_std__shared_ptr_Promise_double__(std::shared_ptr<Promise<double>> promise) noexcept {
|
|
145
|
+
return PromiseHolder<double>(std::move(promise));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// pragma MARK: std::function<void(double /* result */)>
|
|
149
|
+
/**
|
|
150
|
+
* Specialized version of `std::function<void(double)>`.
|
|
151
|
+
*/
|
|
152
|
+
using Func_void_double = std::function<void(double /* result */)>;
|
|
153
|
+
/**
|
|
154
|
+
* Wrapper class for a `std::function<void(double / * result * /)>`, this can be used from Swift.
|
|
155
|
+
*/
|
|
156
|
+
class Func_void_double_Wrapper final {
|
|
157
|
+
public:
|
|
158
|
+
explicit Func_void_double_Wrapper(std::function<void(double /* result */)>&& func): _function(std::make_unique<std::function<void(double /* result */)>>(std::move(func))) {}
|
|
159
|
+
inline void call(double result) const noexcept {
|
|
160
|
+
_function->operator()(result);
|
|
161
|
+
}
|
|
162
|
+
private:
|
|
163
|
+
std::unique_ptr<std::function<void(double /* result */)>> _function;
|
|
164
|
+
} SWIFT_NONCOPYABLE;
|
|
165
|
+
Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
166
|
+
inline Func_void_double_Wrapper wrap_Func_void_double(Func_void_double value) noexcept {
|
|
167
|
+
return Func_void_double_Wrapper(std::move(value));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// pragma MARK: std::shared_ptr<HybridReactNativeZipArchiveSpec>
|
|
171
|
+
/**
|
|
172
|
+
* Specialized version of `std::shared_ptr<HybridReactNativeZipArchiveSpec>`.
|
|
173
|
+
*/
|
|
174
|
+
using std__shared_ptr_HybridReactNativeZipArchiveSpec_ = std::shared_ptr<HybridReactNativeZipArchiveSpec>;
|
|
175
|
+
std::shared_ptr<HybridReactNativeZipArchiveSpec> create_std__shared_ptr_HybridReactNativeZipArchiveSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
176
|
+
void* NON_NULL get_std__shared_ptr_HybridReactNativeZipArchiveSpec_(std__shared_ptr_HybridReactNativeZipArchiveSpec_ cppType);
|
|
177
|
+
|
|
178
|
+
// pragma MARK: std::weak_ptr<HybridReactNativeZipArchiveSpec>
|
|
179
|
+
using std__weak_ptr_HybridReactNativeZipArchiveSpec_ = std::weak_ptr<HybridReactNativeZipArchiveSpec>;
|
|
180
|
+
inline std__weak_ptr_HybridReactNativeZipArchiveSpec_ weakify_std__shared_ptr_HybridReactNativeZipArchiveSpec_(const std::shared_ptr<HybridReactNativeZipArchiveSpec>& strong) noexcept { return strong; }
|
|
181
|
+
|
|
182
|
+
// pragma MARK: Result<std::shared_ptr<Promise<bool>>>
|
|
183
|
+
using Result_std__shared_ptr_Promise_bool___ = Result<std::shared_ptr<Promise<bool>>>;
|
|
184
|
+
inline Result_std__shared_ptr_Promise_bool___ create_Result_std__shared_ptr_Promise_bool___(const std::shared_ptr<Promise<bool>>& value) noexcept {
|
|
185
|
+
return Result<std::shared_ptr<Promise<bool>>>::withValue(value);
|
|
186
|
+
}
|
|
187
|
+
inline Result_std__shared_ptr_Promise_bool___ create_Result_std__shared_ptr_Promise_bool___(const std::exception_ptr& error) noexcept {
|
|
188
|
+
return Result<std::shared_ptr<Promise<bool>>>::withError(error);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// pragma MARK: Result<std::shared_ptr<Promise<std::string>>>
|
|
192
|
+
using Result_std__shared_ptr_Promise_std__string___ = Result<std::shared_ptr<Promise<std::string>>>;
|
|
193
|
+
inline Result_std__shared_ptr_Promise_std__string___ create_Result_std__shared_ptr_Promise_std__string___(const std::shared_ptr<Promise<std::string>>& value) noexcept {
|
|
194
|
+
return Result<std::shared_ptr<Promise<std::string>>>::withValue(value);
|
|
195
|
+
}
|
|
196
|
+
inline Result_std__shared_ptr_Promise_std__string___ create_Result_std__shared_ptr_Promise_std__string___(const std::exception_ptr& error) noexcept {
|
|
197
|
+
return Result<std::shared_ptr<Promise<std::string>>>::withError(error);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// pragma MARK: Result<std::shared_ptr<Promise<double>>>
|
|
201
|
+
using Result_std__shared_ptr_Promise_double___ = Result<std::shared_ptr<Promise<double>>>;
|
|
202
|
+
inline Result_std__shared_ptr_Promise_double___ create_Result_std__shared_ptr_Promise_double___(const std::shared_ptr<Promise<double>>& value) noexcept {
|
|
203
|
+
return Result<std::shared_ptr<Promise<double>>>::withValue(value);
|
|
204
|
+
}
|
|
205
|
+
inline Result_std__shared_ptr_Promise_double___ create_Result_std__shared_ptr_Promise_double___(const std::exception_ptr& error) noexcept {
|
|
206
|
+
return Result<std::shared_ptr<Promise<double>>>::withError(error);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
} // namespace margelo::nitro::reactnativeziparchive::bridge::swift
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeZipArchive-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 `HybridReactNativeZipArchiveSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::reactnativeziparchive { class HybridReactNativeZipArchiveSpec; }
|
|
13
|
+
|
|
14
|
+
// Include C++ defined types
|
|
15
|
+
#include "HybridReactNativeZipArchiveSpec.hpp"
|
|
16
|
+
#include <NitroModules/Promise.hpp>
|
|
17
|
+
#include <NitroModules/Result.hpp>
|
|
18
|
+
#include <exception>
|
|
19
|
+
#include <memory>
|
|
20
|
+
#include <string>
|
|
21
|
+
#include <vector>
|
|
22
|
+
|
|
23
|
+
// C++ helpers for Swift
|
|
24
|
+
#include "ReactNativeZipArchive-Swift-Cxx-Bridge.hpp"
|
|
25
|
+
|
|
26
|
+
// Common C++ types used in Swift
|
|
27
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
28
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
29
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
30
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
31
|
+
|
|
32
|
+
// Forward declarations of Swift defined types
|
|
33
|
+
// Forward declaration of `HybridReactNativeZipArchiveSpec_cxx` to properly resolve imports.
|
|
34
|
+
namespace ReactNativeZipArchive { class HybridReactNativeZipArchiveSpec_cxx; }
|
|
35
|
+
|
|
36
|
+
// Include Swift defined types
|
|
37
|
+
#if __has_include("ReactNativeZipArchive-Swift.h")
|
|
38
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
39
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "ReactNativeZipArchive".
|
|
40
|
+
#include "ReactNativeZipArchive-Swift.h"
|
|
41
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
42
|
+
#elif __has_include(<ReactNativeZipArchive/ReactNativeZipArchive-Swift.h>)
|
|
43
|
+
#include <ReactNativeZipArchive/ReactNativeZipArchive-Swift.h>
|
|
44
|
+
#else
|
|
45
|
+
#error ReactNativeZipArchive's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "ReactNativeZipArchive", and try building the app first.
|
|
46
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeZipArchiveAutolinking.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 "ReactNativeZipArchive-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridReactNativeZipArchiveSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface ReactNativeZipArchiveAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation ReactNativeZipArchiveAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::reactnativeziparchive;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"ReactNativeZipArchive",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridReactNativeZipArchiveSpec> hybridObject = ReactNativeZipArchive::ReactNativeZipArchiveAutolinking::createReactNativeZipArchive();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeZipArchiveAutolinking.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 ReactNativeZipArchiveAutolinking {
|
|
9
|
+
public typealias bridge = margelo.nitro.reactnativeziparchive.bridge.swift
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of a Swift class that implements `HybridReactNativeZipArchiveSpec`,
|
|
13
|
+
* and wraps it in a Swift class that can directly interop with C++ (`HybridReactNativeZipArchiveSpec_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, `ReactNativeZipArchive`).
|
|
17
|
+
*/
|
|
18
|
+
public static func createReactNativeZipArchive() -> bridge.std__shared_ptr_HybridReactNativeZipArchiveSpec_ {
|
|
19
|
+
let hybridObject = ReactNativeZipArchive()
|
|
20
|
+
return { () -> bridge.std__shared_ptr_HybridReactNativeZipArchiveSpec_ in
|
|
21
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
22
|
+
return __cxxWrapped.getCxxPart()
|
|
23
|
+
}()
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReactNativeZipArchiveSpecSwift.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 "HybridReactNativeZipArchiveSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::reactnativeziparchive {
|
|
11
|
+
} // namespace margelo::nitro::reactnativeziparchive
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReactNativeZipArchiveSpecSwift.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 "HybridReactNativeZipArchiveSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridReactNativeZipArchiveSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace ReactNativeZipArchive { class HybridReactNativeZipArchiveSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
#include <NitroModules/Promise.hpp>
|
|
18
|
+
#include <string>
|
|
19
|
+
#include <vector>
|
|
20
|
+
|
|
21
|
+
#include "ReactNativeZipArchive-Swift-Cxx-Umbrella.hpp"
|
|
22
|
+
|
|
23
|
+
namespace margelo::nitro::reactnativeziparchive {
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The C++ part of HybridReactNativeZipArchiveSpec_cxx.swift.
|
|
27
|
+
*
|
|
28
|
+
* HybridReactNativeZipArchiveSpecSwift (C++) accesses HybridReactNativeZipArchiveSpec_cxx (Swift), and might
|
|
29
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
30
|
+
*
|
|
31
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
32
|
+
* the future, HybridReactNativeZipArchiveSpec_cxx can directly inherit from the C++ class HybridReactNativeZipArchiveSpec
|
|
33
|
+
* to simplify the whole structure and memory management.
|
|
34
|
+
*/
|
|
35
|
+
class HybridReactNativeZipArchiveSpecSwift: public virtual HybridReactNativeZipArchiveSpec {
|
|
36
|
+
public:
|
|
37
|
+
// Constructor from a Swift instance
|
|
38
|
+
explicit HybridReactNativeZipArchiveSpecSwift(const ReactNativeZipArchive::HybridReactNativeZipArchiveSpec_cxx& swiftPart):
|
|
39
|
+
HybridObject(HybridReactNativeZipArchiveSpec::TAG),
|
|
40
|
+
_swiftPart(swiftPart) { }
|
|
41
|
+
|
|
42
|
+
public:
|
|
43
|
+
// Get the Swift part
|
|
44
|
+
inline ReactNativeZipArchive::HybridReactNativeZipArchiveSpec_cxx& getSwiftPart() noexcept {
|
|
45
|
+
return _swiftPart;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
50
|
+
return _swiftPart.getMemorySize();
|
|
51
|
+
}
|
|
52
|
+
void dispose() noexcept override {
|
|
53
|
+
_swiftPart.dispose();
|
|
54
|
+
}
|
|
55
|
+
std::string toString() override {
|
|
56
|
+
return _swiftPart.toString();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public:
|
|
60
|
+
// Properties
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
// Methods
|
|
65
|
+
inline std::shared_ptr<Promise<bool>> isPasswordProtected(const std::string& file) override {
|
|
66
|
+
auto __result = _swiftPart.isPasswordProtected(file);
|
|
67
|
+
if (__result.hasError()) [[unlikely]] {
|
|
68
|
+
std::rethrow_exception(__result.error());
|
|
69
|
+
}
|
|
70
|
+
auto __value = std::move(__result.value());
|
|
71
|
+
return __value;
|
|
72
|
+
}
|
|
73
|
+
inline std::shared_ptr<Promise<std::string>> unzip(const std::string& from, const std::string& to) override {
|
|
74
|
+
auto __result = _swiftPart.unzip(from, to);
|
|
75
|
+
if (__result.hasError()) [[unlikely]] {
|
|
76
|
+
std::rethrow_exception(__result.error());
|
|
77
|
+
}
|
|
78
|
+
auto __value = std::move(__result.value());
|
|
79
|
+
return __value;
|
|
80
|
+
}
|
|
81
|
+
inline std::shared_ptr<Promise<std::string>> unzipWithPassword(const std::string& from, const std::string& to, const std::string& password) override {
|
|
82
|
+
auto __result = _swiftPart.unzipWithPassword(from, to, password);
|
|
83
|
+
if (__result.hasError()) [[unlikely]] {
|
|
84
|
+
std::rethrow_exception(__result.error());
|
|
85
|
+
}
|
|
86
|
+
auto __value = std::move(__result.value());
|
|
87
|
+
return __value;
|
|
88
|
+
}
|
|
89
|
+
inline std::shared_ptr<Promise<std::string>> zipFolder(const std::string& from, const std::string& to) override {
|
|
90
|
+
auto __result = _swiftPart.zipFolder(from, to);
|
|
91
|
+
if (__result.hasError()) [[unlikely]] {
|
|
92
|
+
std::rethrow_exception(__result.error());
|
|
93
|
+
}
|
|
94
|
+
auto __value = std::move(__result.value());
|
|
95
|
+
return __value;
|
|
96
|
+
}
|
|
97
|
+
inline std::shared_ptr<Promise<std::string>> zipFiles(const std::vector<std::string>& files, const std::string& to) override {
|
|
98
|
+
auto __result = _swiftPart.zipFiles(files, to);
|
|
99
|
+
if (__result.hasError()) [[unlikely]] {
|
|
100
|
+
std::rethrow_exception(__result.error());
|
|
101
|
+
}
|
|
102
|
+
auto __value = std::move(__result.value());
|
|
103
|
+
return __value;
|
|
104
|
+
}
|
|
105
|
+
inline std::shared_ptr<Promise<double>> getUncompressedSize(const std::string& path) override {
|
|
106
|
+
auto __result = _swiftPart.getUncompressedSize(path);
|
|
107
|
+
if (__result.hasError()) [[unlikely]] {
|
|
108
|
+
std::rethrow_exception(__result.error());
|
|
109
|
+
}
|
|
110
|
+
auto __value = std::move(__result.value());
|
|
111
|
+
return __value;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private:
|
|
115
|
+
ReactNativeZipArchive::HybridReactNativeZipArchiveSpec_cxx _swiftPart;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
} // namespace margelo::nitro::reactnativeziparchive
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_bool.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
|
+
* Wraps a Swift `(_ value: Bool) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_bool {
|
|
16
|
+
public typealias bridge = margelo.nitro.reactnativeziparchive.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ value: Bool) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ value: Bool) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(value: Bool) -> Void {
|
|
26
|
+
self.closure(value)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_bool`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_bool>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_bool {
|
|
45
|
+
return Unmanaged<Func_void_bool>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_double.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
|
+
* Wraps a Swift `(_ value: Double) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_double {
|
|
16
|
+
public typealias bridge = margelo.nitro.reactnativeziparchive.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ value: Double) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ value: Double) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(value: Double) -> Void {
|
|
26
|
+
self.closure(value)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_double`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_double>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_double {
|
|
45
|
+
return Unmanaged<Func_void_double>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__exception_ptr.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
|
+
* Wraps a Swift `(_ error: Error) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_std__exception_ptr {
|
|
16
|
+
public typealias bridge = margelo.nitro.reactnativeziparchive.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ error: Error) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ error: Error) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(error: std.exception_ptr) -> Void {
|
|
26
|
+
self.closure(RuntimeError.from(cppError: error))
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
|
|
45
|
+
return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__string.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
|
+
* Wraps a Swift `(_ value: String) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_std__string {
|
|
16
|
+
public typealias bridge = margelo.nitro.reactnativeziparchive.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ value: String) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ value: String) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(value: std.string) -> Void {
|
|
26
|
+
self.closure(String(value))
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_std__string`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__string>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__string {
|
|
45
|
+
return Unmanaged<Func_void_std__string>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|