From 8b230ec2715f2503cd1c6bd1c8ad06bd990fe6db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=E1=BA=A3o=20H=C3=A0?= Date: Sat, 21 Dec 2024 11:08:33 +0700 Subject: [PATCH 1/5] =?UTF-8?q?=E2=9C=A8=20feat:=20Nitro=2020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/package.json | 2 +- example/yarn.lock | 8 +- .../android/c++/JFunc_void_CameraResult.hpp | 2 +- .../android/c++/JFunc_void_CropResult.hpp | 2 +- .../android/c++/JFunc_void_double.hpp | 2 +- .../c++/JFunc_void_std__vector_Result_.hpp | 20 +-- .../MultipleImagePicker-Swift-Cxx-Bridge.cpp | 41 ++++- .../MultipleImagePicker-Swift-Cxx-Bridge.hpp | 91 +++++------ ...MultipleImagePicker-Swift-Cxx-Umbrella.hpp | 6 +- .../ios/MultipleImagePickerAutolinking.swift | 7 +- .../HybridMultipleImagePickerSpecSwift.hpp | 42 +++-- .../ios/swift/Func_void_CameraResult.swift | 46 ++++++ .../ios/swift/Func_void_CropResult.swift | 46 ++++++ .../ios/swift/Func_void_double.swift | 46 ++++++ .../swift/Func_void_std__vector_Result_.swift | 46 ++++++ .../swift/HybridMultipleImagePickerSpec.swift | 53 +++--- ...> HybridMultipleImagePickerSpec_cxx.swift} | 154 +++++++++--------- package.json | 4 +- yarn.lock | 18 +- 19 files changed, 432 insertions(+), 204 deletions(-) create mode 100644 nitrogen/generated/ios/swift/Func_void_CameraResult.swift create mode 100644 nitrogen/generated/ios/swift/Func_void_CropResult.swift create mode 100644 nitrogen/generated/ios/swift/Func_void_double.swift create mode 100644 nitrogen/generated/ios/swift/Func_void_std__vector_Result_.swift rename nitrogen/generated/ios/swift/{HybridMultipleImagePickerSpecCxx.swift => HybridMultipleImagePickerSpec_cxx.swift} (52%) diff --git a/example/package.json b/example/package.json index 165e0a4a..d76bdd94 100644 --- a/example/package.json +++ b/example/package.json @@ -31,7 +31,7 @@ "@react-native/typescript-config": "0.75.2", "@types/react": "~18.2.45", "react-native-builder-bob": "^0.30.0", - "react-native-nitro-modules": "0.18.2", + "react-native-nitro-modules": "0.20.0", "typescript": "^5.1.3" }, "private": true diff --git a/example/yarn.lock b/example/yarn.lock index a215e980..9235f886 100644 --- a/example/yarn.lock +++ b/example/yarn.lock @@ -5414,10 +5414,10 @@ react-native-builder-bob@^0.30.0: which "^2.0.2" yargs "^17.5.1" -react-native-nitro-modules@0.18.2: - version "0.18.2" - resolved "https://registry.yarnpkg.com/react-native-nitro-modules/-/react-native-nitro-modules-0.18.2.tgz#f1172f90ecaded0e4b3306f6e7be4b54a24b310e" - integrity sha512-eHsq1cRfm/Bz1Nq7KctTqxAqhzVSNo0WGX281xARZh+vOq8633Qxn1NHRZ5/Rno2Bla6HOXlUW6RoW0wKM/7kg== +react-native-nitro-modules@0.20.0: + version "0.20.0" + resolved "https://registry.yarnpkg.com/react-native-nitro-modules/-/react-native-nitro-modules-0.20.0.tgz#3c659d4c8cbc8038b1bf35af6475e77023e70ffa" + integrity sha512-u41SaGdQ/EQFuRLFPRQ+cbEemzsARmkElXErwZlXJhr2KYmVwQMrIYGe69NuMSyvHlw3JTl09SNugt3PXa2vEQ== react-native@0.76.5: version "0.76.5" diff --git a/nitrogen/generated/android/c++/JFunc_void_CameraResult.hpp b/nitrogen/generated/android/c++/JFunc_void_CameraResult.hpp index 4be5fb27..e073966a 100644 --- a/nitrogen/generated/android/c++/JFunc_void_CameraResult.hpp +++ b/nitrogen/generated/android/c++/JFunc_void_CameraResult.hpp @@ -34,7 +34,7 @@ namespace margelo::nitro::multipleimagepicker { public: void call(jni::alias_ref result) { - return _func(result->toCpp()); + _func(result->toCpp()); } public: diff --git a/nitrogen/generated/android/c++/JFunc_void_CropResult.hpp b/nitrogen/generated/android/c++/JFunc_void_CropResult.hpp index 024e3611..24ffce10 100644 --- a/nitrogen/generated/android/c++/JFunc_void_CropResult.hpp +++ b/nitrogen/generated/android/c++/JFunc_void_CropResult.hpp @@ -31,7 +31,7 @@ namespace margelo::nitro::multipleimagepicker { public: void call(jni::alias_ref result) { - return _func(result->toCpp()); + _func(result->toCpp()); } public: diff --git a/nitrogen/generated/android/c++/JFunc_void_double.hpp b/nitrogen/generated/android/c++/JFunc_void_double.hpp index 2f106fda..18d6f497 100644 --- a/nitrogen/generated/android/c++/JFunc_void_double.hpp +++ b/nitrogen/generated/android/c++/JFunc_void_double.hpp @@ -28,7 +28,7 @@ namespace margelo::nitro::multipleimagepicker { public: void call(double reject) { - return _func(reject); + _func(reject); } public: diff --git a/nitrogen/generated/android/c++/JFunc_void_std__vector_Result_.hpp b/nitrogen/generated/android/c++/JFunc_void_std__vector_Result_.hpp index dc9475af..c965e231 100644 --- a/nitrogen/generated/android/c++/JFunc_void_std__vector_Result_.hpp +++ b/nitrogen/generated/android/c++/JFunc_void_std__vector_Result_.hpp @@ -35,16 +35,16 @@ namespace margelo::nitro::multipleimagepicker { public: void call(jni::alias_ref> result) { - return _func([&]() { - size_t __size = result->size(); - std::vector __vector; - __vector.reserve(__size); - for (size_t __i = 0; __i < __size; __i++) { - auto __element = result->getElement(__i); - __vector.push_back(__element->toCpp()); - } - return __vector; - }()); + _func([&]() { + size_t __size = result->size(); + std::vector __vector; + __vector.reserve(__size); + for (size_t __i = 0; __i < __size; __i++) { + auto __element = result->getElement(__i); + __vector.push_back(__element->toCpp()); + } + return __vector; + }()); } public: diff --git a/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Bridge.cpp b/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Bridge.cpp index 88fc3bc2..f8d2f89c 100644 --- a/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Bridge.cpp +++ b/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Bridge.cpp @@ -10,14 +10,45 @@ // Include C++ implementation defined types #include "HybridMultipleImagePickerSpecSwift.hpp" #include "MultipleImagePicker-Swift-Cxx-Umbrella.hpp" -#include namespace margelo::nitro::multipleimagepicker::bridge::swift { + // pragma MARK: std::function& /* result */)> + Func_void_std__vector_Result_ create_Func_void_std__vector_Result_(void* _Nonnull swiftClosureWrapper) { + auto swiftClosure = MultipleImagePicker::Func_void_std__vector_Result_::fromUnsafe(swiftClosureWrapper); + return [swiftClosure = std::move(swiftClosure)](const std::vector& result) mutable -> void { + swiftClosure.call(result); + }; + } + + // pragma MARK: std::function + Func_void_double create_Func_void_double(void* _Nonnull swiftClosureWrapper) { + auto swiftClosure = MultipleImagePicker::Func_void_double::fromUnsafe(swiftClosureWrapper); + return [swiftClosure = std::move(swiftClosure)](double reject) mutable -> void { + swiftClosure.call(reject); + }; + } + + // pragma MARK: std::function + Func_void_CropResult create_Func_void_CropResult(void* _Nonnull swiftClosureWrapper) { + auto swiftClosure = MultipleImagePicker::Func_void_CropResult::fromUnsafe(swiftClosureWrapper); + return [swiftClosure = std::move(swiftClosure)](const CropResult& result) mutable -> void { + swiftClosure.call(result); + }; + } + + // pragma MARK: std::function + Func_void_CameraResult create_Func_void_CameraResult(void* _Nonnull swiftClosureWrapper) { + auto swiftClosure = MultipleImagePicker::Func_void_CameraResult::fromUnsafe(swiftClosureWrapper); + return [swiftClosure = std::move(swiftClosure)](const CameraResult& result) mutable -> void { + swiftClosure.call(result); + }; + } + // pragma MARK: std::shared_ptr std::shared_ptr create_std__shared_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_(void* _Nonnull swiftUnsafePointer) { - MultipleImagePicker::HybridMultipleImagePickerSpecCxx swiftPart = MultipleImagePicker::HybridMultipleImagePickerSpecCxxUnsafe::fromUnsafe(swiftUnsafePointer); - return HybridContext::getOrCreate(swiftPart); + MultipleImagePicker::HybridMultipleImagePickerSpec_cxx swiftPart = MultipleImagePicker::HybridMultipleImagePickerSpec_cxx::fromUnsafe(swiftUnsafePointer); + return std::make_shared(swiftPart); } void* _Nonnull get_std__shared_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_(std__shared_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_ cppType) { std::shared_ptr swiftWrapper = std::dynamic_pointer_cast(cppType); @@ -26,8 +57,8 @@ namespace margelo::nitro::multipleimagepicker::bridge::swift { throw std::runtime_error("Class \"HybridMultipleImagePickerSpec\" is not implemented in Swift!"); } #endif - MultipleImagePicker::HybridMultipleImagePickerSpecCxx swiftPart = swiftWrapper->getSwiftPart(); - return MultipleImagePicker::HybridMultipleImagePickerSpecCxxUnsafe::toUnsafe(swiftPart); + MultipleImagePicker::HybridMultipleImagePickerSpec_cxx swiftPart = swiftWrapper->getSwiftPart(); + return swiftPart.toUnsafe(); } } // namespace margelo::nitro::multipleimagepicker::bridge::swift diff --git a/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Bridge.hpp b/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Bridge.hpp index 2d109b33..6fe4b492 100644 --- a/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Bridge.hpp +++ b/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Bridge.hpp @@ -32,8 +32,8 @@ namespace margelo::nitro::multipleimagepicker { struct Result; } namespace margelo::nitro::multipleimagepicker { struct Text; } // Forward declarations of Swift defined types -// Forward declaration of `HybridMultipleImagePickerSpecCxx` to properly resolve imports. -namespace MultipleImagePicker { class HybridMultipleImagePickerSpecCxx; } +// Forward declaration of `HybridMultipleImagePickerSpec_cxx` to properly resolve imports. +namespace MultipleImagePicker { class HybridMultipleImagePickerSpec_cxx; } // Include C++ defined types #include "CameraDevice.hpp" @@ -47,6 +47,8 @@ namespace MultipleImagePicker { class HybridMultipleImagePickerSpecCxx; } #include "Result.hpp" #include "ResultType.hpp" #include "Text.hpp" +#include +#include #include #include #include @@ -163,22 +165,16 @@ namespace margelo::nitro::multipleimagepicker::bridge::swift { */ class Func_void_std__vector_Result__Wrapper final { public: - explicit Func_void_std__vector_Result__Wrapper(const std::function& /* result */)>& func): _function(func) {} - explicit Func_void_std__vector_Result__Wrapper(std::function& /* result */)>&& func): _function(std::move(func)) {} + explicit Func_void_std__vector_Result__Wrapper(std::function& /* result */)>&& func): _function(std::make_shared& /* result */)>>(std::move(func))) {} inline void call(std::vector result) const { - _function(result); + _function->operator()(result); } private: - std::function& /* result */)> _function; + std::shared_ptr& /* result */)>> _function; }; - inline Func_void_std__vector_Result_ create_Func_void_std__vector_Result_(void* _Nonnull closureHolder, void(* _Nonnull call)(void* _Nonnull /* closureHolder */, std::vector), void(* _Nonnull destroy)(void* _Nonnull)) { - std::shared_ptr sharedClosureHolder(closureHolder, destroy); - return Func_void_std__vector_Result_([sharedClosureHolder, call](const std::vector& result) -> void { - call(sharedClosureHolder.get(), result); - }); - } - inline std::shared_ptr share_Func_void_std__vector_Result_(const Func_void_std__vector_Result_& value) { - return std::make_shared(value); + Func_void_std__vector_Result_ create_Func_void_std__vector_Result_(void* _Nonnull swiftClosureWrapper); + inline Func_void_std__vector_Result__Wrapper wrap_Func_void_std__vector_Result_(Func_void_std__vector_Result_ value) { + return Func_void_std__vector_Result__Wrapper(std::move(value)); } // pragma MARK: std::function @@ -191,22 +187,16 @@ namespace margelo::nitro::multipleimagepicker::bridge::swift { */ class Func_void_double_Wrapper final { public: - explicit Func_void_double_Wrapper(const std::function& func): _function(func) {} - explicit Func_void_double_Wrapper(std::function&& func): _function(std::move(func)) {} + explicit Func_void_double_Wrapper(std::function&& func): _function(std::make_shared>(std::move(func))) {} inline void call(double reject) const { - _function(reject); + _function->operator()(reject); } private: - std::function _function; + std::shared_ptr> _function; }; - inline Func_void_double create_Func_void_double(void* _Nonnull closureHolder, void(* _Nonnull call)(void* _Nonnull /* closureHolder */, double), void(* _Nonnull destroy)(void* _Nonnull)) { - std::shared_ptr sharedClosureHolder(closureHolder, destroy); - return Func_void_double([sharedClosureHolder, call](double reject) -> void { - call(sharedClosureHolder.get(), reject); - }); - } - inline std::shared_ptr share_Func_void_double(const Func_void_double& value) { - return std::make_shared(value); + Func_void_double create_Func_void_double(void* _Nonnull swiftClosureWrapper); + inline Func_void_double_Wrapper wrap_Func_void_double(Func_void_double value) { + return Func_void_double_Wrapper(std::move(value)); } // pragma MARK: std::function @@ -219,22 +209,16 @@ namespace margelo::nitro::multipleimagepicker::bridge::swift { */ class Func_void_CropResult_Wrapper final { public: - explicit Func_void_CropResult_Wrapper(const std::function& func): _function(func) {} - explicit Func_void_CropResult_Wrapper(std::function&& func): _function(std::move(func)) {} + explicit Func_void_CropResult_Wrapper(std::function&& func): _function(std::make_shared>(std::move(func))) {} inline void call(CropResult result) const { - _function(result); + _function->operator()(result); } private: - std::function _function; + std::shared_ptr> _function; }; - inline Func_void_CropResult create_Func_void_CropResult(void* _Nonnull closureHolder, void(* _Nonnull call)(void* _Nonnull /* closureHolder */, CropResult), void(* _Nonnull destroy)(void* _Nonnull)) { - std::shared_ptr sharedClosureHolder(closureHolder, destroy); - return Func_void_CropResult([sharedClosureHolder, call](const CropResult& result) -> void { - call(sharedClosureHolder.get(), result); - }); - } - inline std::shared_ptr share_Func_void_CropResult(const Func_void_CropResult& value) { - return std::make_shared(value); + Func_void_CropResult create_Func_void_CropResult(void* _Nonnull swiftClosureWrapper); + inline Func_void_CropResult_Wrapper wrap_Func_void_CropResult(Func_void_CropResult value) { + return Func_void_CropResult_Wrapper(std::move(value)); } // pragma MARK: std::vector @@ -258,22 +242,16 @@ namespace margelo::nitro::multipleimagepicker::bridge::swift { */ class Func_void_CameraResult_Wrapper final { public: - explicit Func_void_CameraResult_Wrapper(const std::function& func): _function(func) {} - explicit Func_void_CameraResult_Wrapper(std::function&& func): _function(std::move(func)) {} + explicit Func_void_CameraResult_Wrapper(std::function&& func): _function(std::make_shared>(std::move(func))) {} inline void call(CameraResult result) const { - _function(result); + _function->operator()(result); } private: - std::function _function; + std::shared_ptr> _function; }; - inline Func_void_CameraResult create_Func_void_CameraResult(void* _Nonnull closureHolder, void(* _Nonnull call)(void* _Nonnull /* closureHolder */, CameraResult), void(* _Nonnull destroy)(void* _Nonnull)) { - std::shared_ptr sharedClosureHolder(closureHolder, destroy); - return Func_void_CameraResult([sharedClosureHolder, call](const CameraResult& result) -> void { - call(sharedClosureHolder.get(), result); - }); - } - inline std::shared_ptr share_Func_void_CameraResult(const Func_void_CameraResult& value) { - return std::make_shared(value); + Func_void_CameraResult create_Func_void_CameraResult(void* _Nonnull swiftClosureWrapper); + inline Func_void_CameraResult_Wrapper wrap_Func_void_CameraResult(Func_void_CameraResult value) { + return Func_void_CameraResult_Wrapper(std::move(value)); } // pragma MARK: std::shared_ptr @@ -283,5 +261,18 @@ namespace margelo::nitro::multipleimagepicker::bridge::swift { using std__shared_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_ = std::shared_ptr; std::shared_ptr create_std__shared_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_(void* _Nonnull swiftUnsafePointer); void* _Nonnull get_std__shared_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_(std__shared_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_ cppType); + + // pragma MARK: std::weak_ptr + using std__weak_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_ = std::weak_ptr; + inline std__weak_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_ weakify_std__shared_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_(const std::shared_ptr& strong) { return strong; } + + // pragma MARK: Result + using Result_void_ = Result; + inline Result_void_ create_Result_void_() { + return Result::withValue(); + } + inline Result_void_ create_Result_void_(const std::exception_ptr& error) { + return Result::withError(error); + } } // namespace margelo::nitro::multipleimagepicker::bridge::swift diff --git a/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Umbrella.hpp b/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Umbrella.hpp index fc293efb..0f3f7d08 100644 --- a/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Umbrella.hpp +++ b/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Umbrella.hpp @@ -73,6 +73,8 @@ namespace margelo::nitro::multipleimagepicker { enum class Theme; } #include "SelectMode.hpp" #include "Text.hpp" #include "Theme.hpp" +#include +#include #include #include #include @@ -89,8 +91,8 @@ namespace margelo::nitro::multipleimagepicker { enum class Theme; } #include // Forward declarations of Swift defined types -// Forward declaration of `HybridMultipleImagePickerSpecCxx` to properly resolve imports. -namespace MultipleImagePicker { class HybridMultipleImagePickerSpecCxx; } +// Forward declaration of `HybridMultipleImagePickerSpec_cxx` to properly resolve imports. +namespace MultipleImagePicker { class HybridMultipleImagePickerSpec_cxx; } // Include Swift defined types #if __has_include("MultipleImagePicker-Swift.h") diff --git a/nitrogen/generated/ios/MultipleImagePickerAutolinking.swift b/nitrogen/generated/ios/MultipleImagePickerAutolinking.swift index 17bb4311..ebf15ae1 100644 --- a/nitrogen/generated/ios/MultipleImagePickerAutolinking.swift +++ b/nitrogen/generated/ios/MultipleImagePickerAutolinking.swift @@ -10,7 +10,7 @@ public final class MultipleImagePickerAutolinking { /** * Creates an instance of a Swift class that implements `HybridMultipleImagePickerSpec`, - * and wraps it in a Swift class that can directly interop with C++ (`HybridMultipleImagePickerSpecCxx`) + * and wraps it in a Swift class that can directly interop with C++ (`HybridMultipleImagePickerSpec_cxx`) * * This is generated by Nitrogen and will initialize the class specified * in the `"autolinking"` property of `nitro.json` (in this case, `HybridMultipleImagePicker`). @@ -18,9 +18,8 @@ public final class MultipleImagePickerAutolinking { public static func createMultipleImagePicker() -> bridge.std__shared_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_ { let hybridObject = HybridMultipleImagePicker() return { () -> bridge.std__shared_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_ in - let __cxxWrapped = HybridMultipleImagePickerSpecCxx(hybridObject) - let __pointer = HybridMultipleImagePickerSpecCxxUnsafe.toUnsafe(__cxxWrapped) - return bridge.create_std__shared_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_(__pointer) + let __cxxWrapped = hybridObject.getCxxWrapper() + return __cxxWrapped.getCxxPart() }() } } diff --git a/nitrogen/generated/ios/c++/HybridMultipleImagePickerSpecSwift.hpp b/nitrogen/generated/ios/c++/HybridMultipleImagePickerSpecSwift.hpp index 5d333b30..0fb974f3 100644 --- a/nitrogen/generated/ios/c++/HybridMultipleImagePickerSpecSwift.hpp +++ b/nitrogen/generated/ios/c++/HybridMultipleImagePickerSpecSwift.hpp @@ -9,8 +9,8 @@ #include "HybridMultipleImagePickerSpec.hpp" -// Forward declaration of `HybridMultipleImagePickerSpecCxx` to properly resolve imports. -namespace MultipleImagePicker { class HybridMultipleImagePickerSpecCxx; } +// Forward declaration of `HybridMultipleImagePickerSpec_cxx` to properly resolve imports. +namespace MultipleImagePicker { class HybridMultipleImagePickerSpec_cxx; } // Forward declaration of `NitroConfig` to properly resolve imports. namespace margelo::nitro::multipleimagepicker { struct NitroConfig; } @@ -78,36 +78,30 @@ namespace margelo::nitro::multipleimagepicker { struct CameraResult; } #include "NitroCameraConfig.hpp" #include "CameraResult.hpp" -#if __has_include() -#include -#else -#error NitroModules cannot be found! Are you sure you installed NitroModules properly? -#endif - #include "MultipleImagePicker-Swift-Cxx-Umbrella.hpp" namespace margelo::nitro::multipleimagepicker { /** - * The C++ part of HybridMultipleImagePickerSpecCxx.swift. + * The C++ part of HybridMultipleImagePickerSpec_cxx.swift. * - * HybridMultipleImagePickerSpecSwift (C++) accesses HybridMultipleImagePickerSpecCxx (Swift), and might + * HybridMultipleImagePickerSpecSwift (C++) accesses HybridMultipleImagePickerSpec_cxx (Swift), and might * contain some additional bridging code for C++ <> Swift interop. * * Since this obviously introduces an overhead, I hope at some point in - * the future, HybridMultipleImagePickerSpecCxx can directly inherit from the C++ class HybridMultipleImagePickerSpec + * the future, HybridMultipleImagePickerSpec_cxx can directly inherit from the C++ class HybridMultipleImagePickerSpec * to simplify the whole structure and memory management. */ class HybridMultipleImagePickerSpecSwift: public virtual HybridMultipleImagePickerSpec { public: // Constructor from a Swift instance - explicit HybridMultipleImagePickerSpecSwift(const MultipleImagePicker::HybridMultipleImagePickerSpecCxx& swiftPart): + explicit HybridMultipleImagePickerSpecSwift(const MultipleImagePicker::HybridMultipleImagePickerSpec_cxx& swiftPart): HybridObject(HybridMultipleImagePickerSpec::TAG), _swiftPart(swiftPart) { } public: // Get the Swift part - inline MultipleImagePicker::HybridMultipleImagePickerSpecCxx getSwiftPart() noexcept { return _swiftPart; } + inline MultipleImagePicker::HybridMultipleImagePickerSpec_cxx getSwiftPart() noexcept { return _swiftPart; } public: // Get memory pressure @@ -122,20 +116,32 @@ namespace margelo::nitro::multipleimagepicker { public: // Methods inline void openPicker(const NitroConfig& config, const std::function& /* result */)>& resolved, const std::function& rejected) override { - _swiftPart.openPicker(config, resolved, rejected); + auto __result = _swiftPart.openPicker(config, resolved, rejected); + if (__result.hasError()) [[unlikely]] { + std::rethrow_exception(__result.error()); + } } inline void openCrop(const std::string& image, const NitroCropConfig& config, const std::function& resolved, const std::function& rejected) override { - _swiftPart.openCrop(image, config, resolved, rejected); + auto __result = _swiftPart.openCrop(image, config, resolved, rejected); + if (__result.hasError()) [[unlikely]] { + std::rethrow_exception(__result.error()); + } } inline void openPreview(const std::vector& media, double index, const NitroPreviewConfig& config) override { - _swiftPart.openPreview(media, std::forward(index), config); + auto __result = _swiftPart.openPreview(media, std::forward(index), config); + if (__result.hasError()) [[unlikely]] { + std::rethrow_exception(__result.error()); + } } inline void openCamera(const NitroCameraConfig& config, const std::function& resolved, const std::function& rejected) override { - _swiftPart.openCamera(config, resolved, rejected); + auto __result = _swiftPart.openCamera(config, resolved, rejected); + if (__result.hasError()) [[unlikely]] { + std::rethrow_exception(__result.error()); + } } private: - MultipleImagePicker::HybridMultipleImagePickerSpecCxx _swiftPart; + MultipleImagePicker::HybridMultipleImagePickerSpec_cxx _swiftPart; }; } // namespace margelo::nitro::multipleimagepicker diff --git a/nitrogen/generated/ios/swift/Func_void_CameraResult.swift b/nitrogen/generated/ios/swift/Func_void_CameraResult.swift new file mode 100644 index 00000000..89de9454 --- /dev/null +++ b/nitrogen/generated/ios/swift/Func_void_CameraResult.swift @@ -0,0 +1,46 @@ +/// +/// Func_void_CameraResult.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2024 Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Wraps a Swift `((_ result: CameraResult) -> Void)` as a class. + * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. + */ +public final class Func_void_CameraResult { + public typealias bridge = margelo.nitro.multipleimagepicker.bridge.swift + + private let closure: ((_ result: CameraResult) -> Void) + + public init(_ closure: @escaping ((_ result: CameraResult) -> Void)) { + self.closure = closure + } + + @inline(__always) + public func call(result: CameraResult) -> Void { + self.closure(result) + } + + /** + * Casts this instance to a retained unsafe raw pointer. + * This acquires one additional strong reference on the object! + */ + @inline(__always) + public func toUnsafe() -> UnsafeMutableRawPointer { + return Unmanaged.passRetained(self).toOpaque() + } + + /** + * Casts an unsafe pointer to a `Func_void_CameraResult`. + * The pointer has to be a retained opaque `Unmanaged`. + * This removes one strong reference from the object! + */ + @inline(__always) + public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_CameraResult { + return Unmanaged.fromOpaque(pointer).takeRetainedValue() + } +} diff --git a/nitrogen/generated/ios/swift/Func_void_CropResult.swift b/nitrogen/generated/ios/swift/Func_void_CropResult.swift new file mode 100644 index 00000000..c174ecaa --- /dev/null +++ b/nitrogen/generated/ios/swift/Func_void_CropResult.swift @@ -0,0 +1,46 @@ +/// +/// Func_void_CropResult.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2024 Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Wraps a Swift `((_ result: CropResult) -> Void)` as a class. + * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. + */ +public final class Func_void_CropResult { + public typealias bridge = margelo.nitro.multipleimagepicker.bridge.swift + + private let closure: ((_ result: CropResult) -> Void) + + public init(_ closure: @escaping ((_ result: CropResult) -> Void)) { + self.closure = closure + } + + @inline(__always) + public func call(result: CropResult) -> Void { + self.closure(result) + } + + /** + * Casts this instance to a retained unsafe raw pointer. + * This acquires one additional strong reference on the object! + */ + @inline(__always) + public func toUnsafe() -> UnsafeMutableRawPointer { + return Unmanaged.passRetained(self).toOpaque() + } + + /** + * Casts an unsafe pointer to a `Func_void_CropResult`. + * The pointer has to be a retained opaque `Unmanaged`. + * This removes one strong reference from the object! + */ + @inline(__always) + public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_CropResult { + return Unmanaged.fromOpaque(pointer).takeRetainedValue() + } +} diff --git a/nitrogen/generated/ios/swift/Func_void_double.swift b/nitrogen/generated/ios/swift/Func_void_double.swift new file mode 100644 index 00000000..b9d1a3ed --- /dev/null +++ b/nitrogen/generated/ios/swift/Func_void_double.swift @@ -0,0 +1,46 @@ +/// +/// Func_void_double.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2024 Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Wraps a Swift `((_ reject: Double) -> Void)` as a class. + * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. + */ +public final class Func_void_double { + public typealias bridge = margelo.nitro.multipleimagepicker.bridge.swift + + private let closure: ((_ reject: Double) -> Void) + + public init(_ closure: @escaping ((_ reject: Double) -> Void)) { + self.closure = closure + } + + @inline(__always) + public func call(reject: Double) -> Void { + self.closure(reject) + } + + /** + * Casts this instance to a retained unsafe raw pointer. + * This acquires one additional strong reference on the object! + */ + @inline(__always) + public func toUnsafe() -> UnsafeMutableRawPointer { + return Unmanaged.passRetained(self).toOpaque() + } + + /** + * Casts an unsafe pointer to a `Func_void_double`. + * The pointer has to be a retained opaque `Unmanaged`. + * This removes one strong reference from the object! + */ + @inline(__always) + public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_double { + return Unmanaged.fromOpaque(pointer).takeRetainedValue() + } +} diff --git a/nitrogen/generated/ios/swift/Func_void_std__vector_Result_.swift b/nitrogen/generated/ios/swift/Func_void_std__vector_Result_.swift new file mode 100644 index 00000000..d313faa6 --- /dev/null +++ b/nitrogen/generated/ios/swift/Func_void_std__vector_Result_.swift @@ -0,0 +1,46 @@ +/// +/// Func_void_std__vector_Result_.swift +/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. +/// https://github.com/mrousavy/nitro +/// Copyright © 2024 Marc Rousavy @ Margelo +/// + +import NitroModules + +/** + * Wraps a Swift `((_ result: [Result]) -> Void)` as a class. + * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. + */ +public final class Func_void_std__vector_Result_ { + public typealias bridge = margelo.nitro.multipleimagepicker.bridge.swift + + private let closure: ((_ result: [Result]) -> Void) + + public init(_ closure: @escaping ((_ result: [Result]) -> Void)) { + self.closure = closure + } + + @inline(__always) + public func call(result: bridge.std__vector_Result_) -> Void { + self.closure(result.map({ __item in __item })) + } + + /** + * Casts this instance to a retained unsafe raw pointer. + * This acquires one additional strong reference on the object! + */ + @inline(__always) + public func toUnsafe() -> UnsafeMutableRawPointer { + return Unmanaged.passRetained(self).toOpaque() + } + + /** + * Casts an unsafe pointer to a `Func_void_std__vector_Result_`. + * The pointer has to be a retained opaque `Unmanaged`. + * This removes one strong reference from the object! + */ + @inline(__always) + public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_Result_ { + return Unmanaged.fromOpaque(pointer).takeRetainedValue() + } +} diff --git a/nitrogen/generated/ios/swift/HybridMultipleImagePickerSpec.swift b/nitrogen/generated/ios/swift/HybridMultipleImagePickerSpec.swift index a394edf9..df6cf6f5 100644 --- a/nitrogen/generated/ios/swift/HybridMultipleImagePickerSpec.swift +++ b/nitrogen/generated/ios/swift/HybridMultipleImagePickerSpec.swift @@ -8,26 +8,8 @@ import Foundation import NitroModules -/** - * A Swift protocol representing the MultipleImagePicker HybridObject. - * Implement this protocol to create Swift-based instances of MultipleImagePicker. - * - * When implementing this protocol, make sure to initialize `hybridContext` - example: - * ``` - * public class HybridMultipleImagePicker : HybridMultipleImagePickerSpec { - * // Initialize HybridContext - * var hybridContext = margelo.nitro.HybridContext() - * - * // Return size of the instance to inform JS GC about memory pressure - * var memorySize: Int { - * return getSizeOf(self) - * } - * - * // ... - * } - * ``` - */ -public protocol HybridMultipleImagePickerSpec: AnyObject, HybridObjectSpec { +/// See ``HybridMultipleImagePickerSpec`` +public protocol HybridMultipleImagePickerSpec_protocol: AnyObject { // Properties @@ -37,3 +19,34 @@ public protocol HybridMultipleImagePickerSpec: AnyObject, HybridObjectSpec { func openPreview(media: [MediaPreview], index: Double, config: NitroPreviewConfig) throws -> Void func openCamera(config: NitroCameraConfig, resolved: @escaping ((_ result: CameraResult) -> Void), rejected: @escaping ((_ reject: Double) -> Void)) throws -> Void } + +/// See ``HybridMultipleImagePickerSpec`` +public class HybridMultipleImagePickerSpec_base: HybridObjectSpec { + private weak var cxxWrapper: HybridMultipleImagePickerSpec_cxx? = nil + public func getCxxWrapper() -> HybridMultipleImagePickerSpec_cxx { + #if DEBUG + guard self is HybridMultipleImagePickerSpec else { + fatalError("`self` is not a `HybridMultipleImagePickerSpec`! Did you accidentally inherit from `HybridMultipleImagePickerSpec_base` instead of `HybridMultipleImagePickerSpec`?") + } + #endif + if let cxxWrapper = self.cxxWrapper { + return cxxWrapper + } else { + let cxxWrapper = HybridMultipleImagePickerSpec_cxx(self as! HybridMultipleImagePickerSpec) + self.cxxWrapper = cxxWrapper + return cxxWrapper + } + } + public var memorySize: Int { return 0 } +} + +/** + * A Swift base-protocol representing the MultipleImagePicker HybridObject. + * Implement this protocol to create Swift-based instances of MultipleImagePicker. + * ```swift + * class HybridMultipleImagePicker : HybridMultipleImagePickerSpec { + * // ... + * } + * ``` + */ +public typealias HybridMultipleImagePickerSpec = HybridMultipleImagePickerSpec_protocol & HybridMultipleImagePickerSpec_base diff --git a/nitrogen/generated/ios/swift/HybridMultipleImagePickerSpecCxx.swift b/nitrogen/generated/ios/swift/HybridMultipleImagePickerSpec_cxx.swift similarity index 52% rename from nitrogen/generated/ios/swift/HybridMultipleImagePickerSpecCxx.swift rename to nitrogen/generated/ios/swift/HybridMultipleImagePickerSpec_cxx.swift index e4035bcf..460744ef 100644 --- a/nitrogen/generated/ios/swift/HybridMultipleImagePickerSpecCxx.swift +++ b/nitrogen/generated/ios/swift/HybridMultipleImagePickerSpec_cxx.swift @@ -1,5 +1,5 @@ /// -/// HybridMultipleImagePickerSpecCxx.swift +/// HybridMultipleImagePickerSpec_cxx.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -8,30 +8,6 @@ import Foundation import NitroModules -/** - * Helper class for converting instances of `HybridMultipleImagePickerSpecCxx` from- and to unsafe pointers. - * This is useful to pass Swift classes to C++, without having to strongly type the C++ function signature. - * The actual Swift type can be included in the .cpp file, without having to forward-declare anything in .hpp. - */ -public final class HybridMultipleImagePickerSpecCxxUnsafe { - /** - * Casts a `HybridMultipleImagePickerSpecCxx` instance to a retained unsafe raw pointer. - * This acquires one additional strong reference on the object! - */ - public static func toUnsafe(_ instance: HybridMultipleImagePickerSpecCxx) -> UnsafeMutableRawPointer { - return Unmanaged.passRetained(instance).toOpaque() - } - - /** - * Casts an unsafe pointer to a `HybridMultipleImagePickerSpecCxx`. - * The pointer has to be a retained opaque `Unmanaged`. - * This removes one strong reference from the object! - */ - public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridMultipleImagePickerSpecCxx { - return Unmanaged.fromOpaque(pointer).takeRetainedValue() - } -} - /** * A class implementation that bridges HybridMultipleImagePickerSpec over to C++. * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined. @@ -41,7 +17,7 @@ public final class HybridMultipleImagePickerSpecCxxUnsafe { * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper * - Throwing methods need to be wrapped with a Result type, as exceptions cannot be propagated to C++ */ -public class HybridMultipleImagePickerSpecCxx { +public class HybridMultipleImagePickerSpec_cxx { /** * The Swift <> C++ bridge's namespace (`margelo::nitro::multipleimagepicker::bridge::swift`) * from `MultipleImagePicker-Swift-Cxx-Bridge.hpp`. @@ -55,11 +31,17 @@ public class HybridMultipleImagePickerSpecCxx { private var __implementation: any HybridMultipleImagePickerSpec /** - * Create a new `HybridMultipleImagePickerSpecCxx` that wraps the given `HybridMultipleImagePickerSpec`. + * Holds a weak pointer to the C++ class that wraps the Swift class. + */ + private var __cxxPart: bridge.std__weak_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_ + + /** + * Create a new `HybridMultipleImagePickerSpec_cxx` that wraps the given `HybridMultipleImagePickerSpec`. * All properties and methods bridge to C++ types. */ - public init(_ implementation: some HybridMultipleImagePickerSpec) { + public init(_ implementation: any HybridMultipleImagePickerSpec) { self.__implementation = implementation + self.__cxxPart = .init() /* no base class */ } @@ -72,26 +54,46 @@ public class HybridMultipleImagePickerSpecCxx { } /** - * Contains a (weak) reference to the C++ HybridObject to cache it. + * Casts this instance to a retained unsafe raw pointer. + * This acquires one additional strong reference on the object! */ - public var hybridContext: margelo.nitro.HybridContext { - @inline(__always) - get { - return self.__implementation.hybridContext - } - @inline(__always) - set { - self.__implementation.hybridContext = newValue + public func toUnsafe() -> UnsafeMutableRawPointer { + return Unmanaged.passRetained(self).toOpaque() + } + + /** + * Casts an unsafe pointer to a `HybridMultipleImagePickerSpec_cxx`. + * The pointer has to be a retained opaque `Unmanaged`. + * This removes one strong reference from the object! + */ + public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridMultipleImagePickerSpec_cxx { + return Unmanaged.fromOpaque(pointer).takeRetainedValue() + } + + /** + * Gets (or creates) the C++ part of this Hybrid Object. + * The C++ part is a `std::shared_ptr`. + */ + public func getCxxPart() -> bridge.std__shared_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_ { + let cachedCxxPart = self.__cxxPart.lock() + if cachedCxxPart.__convertToBool() { + return cachedCxxPart + } else { + let newCxxPart = bridge.create_std__shared_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_(self.toUnsafe()) + __cxxPart = bridge.weakify_std__shared_ptr_margelo__nitro__multipleimagepicker__HybridMultipleImagePickerSpec_(newCxxPart) + return newCxxPart } } + + /** * Get the memory size of the Swift class (plus size of any other allocations) * so the JS VM can properly track it and garbage-collect the JS object if needed. */ @inline(__always) public var memorySize: Int { - return self.__implementation.memorySize + return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize } // Properties @@ -99,82 +101,82 @@ public class HybridMultipleImagePickerSpecCxx { // Methods @inline(__always) - public func openPicker(config: NitroConfig, resolved: bridge.Func_void_std__vector_Result_, rejected: bridge.Func_void_double) -> Void { + public func openPicker(config: NitroConfig, resolved: bridge.Func_void_std__vector_Result_, rejected: bridge.Func_void_double) -> bridge.Result_void_ { do { try self.__implementation.openPicker(config: config, resolved: { () -> (([Result]) -> Void) in - let __sharedClosure = bridge.share_Func_void_std__vector_Result_(resolved) + let __wrappedFunction = bridge.wrap_Func_void_std__vector_Result_(resolved) return { (__result: [Result]) -> Void in - __sharedClosure.pointee.call({ () -> bridge.std__vector_Result_ in - var __vector = bridge.create_std__vector_Result_(__result.count) - for __item in __result { - __vector.push_back(__item) - } - return __vector - }()) + __wrappedFunction.call({ () -> bridge.std__vector_Result_ in + var __vector = bridge.create_std__vector_Result_(__result.count) + for __item in __result { + __vector.push_back(__item) + } + return __vector + }()) } }(), rejected: { () -> ((Double) -> Void) in - let __sharedClosure = bridge.share_Func_void_double(rejected) + let __wrappedFunction = bridge.wrap_Func_void_double(rejected) return { (__reject: Double) -> Void in - __sharedClosure.pointee.call(__reject) + __wrappedFunction.call(__reject) } }()) - return - } catch { - let __message = "\(error.localizedDescription)" - fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))") + return bridge.create_Result_void_() + } catch (let __error) { + let __exceptionPtr = __error.toCpp() + return bridge.create_Result_void_(__exceptionPtr) } } @inline(__always) - public func openCrop(image: std.string, config: NitroCropConfig, resolved: bridge.Func_void_CropResult, rejected: bridge.Func_void_double) -> Void { + public func openCrop(image: std.string, config: NitroCropConfig, resolved: bridge.Func_void_CropResult, rejected: bridge.Func_void_double) -> bridge.Result_void_ { do { try self.__implementation.openCrop(image: String(image), config: config, resolved: { () -> ((CropResult) -> Void) in - let __sharedClosure = bridge.share_Func_void_CropResult(resolved) + let __wrappedFunction = bridge.wrap_Func_void_CropResult(resolved) return { (__result: CropResult) -> Void in - __sharedClosure.pointee.call(__result) + __wrappedFunction.call(__result) } }(), rejected: { () -> ((Double) -> Void) in - let __sharedClosure = bridge.share_Func_void_double(rejected) + let __wrappedFunction = bridge.wrap_Func_void_double(rejected) return { (__reject: Double) -> Void in - __sharedClosure.pointee.call(__reject) + __wrappedFunction.call(__reject) } }()) - return - } catch { - let __message = "\(error.localizedDescription)" - fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))") + return bridge.create_Result_void_() + } catch (let __error) { + let __exceptionPtr = __error.toCpp() + return bridge.create_Result_void_(__exceptionPtr) } } @inline(__always) - public func openPreview(media: bridge.std__vector_MediaPreview_, index: Double, config: NitroPreviewConfig) -> Void { + public func openPreview(media: bridge.std__vector_MediaPreview_, index: Double, config: NitroPreviewConfig) -> bridge.Result_void_ { do { try self.__implementation.openPreview(media: media.map({ __item in __item }), index: index, config: config) - return - } catch { - let __message = "\(error.localizedDescription)" - fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))") + return bridge.create_Result_void_() + } catch (let __error) { + let __exceptionPtr = __error.toCpp() + return bridge.create_Result_void_(__exceptionPtr) } } @inline(__always) - public func openCamera(config: NitroCameraConfig, resolved: bridge.Func_void_CameraResult, rejected: bridge.Func_void_double) -> Void { + public func openCamera(config: NitroCameraConfig, resolved: bridge.Func_void_CameraResult, rejected: bridge.Func_void_double) -> bridge.Result_void_ { do { try self.__implementation.openCamera(config: config, resolved: { () -> ((CameraResult) -> Void) in - let __sharedClosure = bridge.share_Func_void_CameraResult(resolved) + let __wrappedFunction = bridge.wrap_Func_void_CameraResult(resolved) return { (__result: CameraResult) -> Void in - __sharedClosure.pointee.call(__result) + __wrappedFunction.call(__result) } }(), rejected: { () -> ((Double) -> Void) in - let __sharedClosure = bridge.share_Func_void_double(rejected) + let __wrappedFunction = bridge.wrap_Func_void_double(rejected) return { (__reject: Double) -> Void in - __sharedClosure.pointee.call(__reject) + __wrappedFunction.call(__reject) } }()) - return - } catch { - let __message = "\(error.localizedDescription)" - fatalError("Swift errors can currently not be propagated to C++! See https://github.com/swiftlang/swift/issues/75290 (Error: \(__message))") + return bridge.create_Result_void_() + } catch (let __error) { + let __exceptionPtr = __error.toCpp() + return bridge.create_Result_void_(__exceptionPtr) } } } diff --git a/package.json b/package.json index 4a35efb0..1aa0dce9 100644 --- a/package.json +++ b/package.json @@ -64,12 +64,12 @@ "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", - "nitro-codegen": "0.18.2", + "nitro-codegen": "0.20.0", "prettier": "^3.3.3", "react": "^18.3.1", "react-native": "^0.75.2", "react-native-builder-bob": "^0.30.0", - "react-native-nitro-modules": "0.18.2", + "react-native-nitro-modules": "0.20.0", "typescript": "^5.5.4" }, "peerDependencies": { diff --git a/yarn.lock b/yarn.lock index 11b9e88c..a6dde3c0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4590,13 +4590,13 @@ neo-async@^2.5.0: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -nitro-codegen@0.18.2: - version "0.18.2" - resolved "https://registry.yarnpkg.com/nitro-codegen/-/nitro-codegen-0.18.2.tgz#cf2087729260e910e2ef582de6dc3c6ac172ab70" - integrity sha512-SMPf7dkb9/kZpXvIRdQojgqqmIVy7sa6DmxhC7kqJyDoXWteTM3b6NMJ4z+Ir4ON5MxbUWLqjRvfjQpQC1tPIw== +nitro-codegen@0.20.0: + version "0.20.0" + resolved "https://registry.yarnpkg.com/nitro-codegen/-/nitro-codegen-0.20.0.tgz#7fdc978ab4148c0899ddf134091f4151c601795b" + integrity sha512-MFPDb4AsY6r/PR6eTAONCoSmi2a9KivOHg3JfQiPa6jtY/mGNujAmYo0LK6UvaPSxkrP69J9tZMJ3ERWaeoCDg== dependencies: chalk "^5.3.0" - react-native-nitro-modules "^0.18.2" + react-native-nitro-modules "^0.20.0" ts-morph "^24.0.0" yargs "^17.7.2" zod "^3.23.8" @@ -5110,10 +5110,10 @@ react-native-builder-bob@^0.30.0: which "^2.0.2" yargs "^17.5.1" -react-native-nitro-modules@0.18.2, react-native-nitro-modules@^0.18.2: - version "0.18.2" - resolved "https://registry.yarnpkg.com/react-native-nitro-modules/-/react-native-nitro-modules-0.18.2.tgz#f1172f90ecaded0e4b3306f6e7be4b54a24b310e" - integrity sha512-eHsq1cRfm/Bz1Nq7KctTqxAqhzVSNo0WGX281xARZh+vOq8633Qxn1NHRZ5/Rno2Bla6HOXlUW6RoW0wKM/7kg== +react-native-nitro-modules@0.20.0, react-native-nitro-modules@^0.20.0: + version "0.20.0" + resolved "https://registry.yarnpkg.com/react-native-nitro-modules/-/react-native-nitro-modules-0.20.0.tgz#3c659d4c8cbc8038b1bf35af6475e77023e70ffa" + integrity sha512-u41SaGdQ/EQFuRLFPRQ+cbEemzsARmkElXErwZlXJhr2KYmVwQMrIYGe69NuMSyvHlw3JTl09SNugt3PXa2vEQ== react-native@^0.75.2: version "0.75.4" From 3ffd67ac0c38cfd5efd5ca25088fa76296a216d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=E1=BA=A3o=20H=C3=A0?= Date: Mon, 23 Dec 2024 11:22:17 +0700 Subject: [PATCH 2/5] =?UTF-8?q?=E2=9C=A8=20feat:=20done=20upgrade=20nitro?= =?UTF-8?q?=200.20.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MultipleImagePicker.kt | 2 +- .../MultipleImagePickerImp.kt | 8 ++-- docs/docs/GETTING_STARTED.mdx | 4 +- example/src/index.tsx | 10 ++--- ios/HybridMultipleImagePicker+Result.swift | 32 ++++++++-------- ios/HybridMultipleImagePicker.swift | 10 +---- .../android/MultipleImagePickerOnLoad.cpp | 4 +- ... JFunc_void_std__vector_PickerResult_.hpp} | 28 +++++++------- .../c++/JHybridMultipleImagePickerSpec.cpp | 16 ++++---- .../c++/JHybridMultipleImagePickerSpec.hpp | 2 +- .../generated/android/c++/JNitroConfig.hpp | 14 +++---- .../c++/{JResult.hpp => JPickerResult.hpp} | 18 ++++----- ...=> Func_void_std__vector_PickerResult_.kt} | 8 ++-- .../HybridMultipleImagePickerSpec.kt | 4 +- .../nitro/multipleimagepicker/NitroConfig.kt | 2 +- .../{Result.kt => PickerResult.kt} | 6 +-- .../MultipleImagePicker-Swift-Cxx-Bridge.cpp | 8 ++-- .../MultipleImagePicker-Swift-Cxx-Bridge.hpp | 38 +++++++++---------- ...MultipleImagePicker-Swift-Cxx-Umbrella.hpp | 6 +-- .../HybridMultipleImagePickerSpecSwift.hpp | 8 ++-- ...Func_void_std__vector_PickerResult_.swift} | 20 +++++----- .../swift/HybridMultipleImagePickerSpec.swift | 2 +- .../HybridMultipleImagePickerSpec_cxx.swift | 12 +++--- .../generated/ios/swift/NitroConfig.swift | 12 +++--- .../{Result.swift => PickerResult.swift} | 10 ++--- .../c++/HybridMultipleImagePickerSpec.hpp | 8 ++-- nitrogen/generated/shared/c++/NitroConfig.hpp | 16 ++++---- .../c++/{Result.hpp => PickerResult.hpp} | 18 ++++----- src/index.ts | 10 ++--- src/specs/MultipleImagePicker.nitro.ts | 4 +- src/types/picker.ts | 6 +-- src/types/result.ts | 2 +- 32 files changed, 171 insertions(+), 177 deletions(-) rename nitrogen/generated/android/c++/{JFunc_void_std__vector_Result_.hpp => JFunc_void_std__vector_PickerResult_.hpp} (50%) rename nitrogen/generated/android/c++/{JResult.hpp => JPickerResult.hpp} (90%) rename nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/{Func_void_std__vector_Result_.kt => Func_void_std__vector_PickerResult_.kt} (84%) rename nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/{Result.kt => PickerResult.kt} (87%) rename nitrogen/generated/ios/swift/{Func_void_std__vector_Result_.swift => Func_void_std__vector_PickerResult_.swift} (60%) rename nitrogen/generated/ios/swift/{Result.swift => PickerResult.swift} (96%) rename nitrogen/generated/shared/c++/{Result.hpp => PickerResult.hpp} (86%) diff --git a/android/src/main/java/com/margelo/nitro/multipleimagepicker/MultipleImagePicker.kt b/android/src/main/java/com/margelo/nitro/multipleimagepicker/MultipleImagePicker.kt index dd871c06..6ee259ad 100644 --- a/android/src/main/java/com/margelo/nitro/multipleimagepicker/MultipleImagePicker.kt +++ b/android/src/main/java/com/margelo/nitro/multipleimagepicker/MultipleImagePicker.kt @@ -11,7 +11,7 @@ class MultipleImagePicker : HybridMultipleImagePickerSpec() { override fun openPicker( config: NitroConfig, - resolved: (result: Array) -> Unit, + resolved: (result: Array) -> Unit, rejected: (reject: Double) -> Unit ) { pickerModule.openPicker(config, resolved, rejected) diff --git a/android/src/main/java/com/margelo/nitro/multipleimagepicker/MultipleImagePickerImp.kt b/android/src/main/java/com/margelo/nitro/multipleimagepicker/MultipleImagePickerImp.kt index e3af2913..671325cf 100644 --- a/android/src/main/java/com/margelo/nitro/multipleimagepicker/MultipleImagePickerImp.kt +++ b/android/src/main/java/com/margelo/nitro/multipleimagepicker/MultipleImagePickerImp.kt @@ -60,7 +60,7 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) : @ReactMethod fun openPicker( options: NitroConfig, - resolved: (result: Array) -> Unit, + resolved: (result: Array) -> Unit, rejected: (reject: Double) -> Unit ) { PictureAppMaster.getInstance().app = this @@ -150,7 +150,7 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) : .isPreviewFullScreenMode(true) .forResult(object : OnResultCallbackListener { override fun onResult(localMedia: ArrayList?) { - var data: Array = arrayOf() + var data: Array = arrayOf() if (localMedia?.size == 0 || localMedia == null) { resolved(arrayOf()) return @@ -575,7 +575,7 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) : }.toMutableList() } - private fun getResult(item: LocalMedia): Result { + private fun getResult(item: LocalMedia): PickerResult { val type: ResultType = if (item.mimeType.startsWith("video/")) ResultType.VIDEO else ResultType.IMAGE @@ -597,7 +597,7 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) : if (!path.startsWith("file://") && !path.startsWith("content://") && type == ResultType.IMAGE) path = "file://$path" - val media = Result( + val media = PickerResult( localIdentifier = item.id.toString(), width, height, diff --git a/docs/docs/GETTING_STARTED.mdx b/docs/docs/GETTING_STARTED.mdx index 551facb0..b0412b00 100644 --- a/docs/docs/GETTING_STARTED.mdx +++ b/docs/docs/GETTING_STARTED.mdx @@ -50,7 +50,7 @@ Install [@baronha/react-native-multiple-image-picker](https://www.npmjs.com/pack ```bash yarn add @baronha/react-native-multiple-image-picker -yarn add -D react-native-nitro-modules@0.18.2 +yarn add -D react-native-nitro-modules cd ios && pod install ``` @@ -60,7 +60,7 @@ cd ios && pod install ```bash npx expo install @baronha/react-native-multiple-image-picker -npx expo install react-native-nitro-modules@0.18.2 -- --dev +npx expo install react-native-nitro-modules -- --dev npx expo prebuild ``` diff --git a/example/src/index.tsx b/example/src/index.tsx index f90bf10e..7a9a5333 100644 --- a/example/src/index.tsx +++ b/example/src/index.tsx @@ -17,7 +17,7 @@ import { StyleSheet } from 'react-native' import ImageGrid from '@baronha/react-native-image-grid' import { openPicker, - Result, + PickerResult, defaultOptions, Config, openCropper, @@ -64,7 +64,7 @@ const parseNumber = (value: string): number | undefined => { export default function App() { const { background, foreground } = useTheme() - const [images, setImages] = useState([]) + const [images, setImages] = useState([]) const [options, changeOptions] = useImmer(defaultOptions) const colorScheme = useColorScheme() @@ -75,7 +75,7 @@ export default function App() { }) } - const onPressImage = (_: Result, index: number) => { + const onPressImage = (_: PickerResult, index: number) => { openPreview(images, index, {}) } @@ -98,7 +98,7 @@ export default function App() { const response = await openCamera() setImages((prev) => { - return [response as Result, ...prev] + return [response as PickerResult, ...prev] }) layoutEffect() @@ -130,7 +130,7 @@ export default function App() { } } - const onRemovePhoto = (_: Result, index: number) => { + const onRemovePhoto = (_: PickerResult, index: number) => { const data = [...images].filter((__, idx) => idx !== index) setImages(data) } diff --git a/ios/HybridMultipleImagePicker+Result.swift b/ios/HybridMultipleImagePicker+Result.swift index 88dab8ea..50c019b4 100644 --- a/ios/HybridMultipleImagePicker+Result.swift +++ b/ios/HybridMultipleImagePicker+Result.swift @@ -9,7 +9,7 @@ import HXPhotoPicker // import Photos extension HybridMultipleImagePicker { - func getResult(_ asset: PhotoAsset) async throws -> Result { + func getResult(_ asset: PhotoAsset) async throws -> PickerResult { let urlResult = try await asset.urlResult() let url = urlResult.url @@ -22,20 +22,20 @@ extension HybridMultipleImagePicker { let type: ResultType = .init(fromString: asset.mediaType == .video ? "video" : "image")! let thumbnail = asset.phAsset?.getVideoAssetThumbnail(from: url.absoluteString, in: 1) - return Result(localIdentifier: phAsset!.localIdentifier, - width: asset.imageSize.width, - height: asset.imageSize.height, - mime: mime, - size: Double(asset.fileSize), - bucketId: nil, - realPath: nil, - parentFolderName: nil, - creationDate: creationDate > 0 ? Double(creationDate) : nil, - crop: false, - path: "file://\(url.absoluteString)", - type: type, - duration: asset.videoDuration, - thumbnail: thumbnail, - fileName: phAsset?.fileName) + return PickerResult(localIdentifier: phAsset!.localIdentifier, + width: asset.imageSize.width, + height: asset.imageSize.height, + mime: mime, + size: Double(asset.fileSize), + bucketId: nil, + realPath: nil, + parentFolderName: nil, + creationDate: creationDate > 0 ? Double(creationDate) : nil, + crop: false, + path: "file://\(url.absoluteString)", + type: type, + duration: asset.videoDuration, + thumbnail: thumbnail, + fileName: phAsset?.fileName) } } diff --git a/ios/HybridMultipleImagePicker.swift b/ios/HybridMultipleImagePicker.swift index 93083f54..a6d9d919 100644 --- a/ios/HybridMultipleImagePicker.swift +++ b/ios/HybridMultipleImagePicker.swift @@ -10,17 +10,11 @@ import NitroModules import Photos class HybridMultipleImagePicker: HybridMultipleImagePickerSpec { - var hybridContext = margelo.nitro.HybridContext() - - var memorySize: Int { - return getSizeOf(self) - } - var selectedAssets: [PhotoAsset] = .init() var config: PickerConfiguration = .init() - func openPicker(config: NitroConfig, resolved: @escaping (([Result]) -> Void), rejected: @escaping ((Double) -> Void)) throws { + func openPicker(config: NitroConfig, resolved: @escaping (([PickerResult]) -> Void), rejected: @escaping ((Double) -> Void)) throws { setConfig(config) // get selected photo @@ -67,7 +61,7 @@ class HybridMultipleImagePicker: HybridMultipleImagePickerSpec { let group = DispatchGroup() - var data: [Result] = [] + var data: [PickerResult] = [] self.selectedAssets = pickerResult.photoAssets diff --git a/nitrogen/generated/android/MultipleImagePickerOnLoad.cpp b/nitrogen/generated/android/MultipleImagePickerOnLoad.cpp index 9fd7a974..8dbf16dd 100644 --- a/nitrogen/generated/android/MultipleImagePickerOnLoad.cpp +++ b/nitrogen/generated/android/MultipleImagePickerOnLoad.cpp @@ -12,7 +12,7 @@ #include #include "JHybridMultipleImagePickerSpec.hpp" -#include "JFunc_void_std__vector_Result_.hpp" +#include "JFunc_void_std__vector_PickerResult_.hpp" #include "JFunc_void_double.hpp" #include "JFunc_void_CropResult.hpp" #include "JFunc_void_CameraResult.hpp" @@ -29,7 +29,7 @@ int initialize(JavaVM* vm) { return facebook::jni::initialize(vm, [] { // Register native JNI methods margelo::nitro::multipleimagepicker::JHybridMultipleImagePickerSpec::registerNatives(); - margelo::nitro::multipleimagepicker::JFunc_void_std__vector_Result_::registerNatives(); + margelo::nitro::multipleimagepicker::JFunc_void_std__vector_PickerResult_::registerNatives(); margelo::nitro::multipleimagepicker::JFunc_void_double::registerNatives(); margelo::nitro::multipleimagepicker::JFunc_void_CropResult::registerNatives(); margelo::nitro::multipleimagepicker::JFunc_void_double::registerNatives(); diff --git a/nitrogen/generated/android/c++/JFunc_void_std__vector_Result_.hpp b/nitrogen/generated/android/c++/JFunc_void_std__vector_PickerResult_.hpp similarity index 50% rename from nitrogen/generated/android/c++/JFunc_void_std__vector_Result_.hpp rename to nitrogen/generated/android/c++/JFunc_void_std__vector_PickerResult_.hpp index c965e231..08a05252 100644 --- a/nitrogen/generated/android/c++/JFunc_void_std__vector_Result_.hpp +++ b/nitrogen/generated/android/c++/JFunc_void_std__vector_PickerResult_.hpp @@ -1,5 +1,5 @@ /// -/// JFunc_void_std__vector_Result_.hpp +/// JFunc_void_std__vector_PickerResult_.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -12,8 +12,8 @@ #include #include -#include "Result.hpp" -#include "JResult.hpp" +#include "PickerResult.hpp" +#include "JPickerResult.hpp" #include #include #include "ResultType.hpp" @@ -24,20 +24,20 @@ namespace margelo::nitro::multipleimagepicker { using namespace facebook; /** - * C++ representation of the callback Func_void_std__vector_Result_. - * This is a Kotlin `(result: Array) -> Unit`, backed by a `std::function<...>`. + * C++ representation of the callback Func_void_std__vector_PickerResult_. + * This is a Kotlin `(result: Array) -> Unit`, backed by a `std::function<...>`. */ - struct JFunc_void_std__vector_Result_ final: public jni::HybridClass { + struct JFunc_void_std__vector_PickerResult_ final: public jni::HybridClass { public: - static jni::local_ref fromCpp(const std::function& /* result */)>& func) { - return JFunc_void_std__vector_Result_::newObjectCxxArgs(func); + static jni::local_ref fromCpp(const std::function& /* result */)>& func) { + return JFunc_void_std__vector_PickerResult_::newObjectCxxArgs(func); } public: - void call(jni::alias_ref> result) { + void call(jni::alias_ref> result) { _func([&]() { size_t __size = result->size(); - std::vector __vector; + std::vector __vector; __vector.reserve(__size); for (size_t __i = 0; __i < __size; __i++) { auto __element = result->getElement(__i); @@ -48,17 +48,17 @@ namespace margelo::nitro::multipleimagepicker { } public: - static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/multipleimagepicker/Func_void_std__vector_Result_;"; + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/multipleimagepicker/Func_void_std__vector_PickerResult_;"; static void registerNatives() { - registerHybrid({makeNativeMethod("call", JFunc_void_std__vector_Result_::call)}); + registerHybrid({makeNativeMethod("call", JFunc_void_std__vector_PickerResult_::call)}); } private: - explicit JFunc_void_std__vector_Result_(const std::function& /* result */)>& func): _func(func) { } + explicit JFunc_void_std__vector_PickerResult_(const std::function& /* result */)>& func): _func(func) { } private: friend HybridBase; - std::function& /* result */)> _func; + std::function& /* result */)> _func; }; } // namespace margelo::nitro::multipleimagepicker diff --git a/nitrogen/generated/android/c++/JHybridMultipleImagePickerSpec.cpp b/nitrogen/generated/android/c++/JHybridMultipleImagePickerSpec.cpp index 3ec5df78..5c0792a4 100644 --- a/nitrogen/generated/android/c++/JHybridMultipleImagePickerSpec.cpp +++ b/nitrogen/generated/android/c++/JHybridMultipleImagePickerSpec.cpp @@ -11,8 +11,8 @@ namespace margelo::nitro::multipleimagepicker { struct NitroConfig; } // Forward declaration of `MediaType` to properly resolve imports. namespace margelo::nitro::multipleimagepicker { enum class MediaType; } -// Forward declaration of `Result` to properly resolve imports. -namespace margelo::nitro::multipleimagepicker { struct Result; } +// Forward declaration of `PickerResult` to properly resolve imports. +namespace margelo::nitro::multipleimagepicker { struct PickerResult; } // Forward declaration of `ResultType` to properly resolve imports. namespace margelo::nitro::multipleimagepicker { enum class ResultType; } // Forward declaration of `SelectBoxStyle` to properly resolve imports. @@ -53,8 +53,8 @@ namespace margelo::nitro::multipleimagepicker { struct CameraResult; } #include "MediaType.hpp" #include "JMediaType.hpp" #include -#include "Result.hpp" -#include "JResult.hpp" +#include "PickerResult.hpp" +#include "JPickerResult.hpp" #include #include #include "ResultType.hpp" @@ -80,7 +80,7 @@ namespace margelo::nitro::multipleimagepicker { struct CameraResult; } #include "CameraDevice.hpp" #include "JCameraDevice.hpp" #include -#include "JFunc_void_std__vector_Result_.hpp" +#include "JFunc_void_std__vector_PickerResult_.hpp" #include "JFunc_void_double.hpp" #include "NitroCropConfig.hpp" #include "JNitroCropConfig.hpp" @@ -118,9 +118,9 @@ namespace margelo::nitro::multipleimagepicker { // Methods - void JHybridMultipleImagePickerSpec::openPicker(const NitroConfig& config, const std::function& /* result */)>& resolved, const std::function& rejected) { - static const auto method = _javaPart->getClass()->getMethod /* config */, jni::alias_ref /* resolved */, jni::alias_ref /* rejected */)>("openPicker"); - method(_javaPart, JNitroConfig::fromCpp(config), JFunc_void_std__vector_Result_::fromCpp(resolved), JFunc_void_double::fromCpp(rejected)); + void JHybridMultipleImagePickerSpec::openPicker(const NitroConfig& config, const std::function& /* result */)>& resolved, const std::function& rejected) { + static const auto method = _javaPart->getClass()->getMethod /* config */, jni::alias_ref /* resolved */, jni::alias_ref /* rejected */)>("openPicker"); + method(_javaPart, JNitroConfig::fromCpp(config), JFunc_void_std__vector_PickerResult_::fromCpp(resolved), JFunc_void_double::fromCpp(rejected)); } void JHybridMultipleImagePickerSpec::openCrop(const std::string& image, const NitroCropConfig& config, const std::function& resolved, const std::function& rejected) { static const auto method = _javaPart->getClass()->getMethod /* image */, jni::alias_ref /* config */, jni::alias_ref /* resolved */, jni::alias_ref /* rejected */)>("openCrop"); diff --git a/nitrogen/generated/android/c++/JHybridMultipleImagePickerSpec.hpp b/nitrogen/generated/android/c++/JHybridMultipleImagePickerSpec.hpp index d11601ec..360d96b0 100644 --- a/nitrogen/generated/android/c++/JHybridMultipleImagePickerSpec.hpp +++ b/nitrogen/generated/android/c++/JHybridMultipleImagePickerSpec.hpp @@ -51,7 +51,7 @@ namespace margelo::nitro::multipleimagepicker { public: // Methods - void openPicker(const NitroConfig& config, const std::function& /* result */)>& resolved, const std::function& rejected) override; + void openPicker(const NitroConfig& config, const std::function& /* result */)>& resolved, const std::function& rejected) override; void openCrop(const std::string& image, const NitroCropConfig& config, const std::function& resolved, const std::function& rejected) override; void openPreview(const std::vector& media, double index, const NitroPreviewConfig& config) override; void openCamera(const NitroCameraConfig& config, const std::function& resolved, const std::function& rejected) override; diff --git a/nitrogen/generated/android/c++/JNitroConfig.hpp b/nitrogen/generated/android/c++/JNitroConfig.hpp index 17e1ae2b..b4cef6e5 100644 --- a/nitrogen/generated/android/c++/JNitroConfig.hpp +++ b/nitrogen/generated/android/c++/JNitroConfig.hpp @@ -18,8 +18,8 @@ #include "JMediaType.hpp" #include "JPickerCameraConfig.hpp" #include "JPickerCropConfig.hpp" +#include "JPickerResult.hpp" #include "JPresentation.hpp" -#include "JResult.hpp" #include "JResultType.hpp" #include "JSelectBoxStyle.hpp" #include "JSelectMode.hpp" @@ -29,8 +29,8 @@ #include "MediaType.hpp" #include "PickerCameraConfig.hpp" #include "PickerCropConfig.hpp" +#include "PickerResult.hpp" #include "Presentation.hpp" -#include "Result.hpp" #include "ResultType.hpp" #include "SelectBoxStyle.hpp" #include "SelectMode.hpp" @@ -60,8 +60,8 @@ namespace margelo::nitro::multipleimagepicker { static const auto clazz = javaClassStatic(); static const auto fieldMediaType = clazz->getField("mediaType"); jni::local_ref mediaType = this->getFieldValue(fieldMediaType); - static const auto fieldSelectedAssets = clazz->getField>("selectedAssets"); - jni::local_ref> selectedAssets = this->getFieldValue(fieldSelectedAssets); + static const auto fieldSelectedAssets = clazz->getField>("selectedAssets"); + jni::local_ref> selectedAssets = this->getFieldValue(fieldSelectedAssets); static const auto fieldSelectBoxStyle = clazz->getField("selectBoxStyle"); jni::local_ref selectBoxStyle = this->getFieldValue(fieldSelectBoxStyle); static const auto fieldSelectMode = clazz->getField("selectMode"); @@ -114,7 +114,7 @@ namespace margelo::nitro::multipleimagepicker { mediaType->toCpp(), [&]() { size_t __size = selectedAssets->size(); - std::vector __vector; + std::vector __vector; __vector.reserve(__size); for (size_t __i = 0; __i < __size; __i++) { auto __element = selectedAssets->getElement(__i); @@ -159,10 +159,10 @@ namespace margelo::nitro::multipleimagepicker { JMediaType::fromCpp(value.mediaType), [&]() { size_t __size = value.selectedAssets.size(); - jni::local_ref> __array = jni::JArrayClass::newArray(__size); + jni::local_ref> __array = jni::JArrayClass::newArray(__size); for (size_t __i = 0; __i < __size; __i++) { const auto& __element = value.selectedAssets[__i]; - __array->setElement(__i, *JResult::fromCpp(__element)); + __array->setElement(__i, *JPickerResult::fromCpp(__element)); } return __array; }(), diff --git a/nitrogen/generated/android/c++/JResult.hpp b/nitrogen/generated/android/c++/JPickerResult.hpp similarity index 90% rename from nitrogen/generated/android/c++/JResult.hpp rename to nitrogen/generated/android/c++/JPickerResult.hpp index 6c526284..5ce5eece 100644 --- a/nitrogen/generated/android/c++/JResult.hpp +++ b/nitrogen/generated/android/c++/JPickerResult.hpp @@ -1,5 +1,5 @@ /// -/// JResult.hpp +/// JPickerResult.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -8,7 +8,7 @@ #pragma once #include -#include "Result.hpp" +#include "PickerResult.hpp" #include "JResultType.hpp" #include "ResultType.hpp" @@ -20,18 +20,18 @@ namespace margelo::nitro::multipleimagepicker { using namespace facebook; /** - * The C++ JNI bridge between the C++ struct "Result" and the the Kotlin data class "Result". + * The C++ JNI bridge between the C++ struct "PickerResult" and the the Kotlin data class "PickerResult". */ - struct JResult final: public jni::JavaClass { + struct JPickerResult final: public jni::JavaClass { public: - static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/multipleimagepicker/Result;"; + static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/multipleimagepicker/PickerResult;"; public: /** - * Convert this Java/Kotlin-based struct to the C++ struct Result by copying all values to C++. + * Convert this Java/Kotlin-based struct to the C++ struct PickerResult by copying all values to C++. */ [[maybe_unused]] - Result toCpp() const { + PickerResult toCpp() const { static const auto clazz = javaClassStatic(); static const auto fieldLocalIdentifier = clazz->getField("localIdentifier"); jni::local_ref localIdentifier = this->getFieldValue(fieldLocalIdentifier); @@ -63,7 +63,7 @@ namespace margelo::nitro::multipleimagepicker { jni::local_ref thumbnail = this->getFieldValue(fieldThumbnail); static const auto fieldFileName = clazz->getField("fileName"); jni::local_ref fileName = this->getFieldValue(fieldFileName); - return Result( + return PickerResult( localIdentifier->toStdString(), width, height, @@ -87,7 +87,7 @@ namespace margelo::nitro::multipleimagepicker { * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java. */ [[maybe_unused]] - static jni::local_ref fromCpp(const Result& value) { + static jni::local_ref fromCpp(const PickerResult& value) { return newInstance( jni::make_jstring(value.localIdentifier), value.width, diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/Func_void_std__vector_Result_.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/Func_void_std__vector_PickerResult_.kt similarity index 84% rename from nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/Func_void_std__vector_Result_.kt rename to nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/Func_void_std__vector_PickerResult_.kt index b676d784..b07df2cd 100644 --- a/nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/Func_void_std__vector_Result_.kt +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/Func_void_std__vector_PickerResult_.kt @@ -1,5 +1,5 @@ /// -/// Func_void_std__vector_Result_.kt +/// Func_void_std__vector_PickerResult_.kt /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -20,7 +20,7 @@ import dalvik.annotation.optimization.FastNative @DoNotStrip @Keep @Suppress("RedundantSuppression", "ConvertSecondaryConstructorToPrimary", "RedundantUnitReturnType", "KotlinJniMissingFunction", "ClassName", "unused") -class Func_void_std__vector_Result_ { +class Func_void_std__vector_PickerResult_ { @DoNotStrip @Keep private val mHybridData: HybridData @@ -35,12 +35,12 @@ class Func_void_std__vector_Result_ { * Converts this function to a Kotlin Lambda. * This exists purely as syntactic sugar, and has minimal runtime overhead. */ - fun toLambda(): (result: Array) -> Unit = this::call + fun toLambda(): (result: Array) -> Unit = this::call /** * Call the given JS callback. * @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted. */ @FastNative - external fun call(result: Array): Unit + external fun call(result: Array): Unit } diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/HybridMultipleImagePickerSpec.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/HybridMultipleImagePickerSpec.kt index caf39b02..a2cd30b0 100644 --- a/nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/HybridMultipleImagePickerSpec.kt +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/HybridMultipleImagePickerSpec.kt @@ -43,11 +43,11 @@ abstract class HybridMultipleImagePickerSpec: HybridObject() { // Methods @DoNotStrip @Keep - abstract fun openPicker(config: NitroConfig, resolved: (result: Array) -> Unit, rejected: (reject: Double) -> Unit): Unit + abstract fun openPicker(config: NitroConfig, resolved: (result: Array) -> Unit, rejected: (reject: Double) -> Unit): Unit @DoNotStrip @Keep - private fun openPicker(config: NitroConfig, resolved: Func_void_std__vector_Result_, rejected: Func_void_double): Unit { + private fun openPicker(config: NitroConfig, resolved: Func_void_std__vector_PickerResult_, rejected: Func_void_double): Unit { val __result = openPicker(config, resolved.toLambda(), rejected.toLambda()) return __result } diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/NitroConfig.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/NitroConfig.kt index de5cf8d1..064e00ad 100644 --- a/nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/NitroConfig.kt +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/NitroConfig.kt @@ -18,7 +18,7 @@ import com.margelo.nitro.core.* @Keep data class NitroConfig( val mediaType: MediaType, - val selectedAssets: Array, + val selectedAssets: Array, val selectBoxStyle: SelectBoxStyle, val selectMode: SelectMode, val numberOfColumn: Double?, diff --git a/nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/Result.kt b/nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/PickerResult.kt similarity index 87% rename from nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/Result.kt rename to nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/PickerResult.kt index 60d06ab2..2369bbb6 100644 --- a/nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/Result.kt +++ b/nitrogen/generated/android/kotlin/com/margelo/nitro/multipleimagepicker/PickerResult.kt @@ -1,5 +1,5 @@ /// -/// Result.kt +/// PickerResult.kt /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -12,11 +12,11 @@ import com.facebook.proguard.annotations.DoNotStrip import com.margelo.nitro.core.* /** - * Represents the JavaScript object/struct "Result". + * Represents the JavaScript object/struct "PickerResult". */ @DoNotStrip @Keep -data class Result( +data class PickerResult( val localIdentifier: String, val width: Double, val height: Double, diff --git a/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Bridge.cpp b/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Bridge.cpp index f8d2f89c..da5932ba 100644 --- a/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Bridge.cpp +++ b/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Bridge.cpp @@ -13,10 +13,10 @@ namespace margelo::nitro::multipleimagepicker::bridge::swift { - // pragma MARK: std::function& /* result */)> - Func_void_std__vector_Result_ create_Func_void_std__vector_Result_(void* _Nonnull swiftClosureWrapper) { - auto swiftClosure = MultipleImagePicker::Func_void_std__vector_Result_::fromUnsafe(swiftClosureWrapper); - return [swiftClosure = std::move(swiftClosure)](const std::vector& result) mutable -> void { + // pragma MARK: std::function& /* result */)> + Func_void_std__vector_PickerResult_ create_Func_void_std__vector_PickerResult_(void* _Nonnull swiftClosureWrapper) { + auto swiftClosure = MultipleImagePicker::Func_void_std__vector_PickerResult_::fromUnsafe(swiftClosureWrapper); + return [swiftClosure = std::move(swiftClosure)](const std::vector& result) mutable -> void { swiftClosure.call(result); }; } diff --git a/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Bridge.hpp b/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Bridge.hpp index 6fe4b492..7c0e4262 100644 --- a/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Bridge.hpp +++ b/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Bridge.hpp @@ -24,10 +24,10 @@ namespace margelo::nitro::multipleimagepicker { struct MediaPreview; } namespace margelo::nitro::multipleimagepicker { struct PickerCameraConfig; } // Forward declaration of `PickerCropConfig` to properly resolve imports. namespace margelo::nitro::multipleimagepicker { struct PickerCropConfig; } +// Forward declaration of `PickerResult` to properly resolve imports. +namespace margelo::nitro::multipleimagepicker { struct PickerResult; } // Forward declaration of `ResultType` to properly resolve imports. namespace margelo::nitro::multipleimagepicker { enum class ResultType; } -// Forward declaration of `Result` to properly resolve imports. -namespace margelo::nitro::multipleimagepicker { struct Result; } // Forward declaration of `Text` to properly resolve imports. namespace margelo::nitro::multipleimagepicker { struct Text; } @@ -44,7 +44,7 @@ namespace MultipleImagePicker { class HybridMultipleImagePickerSpec_cxx; } #include "MediaPreview.hpp" #include "PickerCameraConfig.hpp" #include "PickerCropConfig.hpp" -#include "Result.hpp" +#include "PickerResult.hpp" #include "ResultType.hpp" #include "Text.hpp" #include @@ -88,13 +88,13 @@ namespace margelo::nitro::multipleimagepicker::bridge::swift { return std::optional(value); } - // pragma MARK: std::vector + // pragma MARK: std::vector /** - * Specialized version of `std::vector`. + * Specialized version of `std::vector`. */ - using std__vector_Result_ = std::vector; - inline std::vector create_std__vector_Result_(size_t size) { - std::vector vector; + using std__vector_PickerResult_ = std::vector; + inline std::vector create_std__vector_PickerResult_(size_t size) { + std::vector vector; vector.reserve(size); return vector; } @@ -155,26 +155,26 @@ namespace margelo::nitro::multipleimagepicker::bridge::swift { return std::optional(value); } - // pragma MARK: std::function& /* result */)> + // pragma MARK: std::function& /* result */)> /** - * Specialized version of `std::function&)>`. + * Specialized version of `std::function&)>`. */ - using Func_void_std__vector_Result_ = std::function& /* result */)>; + using Func_void_std__vector_PickerResult_ = std::function& /* result */)>; /** - * Wrapper class for a `std::function& / * result * /)>`, this can be used from Swift. + * Wrapper class for a `std::function& / * result * /)>`, this can be used from Swift. */ - class Func_void_std__vector_Result__Wrapper final { + class Func_void_std__vector_PickerResult__Wrapper final { public: - explicit Func_void_std__vector_Result__Wrapper(std::function& /* result */)>&& func): _function(std::make_shared& /* result */)>>(std::move(func))) {} - inline void call(std::vector result) const { + explicit Func_void_std__vector_PickerResult__Wrapper(std::function& /* result */)>&& func): _function(std::make_shared& /* result */)>>(std::move(func))) {} + inline void call(std::vector result) const { _function->operator()(result); } private: - std::shared_ptr& /* result */)>> _function; + std::shared_ptr& /* result */)>> _function; }; - Func_void_std__vector_Result_ create_Func_void_std__vector_Result_(void* _Nonnull swiftClosureWrapper); - inline Func_void_std__vector_Result__Wrapper wrap_Func_void_std__vector_Result_(Func_void_std__vector_Result_ value) { - return Func_void_std__vector_Result__Wrapper(std::move(value)); + Func_void_std__vector_PickerResult_ create_Func_void_std__vector_PickerResult_(void* _Nonnull swiftClosureWrapper); + inline Func_void_std__vector_PickerResult__Wrapper wrap_Func_void_std__vector_PickerResult_(Func_void_std__vector_PickerResult_ value) { + return Func_void_std__vector_PickerResult__Wrapper(std::move(value)); } // pragma MARK: std::function diff --git a/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Umbrella.hpp b/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Umbrella.hpp index 0f3f7d08..cedde14f 100644 --- a/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Umbrella.hpp +++ b/nitrogen/generated/ios/MultipleImagePicker-Swift-Cxx-Umbrella.hpp @@ -36,12 +36,12 @@ namespace margelo::nitro::multipleimagepicker { struct NitroPreviewConfig; } namespace margelo::nitro::multipleimagepicker { struct PickerCameraConfig; } // Forward declaration of `PickerCropConfig` to properly resolve imports. namespace margelo::nitro::multipleimagepicker { struct PickerCropConfig; } +// Forward declaration of `PickerResult` to properly resolve imports. +namespace margelo::nitro::multipleimagepicker { struct PickerResult; } // Forward declaration of `Presentation` to properly resolve imports. namespace margelo::nitro::multipleimagepicker { enum class Presentation; } // Forward declaration of `ResultType` to properly resolve imports. namespace margelo::nitro::multipleimagepicker { enum class ResultType; } -// Forward declaration of `Result` to properly resolve imports. -namespace margelo::nitro::multipleimagepicker { struct Result; } // Forward declaration of `SelectBoxStyle` to properly resolve imports. namespace margelo::nitro::multipleimagepicker { enum class SelectBoxStyle; } // Forward declaration of `SelectMode` to properly resolve imports. @@ -66,8 +66,8 @@ namespace margelo::nitro::multipleimagepicker { enum class Theme; } #include "NitroPreviewConfig.hpp" #include "PickerCameraConfig.hpp" #include "PickerCropConfig.hpp" +#include "PickerResult.hpp" #include "Presentation.hpp" -#include "Result.hpp" #include "ResultType.hpp" #include "SelectBoxStyle.hpp" #include "SelectMode.hpp" diff --git a/nitrogen/generated/ios/c++/HybridMultipleImagePickerSpecSwift.hpp b/nitrogen/generated/ios/c++/HybridMultipleImagePickerSpecSwift.hpp index 0fb974f3..d9b8f7a5 100644 --- a/nitrogen/generated/ios/c++/HybridMultipleImagePickerSpecSwift.hpp +++ b/nitrogen/generated/ios/c++/HybridMultipleImagePickerSpecSwift.hpp @@ -16,8 +16,8 @@ namespace MultipleImagePicker { class HybridMultipleImagePickerSpec_cxx; } namespace margelo::nitro::multipleimagepicker { struct NitroConfig; } // Forward declaration of `MediaType` to properly resolve imports. namespace margelo::nitro::multipleimagepicker { enum class MediaType; } -// Forward declaration of `Result` to properly resolve imports. -namespace margelo::nitro::multipleimagepicker { struct Result; } +// Forward declaration of `PickerResult` to properly resolve imports. +namespace margelo::nitro::multipleimagepicker { struct PickerResult; } // Forward declaration of `ResultType` to properly resolve imports. namespace margelo::nitro::multipleimagepicker { enum class ResultType; } // Forward declaration of `SelectBoxStyle` to properly resolve imports. @@ -56,7 +56,7 @@ namespace margelo::nitro::multipleimagepicker { struct CameraResult; } #include "NitroConfig.hpp" #include "MediaType.hpp" #include -#include "Result.hpp" +#include "PickerResult.hpp" #include #include #include "ResultType.hpp" @@ -115,7 +115,7 @@ namespace margelo::nitro::multipleimagepicker { public: // Methods - inline void openPicker(const NitroConfig& config, const std::function& /* result */)>& resolved, const std::function& rejected) override { + inline void openPicker(const NitroConfig& config, const std::function& /* result */)>& resolved, const std::function& rejected) override { auto __result = _swiftPart.openPicker(config, resolved, rejected); if (__result.hasError()) [[unlikely]] { std::rethrow_exception(__result.error()); diff --git a/nitrogen/generated/ios/swift/Func_void_std__vector_Result_.swift b/nitrogen/generated/ios/swift/Func_void_std__vector_PickerResult_.swift similarity index 60% rename from nitrogen/generated/ios/swift/Func_void_std__vector_Result_.swift rename to nitrogen/generated/ios/swift/Func_void_std__vector_PickerResult_.swift index d313faa6..ce923730 100644 --- a/nitrogen/generated/ios/swift/Func_void_std__vector_Result_.swift +++ b/nitrogen/generated/ios/swift/Func_void_std__vector_PickerResult_.swift @@ -1,5 +1,5 @@ /// -/// Func_void_std__vector_Result_.swift +/// Func_void_std__vector_PickerResult_.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -8,20 +8,20 @@ import NitroModules /** - * Wraps a Swift `((_ result: [Result]) -> Void)` as a class. + * Wraps a Swift `((_ result: [PickerResult]) -> Void)` as a class. * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`. */ -public final class Func_void_std__vector_Result_ { +public final class Func_void_std__vector_PickerResult_ { public typealias bridge = margelo.nitro.multipleimagepicker.bridge.swift - private let closure: ((_ result: [Result]) -> Void) + private let closure: ((_ result: [PickerResult]) -> Void) - public init(_ closure: @escaping ((_ result: [Result]) -> Void)) { + public init(_ closure: @escaping ((_ result: [PickerResult]) -> Void)) { self.closure = closure } @inline(__always) - public func call(result: bridge.std__vector_Result_) -> Void { + public func call(result: bridge.std__vector_PickerResult_) -> Void { self.closure(result.map({ __item in __item })) } @@ -35,12 +35,12 @@ public final class Func_void_std__vector_Result_ { } /** - * Casts an unsafe pointer to a `Func_void_std__vector_Result_`. - * The pointer has to be a retained opaque `Unmanaged`. + * Casts an unsafe pointer to a `Func_void_std__vector_PickerResult_`. + * The pointer has to be a retained opaque `Unmanaged`. * This removes one strong reference from the object! */ @inline(__always) - public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_Result_ { - return Unmanaged.fromOpaque(pointer).takeRetainedValue() + public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_PickerResult_ { + return Unmanaged.fromOpaque(pointer).takeRetainedValue() } } diff --git a/nitrogen/generated/ios/swift/HybridMultipleImagePickerSpec.swift b/nitrogen/generated/ios/swift/HybridMultipleImagePickerSpec.swift index df6cf6f5..4c9a4eeb 100644 --- a/nitrogen/generated/ios/swift/HybridMultipleImagePickerSpec.swift +++ b/nitrogen/generated/ios/swift/HybridMultipleImagePickerSpec.swift @@ -14,7 +14,7 @@ public protocol HybridMultipleImagePickerSpec_protocol: AnyObject { // Methods - func openPicker(config: NitroConfig, resolved: @escaping ((_ result: [Result]) -> Void), rejected: @escaping ((_ reject: Double) -> Void)) throws -> Void + func openPicker(config: NitroConfig, resolved: @escaping ((_ result: [PickerResult]) -> Void), rejected: @escaping ((_ reject: Double) -> Void)) throws -> Void func openCrop(image: String, config: NitroCropConfig, resolved: @escaping ((_ result: CropResult) -> Void), rejected: @escaping ((_ reject: Double) -> Void)) throws -> Void func openPreview(media: [MediaPreview], index: Double, config: NitroPreviewConfig) throws -> Void func openCamera(config: NitroCameraConfig, resolved: @escaping ((_ result: CameraResult) -> Void), rejected: @escaping ((_ reject: Double) -> Void)) throws -> Void diff --git a/nitrogen/generated/ios/swift/HybridMultipleImagePickerSpec_cxx.swift b/nitrogen/generated/ios/swift/HybridMultipleImagePickerSpec_cxx.swift index 460744ef..9222e94b 100644 --- a/nitrogen/generated/ios/swift/HybridMultipleImagePickerSpec_cxx.swift +++ b/nitrogen/generated/ios/swift/HybridMultipleImagePickerSpec_cxx.swift @@ -101,13 +101,13 @@ public class HybridMultipleImagePickerSpec_cxx { // Methods @inline(__always) - public func openPicker(config: NitroConfig, resolved: bridge.Func_void_std__vector_Result_, rejected: bridge.Func_void_double) -> bridge.Result_void_ { + public func openPicker(config: NitroConfig, resolved: bridge.Func_void_std__vector_PickerResult_, rejected: bridge.Func_void_double) -> bridge.Result_void_ { do { - try self.__implementation.openPicker(config: config, resolved: { () -> (([Result]) -> Void) in - let __wrappedFunction = bridge.wrap_Func_void_std__vector_Result_(resolved) - return { (__result: [Result]) -> Void in - __wrappedFunction.call({ () -> bridge.std__vector_Result_ in - var __vector = bridge.create_std__vector_Result_(__result.count) + try self.__implementation.openPicker(config: config, resolved: { () -> (([PickerResult]) -> Void) in + let __wrappedFunction = bridge.wrap_Func_void_std__vector_PickerResult_(resolved) + return { (__result: [PickerResult]) -> Void in + __wrappedFunction.call({ () -> bridge.std__vector_PickerResult_ in + var __vector = bridge.create_std__vector_PickerResult_(__result.count) for __item in __result { __vector.push_back(__item) } diff --git a/nitrogen/generated/ios/swift/NitroConfig.swift b/nitrogen/generated/ios/swift/NitroConfig.swift index d456df5a..166b9ab8 100644 --- a/nitrogen/generated/ios/swift/NitroConfig.swift +++ b/nitrogen/generated/ios/swift/NitroConfig.swift @@ -18,9 +18,9 @@ public extension NitroConfig { /** * Create a new instance of `NitroConfig`. */ - init(mediaType: MediaType, selectedAssets: [Result], selectBoxStyle: SelectBoxStyle, selectMode: SelectMode, numberOfColumn: Double?, isPreview: Bool?, primaryColor: Double?, allowSwipeToSelect: Bool?, spacing: Double?, isHiddenPreviewButton: Bool?, isHiddenOriginalButton: Bool?, isShowPreviewList: Bool?, allowHapticTouchPreview: Bool?, allowedLimit: Bool?, maxVideo: Double?, maxSelect: Double?, maxVideoDuration: Double?, minVideoDuration: Double?, maxFileSize: Double?, backgroundDark: Double?, crop: PickerCropConfig?, text: Text?, language: Language, theme: Theme, presentation: Presentation, camera: PickerCameraConfig?) { - self.init(mediaType, { () -> bridge.std__vector_Result_ in - var __vector = bridge.create_std__vector_Result_(selectedAssets.count) + init(mediaType: MediaType, selectedAssets: [PickerResult], selectBoxStyle: SelectBoxStyle, selectMode: SelectMode, numberOfColumn: Double?, isPreview: Bool?, primaryColor: Double?, allowSwipeToSelect: Bool?, spacing: Double?, isHiddenPreviewButton: Bool?, isHiddenOriginalButton: Bool?, isShowPreviewList: Bool?, allowHapticTouchPreview: Bool?, allowedLimit: Bool?, maxVideo: Double?, maxSelect: Double?, maxVideoDuration: Double?, minVideoDuration: Double?, maxFileSize: Double?, backgroundDark: Double?, crop: PickerCropConfig?, text: Text?, language: Language, theme: Theme, presentation: Presentation, camera: PickerCameraConfig?) { + self.init(mediaType, { () -> bridge.std__vector_PickerResult_ in + var __vector = bridge.create_std__vector_PickerResult_(selectedAssets.count) for __item in selectedAssets { __vector.push_back(__item) } @@ -153,15 +153,15 @@ public extension NitroConfig { } } - var selectedAssets: [Result] { + var selectedAssets: [PickerResult] { @inline(__always) get { return self.__selectedAssets.map({ __item in __item }) } @inline(__always) set { - self.__selectedAssets = { () -> bridge.std__vector_Result_ in - var __vector = bridge.create_std__vector_Result_(newValue.count) + self.__selectedAssets = { () -> bridge.std__vector_PickerResult_ in + var __vector = bridge.create_std__vector_PickerResult_(newValue.count) for __item in newValue { __vector.push_back(__item) } diff --git a/nitrogen/generated/ios/swift/Result.swift b/nitrogen/generated/ios/swift/PickerResult.swift similarity index 96% rename from nitrogen/generated/ios/swift/Result.swift rename to nitrogen/generated/ios/swift/PickerResult.swift index 510090e3..df42962e 100644 --- a/nitrogen/generated/ios/swift/Result.swift +++ b/nitrogen/generated/ios/swift/PickerResult.swift @@ -1,5 +1,5 @@ /// -/// Result.swift +/// PickerResult.swift /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -8,15 +8,15 @@ import NitroModules /** - * Represents an instance of `Result`, backed by a C++ struct. + * Represents an instance of `PickerResult`, backed by a C++ struct. */ -public typealias Result = margelo.nitro.multipleimagepicker.Result +public typealias PickerResult = margelo.nitro.multipleimagepicker.PickerResult -public extension Result { +public extension PickerResult { private typealias bridge = margelo.nitro.multipleimagepicker.bridge.swift /** - * Create a new instance of `Result`. + * Create a new instance of `PickerResult`. */ init(localIdentifier: String, width: Double, height: Double, mime: String, size: Double, bucketId: Double?, realPath: String?, parentFolderName: String?, creationDate: Double?, crop: Bool?, path: String, type: ResultType, duration: Double?, thumbnail: String?, fileName: String?) { self.init(std.string(localIdentifier), width, height, std.string(mime), size, { () -> bridge.std__optional_double_ in diff --git a/nitrogen/generated/shared/c++/HybridMultipleImagePickerSpec.hpp b/nitrogen/generated/shared/c++/HybridMultipleImagePickerSpec.hpp index 6e86b8b0..9406a700 100644 --- a/nitrogen/generated/shared/c++/HybridMultipleImagePickerSpec.hpp +++ b/nitrogen/generated/shared/c++/HybridMultipleImagePickerSpec.hpp @@ -15,8 +15,8 @@ // Forward declaration of `NitroConfig` to properly resolve imports. namespace margelo::nitro::multipleimagepicker { struct NitroConfig; } -// Forward declaration of `Result` to properly resolve imports. -namespace margelo::nitro::multipleimagepicker { struct Result; } +// Forward declaration of `PickerResult` to properly resolve imports. +namespace margelo::nitro::multipleimagepicker { struct PickerResult; } // Forward declaration of `NitroCropConfig` to properly resolve imports. namespace margelo::nitro::multipleimagepicker { struct NitroCropConfig; } // Forward declaration of `CropResult` to properly resolve imports. @@ -33,7 +33,7 @@ namespace margelo::nitro::multipleimagepicker { struct CameraResult; } #include "NitroConfig.hpp" #include #include -#include "Result.hpp" +#include "PickerResult.hpp" #include #include "NitroCropConfig.hpp" #include "CropResult.hpp" @@ -73,7 +73,7 @@ namespace margelo::nitro::multipleimagepicker { public: // Methods - virtual void openPicker(const NitroConfig& config, const std::function& /* result */)>& resolved, const std::function& rejected) = 0; + virtual void openPicker(const NitroConfig& config, const std::function& /* result */)>& resolved, const std::function& rejected) = 0; virtual void openCrop(const std::string& image, const NitroCropConfig& config, const std::function& resolved, const std::function& rejected) = 0; virtual void openPreview(const std::vector& media, double index, const NitroPreviewConfig& config) = 0; virtual void openCamera(const NitroCameraConfig& config, const std::function& resolved, const std::function& rejected) = 0; diff --git a/nitrogen/generated/shared/c++/NitroConfig.hpp b/nitrogen/generated/shared/c++/NitroConfig.hpp index acf1534d..72df0818 100644 --- a/nitrogen/generated/shared/c++/NitroConfig.hpp +++ b/nitrogen/generated/shared/c++/NitroConfig.hpp @@ -20,8 +20,8 @@ // Forward declaration of `MediaType` to properly resolve imports. namespace margelo::nitro::multipleimagepicker { enum class MediaType; } -// Forward declaration of `Result` to properly resolve imports. -namespace margelo::nitro::multipleimagepicker { struct Result; } +// Forward declaration of `PickerResult` to properly resolve imports. +namespace margelo::nitro::multipleimagepicker { struct PickerResult; } // Forward declaration of `SelectBoxStyle` to properly resolve imports. namespace margelo::nitro::multipleimagepicker { enum class SelectBoxStyle; } // Forward declaration of `SelectMode` to properly resolve imports. @@ -41,7 +41,7 @@ namespace margelo::nitro::multipleimagepicker { struct PickerCameraConfig; } #include "MediaType.hpp" #include -#include "Result.hpp" +#include "PickerResult.hpp" #include "SelectBoxStyle.hpp" #include "SelectMode.hpp" #include @@ -60,7 +60,7 @@ namespace margelo::nitro::multipleimagepicker { struct NitroConfig { public: MediaType mediaType SWIFT_PRIVATE; - std::vector selectedAssets SWIFT_PRIVATE; + std::vector selectedAssets SWIFT_PRIVATE; SelectBoxStyle selectBoxStyle SWIFT_PRIVATE; SelectMode selectMode SWIFT_PRIVATE; std::optional numberOfColumn SWIFT_PRIVATE; @@ -87,7 +87,7 @@ namespace margelo::nitro::multipleimagepicker { std::optional camera SWIFT_PRIVATE; public: - explicit NitroConfig(MediaType mediaType, std::vector selectedAssets, SelectBoxStyle selectBoxStyle, SelectMode selectMode, std::optional numberOfColumn, std::optional isPreview, std::optional primaryColor, std::optional allowSwipeToSelect, std::optional spacing, std::optional isHiddenPreviewButton, std::optional isHiddenOriginalButton, std::optional isShowPreviewList, std::optional allowHapticTouchPreview, std::optional allowedLimit, std::optional maxVideo, std::optional maxSelect, std::optional maxVideoDuration, std::optional minVideoDuration, std::optional maxFileSize, std::optional backgroundDark, std::optional crop, std::optional text, Language language, Theme theme, Presentation presentation, std::optional camera): mediaType(mediaType), selectedAssets(selectedAssets), selectBoxStyle(selectBoxStyle), selectMode(selectMode), numberOfColumn(numberOfColumn), isPreview(isPreview), primaryColor(primaryColor), allowSwipeToSelect(allowSwipeToSelect), spacing(spacing), isHiddenPreviewButton(isHiddenPreviewButton), isHiddenOriginalButton(isHiddenOriginalButton), isShowPreviewList(isShowPreviewList), allowHapticTouchPreview(allowHapticTouchPreview), allowedLimit(allowedLimit), maxVideo(maxVideo), maxSelect(maxSelect), maxVideoDuration(maxVideoDuration), minVideoDuration(minVideoDuration), maxFileSize(maxFileSize), backgroundDark(backgroundDark), crop(crop), text(text), language(language), theme(theme), presentation(presentation), camera(camera) {} + explicit NitroConfig(MediaType mediaType, std::vector selectedAssets, SelectBoxStyle selectBoxStyle, SelectMode selectMode, std::optional numberOfColumn, std::optional isPreview, std::optional primaryColor, std::optional allowSwipeToSelect, std::optional spacing, std::optional isHiddenPreviewButton, std::optional isHiddenOriginalButton, std::optional isShowPreviewList, std::optional allowHapticTouchPreview, std::optional allowedLimit, std::optional maxVideo, std::optional maxSelect, std::optional maxVideoDuration, std::optional minVideoDuration, std::optional maxFileSize, std::optional backgroundDark, std::optional crop, std::optional text, Language language, Theme theme, Presentation presentation, std::optional camera): mediaType(mediaType), selectedAssets(selectedAssets), selectBoxStyle(selectBoxStyle), selectMode(selectMode), numberOfColumn(numberOfColumn), isPreview(isPreview), primaryColor(primaryColor), allowSwipeToSelect(allowSwipeToSelect), spacing(spacing), isHiddenPreviewButton(isHiddenPreviewButton), isHiddenOriginalButton(isHiddenOriginalButton), isShowPreviewList(isShowPreviewList), allowHapticTouchPreview(allowHapticTouchPreview), allowedLimit(allowedLimit), maxVideo(maxVideo), maxSelect(maxSelect), maxVideoDuration(maxVideoDuration), minVideoDuration(minVideoDuration), maxFileSize(maxFileSize), backgroundDark(backgroundDark), crop(crop), text(text), language(language), theme(theme), presentation(presentation), camera(camera) {} }; } // namespace margelo::nitro::multipleimagepicker @@ -103,7 +103,7 @@ namespace margelo::nitro { jsi::Object obj = arg.asObject(runtime); return NitroConfig( JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "mediaType")), - JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "selectedAssets")), + JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "selectedAssets")), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "selectBoxStyle")), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "selectMode")), JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "numberOfColumn")), @@ -133,7 +133,7 @@ namespace margelo::nitro { static inline jsi::Value toJSI(jsi::Runtime& runtime, const NitroConfig& arg) { jsi::Object obj(runtime); obj.setProperty(runtime, "mediaType", JSIConverter::toJSI(runtime, arg.mediaType)); - obj.setProperty(runtime, "selectedAssets", JSIConverter>::toJSI(runtime, arg.selectedAssets)); + obj.setProperty(runtime, "selectedAssets", JSIConverter>::toJSI(runtime, arg.selectedAssets)); obj.setProperty(runtime, "selectBoxStyle", JSIConverter::toJSI(runtime, arg.selectBoxStyle)); obj.setProperty(runtime, "selectMode", JSIConverter::toJSI(runtime, arg.selectMode)); obj.setProperty(runtime, "numberOfColumn", JSIConverter>::toJSI(runtime, arg.numberOfColumn)); @@ -166,7 +166,7 @@ namespace margelo::nitro { } jsi::Object obj = value.getObject(runtime); if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "mediaType"))) return false; - if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "selectedAssets"))) return false; + if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "selectedAssets"))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "selectBoxStyle"))) return false; if (!JSIConverter::canConvert(runtime, obj.getProperty(runtime, "selectMode"))) return false; if (!JSIConverter>::canConvert(runtime, obj.getProperty(runtime, "numberOfColumn"))) return false; diff --git a/nitrogen/generated/shared/c++/Result.hpp b/nitrogen/generated/shared/c++/PickerResult.hpp similarity index 86% rename from nitrogen/generated/shared/c++/Result.hpp rename to nitrogen/generated/shared/c++/PickerResult.hpp index a4f82236..fe84b295 100644 --- a/nitrogen/generated/shared/c++/Result.hpp +++ b/nitrogen/generated/shared/c++/PickerResult.hpp @@ -1,5 +1,5 @@ /// -/// Result.hpp +/// PickerResult.hpp /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo @@ -28,9 +28,9 @@ namespace margelo::nitro::multipleimagepicker { enum class ResultType; } namespace margelo::nitro::multipleimagepicker { /** - * A struct which can be represented as a JavaScript object (Result). + * A struct which can be represented as a JavaScript object (PickerResult). */ - struct Result { + struct PickerResult { public: std::string localIdentifier SWIFT_PRIVATE; double width SWIFT_PRIVATE; @@ -49,7 +49,7 @@ namespace margelo::nitro::multipleimagepicker { std::optional fileName SWIFT_PRIVATE; public: - explicit Result(std::string localIdentifier, double width, double height, std::string mime, double size, std::optional bucketId, std::optional realPath, std::optional parentFolderName, std::optional creationDate, std::optional crop, std::string path, ResultType type, std::optional duration, std::optional thumbnail, std::optional fileName): localIdentifier(localIdentifier), width(width), height(height), mime(mime), size(size), bucketId(bucketId), realPath(realPath), parentFolderName(parentFolderName), creationDate(creationDate), crop(crop), path(path), type(type), duration(duration), thumbnail(thumbnail), fileName(fileName) {} + explicit PickerResult(std::string localIdentifier, double width, double height, std::string mime, double size, std::optional bucketId, std::optional realPath, std::optional parentFolderName, std::optional creationDate, std::optional crop, std::string path, ResultType type, std::optional duration, std::optional thumbnail, std::optional fileName): localIdentifier(localIdentifier), width(width), height(height), mime(mime), size(size), bucketId(bucketId), realPath(realPath), parentFolderName(parentFolderName), creationDate(creationDate), crop(crop), path(path), type(type), duration(duration), thumbnail(thumbnail), fileName(fileName) {} }; } // namespace margelo::nitro::multipleimagepicker @@ -58,12 +58,12 @@ namespace margelo::nitro { using namespace margelo::nitro::multipleimagepicker; - // C++ Result <> JS Result (object) + // C++ PickerResult <> JS PickerResult (object) template <> - struct JSIConverter { - static inline Result fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { + struct JSIConverter { + static inline PickerResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) { jsi::Object obj = arg.asObject(runtime); - return Result( + return PickerResult( JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "localIdentifier")), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "width")), JSIConverter::fromJSI(runtime, obj.getProperty(runtime, "height")), @@ -81,7 +81,7 @@ namespace margelo::nitro { JSIConverter>::fromJSI(runtime, obj.getProperty(runtime, "fileName")) ); } - static inline jsi::Value toJSI(jsi::Runtime& runtime, const Result& arg) { + static inline jsi::Value toJSI(jsi::Runtime& runtime, const PickerResult& arg) { jsi::Object obj(runtime); obj.setProperty(runtime, "localIdentifier", JSIConverter::toJSI(runtime, arg.localIdentifier)); obj.setProperty(runtime, "width", JSIConverter::toJSI(runtime, arg.width)); diff --git a/src/index.ts b/src/index.ts index 95c7f258..260b2abb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,7 +8,7 @@ import { type MultipleImagePicker } from './specs/MultipleImagePicker.nitro' import { processColor, Appearance } from 'react-native' import { - Result, + PickerResult, Config, NitroConfig, CropResult, @@ -29,8 +29,8 @@ const Picker = NitroModules.createHybridObject( ) type IPromisePicker = T['selectMode'] extends 'single' - ? Result - : Result[] + ? PickerResult + : PickerResult[] export async function openPicker( conf: T @@ -55,7 +55,7 @@ export async function openPicker( return Picker.openPicker( config, - (result: Result[]) => { + (result: PickerResult[]) => { resolved(result as IPromisePicker) }, (reject: number) => { @@ -93,7 +93,7 @@ export async function openCropper( } export function openPreview( - media: MediaPreview[] | Result[], + media: MediaPreview[] | PickerResult[], index: number = 0, conf?: PreviewConfig ): void { diff --git a/src/specs/MultipleImagePicker.nitro.ts b/src/specs/MultipleImagePicker.nitro.ts index 190f7e32..da702d59 100644 --- a/src/specs/MultipleImagePicker.nitro.ts +++ b/src/specs/MultipleImagePicker.nitro.ts @@ -7,14 +7,14 @@ import { NitroConfig, NitroCropConfig, NitroPreviewConfig, - Result, + PickerResult, } from '../types' export interface MultipleImagePicker extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> { openPicker( config: NitroConfig, - resolved: (result: Result[]) => void, + resolved: (result: PickerResult[]) => void, rejected: (reject: number) => void ): void diff --git a/src/types/picker.ts b/src/types/picker.ts index 154972c7..f803ffe6 100644 --- a/src/types/picker.ts +++ b/src/types/picker.ts @@ -1,8 +1,8 @@ import { ColorValue } from 'react-native' import { Language, MediaType, Presentation, Theme } from './config' -import { Result } from './result' import { PickerCropConfig, CropRatio } from './crop' import { PickerCameraConfig } from './camera' +import { PickerResult } from './result' export type SelectBoxStyle = 'number' | 'tick' @@ -38,7 +38,7 @@ export interface NitroConfig { * Array of currently selected assets * @type {Result[]} */ - selectedAssets: Result[] + selectedAssets: PickerResult[] /** * Style of the selection box @@ -243,7 +243,7 @@ export interface Config * Array of currently selected assets * @type {Result[]} */ - selectedAssets?: Result[] + selectedAssets?: PickerResult[] /** * Style of selection box in the picker diff --git a/src/types/result.ts b/src/types/result.ts index 2300f87b..2f277cca 100644 --- a/src/types/result.ts +++ b/src/types/result.ts @@ -85,7 +85,7 @@ export interface BaseResult { * creationDate: 1709312436000 * } */ -export interface Result extends BaseResult { +export interface PickerResult extends BaseResult { /** * Unique identifier for the media asset * Used for local database tracking and reference From e9302bd8bce022be8bd857dee66934a512b5c8c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=E1=BA=A3o=20H=C3=A0?= Date: Mon, 23 Dec 2024 11:36:40 +0700 Subject: [PATCH 3/5] =?UTF-8?q?=E2=9C=A8=20feat:=20upgrade=200.20.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/package.json b/example/package.json index d76bdd94..626a2cc2 100644 --- a/example/package.json +++ b/example/package.json @@ -31,7 +31,7 @@ "@react-native/typescript-config": "0.75.2", "@types/react": "~18.2.45", "react-native-builder-bob": "^0.30.0", - "react-native-nitro-modules": "0.20.0", + "react-native-nitro-modules": "^0.20.1", "typescript": "^5.1.3" }, "private": true From 390a21f86af567178ce725813de301471f87fca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=E1=BA=A3o=20H=C3=A0?= Date: Mon, 23 Dec 2024 11:36:57 +0700 Subject: [PATCH 4/5] =?UTF-8?q?=E2=9C=A8=20feat:=20Nitro=200.20.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/docs/GETTING_STARTED.mdx | 4 ++-- package.json | 4 ++-- yarn.lock | 18 +++++++++--------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/docs/GETTING_STARTED.mdx b/docs/docs/GETTING_STARTED.mdx index b0412b00..b3af2a74 100644 --- a/docs/docs/GETTING_STARTED.mdx +++ b/docs/docs/GETTING_STARTED.mdx @@ -50,7 +50,7 @@ Install [@baronha/react-native-multiple-image-picker](https://www.npmjs.com/pack ```bash yarn add @baronha/react-native-multiple-image-picker -yarn add -D react-native-nitro-modules +yarn add -D react-native-nitro-modules@0.20.1 cd ios && pod install ``` @@ -60,7 +60,7 @@ cd ios && pod install ```bash npx expo install @baronha/react-native-multiple-image-picker -npx expo install react-native-nitro-modules -- --dev +npx expo install react-native-nitro-modules@0.20.1 -- --dev npx expo prebuild ``` diff --git a/package.json b/package.json index 1aa0dce9..68f34bd0 100644 --- a/package.json +++ b/package.json @@ -64,12 +64,12 @@ "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.2.1", - "nitro-codegen": "0.20.0", + "nitro-codegen": "0.20.1", "prettier": "^3.3.3", "react": "^18.3.1", "react-native": "^0.75.2", "react-native-builder-bob": "^0.30.0", - "react-native-nitro-modules": "0.20.0", + "react-native-nitro-modules": "0.20.1", "typescript": "^5.5.4" }, "peerDependencies": { diff --git a/yarn.lock b/yarn.lock index a6dde3c0..ba5cf73c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4590,13 +4590,13 @@ neo-async@^2.5.0: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -nitro-codegen@0.20.0: - version "0.20.0" - resolved "https://registry.yarnpkg.com/nitro-codegen/-/nitro-codegen-0.20.0.tgz#7fdc978ab4148c0899ddf134091f4151c601795b" - integrity sha512-MFPDb4AsY6r/PR6eTAONCoSmi2a9KivOHg3JfQiPa6jtY/mGNujAmYo0LK6UvaPSxkrP69J9tZMJ3ERWaeoCDg== +nitro-codegen@0.20.1: + version "0.20.1" + resolved "https://registry.yarnpkg.com/nitro-codegen/-/nitro-codegen-0.20.1.tgz#dd1ff1a0e7a16d06a0263a8eb851a1571b9aa846" + integrity sha512-gFABTk5bl03C1oGzK+Up8m3169eUTCwNheLIvYU38pyGaNdJPJJMo0pK5aRhQ1CUP0Rc9kcKI2W6mNKN5tjgsw== dependencies: chalk "^5.3.0" - react-native-nitro-modules "^0.20.0" + react-native-nitro-modules "^0.20.1" ts-morph "^24.0.0" yargs "^17.7.2" zod "^3.23.8" @@ -5110,10 +5110,10 @@ react-native-builder-bob@^0.30.0: which "^2.0.2" yargs "^17.5.1" -react-native-nitro-modules@0.20.0, react-native-nitro-modules@^0.20.0: - version "0.20.0" - resolved "https://registry.yarnpkg.com/react-native-nitro-modules/-/react-native-nitro-modules-0.20.0.tgz#3c659d4c8cbc8038b1bf35af6475e77023e70ffa" - integrity sha512-u41SaGdQ/EQFuRLFPRQ+cbEemzsARmkElXErwZlXJhr2KYmVwQMrIYGe69NuMSyvHlw3JTl09SNugt3PXa2vEQ== +react-native-nitro-modules@0.20.1, react-native-nitro-modules@^0.20.1: + version "0.20.1" + resolved "https://registry.yarnpkg.com/react-native-nitro-modules/-/react-native-nitro-modules-0.20.1.tgz#99568818b90e364f1e08b5341a7868eca3762333" + integrity sha512-ffa8GbnLBs7irEx1ZCl7WdHzzA5uj4ngh7hIWbeUfBs8m2iAn+byowOJWHKmO+RA2hp9dVwTxHYSBOqIvTVvHA== react-native@^0.75.2: version "0.75.4" From ec0137b08a49937c8497465b1d725e8b1ee2f40e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=E1=BA=A3o=20H=C3=A0?= Date: Mon, 23 Dec 2024 11:38:08 +0700 Subject: [PATCH 5/5] =?UTF-8?q?=E2=9C=A8=20feat:=20release=202.1.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/package.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example/package.json b/example/package.json index 626a2cc2..730d1938 100644 --- a/example/package.json +++ b/example/package.json @@ -1,6 +1,6 @@ { "name": "multipleimagepickerexample", - "version": "2.0.4", + "version": "2.1.2", "main": "expo/AppEntry.js", "scripts": { "start": "expo start", diff --git a/package.json b/package.json index 68f34bd0..85a58cc4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@baronha/react-native-multiple-image-picker", - "version": "2.1.1", + "version": "2.1.2", "description": "� react-native-multiple-image-picker enables applications to pick images and videos from multiple smart albums in iOS/Android �", "main": "./lib/commonjs/index.js", "module": "./lib/module/index.js",