@onekeyfe/react-native-image-crop-picker 3.0.147
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +83 -0
- package/ReactNativeImageCropPicker.podspec +40 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +144 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +24 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerException.kt +45 -0
- package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerImageProcessor.kt +308 -0
- package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerSession.kt +297 -0
- package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ReactNativeImageCropPicker.kt +69 -0
- package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ReactNativeImageCropPickerPackage.kt +24 -0
- package/ios/ImageCropPickerError.swift +57 -0
- package/ios/ImageCropPickerImageProcessor.swift +343 -0
- package/ios/ImageCropPickerSession.swift +407 -0
- package/ios/ReactNativeImageCropPicker.swift +65 -0
- package/ios/TOCropViewController/Categories/UIImage+CropRotate.h +39 -0
- package/ios/TOCropViewController/Categories/UIImage+CropRotate.m +94 -0
- package/ios/TOCropViewController/Constants/TOCropViewConstants.h +63 -0
- package/ios/TOCropViewController/LICENSE +21 -0
- package/ios/TOCropViewController/Models/TOActivityCroppedImageProvider.h +38 -0
- package/ios/TOCropViewController/Models/TOActivityCroppedImageProvider.m +73 -0
- package/ios/TOCropViewController/Models/TOCropViewControllerAspectRatioPreset.h +64 -0
- package/ios/TOCropViewController/Models/TOCropViewControllerAspectRatioPreset.m +121 -0
- package/ios/TOCropViewController/Models/TOCropViewControllerTransitioning.h +49 -0
- package/ios/TOCropViewController/Models/TOCropViewControllerTransitioning.m +125 -0
- package/ios/TOCropViewController/Models/TOCroppedImageAttributes.h +38 -0
- package/ios/TOCropViewController/Models/TOCroppedImageAttributes.m +45 -0
- package/ios/TOCropViewController/Resources/Base.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/PrivacyInfo.xcprivacy +14 -0
- package/ios/TOCropViewController/Resources/ar.lproj/TOCropViewControllerLocalizable.strings +9 -0
- package/ios/TOCropViewController/Resources/ca.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/cs.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/da-DK.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/de.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/en.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/es.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/fa-IR.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/fa.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/fi.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/fr.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/hu.lproj/TOCropViewControllerLocalizable.strings +9 -0
- package/ios/TOCropViewController/Resources/id.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/it.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/ja.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/ko.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/ms.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/nl.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/pl.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/pt-BR.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/pt.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/ro.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/ru.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/sk.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/tr.lproj/TOCropViewControllerLocalizable.strings +9 -0
- package/ios/TOCropViewController/Resources/uk.lproj/TOCropViewControllerLocalizable.strings +8 -0
- package/ios/TOCropViewController/Resources/vi.lproj/TOCropViewControllerLocalizable.strings +9 -0
- package/ios/TOCropViewController/Resources/zh-Hans.lproj/TOCropViewControllerLocalizable.strings +9 -0
- package/ios/TOCropViewController/Resources/zh-Hant.lproj/TOCropViewControllerLocalizable.strings +9 -0
- package/ios/TOCropViewController/TOCropViewController.h +479 -0
- package/ios/TOCropViewController/TOCropViewController.m +1355 -0
- package/ios/TOCropViewController/Views/TOCropOverlayView.h +43 -0
- package/ios/TOCropViewController/Views/TOCropOverlayView.m +240 -0
- package/ios/TOCropViewController/Views/TOCropScrollView.h +39 -0
- package/ios/TOCropViewController/Views/TOCropScrollView.m +48 -0
- package/ios/TOCropViewController/Views/TOCropToolbar.h +104 -0
- package/ios/TOCropViewController/Views/TOCropToolbar.m +783 -0
- package/ios/TOCropViewController/Views/TOCropView.h +311 -0
- package/ios/TOCropViewController/Views/TOCropView.m +1787 -0
- package/lib/module/ReactNativeImageCropPicker.nitro.js +4 -0
- package/lib/module/ReactNativeImageCropPicker.nitro.js.map +1 -0
- package/lib/module/index.js +83 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/ReactNativeImageCropPicker.nitro.d.ts +54 -0
- package/lib/typescript/src/ReactNativeImageCropPicker.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +31 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/android/c++/JCropRect.hpp +69 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeImageCropPickerSpec.cpp +125 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeImageCropPickerSpec.hpp +66 -0
- package/nitrogen/generated/android/c++/JImageCropPickerOptions.hpp +154 -0
- package/nitrogen/generated/android/c++/JPickedImage.hpp +88 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/CropRect.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/HybridReactNativeImageCropPickerSpec.kt +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerOptions.kt +171 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/PickedImage.kt +86 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/reactnativeimagecroppickerOnLoad.kt +35 -0
- package/nitrogen/generated/android/reactnativeimagecroppicker+autolinking.cmake +81 -0
- package/nitrogen/generated/android/reactnativeimagecroppicker+autolinking.gradle +27 -0
- package/nitrogen/generated/android/reactnativeimagecroppickerOnLoad.cpp +54 -0
- package/nitrogen/generated/android/reactnativeimagecroppickerOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/ReactNativeImageCropPicker+autolinking.rb +62 -0
- package/nitrogen/generated/ios/ReactNativeImageCropPicker-Swift-Cxx-Bridge.cpp +57 -0
- package/nitrogen/generated/ios/ReactNativeImageCropPicker-Swift-Cxx-Bridge.hpp +221 -0
- package/nitrogen/generated/ios/ReactNativeImageCropPicker-Swift-Cxx-Umbrella.hpp +55 -0
- package/nitrogen/generated/ios/ReactNativeImageCropPickerAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ReactNativeImageCropPickerAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeImageCropPickerSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeImageCropPickerSpecSwift.hpp +116 -0
- package/nitrogen/generated/ios/swift/CropRect.swift +44 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_PickedImage.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeImageCropPickerSpec.swift +58 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeImageCropPickerSpec_cxx.swift +202 -0
- package/nitrogen/generated/ios/swift/ImageCropPickerOptions.swift +474 -0
- package/nitrogen/generated/ios/swift/PickedImage.swift +96 -0
- package/nitrogen/generated/shared/c++/CropRect.hpp +95 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeImageCropPickerSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeImageCropPickerSpec.hpp +71 -0
- package/nitrogen/generated/shared/c++/ImageCropPickerOptions.hpp +180 -0
- package/nitrogen/generated/shared/c++/PickedImage.hpp +114 -0
- package/package.json +173 -0
- package/src/ReactNativeImageCropPicker.nitro.ts +72 -0
- package/src/index.tsx +134 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// reactnativeimagecroppickerOnLoad.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include <jni.h>
|
|
9
|
+
#include <functional>
|
|
10
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
11
|
+
|
|
12
|
+
namespace margelo::nitro::reactnativeimagecroppicker {
|
|
13
|
+
|
|
14
|
+
[[deprecated("Use registerNatives() instead.")]]
|
|
15
|
+
int initialize(JavaVM* vm);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Register the native (C++) part of reactnativeimagecroppicker, and autolinks all Hybrid Objects.
|
|
19
|
+
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),
|
|
20
|
+
* inside a `facebook::jni::initialize(vm, ...)` call.
|
|
21
|
+
* Example:
|
|
22
|
+
* ```cpp (cpp-adapter.cpp)
|
|
23
|
+
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
24
|
+
* return facebook::jni::initialize(vm, []() {
|
|
25
|
+
* // register all reactnativeimagecroppicker HybridObjects
|
|
26
|
+
* margelo::nitro::reactnativeimagecroppicker::registerNatives();
|
|
27
|
+
* // any other custom registrations go here.
|
|
28
|
+
* });
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
void registerAllNatives();
|
|
33
|
+
|
|
34
|
+
} // namespace margelo::nitro::reactnativeimagecroppicker
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#
|
|
2
|
+
# ReactNativeImageCropPicker+autolinking.rb
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a Ruby script that adds all files generated by Nitrogen
|
|
9
|
+
# to the given podspec.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your .podspec:
|
|
12
|
+
# ```ruby
|
|
13
|
+
# Pod::Spec.new do |spec|
|
|
14
|
+
# # ...
|
|
15
|
+
#
|
|
16
|
+
# # Add all files generated by Nitrogen
|
|
17
|
+
# load 'nitrogen/generated/ios/ReactNativeImageCropPicker+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 ReactNativeImageCropPicker is boosted by nitro!"
|
|
24
|
+
|
|
25
|
+
spec.dependency "NitroModules"
|
|
26
|
+
|
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
|
28
|
+
spec.source_files = current_source_files + [
|
|
29
|
+
# Generated cross-platform specs
|
|
30
|
+
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
|
31
|
+
# Generated bridges for the cross-platform specs
|
|
32
|
+
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
|
36
|
+
spec.public_header_files = current_public_header_files + [
|
|
37
|
+
# Generated specs
|
|
38
|
+
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
|
+
# Swift to C++ bridging helpers
|
|
40
|
+
"nitrogen/generated/ios/ReactNativeImageCropPicker-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
44
|
+
spec.private_header_files = current_private_header_files + [
|
|
45
|
+
# iOS specific specs
|
|
46
|
+
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
52
|
+
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
|
+
# Use C++ 20
|
|
54
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
# Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here)
|
|
60
|
+
"SWIFT_INSTALL_OBJC_HEADER" => "NO",
|
|
61
|
+
})
|
|
62
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeImageCropPicker-Swift-Cxx-Bridge.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "ReactNativeImageCropPicker-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridReactNativeImageCropPickerSpecSwift.hpp"
|
|
12
|
+
#include "ReactNativeImageCropPicker-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::reactnativeimagecroppicker::bridge::swift {
|
|
16
|
+
|
|
17
|
+
// pragma MARK: std::function<void(const PickedImage& /* result */)>
|
|
18
|
+
Func_void_PickedImage create_Func_void_PickedImage(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
19
|
+
auto swiftClosure = ReactNativeImageCropPicker::Func_void_PickedImage::fromUnsafe(swiftClosureWrapper);
|
|
20
|
+
return [swiftClosure = std::move(swiftClosure)](const PickedImage& result) mutable -> void {
|
|
21
|
+
swiftClosure.call(result);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
26
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
27
|
+
auto swiftClosure = ReactNativeImageCropPicker::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
|
|
28
|
+
return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
|
|
29
|
+
swiftClosure.call(error);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// pragma MARK: std::function<void()>
|
|
34
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
35
|
+
auto swiftClosure = ReactNativeImageCropPicker::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
36
|
+
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
37
|
+
swiftClosure.call();
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// pragma MARK: std::shared_ptr<HybridReactNativeImageCropPickerSpec>
|
|
42
|
+
std::shared_ptr<HybridReactNativeImageCropPickerSpec> create_std__shared_ptr_HybridReactNativeImageCropPickerSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
43
|
+
ReactNativeImageCropPicker::HybridReactNativeImageCropPickerSpec_cxx swiftPart = ReactNativeImageCropPicker::HybridReactNativeImageCropPickerSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
44
|
+
return std::make_shared<margelo::nitro::reactnativeimagecroppicker::HybridReactNativeImageCropPickerSpecSwift>(swiftPart);
|
|
45
|
+
}
|
|
46
|
+
void* NON_NULL get_std__shared_ptr_HybridReactNativeImageCropPickerSpec_(std__shared_ptr_HybridReactNativeImageCropPickerSpec_ cppType) {
|
|
47
|
+
std::shared_ptr<margelo::nitro::reactnativeimagecroppicker::HybridReactNativeImageCropPickerSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::reactnativeimagecroppicker::HybridReactNativeImageCropPickerSpecSwift>(cppType);
|
|
48
|
+
#ifdef NITRO_DEBUG
|
|
49
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
50
|
+
throw std::runtime_error("Class \"HybridReactNativeImageCropPickerSpec\" is not implemented in Swift!");
|
|
51
|
+
}
|
|
52
|
+
#endif
|
|
53
|
+
ReactNativeImageCropPicker::HybridReactNativeImageCropPickerSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
54
|
+
return swiftPart.toUnsafe();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::reactnativeimagecroppicker::bridge::swift
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeImageCropPicker-Swift-Cxx-Bridge.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `CropRect` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::reactnativeimagecroppicker { struct CropRect; }
|
|
13
|
+
// Forward declaration of `HybridReactNativeImageCropPickerSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::reactnativeimagecroppicker { class HybridReactNativeImageCropPickerSpec; }
|
|
15
|
+
// Forward declaration of `PickedImage` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::reactnativeimagecroppicker { struct PickedImage; }
|
|
17
|
+
|
|
18
|
+
// Forward declarations of Swift defined types
|
|
19
|
+
// Forward declaration of `HybridReactNativeImageCropPickerSpec_cxx` to properly resolve imports.
|
|
20
|
+
namespace ReactNativeImageCropPicker { class HybridReactNativeImageCropPickerSpec_cxx; }
|
|
21
|
+
|
|
22
|
+
// Include C++ defined types
|
|
23
|
+
#include "CropRect.hpp"
|
|
24
|
+
#include "HybridReactNativeImageCropPickerSpec.hpp"
|
|
25
|
+
#include "PickedImage.hpp"
|
|
26
|
+
#include <NitroModules/Promise.hpp>
|
|
27
|
+
#include <NitroModules/PromiseHolder.hpp>
|
|
28
|
+
#include <NitroModules/Result.hpp>
|
|
29
|
+
#include <exception>
|
|
30
|
+
#include <functional>
|
|
31
|
+
#include <memory>
|
|
32
|
+
#include <optional>
|
|
33
|
+
#include <string>
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
37
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
38
|
+
*/
|
|
39
|
+
namespace margelo::nitro::reactnativeimagecroppicker::bridge::swift {
|
|
40
|
+
|
|
41
|
+
// pragma MARK: std::optional<std::string>
|
|
42
|
+
/**
|
|
43
|
+
* Specialized version of `std::optional<std::string>`.
|
|
44
|
+
*/
|
|
45
|
+
using std__optional_std__string_ = std::optional<std::string>;
|
|
46
|
+
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
47
|
+
return std::optional<std::string>(value);
|
|
48
|
+
}
|
|
49
|
+
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
50
|
+
return optional.has_value();
|
|
51
|
+
}
|
|
52
|
+
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
53
|
+
return optional.value();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// pragma MARK: std::optional<CropRect>
|
|
57
|
+
/**
|
|
58
|
+
* Specialized version of `std::optional<CropRect>`.
|
|
59
|
+
*/
|
|
60
|
+
using std__optional_CropRect_ = std::optional<CropRect>;
|
|
61
|
+
inline std::optional<CropRect> create_std__optional_CropRect_(const CropRect& value) noexcept {
|
|
62
|
+
return std::optional<CropRect>(value);
|
|
63
|
+
}
|
|
64
|
+
inline bool has_value_std__optional_CropRect_(const std::optional<CropRect>& optional) noexcept {
|
|
65
|
+
return optional.has_value();
|
|
66
|
+
}
|
|
67
|
+
inline CropRect get_std__optional_CropRect_(const std::optional<CropRect>& optional) noexcept {
|
|
68
|
+
return optional.value();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// pragma MARK: std::shared_ptr<Promise<PickedImage>>
|
|
72
|
+
/**
|
|
73
|
+
* Specialized version of `std::shared_ptr<Promise<PickedImage>>`.
|
|
74
|
+
*/
|
|
75
|
+
using std__shared_ptr_Promise_PickedImage__ = std::shared_ptr<Promise<PickedImage>>;
|
|
76
|
+
inline std::shared_ptr<Promise<PickedImage>> create_std__shared_ptr_Promise_PickedImage__() noexcept {
|
|
77
|
+
return Promise<PickedImage>::create();
|
|
78
|
+
}
|
|
79
|
+
inline PromiseHolder<PickedImage> wrap_std__shared_ptr_Promise_PickedImage__(std::shared_ptr<Promise<PickedImage>> promise) noexcept {
|
|
80
|
+
return PromiseHolder<PickedImage>(std::move(promise));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// pragma MARK: std::function<void(const PickedImage& /* result */)>
|
|
84
|
+
/**
|
|
85
|
+
* Specialized version of `std::function<void(const PickedImage&)>`.
|
|
86
|
+
*/
|
|
87
|
+
using Func_void_PickedImage = std::function<void(const PickedImage& /* result */)>;
|
|
88
|
+
/**
|
|
89
|
+
* Wrapper class for a `std::function<void(const PickedImage& / * result * /)>`, this can be used from Swift.
|
|
90
|
+
*/
|
|
91
|
+
class Func_void_PickedImage_Wrapper final {
|
|
92
|
+
public:
|
|
93
|
+
explicit Func_void_PickedImage_Wrapper(std::function<void(const PickedImage& /* result */)>&& func): _function(std::make_unique<std::function<void(const PickedImage& /* result */)>>(std::move(func))) {}
|
|
94
|
+
inline void call(PickedImage result) const noexcept {
|
|
95
|
+
_function->operator()(result);
|
|
96
|
+
}
|
|
97
|
+
private:
|
|
98
|
+
std::unique_ptr<std::function<void(const PickedImage& /* result */)>> _function;
|
|
99
|
+
} SWIFT_NONCOPYABLE;
|
|
100
|
+
Func_void_PickedImage create_Func_void_PickedImage(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
101
|
+
inline Func_void_PickedImage_Wrapper wrap_Func_void_PickedImage(Func_void_PickedImage value) noexcept {
|
|
102
|
+
return Func_void_PickedImage_Wrapper(std::move(value));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
106
|
+
/**
|
|
107
|
+
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
108
|
+
*/
|
|
109
|
+
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
110
|
+
/**
|
|
111
|
+
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
112
|
+
*/
|
|
113
|
+
class Func_void_std__exception_ptr_Wrapper final {
|
|
114
|
+
public:
|
|
115
|
+
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
|
|
116
|
+
inline void call(std::exception_ptr error) const noexcept {
|
|
117
|
+
_function->operator()(error);
|
|
118
|
+
}
|
|
119
|
+
private:
|
|
120
|
+
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
121
|
+
} SWIFT_NONCOPYABLE;
|
|
122
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
123
|
+
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
124
|
+
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// pragma MARK: std::optional<double>
|
|
128
|
+
/**
|
|
129
|
+
* Specialized version of `std::optional<double>`.
|
|
130
|
+
*/
|
|
131
|
+
using std__optional_double_ = std::optional<double>;
|
|
132
|
+
inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
|
|
133
|
+
return std::optional<double>(value);
|
|
134
|
+
}
|
|
135
|
+
inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
136
|
+
return optional.has_value();
|
|
137
|
+
}
|
|
138
|
+
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
139
|
+
return optional.value();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// pragma MARK: std::optional<bool>
|
|
143
|
+
/**
|
|
144
|
+
* Specialized version of `std::optional<bool>`.
|
|
145
|
+
*/
|
|
146
|
+
using std__optional_bool_ = std::optional<bool>;
|
|
147
|
+
inline std::optional<bool> create_std__optional_bool_(const bool& value) noexcept {
|
|
148
|
+
return std::optional<bool>(value);
|
|
149
|
+
}
|
|
150
|
+
inline bool has_value_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
151
|
+
return optional.has_value();
|
|
152
|
+
}
|
|
153
|
+
inline bool get_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
154
|
+
return optional.value();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// pragma MARK: std::shared_ptr<Promise<void>>
|
|
158
|
+
/**
|
|
159
|
+
* Specialized version of `std::shared_ptr<Promise<void>>`.
|
|
160
|
+
*/
|
|
161
|
+
using std__shared_ptr_Promise_void__ = std::shared_ptr<Promise<void>>;
|
|
162
|
+
inline std::shared_ptr<Promise<void>> create_std__shared_ptr_Promise_void__() noexcept {
|
|
163
|
+
return Promise<void>::create();
|
|
164
|
+
}
|
|
165
|
+
inline PromiseHolder<void> wrap_std__shared_ptr_Promise_void__(std::shared_ptr<Promise<void>> promise) noexcept {
|
|
166
|
+
return PromiseHolder<void>(std::move(promise));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// pragma MARK: std::function<void()>
|
|
170
|
+
/**
|
|
171
|
+
* Specialized version of `std::function<void()>`.
|
|
172
|
+
*/
|
|
173
|
+
using Func_void = std::function<void()>;
|
|
174
|
+
/**
|
|
175
|
+
* Wrapper class for a `std::function<void()>`, this can be used from Swift.
|
|
176
|
+
*/
|
|
177
|
+
class Func_void_Wrapper final {
|
|
178
|
+
public:
|
|
179
|
+
explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
|
|
180
|
+
inline void call() const noexcept {
|
|
181
|
+
_function->operator()();
|
|
182
|
+
}
|
|
183
|
+
private:
|
|
184
|
+
std::unique_ptr<std::function<void()>> _function;
|
|
185
|
+
} SWIFT_NONCOPYABLE;
|
|
186
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
187
|
+
inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
|
|
188
|
+
return Func_void_Wrapper(std::move(value));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// pragma MARK: std::shared_ptr<HybridReactNativeImageCropPickerSpec>
|
|
192
|
+
/**
|
|
193
|
+
* Specialized version of `std::shared_ptr<HybridReactNativeImageCropPickerSpec>`.
|
|
194
|
+
*/
|
|
195
|
+
using std__shared_ptr_HybridReactNativeImageCropPickerSpec_ = std::shared_ptr<HybridReactNativeImageCropPickerSpec>;
|
|
196
|
+
std::shared_ptr<HybridReactNativeImageCropPickerSpec> create_std__shared_ptr_HybridReactNativeImageCropPickerSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
197
|
+
void* NON_NULL get_std__shared_ptr_HybridReactNativeImageCropPickerSpec_(std__shared_ptr_HybridReactNativeImageCropPickerSpec_ cppType);
|
|
198
|
+
|
|
199
|
+
// pragma MARK: std::weak_ptr<HybridReactNativeImageCropPickerSpec>
|
|
200
|
+
using std__weak_ptr_HybridReactNativeImageCropPickerSpec_ = std::weak_ptr<HybridReactNativeImageCropPickerSpec>;
|
|
201
|
+
inline std__weak_ptr_HybridReactNativeImageCropPickerSpec_ weakify_std__shared_ptr_HybridReactNativeImageCropPickerSpec_(const std::shared_ptr<HybridReactNativeImageCropPickerSpec>& strong) noexcept { return strong; }
|
|
202
|
+
|
|
203
|
+
// pragma MARK: Result<std::shared_ptr<Promise<PickedImage>>>
|
|
204
|
+
using Result_std__shared_ptr_Promise_PickedImage___ = Result<std::shared_ptr<Promise<PickedImage>>>;
|
|
205
|
+
inline Result_std__shared_ptr_Promise_PickedImage___ create_Result_std__shared_ptr_Promise_PickedImage___(const std::shared_ptr<Promise<PickedImage>>& value) noexcept {
|
|
206
|
+
return Result<std::shared_ptr<Promise<PickedImage>>>::withValue(value);
|
|
207
|
+
}
|
|
208
|
+
inline Result_std__shared_ptr_Promise_PickedImage___ create_Result_std__shared_ptr_Promise_PickedImage___(const std::exception_ptr& error) noexcept {
|
|
209
|
+
return Result<std::shared_ptr<Promise<PickedImage>>>::withError(error);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// pragma MARK: Result<std::shared_ptr<Promise<void>>>
|
|
213
|
+
using Result_std__shared_ptr_Promise_void___ = Result<std::shared_ptr<Promise<void>>>;
|
|
214
|
+
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::shared_ptr<Promise<void>>& value) noexcept {
|
|
215
|
+
return Result<std::shared_ptr<Promise<void>>>::withValue(value);
|
|
216
|
+
}
|
|
217
|
+
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::exception_ptr& error) noexcept {
|
|
218
|
+
return Result<std::shared_ptr<Promise<void>>>::withError(error);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
} // namespace margelo::nitro::reactnativeimagecroppicker::bridge::swift
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeImageCropPicker-Swift-Cxx-Umbrella.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `CropRect` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::reactnativeimagecroppicker { struct CropRect; }
|
|
13
|
+
// Forward declaration of `HybridReactNativeImageCropPickerSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::reactnativeimagecroppicker { class HybridReactNativeImageCropPickerSpec; }
|
|
15
|
+
// Forward declaration of `ImageCropPickerOptions` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::reactnativeimagecroppicker { struct ImageCropPickerOptions; }
|
|
17
|
+
// Forward declaration of `PickedImage` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::reactnativeimagecroppicker { struct PickedImage; }
|
|
19
|
+
|
|
20
|
+
// Include C++ defined types
|
|
21
|
+
#include "CropRect.hpp"
|
|
22
|
+
#include "HybridReactNativeImageCropPickerSpec.hpp"
|
|
23
|
+
#include "ImageCropPickerOptions.hpp"
|
|
24
|
+
#include "PickedImage.hpp"
|
|
25
|
+
#include <NitroModules/Promise.hpp>
|
|
26
|
+
#include <NitroModules/Result.hpp>
|
|
27
|
+
#include <exception>
|
|
28
|
+
#include <memory>
|
|
29
|
+
#include <optional>
|
|
30
|
+
#include <string>
|
|
31
|
+
|
|
32
|
+
// C++ helpers for Swift
|
|
33
|
+
#include "ReactNativeImageCropPicker-Swift-Cxx-Bridge.hpp"
|
|
34
|
+
|
|
35
|
+
// Common C++ types used in Swift
|
|
36
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
37
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
38
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
39
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
40
|
+
|
|
41
|
+
// Forward declarations of Swift defined types
|
|
42
|
+
// Forward declaration of `HybridReactNativeImageCropPickerSpec_cxx` to properly resolve imports.
|
|
43
|
+
namespace ReactNativeImageCropPicker { class HybridReactNativeImageCropPickerSpec_cxx; }
|
|
44
|
+
|
|
45
|
+
// Include Swift defined types
|
|
46
|
+
#if __has_include("ReactNativeImageCropPicker-Swift.h")
|
|
47
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
48
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "ReactNativeImageCropPicker".
|
|
49
|
+
#include "ReactNativeImageCropPicker-Swift.h"
|
|
50
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
51
|
+
#elif __has_include(<ReactNativeImageCropPicker/ReactNativeImageCropPicker-Swift.h>)
|
|
52
|
+
#include <ReactNativeImageCropPicker/ReactNativeImageCropPicker-Swift.h>
|
|
53
|
+
#else
|
|
54
|
+
#error ReactNativeImageCropPicker's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "ReactNativeImageCropPicker", and try building the app first.
|
|
55
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeImageCropPickerAutolinking.mm
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "ReactNativeImageCropPicker-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridReactNativeImageCropPickerSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface ReactNativeImageCropPickerAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation ReactNativeImageCropPickerAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::reactnativeimagecroppicker;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"ReactNativeImageCropPicker",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridReactNativeImageCropPickerSpec> hybridObject = ReactNativeImageCropPicker::ReactNativeImageCropPickerAutolinking::createReactNativeImageCropPicker();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeImageCropPickerAutolinking.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
12
|
+
public final class ReactNativeImageCropPickerAutolinking {
|
|
13
|
+
public typealias bridge = margelo.nitro.reactnativeimagecroppicker.bridge.swift
|
|
14
|
+
|
|
15
|
+
public static func createReactNativeImageCropPicker() -> bridge.std__shared_ptr_HybridReactNativeImageCropPickerSpec_ {
|
|
16
|
+
let hybridObject = ReactNativeImageCropPicker()
|
|
17
|
+
return { () -> bridge.std__shared_ptr_HybridReactNativeImageCropPickerSpec_ in
|
|
18
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
19
|
+
return __cxxWrapped.getCxxPart()
|
|
20
|
+
}()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static func isReactNativeImageCropPickerRecyclable() -> Bool {
|
|
24
|
+
return ReactNativeImageCropPicker.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReactNativeImageCropPickerSpecSwift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridReactNativeImageCropPickerSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::reactnativeimagecroppicker {
|
|
11
|
+
} // namespace margelo::nitro::reactnativeimagecroppicker
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReactNativeImageCropPickerSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridReactNativeImageCropPickerSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridReactNativeImageCropPickerSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace ReactNativeImageCropPicker { class HybridReactNativeImageCropPickerSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `PickedImage` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::reactnativeimagecroppicker { struct PickedImage; }
|
|
17
|
+
// Forward declaration of `CropRect` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::reactnativeimagecroppicker { struct CropRect; }
|
|
19
|
+
// Forward declaration of `ImageCropPickerOptions` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::reactnativeimagecroppicker { struct ImageCropPickerOptions; }
|
|
21
|
+
|
|
22
|
+
#include "PickedImage.hpp"
|
|
23
|
+
#include <NitroModules/Promise.hpp>
|
|
24
|
+
#include <string>
|
|
25
|
+
#include <optional>
|
|
26
|
+
#include "CropRect.hpp"
|
|
27
|
+
#include "ImageCropPickerOptions.hpp"
|
|
28
|
+
|
|
29
|
+
#include "ReactNativeImageCropPicker-Swift-Cxx-Umbrella.hpp"
|
|
30
|
+
|
|
31
|
+
namespace margelo::nitro::reactnativeimagecroppicker {
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The C++ part of HybridReactNativeImageCropPickerSpec_cxx.swift.
|
|
35
|
+
*
|
|
36
|
+
* HybridReactNativeImageCropPickerSpecSwift (C++) accesses HybridReactNativeImageCropPickerSpec_cxx (Swift), and might
|
|
37
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
38
|
+
*
|
|
39
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
40
|
+
* the future, HybridReactNativeImageCropPickerSpec_cxx can directly inherit from the C++ class HybridReactNativeImageCropPickerSpec
|
|
41
|
+
* to simplify the whole structure and memory management.
|
|
42
|
+
*/
|
|
43
|
+
class HybridReactNativeImageCropPickerSpecSwift: public virtual HybridReactNativeImageCropPickerSpec {
|
|
44
|
+
public:
|
|
45
|
+
// Constructor from a Swift instance
|
|
46
|
+
explicit HybridReactNativeImageCropPickerSpecSwift(const ReactNativeImageCropPicker::HybridReactNativeImageCropPickerSpec_cxx& swiftPart):
|
|
47
|
+
HybridObject(HybridReactNativeImageCropPickerSpec::TAG),
|
|
48
|
+
_swiftPart(swiftPart) { }
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
// Get the Swift part
|
|
52
|
+
inline ReactNativeImageCropPicker::HybridReactNativeImageCropPickerSpec_cxx& getSwiftPart() noexcept {
|
|
53
|
+
return _swiftPart;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
58
|
+
return _swiftPart.getMemorySize();
|
|
59
|
+
}
|
|
60
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
61
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridReactNativeImageCropPickerSpecSwift>(other)) {
|
|
62
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
void dispose() noexcept override {
|
|
67
|
+
_swiftPart.dispose();
|
|
68
|
+
}
|
|
69
|
+
std::string toString() override {
|
|
70
|
+
return _swiftPart.toString();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public:
|
|
74
|
+
// Properties
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
public:
|
|
78
|
+
// Methods
|
|
79
|
+
inline std::shared_ptr<Promise<PickedImage>> openPicker(const ImageCropPickerOptions& options) override {
|
|
80
|
+
auto __result = _swiftPart.openPicker(std::forward<decltype(options)>(options));
|
|
81
|
+
if (__result.hasError()) [[unlikely]] {
|
|
82
|
+
std::rethrow_exception(__result.error());
|
|
83
|
+
}
|
|
84
|
+
auto __value = std::move(__result.value());
|
|
85
|
+
return __value;
|
|
86
|
+
}
|
|
87
|
+
inline std::shared_ptr<Promise<PickedImage>> openCropper(const std::string& path, const ImageCropPickerOptions& options) override {
|
|
88
|
+
auto __result = _swiftPart.openCropper(path, std::forward<decltype(options)>(options));
|
|
89
|
+
if (__result.hasError()) [[unlikely]] {
|
|
90
|
+
std::rethrow_exception(__result.error());
|
|
91
|
+
}
|
|
92
|
+
auto __value = std::move(__result.value());
|
|
93
|
+
return __value;
|
|
94
|
+
}
|
|
95
|
+
inline std::shared_ptr<Promise<void>> clean() override {
|
|
96
|
+
auto __result = _swiftPart.clean();
|
|
97
|
+
if (__result.hasError()) [[unlikely]] {
|
|
98
|
+
std::rethrow_exception(__result.error());
|
|
99
|
+
}
|
|
100
|
+
auto __value = std::move(__result.value());
|
|
101
|
+
return __value;
|
|
102
|
+
}
|
|
103
|
+
inline std::shared_ptr<Promise<void>> cleanSingle(const std::string& path) override {
|
|
104
|
+
auto __result = _swiftPart.cleanSingle(path);
|
|
105
|
+
if (__result.hasError()) [[unlikely]] {
|
|
106
|
+
std::rethrow_exception(__result.error());
|
|
107
|
+
}
|
|
108
|
+
auto __value = std::move(__result.value());
|
|
109
|
+
return __value;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
private:
|
|
113
|
+
ReactNativeImageCropPicker::HybridReactNativeImageCropPickerSpec_cxx _swiftPart;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
} // namespace margelo::nitro::reactnativeimagecroppicker
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CropRect.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `CropRect`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias CropRect = margelo.nitro.reactnativeimagecroppicker.CropRect
|
|
14
|
+
|
|
15
|
+
public extension CropRect {
|
|
16
|
+
private typealias bridge = margelo.nitro.reactnativeimagecroppicker.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `CropRect`.
|
|
20
|
+
*/
|
|
21
|
+
init(x: Double, y: Double, width: Double, height: Double) {
|
|
22
|
+
self.init(x, y, width, height)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@inline(__always)
|
|
26
|
+
var x: Double {
|
|
27
|
+
return self.__x
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@inline(__always)
|
|
31
|
+
var y: Double {
|
|
32
|
+
return self.__y
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@inline(__always)
|
|
36
|
+
var width: Double {
|
|
37
|
+
return self.__width
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@inline(__always)
|
|
41
|
+
var height: Double {
|
|
42
|
+
return self.__height
|
|
43
|
+
}
|
|
44
|
+
}
|