@onekeyfe/react-native-image-crop-picker 3.0.147 → 3.0.148

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.
Files changed (34) hide show
  1. package/README.md +48 -5
  2. package/ReactNativeImageCropPicker.podspec +5 -3
  3. package/android/src/main/AndroidManifest.xml +2 -2
  4. package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerImageProcessor.kt +8 -18
  5. package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerSession.kt +21 -46
  6. package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ImageCropperActivity.kt +636 -0
  7. package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ImageCropperTheme.kt +188 -0
  8. package/android/src/main/res/drawable/image_crop_picker_rotate.xml +11 -0
  9. package/ios/ImageCropPickerImageProcessor.swift +8 -4
  10. package/ios/ImageCropPickerSession.swift +43 -46
  11. package/ios/ImageCropperTheme.swift +155 -0
  12. package/ios/ImageCropperViewController.swift +462 -0
  13. package/ios/TOCropViewController/Views/TOCropOverlayView.h +9 -0
  14. package/ios/TOCropViewController/Views/TOCropOverlayView.m +47 -3
  15. package/lib/typescript/src/ReactNativeImageCropPicker.nitro.d.ts +17 -11
  16. package/lib/typescript/src/ReactNativeImageCropPicker.nitro.d.ts.map +1 -1
  17. package/nitrogen/generated/android/c++/JHybridReactNativeImageCropPickerSpec.cpp +8 -0
  18. package/nitrogen/generated/android/c++/JImageCropPickerOptions.hpp +9 -45
  19. package/nitrogen/generated/android/c++/JImageCropperAppearance.hpp +108 -0
  20. package/nitrogen/generated/android/c++/JImageCropperColorScheme.hpp +58 -0
  21. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerOptions.kt +5 -55
  22. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/ImageCropperAppearance.kt +111 -0
  23. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/ImageCropperColorScheme.kt +23 -0
  24. package/nitrogen/generated/ios/ReactNativeImageCropPicker-Swift-Cxx-Bridge.hpp +36 -0
  25. package/nitrogen/generated/ios/ReactNativeImageCropPicker-Swift-Cxx-Umbrella.hpp +6 -0
  26. package/nitrogen/generated/ios/c++/HybridReactNativeImageCropPickerSpecSwift.hpp +6 -0
  27. package/nitrogen/generated/ios/swift/ImageCropPickerOptions.swift +6 -193
  28. package/nitrogen/generated/ios/swift/ImageCropperAppearance.swift +251 -0
  29. package/nitrogen/generated/ios/swift/ImageCropperColorScheme.swift +40 -0
  30. package/nitrogen/generated/shared/c++/ImageCropPickerOptions.hpp +8 -46
  31. package/nitrogen/generated/shared/c++/ImageCropperAppearance.hpp +134 -0
  32. package/nitrogen/generated/shared/c++/ImageCropperColorScheme.hpp +76 -0
  33. package/package.json +1 -1
  34. package/src/ReactNativeImageCropPicker.nitro.ts +29 -13
@@ -18,7 +18,7 @@ public extension ImageCropPickerOptions {
18
18
  /**
19
19
  * Create a new instance of `ImageCropPickerOptions`.
20
20
  */
21
- init(width: Double?, height: Double?, cropping: Bool?, includeBase64: Bool?, compressImageQuality: Double?, compressImageMaxWidth: Double?, compressImageMaxHeight: Double?, freeStyleCropEnabled: Bool?, cropperCircleOverlay: Bool?, cropperToolbarTitle: String?, cropperChooseText: String?, cropperCancelText: String?, cropperChooseColor: String?, cropperCancelColor: String?, cropperRotateButtonsHidden: Bool?, cropperActiveWidgetColor: String?, cropperToolbarColor: String?, cropperToolbarWidgetColor: String?, cropperStatusBarLight: Bool?, cropperNavigationBarLight: Bool?, showCropGuidelines: Bool?, showCropFrame: Bool?, enableRotationGesture: Bool?, hideBottomControls: Bool?, disableCropperColorSetters: Bool?) {
21
+ init(width: Double?, height: Double?, cropping: Bool?, includeBase64: Bool?, compressImageQuality: Double?, compressImageMaxWidth: Double?, compressImageMaxHeight: Double?, freeStyleCropEnabled: Bool?, cropperCircleOverlay: Bool?, cropperToolbarTitle: String?, cropperChooseText: String?, cropperCancelText: String?, cropperRotateButtonsHidden: Bool?, showCropGuidelines: Bool?, cropperAppearance: ImageCropperAppearance?) {
22
22
  self.init({ () -> bridge.std__optional_double_ in
23
23
  if let __unwrappedValue = width {
24
24
  return bridge.create_std__optional_double_(__unwrappedValue)
@@ -91,81 +91,21 @@ public extension ImageCropPickerOptions {
91
91
  } else {
92
92
  return .init()
93
93
  }
94
- }(), { () -> bridge.std__optional_std__string_ in
95
- if let __unwrappedValue = cropperChooseColor {
96
- return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
97
- } else {
98
- return .init()
99
- }
100
- }(), { () -> bridge.std__optional_std__string_ in
101
- if let __unwrappedValue = cropperCancelColor {
102
- return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
103
- } else {
104
- return .init()
105
- }
106
94
  }(), { () -> bridge.std__optional_bool_ in
107
95
  if let __unwrappedValue = cropperRotateButtonsHidden {
108
96
  return bridge.create_std__optional_bool_(__unwrappedValue)
109
97
  } else {
110
98
  return .init()
111
99
  }
112
- }(), { () -> bridge.std__optional_std__string_ in
113
- if let __unwrappedValue = cropperActiveWidgetColor {
114
- return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
115
- } else {
116
- return .init()
117
- }
118
- }(), { () -> bridge.std__optional_std__string_ in
119
- if let __unwrappedValue = cropperToolbarColor {
120
- return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
121
- } else {
122
- return .init()
123
- }
124
- }(), { () -> bridge.std__optional_std__string_ in
125
- if let __unwrappedValue = cropperToolbarWidgetColor {
126
- return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
127
- } else {
128
- return .init()
129
- }
130
- }(), { () -> bridge.std__optional_bool_ in
131
- if let __unwrappedValue = cropperStatusBarLight {
132
- return bridge.create_std__optional_bool_(__unwrappedValue)
133
- } else {
134
- return .init()
135
- }
136
- }(), { () -> bridge.std__optional_bool_ in
137
- if let __unwrappedValue = cropperNavigationBarLight {
138
- return bridge.create_std__optional_bool_(__unwrappedValue)
139
- } else {
140
- return .init()
141
- }
142
100
  }(), { () -> bridge.std__optional_bool_ in
143
101
  if let __unwrappedValue = showCropGuidelines {
144
102
  return bridge.create_std__optional_bool_(__unwrappedValue)
145
103
  } else {
146
104
  return .init()
147
105
  }
148
- }(), { () -> bridge.std__optional_bool_ in
149
- if let __unwrappedValue = showCropFrame {
150
- return bridge.create_std__optional_bool_(__unwrappedValue)
151
- } else {
152
- return .init()
153
- }
154
- }(), { () -> bridge.std__optional_bool_ in
155
- if let __unwrappedValue = enableRotationGesture {
156
- return bridge.create_std__optional_bool_(__unwrappedValue)
157
- } else {
158
- return .init()
159
- }
160
- }(), { () -> bridge.std__optional_bool_ in
161
- if let __unwrappedValue = hideBottomControls {
162
- return bridge.create_std__optional_bool_(__unwrappedValue)
163
- } else {
164
- return .init()
165
- }
166
- }(), { () -> bridge.std__optional_bool_ in
167
- if let __unwrappedValue = disableCropperColorSetters {
168
- return bridge.create_std__optional_bool_(__unwrappedValue)
106
+ }(), { () -> bridge.std__optional_ImageCropperAppearance_ in
107
+ if let __unwrappedValue = cropperAppearance {
108
+ return bridge.create_std__optional_ImageCropperAppearance_(__unwrappedValue)
169
109
  } else {
170
110
  return .init()
171
111
  }
@@ -316,30 +256,6 @@ public extension ImageCropPickerOptions {
316
256
  }()
317
257
  }
318
258
 
319
- @inline(__always)
320
- var cropperChooseColor: String? {
321
- return { () -> String? in
322
- if bridge.has_value_std__optional_std__string_(self.__cropperChooseColor) {
323
- let __unwrapped = bridge.get_std__optional_std__string_(self.__cropperChooseColor)
324
- return String(__unwrapped)
325
- } else {
326
- return nil
327
- }
328
- }()
329
- }
330
-
331
- @inline(__always)
332
- var cropperCancelColor: String? {
333
- return { () -> String? in
334
- if bridge.has_value_std__optional_std__string_(self.__cropperCancelColor) {
335
- let __unwrapped = bridge.get_std__optional_std__string_(self.__cropperCancelColor)
336
- return String(__unwrapped)
337
- } else {
338
- return nil
339
- }
340
- }()
341
- }
342
-
343
259
  @inline(__always)
344
260
  var cropperRotateButtonsHidden: Bool? {
345
261
  return { () -> Bool? in
@@ -352,66 +268,6 @@ public extension ImageCropPickerOptions {
352
268
  }()
353
269
  }
354
270
 
355
- @inline(__always)
356
- var cropperActiveWidgetColor: String? {
357
- return { () -> String? in
358
- if bridge.has_value_std__optional_std__string_(self.__cropperActiveWidgetColor) {
359
- let __unwrapped = bridge.get_std__optional_std__string_(self.__cropperActiveWidgetColor)
360
- return String(__unwrapped)
361
- } else {
362
- return nil
363
- }
364
- }()
365
- }
366
-
367
- @inline(__always)
368
- var cropperToolbarColor: String? {
369
- return { () -> String? in
370
- if bridge.has_value_std__optional_std__string_(self.__cropperToolbarColor) {
371
- let __unwrapped = bridge.get_std__optional_std__string_(self.__cropperToolbarColor)
372
- return String(__unwrapped)
373
- } else {
374
- return nil
375
- }
376
- }()
377
- }
378
-
379
- @inline(__always)
380
- var cropperToolbarWidgetColor: String? {
381
- return { () -> String? in
382
- if bridge.has_value_std__optional_std__string_(self.__cropperToolbarWidgetColor) {
383
- let __unwrapped = bridge.get_std__optional_std__string_(self.__cropperToolbarWidgetColor)
384
- return String(__unwrapped)
385
- } else {
386
- return nil
387
- }
388
- }()
389
- }
390
-
391
- @inline(__always)
392
- var cropperStatusBarLight: Bool? {
393
- return { () -> Bool? in
394
- if bridge.has_value_std__optional_bool_(self.__cropperStatusBarLight) {
395
- let __unwrapped = bridge.get_std__optional_bool_(self.__cropperStatusBarLight)
396
- return __unwrapped
397
- } else {
398
- return nil
399
- }
400
- }()
401
- }
402
-
403
- @inline(__always)
404
- var cropperNavigationBarLight: Bool? {
405
- return { () -> Bool? in
406
- if bridge.has_value_std__optional_bool_(self.__cropperNavigationBarLight) {
407
- let __unwrapped = bridge.get_std__optional_bool_(self.__cropperNavigationBarLight)
408
- return __unwrapped
409
- } else {
410
- return nil
411
- }
412
- }()
413
- }
414
-
415
271
  @inline(__always)
416
272
  var showCropGuidelines: Bool? {
417
273
  return { () -> Bool? in
@@ -425,50 +281,7 @@ public extension ImageCropPickerOptions {
425
281
  }
426
282
 
427
283
  @inline(__always)
428
- var showCropFrame: Bool? {
429
- return { () -> Bool? in
430
- if bridge.has_value_std__optional_bool_(self.__showCropFrame) {
431
- let __unwrapped = bridge.get_std__optional_bool_(self.__showCropFrame)
432
- return __unwrapped
433
- } else {
434
- return nil
435
- }
436
- }()
437
- }
438
-
439
- @inline(__always)
440
- var enableRotationGesture: Bool? {
441
- return { () -> Bool? in
442
- if bridge.has_value_std__optional_bool_(self.__enableRotationGesture) {
443
- let __unwrapped = bridge.get_std__optional_bool_(self.__enableRotationGesture)
444
- return __unwrapped
445
- } else {
446
- return nil
447
- }
448
- }()
449
- }
450
-
451
- @inline(__always)
452
- var hideBottomControls: Bool? {
453
- return { () -> Bool? in
454
- if bridge.has_value_std__optional_bool_(self.__hideBottomControls) {
455
- let __unwrapped = bridge.get_std__optional_bool_(self.__hideBottomControls)
456
- return __unwrapped
457
- } else {
458
- return nil
459
- }
460
- }()
461
- }
462
-
463
- @inline(__always)
464
- var disableCropperColorSetters: Bool? {
465
- return { () -> Bool? in
466
- if bridge.has_value_std__optional_bool_(self.__disableCropperColorSetters) {
467
- let __unwrapped = bridge.get_std__optional_bool_(self.__disableCropperColorSetters)
468
- return __unwrapped
469
- } else {
470
- return nil
471
- }
472
- }()
284
+ var cropperAppearance: ImageCropperAppearance? {
285
+ return self.__cropperAppearance.value
473
286
  }
474
287
  }
@@ -0,0 +1,251 @@
1
+ ///
2
+ /// ImageCropperAppearance.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 `ImageCropperAppearance`, backed by a C++ struct.
12
+ */
13
+ public typealias ImageCropperAppearance = margelo.nitro.reactnativeimagecroppicker.ImageCropperAppearance
14
+
15
+ public extension ImageCropperAppearance {
16
+ private typealias bridge = margelo.nitro.reactnativeimagecroppicker.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `ImageCropperAppearance`.
20
+ */
21
+ init(colorScheme: ImageCropperColorScheme?, backgroundColor: String?, titleColor: String?, iconColor: String?, cancelButtonColor: String?, cancelButtonPressedColor: String?, cancelButtonTextColor: String?, confirmButtonColor: String?, confirmButtonPressedColor: String?, confirmButtonTextColor: String?, titleFontFamily: String?, buttonFontFamily: String?, scale: Double?) {
22
+ self.init({ () -> bridge.std__optional_ImageCropperColorScheme_ in
23
+ if let __unwrappedValue = colorScheme {
24
+ return bridge.create_std__optional_ImageCropperColorScheme_(__unwrappedValue)
25
+ } else {
26
+ return .init()
27
+ }
28
+ }(), { () -> bridge.std__optional_std__string_ in
29
+ if let __unwrappedValue = backgroundColor {
30
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
31
+ } else {
32
+ return .init()
33
+ }
34
+ }(), { () -> bridge.std__optional_std__string_ in
35
+ if let __unwrappedValue = titleColor {
36
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
37
+ } else {
38
+ return .init()
39
+ }
40
+ }(), { () -> bridge.std__optional_std__string_ in
41
+ if let __unwrappedValue = iconColor {
42
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
43
+ } else {
44
+ return .init()
45
+ }
46
+ }(), { () -> bridge.std__optional_std__string_ in
47
+ if let __unwrappedValue = cancelButtonColor {
48
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
49
+ } else {
50
+ return .init()
51
+ }
52
+ }(), { () -> bridge.std__optional_std__string_ in
53
+ if let __unwrappedValue = cancelButtonPressedColor {
54
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
55
+ } else {
56
+ return .init()
57
+ }
58
+ }(), { () -> bridge.std__optional_std__string_ in
59
+ if let __unwrappedValue = cancelButtonTextColor {
60
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
61
+ } else {
62
+ return .init()
63
+ }
64
+ }(), { () -> bridge.std__optional_std__string_ in
65
+ if let __unwrappedValue = confirmButtonColor {
66
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
67
+ } else {
68
+ return .init()
69
+ }
70
+ }(), { () -> bridge.std__optional_std__string_ in
71
+ if let __unwrappedValue = confirmButtonPressedColor {
72
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
73
+ } else {
74
+ return .init()
75
+ }
76
+ }(), { () -> bridge.std__optional_std__string_ in
77
+ if let __unwrappedValue = confirmButtonTextColor {
78
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
79
+ } else {
80
+ return .init()
81
+ }
82
+ }(), { () -> bridge.std__optional_std__string_ in
83
+ if let __unwrappedValue = titleFontFamily {
84
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
85
+ } else {
86
+ return .init()
87
+ }
88
+ }(), { () -> bridge.std__optional_std__string_ in
89
+ if let __unwrappedValue = buttonFontFamily {
90
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
91
+ } else {
92
+ return .init()
93
+ }
94
+ }(), { () -> bridge.std__optional_double_ in
95
+ if let __unwrappedValue = scale {
96
+ return bridge.create_std__optional_double_(__unwrappedValue)
97
+ } else {
98
+ return .init()
99
+ }
100
+ }())
101
+ }
102
+
103
+ @inline(__always)
104
+ var colorScheme: ImageCropperColorScheme? {
105
+ return self.__colorScheme.value
106
+ }
107
+
108
+ @inline(__always)
109
+ var backgroundColor: String? {
110
+ return { () -> String? in
111
+ if bridge.has_value_std__optional_std__string_(self.__backgroundColor) {
112
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__backgroundColor)
113
+ return String(__unwrapped)
114
+ } else {
115
+ return nil
116
+ }
117
+ }()
118
+ }
119
+
120
+ @inline(__always)
121
+ var titleColor: String? {
122
+ return { () -> String? in
123
+ if bridge.has_value_std__optional_std__string_(self.__titleColor) {
124
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__titleColor)
125
+ return String(__unwrapped)
126
+ } else {
127
+ return nil
128
+ }
129
+ }()
130
+ }
131
+
132
+ @inline(__always)
133
+ var iconColor: String? {
134
+ return { () -> String? in
135
+ if bridge.has_value_std__optional_std__string_(self.__iconColor) {
136
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__iconColor)
137
+ return String(__unwrapped)
138
+ } else {
139
+ return nil
140
+ }
141
+ }()
142
+ }
143
+
144
+ @inline(__always)
145
+ var cancelButtonColor: String? {
146
+ return { () -> String? in
147
+ if bridge.has_value_std__optional_std__string_(self.__cancelButtonColor) {
148
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__cancelButtonColor)
149
+ return String(__unwrapped)
150
+ } else {
151
+ return nil
152
+ }
153
+ }()
154
+ }
155
+
156
+ @inline(__always)
157
+ var cancelButtonPressedColor: String? {
158
+ return { () -> String? in
159
+ if bridge.has_value_std__optional_std__string_(self.__cancelButtonPressedColor) {
160
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__cancelButtonPressedColor)
161
+ return String(__unwrapped)
162
+ } else {
163
+ return nil
164
+ }
165
+ }()
166
+ }
167
+
168
+ @inline(__always)
169
+ var cancelButtonTextColor: String? {
170
+ return { () -> String? in
171
+ if bridge.has_value_std__optional_std__string_(self.__cancelButtonTextColor) {
172
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__cancelButtonTextColor)
173
+ return String(__unwrapped)
174
+ } else {
175
+ return nil
176
+ }
177
+ }()
178
+ }
179
+
180
+ @inline(__always)
181
+ var confirmButtonColor: String? {
182
+ return { () -> String? in
183
+ if bridge.has_value_std__optional_std__string_(self.__confirmButtonColor) {
184
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__confirmButtonColor)
185
+ return String(__unwrapped)
186
+ } else {
187
+ return nil
188
+ }
189
+ }()
190
+ }
191
+
192
+ @inline(__always)
193
+ var confirmButtonPressedColor: String? {
194
+ return { () -> String? in
195
+ if bridge.has_value_std__optional_std__string_(self.__confirmButtonPressedColor) {
196
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__confirmButtonPressedColor)
197
+ return String(__unwrapped)
198
+ } else {
199
+ return nil
200
+ }
201
+ }()
202
+ }
203
+
204
+ @inline(__always)
205
+ var confirmButtonTextColor: String? {
206
+ return { () -> String? in
207
+ if bridge.has_value_std__optional_std__string_(self.__confirmButtonTextColor) {
208
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__confirmButtonTextColor)
209
+ return String(__unwrapped)
210
+ } else {
211
+ return nil
212
+ }
213
+ }()
214
+ }
215
+
216
+ @inline(__always)
217
+ var titleFontFamily: String? {
218
+ return { () -> String? in
219
+ if bridge.has_value_std__optional_std__string_(self.__titleFontFamily) {
220
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__titleFontFamily)
221
+ return String(__unwrapped)
222
+ } else {
223
+ return nil
224
+ }
225
+ }()
226
+ }
227
+
228
+ @inline(__always)
229
+ var buttonFontFamily: String? {
230
+ return { () -> String? in
231
+ if bridge.has_value_std__optional_std__string_(self.__buttonFontFamily) {
232
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__buttonFontFamily)
233
+ return String(__unwrapped)
234
+ } else {
235
+ return nil
236
+ }
237
+ }()
238
+ }
239
+
240
+ @inline(__always)
241
+ var scale: Double? {
242
+ return { () -> Double? in
243
+ if bridge.has_value_std__optional_double_(self.__scale) {
244
+ let __unwrapped = bridge.get_std__optional_double_(self.__scale)
245
+ return __unwrapped
246
+ } else {
247
+ return nil
248
+ }
249
+ }()
250
+ }
251
+ }
@@ -0,0 +1,40 @@
1
+ ///
2
+ /// ImageCropperColorScheme.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 `ImageCropperColorScheme`, backed by a C++ enum.
10
+ */
11
+ public typealias ImageCropperColorScheme = margelo.nitro.reactnativeimagecroppicker.ImageCropperColorScheme
12
+
13
+ public extension ImageCropperColorScheme {
14
+ /**
15
+ * Get a ImageCropperColorScheme 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 "light":
21
+ self = .light
22
+ case "dark":
23
+ self = .dark
24
+ default:
25
+ return nil
26
+ }
27
+ }
28
+
29
+ /**
30
+ * Get the String value this ImageCropperColorScheme represents.
31
+ */
32
+ var stringValue: String {
33
+ switch self {
34
+ case .light:
35
+ return "light"
36
+ case .dark:
37
+ return "dark"
38
+ }
39
+ }
40
+ }
@@ -28,10 +28,12 @@
28
28
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
29
  #endif
30
30
 
31
-
31
+ // Forward declaration of `ImageCropperAppearance` to properly resolve imports.
32
+ namespace margelo::nitro::reactnativeimagecroppicker { struct ImageCropperAppearance; }
32
33
 
33
34
  #include <optional>
34
35
  #include <string>
36
+ #include "ImageCropperAppearance.hpp"
35
37
 
36
38
  namespace margelo::nitro::reactnativeimagecroppicker {
37
39
 
@@ -52,23 +54,13 @@ namespace margelo::nitro::reactnativeimagecroppicker {
52
54
  std::optional<std::string> cropperToolbarTitle SWIFT_PRIVATE;
53
55
  std::optional<std::string> cropperChooseText SWIFT_PRIVATE;
54
56
  std::optional<std::string> cropperCancelText SWIFT_PRIVATE;
55
- std::optional<std::string> cropperChooseColor SWIFT_PRIVATE;
56
- std::optional<std::string> cropperCancelColor SWIFT_PRIVATE;
57
57
  std::optional<bool> cropperRotateButtonsHidden SWIFT_PRIVATE;
58
- std::optional<std::string> cropperActiveWidgetColor SWIFT_PRIVATE;
59
- std::optional<std::string> cropperToolbarColor SWIFT_PRIVATE;
60
- std::optional<std::string> cropperToolbarWidgetColor SWIFT_PRIVATE;
61
- std::optional<bool> cropperStatusBarLight SWIFT_PRIVATE;
62
- std::optional<bool> cropperNavigationBarLight SWIFT_PRIVATE;
63
58
  std::optional<bool> showCropGuidelines SWIFT_PRIVATE;
64
- std::optional<bool> showCropFrame SWIFT_PRIVATE;
65
- std::optional<bool> enableRotationGesture SWIFT_PRIVATE;
66
- std::optional<bool> hideBottomControls SWIFT_PRIVATE;
67
- std::optional<bool> disableCropperColorSetters SWIFT_PRIVATE;
59
+ std::optional<ImageCropperAppearance> cropperAppearance SWIFT_PRIVATE;
68
60
 
69
61
  public:
70
62
  ImageCropPickerOptions() = default;
71
- explicit ImageCropPickerOptions(std::optional<double> width, std::optional<double> height, std::optional<bool> cropping, std::optional<bool> includeBase64, std::optional<double> compressImageQuality, std::optional<double> compressImageMaxWidth, std::optional<double> compressImageMaxHeight, std::optional<bool> freeStyleCropEnabled, std::optional<bool> cropperCircleOverlay, std::optional<std::string> cropperToolbarTitle, std::optional<std::string> cropperChooseText, std::optional<std::string> cropperCancelText, std::optional<std::string> cropperChooseColor, std::optional<std::string> cropperCancelColor, std::optional<bool> cropperRotateButtonsHidden, std::optional<std::string> cropperActiveWidgetColor, std::optional<std::string> cropperToolbarColor, std::optional<std::string> cropperToolbarWidgetColor, std::optional<bool> cropperStatusBarLight, std::optional<bool> cropperNavigationBarLight, std::optional<bool> showCropGuidelines, std::optional<bool> showCropFrame, std::optional<bool> enableRotationGesture, std::optional<bool> hideBottomControls, std::optional<bool> disableCropperColorSetters): width(width), height(height), cropping(cropping), includeBase64(includeBase64), compressImageQuality(compressImageQuality), compressImageMaxWidth(compressImageMaxWidth), compressImageMaxHeight(compressImageMaxHeight), freeStyleCropEnabled(freeStyleCropEnabled), cropperCircleOverlay(cropperCircleOverlay), cropperToolbarTitle(cropperToolbarTitle), cropperChooseText(cropperChooseText), cropperCancelText(cropperCancelText), cropperChooseColor(cropperChooseColor), cropperCancelColor(cropperCancelColor), cropperRotateButtonsHidden(cropperRotateButtonsHidden), cropperActiveWidgetColor(cropperActiveWidgetColor), cropperToolbarColor(cropperToolbarColor), cropperToolbarWidgetColor(cropperToolbarWidgetColor), cropperStatusBarLight(cropperStatusBarLight), cropperNavigationBarLight(cropperNavigationBarLight), showCropGuidelines(showCropGuidelines), showCropFrame(showCropFrame), enableRotationGesture(enableRotationGesture), hideBottomControls(hideBottomControls), disableCropperColorSetters(disableCropperColorSetters) {}
63
+ explicit ImageCropPickerOptions(std::optional<double> width, std::optional<double> height, std::optional<bool> cropping, std::optional<bool> includeBase64, std::optional<double> compressImageQuality, std::optional<double> compressImageMaxWidth, std::optional<double> compressImageMaxHeight, std::optional<bool> freeStyleCropEnabled, std::optional<bool> cropperCircleOverlay, std::optional<std::string> cropperToolbarTitle, std::optional<std::string> cropperChooseText, std::optional<std::string> cropperCancelText, std::optional<bool> cropperRotateButtonsHidden, std::optional<bool> showCropGuidelines, std::optional<ImageCropperAppearance> cropperAppearance): width(width), height(height), cropping(cropping), includeBase64(includeBase64), compressImageQuality(compressImageQuality), compressImageMaxWidth(compressImageMaxWidth), compressImageMaxHeight(compressImageMaxHeight), freeStyleCropEnabled(freeStyleCropEnabled), cropperCircleOverlay(cropperCircleOverlay), cropperToolbarTitle(cropperToolbarTitle), cropperChooseText(cropperChooseText), cropperCancelText(cropperCancelText), cropperRotateButtonsHidden(cropperRotateButtonsHidden), showCropGuidelines(showCropGuidelines), cropperAppearance(cropperAppearance) {}
72
64
 
73
65
  public:
74
66
  friend bool operator==(const ImageCropPickerOptions& lhs, const ImageCropPickerOptions& rhs) = default;
@@ -96,19 +88,9 @@ namespace margelo::nitro {
96
88
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarTitle"))),
97
89
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperChooseText"))),
98
90
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperCancelText"))),
99
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperChooseColor"))),
100
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperCancelColor"))),
101
91
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperRotateButtonsHidden"))),
102
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperActiveWidgetColor"))),
103
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarColor"))),
104
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarWidgetColor"))),
105
- JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperStatusBarLight"))),
106
- JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperNavigationBarLight"))),
107
92
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "showCropGuidelines"))),
108
- JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "showCropFrame"))),
109
- JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableRotationGesture"))),
110
- JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hideBottomControls"))),
111
- JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "disableCropperColorSetters")))
93
+ JSIConverter<std::optional<margelo::nitro::reactnativeimagecroppicker::ImageCropperAppearance>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperAppearance")))
112
94
  );
113
95
  }
114
96
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativeimagecroppicker::ImageCropPickerOptions& arg) {
@@ -125,19 +107,9 @@ namespace margelo::nitro {
125
107
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarTitle"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cropperToolbarTitle));
126
108
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperChooseText"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cropperChooseText));
127
109
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperCancelText"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cropperCancelText));
128
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperChooseColor"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cropperChooseColor));
129
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperCancelColor"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cropperCancelColor));
130
110
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperRotateButtonsHidden"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.cropperRotateButtonsHidden));
131
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperActiveWidgetColor"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cropperActiveWidgetColor));
132
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarColor"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cropperToolbarColor));
133
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarWidgetColor"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.cropperToolbarWidgetColor));
134
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperStatusBarLight"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.cropperStatusBarLight));
135
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperNavigationBarLight"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.cropperNavigationBarLight));
136
111
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "showCropGuidelines"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.showCropGuidelines));
137
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "showCropFrame"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.showCropFrame));
138
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "enableRotationGesture"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.enableRotationGesture));
139
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "hideBottomControls"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.hideBottomControls));
140
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "disableCropperColorSetters"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.disableCropperColorSetters));
112
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "cropperAppearance"), JSIConverter<std::optional<margelo::nitro::reactnativeimagecroppicker::ImageCropperAppearance>>::toJSI(runtime, arg.cropperAppearance));
141
113
  return obj;
142
114
  }
143
115
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -160,19 +132,9 @@ namespace margelo::nitro {
160
132
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarTitle")))) return false;
161
133
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperChooseText")))) return false;
162
134
  if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperCancelText")))) return false;
163
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperChooseColor")))) return false;
164
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperCancelColor")))) return false;
165
135
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperRotateButtonsHidden")))) return false;
166
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperActiveWidgetColor")))) return false;
167
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarColor")))) return false;
168
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperToolbarWidgetColor")))) return false;
169
- if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperStatusBarLight")))) return false;
170
- if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperNavigationBarLight")))) return false;
171
136
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "showCropGuidelines")))) return false;
172
- if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "showCropFrame")))) return false;
173
- if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enableRotationGesture")))) return false;
174
- if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hideBottomControls")))) return false;
175
- if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "disableCropperColorSetters")))) return false;
137
+ if (!JSIConverter<std::optional<margelo::nitro::reactnativeimagecroppicker::ImageCropperAppearance>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cropperAppearance")))) return false;
176
138
  return true;
177
139
  }
178
140
  };