react-native-picture-selector 1.0.0
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/README.md +627 -0
- package/android/CMakeLists.txt +30 -0
- package/android/build.gradle +79 -0
- package/android/proguard-rules.pro +21 -0
- package/android/src/main/AndroidManifest.xml +39 -0
- package/android/src/main/kotlin/com/margelo/pictureselector/GlideEngine.kt +80 -0
- package/android/src/main/kotlin/com/margelo/pictureselector/HybridPictureSelector.kt +138 -0
- package/android/src/main/kotlin/com/margelo/pictureselector/LubanCompressEngine.kt +58 -0
- package/android/src/main/kotlin/com/margelo/pictureselector/MediaAssetMapper.kt +69 -0
- package/android/src/main/kotlin/com/margelo/pictureselector/NitroPictureSelectorPackage.kt +52 -0
- package/android/src/main/kotlin/com/margelo/pictureselector/PictureSelectorOptionsMapper.kt +105 -0
- package/android/src/main/kotlin/com/margelo/pictureselector/UCropEngine.kt +57 -0
- package/android/src/main/res/xml/file_paths.xml +8 -0
- package/ios/HybridPictureSelector.swift +386 -0
- package/ios/NitroPictureSelector.podspec +39 -0
- package/lib/commonjs/PictureSelector.js +74 -0
- package/lib/commonjs/PictureSelector.js.map +1 -0
- package/lib/commonjs/index.js +39 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/specs/PictureSelector.nitro.js +34 -0
- package/lib/commonjs/specs/PictureSelector.nitro.js.map +1 -0
- package/lib/commonjs/types.js +44 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/usePictureSelector.js +122 -0
- package/lib/commonjs/usePictureSelector.js.map +1 -0
- package/lib/module/PictureSelector.js +71 -0
- package/lib/module/PictureSelector.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/specs/PictureSelector.nitro.js +36 -0
- package/lib/module/specs/PictureSelector.nitro.js.map +1 -0
- package/lib/module/types.js +29 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/usePictureSelector.js +119 -0
- package/lib/module/usePictureSelector.js.map +1 -0
- package/lib/typescript/PictureSelector.d.ts +23 -0
- package/lib/typescript/PictureSelector.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +6 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/specs/PictureSelector.nitro.d.ts +96 -0
- package/lib/typescript/specs/PictureSelector.nitro.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +16 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/usePictureSelector.d.ts +26 -0
- package/lib/typescript/usePictureSelector.d.ts.map +1 -0
- package/nitro.json +11 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroPictureSelector+autolinking.cmake +81 -0
- package/nitrogen/generated/android/NitroPictureSelector+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroPictureSelectorOnLoad.cpp +41 -0
- package/nitrogen/generated/android/NitroPictureSelectorOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JCompressOptions.hpp +69 -0
- package/nitrogen/generated/android/c++/JCropOptions.hpp +73 -0
- package/nitrogen/generated/android/c++/JHybridHybridPictureSelectorSpec.cpp +125 -0
- package/nitrogen/generated/android/c++/JHybridHybridPictureSelectorSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JMediaAsset.hpp +98 -0
- package/nitrogen/generated/android/c++/JMediaType.hpp +61 -0
- package/nitrogen/generated/android/c++/JPickerTheme.hpp +64 -0
- package/nitrogen/generated/android/c++/JPictureSelectorOptions.hpp +121 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/margelo/pictureselector/CompressOptions.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/margelo/pictureselector/CropOptions.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/margelo/pictureselector/HybridHybridPictureSelectorSpec.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/margelo/pictureselector/MediaAsset.kt +68 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/margelo/pictureselector/MediaType.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/margelo/pictureselector/NitroPictureSelectorOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/margelo/pictureselector/PickerTheme.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/margelo/pictureselector/PictureSelectorOptions.kt +65 -0
- package/nitrogen/generated/ios/NitroPictureSelector+autolinking.rb +60 -0
- package/nitrogen/generated/ios/NitroPictureSelector-Swift-Cxx-Bridge.cpp +49 -0
- package/nitrogen/generated/ios/NitroPictureSelector-Swift-Cxx-Bridge.hpp +270 -0
- package/nitrogen/generated/ios/NitroPictureSelector-Swift-Cxx-Umbrella.hpp +65 -0
- package/nitrogen/generated/ios/c++/HybridHybridPictureSelectorSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridHybridPictureSelectorSpecSwift.hpp +110 -0
- package/nitrogen/generated/ios/swift/CompressOptions.swift +83 -0
- package/nitrogen/generated/ios/swift/CropOptions.swift +101 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_MediaAsset_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridHybridPictureSelectorSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridHybridPictureSelectorSpec_cxx.swift +176 -0
- package/nitrogen/generated/ios/swift/MediaAsset.swift +118 -0
- package/nitrogen/generated/ios/swift/MediaType.swift +44 -0
- package/nitrogen/generated/ios/swift/PickerTheme.swift +48 -0
- package/nitrogen/generated/ios/swift/PictureSelectorOptions.swift +182 -0
- package/nitrogen/generated/shared/c++/CompressOptions.hpp +95 -0
- package/nitrogen/generated/shared/c++/CropOptions.hpp +99 -0
- package/nitrogen/generated/shared/c++/HybridHybridPictureSelectorSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridHybridPictureSelectorSpec.hpp +69 -0
- package/nitrogen/generated/shared/c++/MediaAsset.hpp +124 -0
- package/nitrogen/generated/shared/c++/MediaType.hpp +80 -0
- package/nitrogen/generated/shared/c++/PickerTheme.hpp +84 -0
- package/nitrogen/generated/shared/c++/PictureSelectorOptions.hpp +132 -0
- package/package.json +76 -0
- package/src/PictureSelector.ts +72 -0
- package/src/index.ts +16 -0
- package/src/specs/PictureSelector.nitro.ts +121 -0
- package/src/types.ts +38 -0
- package/src/usePictureSelector.ts +102 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CropOptions.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 `CropOptions`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias CropOptions = margelo.nitro.margelo.pictureselector.CropOptions
|
|
14
|
+
|
|
15
|
+
public extension CropOptions {
|
|
16
|
+
private typealias bridge = margelo.nitro.margelo.pictureselector.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `CropOptions`.
|
|
20
|
+
*/
|
|
21
|
+
init(enabled: Bool, freeStyle: Bool?, circular: Bool?, ratioX: Double?, ratioY: Double?) {
|
|
22
|
+
self.init(enabled, { () -> bridge.std__optional_bool_ in
|
|
23
|
+
if let __unwrappedValue = freeStyle {
|
|
24
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}(), { () -> bridge.std__optional_bool_ in
|
|
29
|
+
if let __unwrappedValue = circular {
|
|
30
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
31
|
+
} else {
|
|
32
|
+
return .init()
|
|
33
|
+
}
|
|
34
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
35
|
+
if let __unwrappedValue = ratioX {
|
|
36
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
37
|
+
} else {
|
|
38
|
+
return .init()
|
|
39
|
+
}
|
|
40
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
41
|
+
if let __unwrappedValue = ratioY {
|
|
42
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
43
|
+
} else {
|
|
44
|
+
return .init()
|
|
45
|
+
}
|
|
46
|
+
}())
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@inline(__always)
|
|
50
|
+
var enabled: Bool {
|
|
51
|
+
return self.__enabled
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@inline(__always)
|
|
55
|
+
var freeStyle: Bool? {
|
|
56
|
+
return { () -> Bool? in
|
|
57
|
+
if bridge.has_value_std__optional_bool_(self.__freeStyle) {
|
|
58
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__freeStyle)
|
|
59
|
+
return __unwrapped
|
|
60
|
+
} else {
|
|
61
|
+
return nil
|
|
62
|
+
}
|
|
63
|
+
}()
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@inline(__always)
|
|
67
|
+
var circular: Bool? {
|
|
68
|
+
return { () -> Bool? in
|
|
69
|
+
if bridge.has_value_std__optional_bool_(self.__circular) {
|
|
70
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__circular)
|
|
71
|
+
return __unwrapped
|
|
72
|
+
} else {
|
|
73
|
+
return nil
|
|
74
|
+
}
|
|
75
|
+
}()
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@inline(__always)
|
|
79
|
+
var ratioX: Double? {
|
|
80
|
+
return { () -> Double? in
|
|
81
|
+
if bridge.has_value_std__optional_double_(self.__ratioX) {
|
|
82
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__ratioX)
|
|
83
|
+
return __unwrapped
|
|
84
|
+
} else {
|
|
85
|
+
return nil
|
|
86
|
+
}
|
|
87
|
+
}()
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@inline(__always)
|
|
91
|
+
var ratioY: Double? {
|
|
92
|
+
return { () -> Double? in
|
|
93
|
+
if bridge.has_value_std__optional_double_(self.__ratioY) {
|
|
94
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__ratioY)
|
|
95
|
+
return __unwrapped
|
|
96
|
+
} else {
|
|
97
|
+
return nil
|
|
98
|
+
}
|
|
99
|
+
}()
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__exception_ptr.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ error: Error) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_std__exception_ptr {
|
|
15
|
+
public typealias bridge = margelo.nitro.margelo.pictureselector.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ error: Error) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ error: Error) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(error: std.exception_ptr) -> Void {
|
|
25
|
+
self.closure(RuntimeError.from(cppError: error))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
|
|
44
|
+
return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__vector_MediaAsset_.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
|
+
* Wraps a Swift `(_ value: [MediaAsset]) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_std__vector_MediaAsset_ {
|
|
15
|
+
public typealias bridge = margelo.nitro.margelo.pictureselector.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ value: [MediaAsset]) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ value: [MediaAsset]) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(value: bridge.std__vector_MediaAsset_) -> Void {
|
|
25
|
+
self.closure(value.map({ __item in __item }))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_std__vector_MediaAsset_`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__vector_MediaAsset_>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_MediaAsset_ {
|
|
44
|
+
return Unmanaged<Func_void_std__vector_MediaAsset_>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridHybridPictureSelectorSpec.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
|
+
/// See ``HybridHybridPictureSelectorSpec``
|
|
11
|
+
public protocol HybridHybridPictureSelectorSpec_protocol: HybridObject {
|
|
12
|
+
// Properties
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
// Methods
|
|
16
|
+
func openPicker(options: PictureSelectorOptions) throws -> Promise<[MediaAsset]>
|
|
17
|
+
func openCamera(options: PictureSelectorOptions) throws -> Promise<[MediaAsset]>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public extension HybridHybridPictureSelectorSpec_protocol {
|
|
21
|
+
/// Default implementation of ``HybridObject.toString``
|
|
22
|
+
func toString() -> String {
|
|
23
|
+
return "[HybridObject HybridPictureSelector]"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// See ``HybridHybridPictureSelectorSpec``
|
|
28
|
+
open class HybridHybridPictureSelectorSpec_base {
|
|
29
|
+
private weak var cxxWrapper: HybridHybridPictureSelectorSpec_cxx? = nil
|
|
30
|
+
public init() { }
|
|
31
|
+
public func getCxxWrapper() -> HybridHybridPictureSelectorSpec_cxx {
|
|
32
|
+
#if DEBUG
|
|
33
|
+
guard self is any HybridHybridPictureSelectorSpec else {
|
|
34
|
+
fatalError("`self` is not a `HybridHybridPictureSelectorSpec`! Did you accidentally inherit from `HybridHybridPictureSelectorSpec_base` instead of `HybridHybridPictureSelectorSpec`?")
|
|
35
|
+
}
|
|
36
|
+
#endif
|
|
37
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
38
|
+
return cxxWrapper
|
|
39
|
+
} else {
|
|
40
|
+
let cxxWrapper = HybridHybridPictureSelectorSpec_cxx(self as! any HybridHybridPictureSelectorSpec)
|
|
41
|
+
self.cxxWrapper = cxxWrapper
|
|
42
|
+
return cxxWrapper
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A Swift base-protocol representing the HybridPictureSelector HybridObject.
|
|
49
|
+
* Implement this protocol to create Swift-based instances of HybridPictureSelector.
|
|
50
|
+
* ```swift
|
|
51
|
+
* class HybridHybridPictureSelector : HybridHybridPictureSelectorSpec {
|
|
52
|
+
* // ...
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
public typealias HybridHybridPictureSelectorSpec = HybridHybridPictureSelectorSpec_protocol & HybridHybridPictureSelectorSpec_base
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridHybridPictureSelectorSpec_cxx.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
|
+
* A class implementation that bridges HybridHybridPictureSelectorSpec over to C++.
|
|
12
|
+
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
|
13
|
+
*
|
|
14
|
+
* Also, some Swift types need to be bridged with special handling:
|
|
15
|
+
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
|
16
|
+
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
|
17
|
+
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
|
18
|
+
*/
|
|
19
|
+
open class HybridHybridPictureSelectorSpec_cxx {
|
|
20
|
+
/**
|
|
21
|
+
* The Swift <> C++ bridge's namespace (`margelo::nitro::margelo::pictureselector::bridge::swift`)
|
|
22
|
+
* from `NitroPictureSelector-Swift-Cxx-Bridge.hpp`.
|
|
23
|
+
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
24
|
+
*/
|
|
25
|
+
public typealias bridge = margelo.nitro.margelo.pictureselector.bridge.swift
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Holds an instance of the `HybridHybridPictureSelectorSpec` Swift protocol.
|
|
29
|
+
*/
|
|
30
|
+
private var __implementation: any HybridHybridPictureSelectorSpec
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
34
|
+
*/
|
|
35
|
+
private var __cxxPart: bridge.std__weak_ptr_HybridHybridPictureSelectorSpec_
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Create a new `HybridHybridPictureSelectorSpec_cxx` that wraps the given `HybridHybridPictureSelectorSpec`.
|
|
39
|
+
* All properties and methods bridge to C++ types.
|
|
40
|
+
*/
|
|
41
|
+
public init(_ implementation: any HybridHybridPictureSelectorSpec) {
|
|
42
|
+
self.__implementation = implementation
|
|
43
|
+
self.__cxxPart = .init()
|
|
44
|
+
/* no base class */
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Get the actual `HybridHybridPictureSelectorSpec` instance this class wraps.
|
|
49
|
+
*/
|
|
50
|
+
@inline(__always)
|
|
51
|
+
public func getHybridHybridPictureSelectorSpec() -> any HybridHybridPictureSelectorSpec {
|
|
52
|
+
return __implementation
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
57
|
+
* This acquires one additional strong reference on the object!
|
|
58
|
+
*/
|
|
59
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
60
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Casts an unsafe pointer to a `HybridHybridPictureSelectorSpec_cxx`.
|
|
65
|
+
* The pointer has to be a retained opaque `Unmanaged<HybridHybridPictureSelectorSpec_cxx>`.
|
|
66
|
+
* This removes one strong reference from the object!
|
|
67
|
+
*/
|
|
68
|
+
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridHybridPictureSelectorSpec_cxx {
|
|
69
|
+
return Unmanaged<HybridHybridPictureSelectorSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Gets (or creates) the C++ part of this Hybrid Object.
|
|
74
|
+
* The C++ part is a `std::shared_ptr<HybridHybridPictureSelectorSpec>`.
|
|
75
|
+
*/
|
|
76
|
+
public func getCxxPart() -> bridge.std__shared_ptr_HybridHybridPictureSelectorSpec_ {
|
|
77
|
+
let cachedCxxPart = self.__cxxPart.lock()
|
|
78
|
+
if Bool(fromCxx: cachedCxxPart) {
|
|
79
|
+
return cachedCxxPart
|
|
80
|
+
} else {
|
|
81
|
+
let newCxxPart = bridge.create_std__shared_ptr_HybridHybridPictureSelectorSpec_(self.toUnsafe())
|
|
82
|
+
__cxxPart = bridge.weakify_std__shared_ptr_HybridHybridPictureSelectorSpec_(newCxxPart)
|
|
83
|
+
return newCxxPart
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
91
|
+
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
|
92
|
+
*/
|
|
93
|
+
@inline(__always)
|
|
94
|
+
public var memorySize: Int {
|
|
95
|
+
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Compares this object with the given [other] object for reference equality.
|
|
100
|
+
*/
|
|
101
|
+
@inline(__always)
|
|
102
|
+
public func equals(other: HybridHybridPictureSelectorSpec_cxx) -> Bool {
|
|
103
|
+
return self.__implementation === other.__implementation
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Call dispose() on the Swift class.
|
|
108
|
+
* This _may_ be called manually from JS.
|
|
109
|
+
*/
|
|
110
|
+
@inline(__always)
|
|
111
|
+
public func dispose() {
|
|
112
|
+
self.__implementation.dispose()
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Call toString() on the Swift class.
|
|
117
|
+
*/
|
|
118
|
+
@inline(__always)
|
|
119
|
+
public func toString() -> String {
|
|
120
|
+
return self.__implementation.toString()
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Properties
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
// Methods
|
|
127
|
+
@inline(__always)
|
|
128
|
+
public final func openPicker(options: PictureSelectorOptions) -> bridge.Result_std__shared_ptr_Promise_std__vector_MediaAsset____ {
|
|
129
|
+
do {
|
|
130
|
+
let __result = try self.__implementation.openPicker(options: options)
|
|
131
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__vector_MediaAsset___ in
|
|
132
|
+
let __promise = bridge.create_std__shared_ptr_Promise_std__vector_MediaAsset___()
|
|
133
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__vector_MediaAsset___(__promise)
|
|
134
|
+
__result
|
|
135
|
+
.then({ __result in __promiseHolder.resolve({ () -> bridge.std__vector_MediaAsset_ in
|
|
136
|
+
var __vector = bridge.create_std__vector_MediaAsset_(__result.count)
|
|
137
|
+
for __item in __result {
|
|
138
|
+
__vector.push_back(__item)
|
|
139
|
+
}
|
|
140
|
+
return __vector
|
|
141
|
+
}()) })
|
|
142
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
143
|
+
return __promise
|
|
144
|
+
}()
|
|
145
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__vector_MediaAsset____(__resultCpp)
|
|
146
|
+
} catch (let __error) {
|
|
147
|
+
let __exceptionPtr = __error.toCpp()
|
|
148
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__vector_MediaAsset____(__exceptionPtr)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@inline(__always)
|
|
153
|
+
public final func openCamera(options: PictureSelectorOptions) -> bridge.Result_std__shared_ptr_Promise_std__vector_MediaAsset____ {
|
|
154
|
+
do {
|
|
155
|
+
let __result = try self.__implementation.openCamera(options: options)
|
|
156
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__vector_MediaAsset___ in
|
|
157
|
+
let __promise = bridge.create_std__shared_ptr_Promise_std__vector_MediaAsset___()
|
|
158
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__vector_MediaAsset___(__promise)
|
|
159
|
+
__result
|
|
160
|
+
.then({ __result in __promiseHolder.resolve({ () -> bridge.std__vector_MediaAsset_ in
|
|
161
|
+
var __vector = bridge.create_std__vector_MediaAsset_(__result.count)
|
|
162
|
+
for __item in __result {
|
|
163
|
+
__vector.push_back(__item)
|
|
164
|
+
}
|
|
165
|
+
return __vector
|
|
166
|
+
}()) })
|
|
167
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
168
|
+
return __promise
|
|
169
|
+
}()
|
|
170
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__vector_MediaAsset____(__resultCpp)
|
|
171
|
+
} catch (let __error) {
|
|
172
|
+
let __exceptionPtr = __error.toCpp()
|
|
173
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__vector_MediaAsset____(__exceptionPtr)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MediaAsset.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 `MediaAsset`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias MediaAsset = margelo.nitro.margelo.pictureselector.MediaAsset
|
|
14
|
+
|
|
15
|
+
public extension MediaAsset {
|
|
16
|
+
private typealias bridge = margelo.nitro.margelo.pictureselector.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `MediaAsset`.
|
|
20
|
+
*/
|
|
21
|
+
init(uri: String, type: String, mimeType: String, width: Double, height: Double, duration: Double, fileName: String, fileSize: Double, editedUri: String?, isOriginal: Bool?, bucketName: String?) {
|
|
22
|
+
self.init(std.string(uri), std.string(type), std.string(mimeType), width, height, duration, std.string(fileName), fileSize, { () -> bridge.std__optional_std__string_ in
|
|
23
|
+
if let __unwrappedValue = editedUri {
|
|
24
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}(), { () -> bridge.std__optional_bool_ in
|
|
29
|
+
if let __unwrappedValue = isOriginal {
|
|
30
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
31
|
+
} else {
|
|
32
|
+
return .init()
|
|
33
|
+
}
|
|
34
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
35
|
+
if let __unwrappedValue = bucketName {
|
|
36
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
37
|
+
} else {
|
|
38
|
+
return .init()
|
|
39
|
+
}
|
|
40
|
+
}())
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@inline(__always)
|
|
44
|
+
var uri: String {
|
|
45
|
+
return String(self.__uri)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@inline(__always)
|
|
49
|
+
var type: String {
|
|
50
|
+
return String(self.__type)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@inline(__always)
|
|
54
|
+
var mimeType: String {
|
|
55
|
+
return String(self.__mimeType)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@inline(__always)
|
|
59
|
+
var width: Double {
|
|
60
|
+
return self.__width
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@inline(__always)
|
|
64
|
+
var height: Double {
|
|
65
|
+
return self.__height
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@inline(__always)
|
|
69
|
+
var duration: Double {
|
|
70
|
+
return self.__duration
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@inline(__always)
|
|
74
|
+
var fileName: String {
|
|
75
|
+
return String(self.__fileName)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@inline(__always)
|
|
79
|
+
var fileSize: Double {
|
|
80
|
+
return self.__fileSize
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@inline(__always)
|
|
84
|
+
var editedUri: String? {
|
|
85
|
+
return { () -> String? in
|
|
86
|
+
if bridge.has_value_std__optional_std__string_(self.__editedUri) {
|
|
87
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__editedUri)
|
|
88
|
+
return String(__unwrapped)
|
|
89
|
+
} else {
|
|
90
|
+
return nil
|
|
91
|
+
}
|
|
92
|
+
}()
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@inline(__always)
|
|
96
|
+
var isOriginal: Bool? {
|
|
97
|
+
return { () -> Bool? in
|
|
98
|
+
if bridge.has_value_std__optional_bool_(self.__isOriginal) {
|
|
99
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__isOriginal)
|
|
100
|
+
return __unwrapped
|
|
101
|
+
} else {
|
|
102
|
+
return nil
|
|
103
|
+
}
|
|
104
|
+
}()
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@inline(__always)
|
|
108
|
+
var bucketName: String? {
|
|
109
|
+
return { () -> String? in
|
|
110
|
+
if bridge.has_value_std__optional_std__string_(self.__bucketName) {
|
|
111
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__bucketName)
|
|
112
|
+
return String(__unwrapped)
|
|
113
|
+
} else {
|
|
114
|
+
return nil
|
|
115
|
+
}
|
|
116
|
+
}()
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MediaType.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
|
+
/**
|
|
9
|
+
* Represents the JS union `MediaType`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias MediaType = margelo.nitro.margelo.pictureselector.MediaType
|
|
12
|
+
|
|
13
|
+
public extension MediaType {
|
|
14
|
+
/**
|
|
15
|
+
* Get a MediaType for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "image":
|
|
21
|
+
self = .image
|
|
22
|
+
case "video":
|
|
23
|
+
self = .video
|
|
24
|
+
case "all":
|
|
25
|
+
self = .all
|
|
26
|
+
default:
|
|
27
|
+
return nil
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get the String value this MediaType represents.
|
|
33
|
+
*/
|
|
34
|
+
var stringValue: String {
|
|
35
|
+
switch self {
|
|
36
|
+
case .image:
|
|
37
|
+
return "image"
|
|
38
|
+
case .video:
|
|
39
|
+
return "video"
|
|
40
|
+
case .all:
|
|
41
|
+
return "all"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PickerTheme.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
|
+
/**
|
|
9
|
+
* Represents the JS union `PickerTheme`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias PickerTheme = margelo.nitro.margelo.pictureselector.PickerTheme
|
|
12
|
+
|
|
13
|
+
public extension PickerTheme {
|
|
14
|
+
/**
|
|
15
|
+
* Get a PickerTheme for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "default":
|
|
21
|
+
self = .default
|
|
22
|
+
case "wechat":
|
|
23
|
+
self = .wechat
|
|
24
|
+
case "white":
|
|
25
|
+
self = .white
|
|
26
|
+
case "dark":
|
|
27
|
+
self = .dark
|
|
28
|
+
default:
|
|
29
|
+
return nil
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get the String value this PickerTheme represents.
|
|
35
|
+
*/
|
|
36
|
+
var stringValue: String {
|
|
37
|
+
switch self {
|
|
38
|
+
case .default:
|
|
39
|
+
return "default"
|
|
40
|
+
case .wechat:
|
|
41
|
+
return "wechat"
|
|
42
|
+
case .white:
|
|
43
|
+
return "white"
|
|
44
|
+
case .dark:
|
|
45
|
+
return "dark"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|