@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.
Files changed (119) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +83 -0
  3. package/ReactNativeImageCropPicker.podspec +40 -0
  4. package/android/CMakeLists.txt +24 -0
  5. package/android/build.gradle +144 -0
  6. package/android/gradle.properties +4 -0
  7. package/android/src/main/AndroidManifest.xml +24 -0
  8. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  9. package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerException.kt +45 -0
  10. package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerImageProcessor.kt +308 -0
  11. package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerSession.kt +297 -0
  12. package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ReactNativeImageCropPicker.kt +69 -0
  13. package/android/src/main/java/com/margelo/nitro/reactnativeimagecroppicker/ReactNativeImageCropPickerPackage.kt +24 -0
  14. package/ios/ImageCropPickerError.swift +57 -0
  15. package/ios/ImageCropPickerImageProcessor.swift +343 -0
  16. package/ios/ImageCropPickerSession.swift +407 -0
  17. package/ios/ReactNativeImageCropPicker.swift +65 -0
  18. package/ios/TOCropViewController/Categories/UIImage+CropRotate.h +39 -0
  19. package/ios/TOCropViewController/Categories/UIImage+CropRotate.m +94 -0
  20. package/ios/TOCropViewController/Constants/TOCropViewConstants.h +63 -0
  21. package/ios/TOCropViewController/LICENSE +21 -0
  22. package/ios/TOCropViewController/Models/TOActivityCroppedImageProvider.h +38 -0
  23. package/ios/TOCropViewController/Models/TOActivityCroppedImageProvider.m +73 -0
  24. package/ios/TOCropViewController/Models/TOCropViewControllerAspectRatioPreset.h +64 -0
  25. package/ios/TOCropViewController/Models/TOCropViewControllerAspectRatioPreset.m +121 -0
  26. package/ios/TOCropViewController/Models/TOCropViewControllerTransitioning.h +49 -0
  27. package/ios/TOCropViewController/Models/TOCropViewControllerTransitioning.m +125 -0
  28. package/ios/TOCropViewController/Models/TOCroppedImageAttributes.h +38 -0
  29. package/ios/TOCropViewController/Models/TOCroppedImageAttributes.m +45 -0
  30. package/ios/TOCropViewController/Resources/Base.lproj/TOCropViewControllerLocalizable.strings +8 -0
  31. package/ios/TOCropViewController/Resources/PrivacyInfo.xcprivacy +14 -0
  32. package/ios/TOCropViewController/Resources/ar.lproj/TOCropViewControllerLocalizable.strings +9 -0
  33. package/ios/TOCropViewController/Resources/ca.lproj/TOCropViewControllerLocalizable.strings +8 -0
  34. package/ios/TOCropViewController/Resources/cs.lproj/TOCropViewControllerLocalizable.strings +8 -0
  35. package/ios/TOCropViewController/Resources/da-DK.lproj/TOCropViewControllerLocalizable.strings +8 -0
  36. package/ios/TOCropViewController/Resources/de.lproj/TOCropViewControllerLocalizable.strings +8 -0
  37. package/ios/TOCropViewController/Resources/en.lproj/TOCropViewControllerLocalizable.strings +8 -0
  38. package/ios/TOCropViewController/Resources/es.lproj/TOCropViewControllerLocalizable.strings +8 -0
  39. package/ios/TOCropViewController/Resources/fa-IR.lproj/TOCropViewControllerLocalizable.strings +8 -0
  40. package/ios/TOCropViewController/Resources/fa.lproj/TOCropViewControllerLocalizable.strings +8 -0
  41. package/ios/TOCropViewController/Resources/fi.lproj/TOCropViewControllerLocalizable.strings +8 -0
  42. package/ios/TOCropViewController/Resources/fr.lproj/TOCropViewControllerLocalizable.strings +8 -0
  43. package/ios/TOCropViewController/Resources/hu.lproj/TOCropViewControllerLocalizable.strings +9 -0
  44. package/ios/TOCropViewController/Resources/id.lproj/TOCropViewControllerLocalizable.strings +8 -0
  45. package/ios/TOCropViewController/Resources/it.lproj/TOCropViewControllerLocalizable.strings +8 -0
  46. package/ios/TOCropViewController/Resources/ja.lproj/TOCropViewControllerLocalizable.strings +8 -0
  47. package/ios/TOCropViewController/Resources/ko.lproj/TOCropViewControllerLocalizable.strings +8 -0
  48. package/ios/TOCropViewController/Resources/ms.lproj/TOCropViewControllerLocalizable.strings +8 -0
  49. package/ios/TOCropViewController/Resources/nl.lproj/TOCropViewControllerLocalizable.strings +8 -0
  50. package/ios/TOCropViewController/Resources/pl.lproj/TOCropViewControllerLocalizable.strings +8 -0
  51. package/ios/TOCropViewController/Resources/pt-BR.lproj/TOCropViewControllerLocalizable.strings +8 -0
  52. package/ios/TOCropViewController/Resources/pt.lproj/TOCropViewControllerLocalizable.strings +8 -0
  53. package/ios/TOCropViewController/Resources/ro.lproj/TOCropViewControllerLocalizable.strings +8 -0
  54. package/ios/TOCropViewController/Resources/ru.lproj/TOCropViewControllerLocalizable.strings +8 -0
  55. package/ios/TOCropViewController/Resources/sk.lproj/TOCropViewControllerLocalizable.strings +8 -0
  56. package/ios/TOCropViewController/Resources/tr.lproj/TOCropViewControllerLocalizable.strings +9 -0
  57. package/ios/TOCropViewController/Resources/uk.lproj/TOCropViewControllerLocalizable.strings +8 -0
  58. package/ios/TOCropViewController/Resources/vi.lproj/TOCropViewControllerLocalizable.strings +9 -0
  59. package/ios/TOCropViewController/Resources/zh-Hans.lproj/TOCropViewControllerLocalizable.strings +9 -0
  60. package/ios/TOCropViewController/Resources/zh-Hant.lproj/TOCropViewControllerLocalizable.strings +9 -0
  61. package/ios/TOCropViewController/TOCropViewController.h +479 -0
  62. package/ios/TOCropViewController/TOCropViewController.m +1355 -0
  63. package/ios/TOCropViewController/Views/TOCropOverlayView.h +43 -0
  64. package/ios/TOCropViewController/Views/TOCropOverlayView.m +240 -0
  65. package/ios/TOCropViewController/Views/TOCropScrollView.h +39 -0
  66. package/ios/TOCropViewController/Views/TOCropScrollView.m +48 -0
  67. package/ios/TOCropViewController/Views/TOCropToolbar.h +104 -0
  68. package/ios/TOCropViewController/Views/TOCropToolbar.m +783 -0
  69. package/ios/TOCropViewController/Views/TOCropView.h +311 -0
  70. package/ios/TOCropViewController/Views/TOCropView.m +1787 -0
  71. package/lib/module/ReactNativeImageCropPicker.nitro.js +4 -0
  72. package/lib/module/ReactNativeImageCropPicker.nitro.js.map +1 -0
  73. package/lib/module/index.js +83 -0
  74. package/lib/module/index.js.map +1 -0
  75. package/lib/module/package.json +1 -0
  76. package/lib/typescript/package.json +1 -0
  77. package/lib/typescript/src/ReactNativeImageCropPicker.nitro.d.ts +54 -0
  78. package/lib/typescript/src/ReactNativeImageCropPicker.nitro.d.ts.map +1 -0
  79. package/lib/typescript/src/index.d.ts +31 -0
  80. package/lib/typescript/src/index.d.ts.map +1 -0
  81. package/nitro.json +23 -0
  82. package/nitrogen/generated/android/c++/JCropRect.hpp +69 -0
  83. package/nitrogen/generated/android/c++/JHybridReactNativeImageCropPickerSpec.cpp +125 -0
  84. package/nitrogen/generated/android/c++/JHybridReactNativeImageCropPickerSpec.hpp +66 -0
  85. package/nitrogen/generated/android/c++/JImageCropPickerOptions.hpp +154 -0
  86. package/nitrogen/generated/android/c++/JPickedImage.hpp +88 -0
  87. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/CropRect.kt +66 -0
  88. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/HybridReactNativeImageCropPickerSpec.kt +69 -0
  89. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/ImageCropPickerOptions.kt +171 -0
  90. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/PickedImage.kt +86 -0
  91. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeimagecroppicker/reactnativeimagecroppickerOnLoad.kt +35 -0
  92. package/nitrogen/generated/android/reactnativeimagecroppicker+autolinking.cmake +81 -0
  93. package/nitrogen/generated/android/reactnativeimagecroppicker+autolinking.gradle +27 -0
  94. package/nitrogen/generated/android/reactnativeimagecroppickerOnLoad.cpp +54 -0
  95. package/nitrogen/generated/android/reactnativeimagecroppickerOnLoad.hpp +34 -0
  96. package/nitrogen/generated/ios/ReactNativeImageCropPicker+autolinking.rb +62 -0
  97. package/nitrogen/generated/ios/ReactNativeImageCropPicker-Swift-Cxx-Bridge.cpp +57 -0
  98. package/nitrogen/generated/ios/ReactNativeImageCropPicker-Swift-Cxx-Bridge.hpp +221 -0
  99. package/nitrogen/generated/ios/ReactNativeImageCropPicker-Swift-Cxx-Umbrella.hpp +55 -0
  100. package/nitrogen/generated/ios/ReactNativeImageCropPickerAutolinking.mm +33 -0
  101. package/nitrogen/generated/ios/ReactNativeImageCropPickerAutolinking.swift +26 -0
  102. package/nitrogen/generated/ios/c++/HybridReactNativeImageCropPickerSpecSwift.cpp +11 -0
  103. package/nitrogen/generated/ios/c++/HybridReactNativeImageCropPickerSpecSwift.hpp +116 -0
  104. package/nitrogen/generated/ios/swift/CropRect.swift +44 -0
  105. package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
  106. package/nitrogen/generated/ios/swift/Func_void_PickedImage.swift +46 -0
  107. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  108. package/nitrogen/generated/ios/swift/HybridReactNativeImageCropPickerSpec.swift +58 -0
  109. package/nitrogen/generated/ios/swift/HybridReactNativeImageCropPickerSpec_cxx.swift +202 -0
  110. package/nitrogen/generated/ios/swift/ImageCropPickerOptions.swift +474 -0
  111. package/nitrogen/generated/ios/swift/PickedImage.swift +96 -0
  112. package/nitrogen/generated/shared/c++/CropRect.hpp +95 -0
  113. package/nitrogen/generated/shared/c++/HybridReactNativeImageCropPickerSpec.cpp +24 -0
  114. package/nitrogen/generated/shared/c++/HybridReactNativeImageCropPickerSpec.hpp +71 -0
  115. package/nitrogen/generated/shared/c++/ImageCropPickerOptions.hpp +180 -0
  116. package/nitrogen/generated/shared/c++/PickedImage.hpp +114 -0
  117. package/package.json +173 -0
  118. package/src/ReactNativeImageCropPicker.nitro.ts +72 -0
  119. package/src/index.tsx +134 -0
@@ -0,0 +1,88 @@
1
+ ///
2
+ /// JPickedImage.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 <fbjni/fbjni.h>
11
+ #include "PickedImage.hpp"
12
+
13
+ #include "CropRect.hpp"
14
+ #include "JCropRect.hpp"
15
+ #include <optional>
16
+ #include <string>
17
+
18
+ namespace margelo::nitro::reactnativeimagecroppicker {
19
+
20
+ using namespace facebook;
21
+
22
+ /**
23
+ * The C++ JNI bridge between the C++ struct "PickedImage" and the Kotlin data class "PickedImage".
24
+ */
25
+ struct JPickedImage final: public jni::JavaClass<JPickedImage> {
26
+ public:
27
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativeimagecroppicker/PickedImage;";
28
+
29
+ public:
30
+ /**
31
+ * Convert this Java/Kotlin-based struct to the C++ struct PickedImage by copying all values to C++.
32
+ */
33
+ [[maybe_unused]]
34
+ [[nodiscard]]
35
+ PickedImage toCpp() const {
36
+ static const auto clazz = javaClassStatic();
37
+ static const auto fieldPath = clazz->getField<jni::JString>("path");
38
+ jni::local_ref<jni::JString> path = this->getFieldValue(fieldPath);
39
+ static const auto fieldSize = clazz->getField<double>("size");
40
+ double size = this->getFieldValue(fieldSize);
41
+ static const auto fieldWidth = clazz->getField<double>("width");
42
+ double width = this->getFieldValue(fieldWidth);
43
+ static const auto fieldHeight = clazz->getField<double>("height");
44
+ double height = this->getFieldValue(fieldHeight);
45
+ static const auto fieldMime = clazz->getField<jni::JString>("mime");
46
+ jni::local_ref<jni::JString> mime = this->getFieldValue(fieldMime);
47
+ static const auto fieldData = clazz->getField<jni::JString>("data");
48
+ jni::local_ref<jni::JString> data = this->getFieldValue(fieldData);
49
+ static const auto fieldCropRect = clazz->getField<JCropRect>("cropRect");
50
+ jni::local_ref<JCropRect> cropRect = this->getFieldValue(fieldCropRect);
51
+ static const auto fieldFilename = clazz->getField<jni::JString>("filename");
52
+ jni::local_ref<jni::JString> filename = this->getFieldValue(fieldFilename);
53
+ return PickedImage(
54
+ path->toStdString(),
55
+ size,
56
+ width,
57
+ height,
58
+ mime->toStdString(),
59
+ data != nullptr ? std::make_optional(data->toStdString()) : std::nullopt,
60
+ cropRect != nullptr ? std::make_optional(cropRect->toCpp()) : std::nullopt,
61
+ filename != nullptr ? std::make_optional(filename->toStdString()) : std::nullopt
62
+ );
63
+ }
64
+
65
+ public:
66
+ /**
67
+ * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
68
+ */
69
+ [[maybe_unused]]
70
+ static jni::local_ref<JPickedImage::javaobject> fromCpp(const PickedImage& value) {
71
+ using JSignature = JPickedImage(jni::alias_ref<jni::JString>, double, double, double, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<JCropRect>, jni::alias_ref<jni::JString>);
72
+ static const auto clazz = javaClassStatic();
73
+ static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
74
+ return create(
75
+ clazz,
76
+ jni::make_jstring(value.path),
77
+ value.size,
78
+ value.width,
79
+ value.height,
80
+ jni::make_jstring(value.mime),
81
+ value.data.has_value() ? jni::make_jstring(value.data.value()) : nullptr,
82
+ value.cropRect.has_value() ? JCropRect::fromCpp(value.cropRect.value()) : nullptr,
83
+ value.filename.has_value() ? jni::make_jstring(value.filename.value()) : nullptr
84
+ );
85
+ }
86
+ };
87
+
88
+ } // namespace margelo::nitro::reactnativeimagecroppicker
@@ -0,0 +1,66 @@
1
+ ///
2
+ /// CropRect.kt
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
+ package com.margelo.nitro.reactnativeimagecroppicker
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "CropRect".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class CropRect(
21
+ @DoNotStrip
22
+ @Keep
23
+ val x: Double,
24
+ @DoNotStrip
25
+ @Keep
26
+ val y: Double,
27
+ @DoNotStrip
28
+ @Keep
29
+ val width: Double,
30
+ @DoNotStrip
31
+ @Keep
32
+ val height: Double
33
+ ) {
34
+ /* primary constructor */
35
+
36
+ override fun equals(other: Any?): Boolean {
37
+ if (this === other) return true
38
+ if (other !is CropRect) return false
39
+ return Objects.deepEquals(this.x, other.x)
40
+ && Objects.deepEquals(this.y, other.y)
41
+ && Objects.deepEquals(this.width, other.width)
42
+ && Objects.deepEquals(this.height, other.height)
43
+ }
44
+
45
+ override fun hashCode(): Int {
46
+ return arrayOf<Any?>(
47
+ x,
48
+ y,
49
+ width,
50
+ height
51
+ ).contentDeepHashCode()
52
+ }
53
+
54
+ companion object {
55
+ /**
56
+ * Constructor called from C++
57
+ */
58
+ @DoNotStrip
59
+ @Keep
60
+ @Suppress("unused")
61
+ @JvmStatic
62
+ private fun fromCpp(x: Double, y: Double, width: Double, height: Double): CropRect {
63
+ return CropRect(x, y, width, height)
64
+ }
65
+ }
66
+ }
@@ -0,0 +1,69 @@
1
+ ///
2
+ /// HybridReactNativeImageCropPickerSpec.kt
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
+ package com.margelo.nitro.reactnativeimagecroppicker
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
14
+ import com.margelo.nitro.core.Promise
15
+ import com.margelo.nitro.core.HybridObject
16
+
17
+ /**
18
+ * A Kotlin class representing the ReactNativeImageCropPicker HybridObject.
19
+ * Implement this abstract class to create Kotlin-based instances of ReactNativeImageCropPicker.
20
+ */
21
+ @DoNotStrip
22
+ @Keep
23
+ @Suppress(
24
+ "KotlinJniMissingFunction", "unused",
25
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
26
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
27
+ )
28
+ abstract class HybridReactNativeImageCropPickerSpec: HybridObject() {
29
+ // Properties
30
+
31
+
32
+ // Methods
33
+ @DoNotStrip
34
+ @Keep
35
+ abstract fun openPicker(options: ImageCropPickerOptions): Promise<PickedImage>
36
+
37
+ @DoNotStrip
38
+ @Keep
39
+ abstract fun openCropper(path: String, options: ImageCropPickerOptions): Promise<PickedImage>
40
+
41
+ @DoNotStrip
42
+ @Keep
43
+ abstract fun clean(): Promise<Unit>
44
+
45
+ @DoNotStrip
46
+ @Keep
47
+ abstract fun cleanSingle(path: String): Promise<Unit>
48
+
49
+ // Default implementation of `HybridObject.toString()`
50
+ override fun toString(): String {
51
+ return "[HybridObject ReactNativeImageCropPicker]"
52
+ }
53
+
54
+ // C++ backing class
55
+ @DoNotStrip
56
+ @Keep
57
+ protected open class CxxPart(javaPart: HybridReactNativeImageCropPickerSpec): HybridObject.CxxPart(javaPart) {
58
+ // C++ JHybridReactNativeImageCropPickerSpec::CxxPart::initHybrid(...)
59
+ @FastNative
60
+ external override fun initHybrid(): HybridData
61
+ }
62
+ override fun createCxxPart(): CxxPart {
63
+ return CxxPart(this)
64
+ }
65
+
66
+ companion object {
67
+ protected const val TAG = "HybridReactNativeImageCropPickerSpec"
68
+ }
69
+ }
@@ -0,0 +1,171 @@
1
+ ///
2
+ /// ImageCropPickerOptions.kt
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
+ package com.margelo.nitro.reactnativeimagecroppicker
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "ImageCropPickerOptions".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class ImageCropPickerOptions(
21
+ @DoNotStrip
22
+ @Keep
23
+ val width: Double?,
24
+ @DoNotStrip
25
+ @Keep
26
+ val height: Double?,
27
+ @DoNotStrip
28
+ @Keep
29
+ val cropping: Boolean?,
30
+ @DoNotStrip
31
+ @Keep
32
+ val includeBase64: Boolean?,
33
+ @DoNotStrip
34
+ @Keep
35
+ val compressImageQuality: Double?,
36
+ @DoNotStrip
37
+ @Keep
38
+ val compressImageMaxWidth: Double?,
39
+ @DoNotStrip
40
+ @Keep
41
+ val compressImageMaxHeight: Double?,
42
+ @DoNotStrip
43
+ @Keep
44
+ val freeStyleCropEnabled: Boolean?,
45
+ @DoNotStrip
46
+ @Keep
47
+ val cropperCircleOverlay: Boolean?,
48
+ @DoNotStrip
49
+ @Keep
50
+ val cropperToolbarTitle: String?,
51
+ @DoNotStrip
52
+ @Keep
53
+ val cropperChooseText: String?,
54
+ @DoNotStrip
55
+ @Keep
56
+ val cropperCancelText: String?,
57
+ @DoNotStrip
58
+ @Keep
59
+ val cropperChooseColor: String?,
60
+ @DoNotStrip
61
+ @Keep
62
+ val cropperCancelColor: String?,
63
+ @DoNotStrip
64
+ @Keep
65
+ val cropperRotateButtonsHidden: Boolean?,
66
+ @DoNotStrip
67
+ @Keep
68
+ val cropperActiveWidgetColor: String?,
69
+ @DoNotStrip
70
+ @Keep
71
+ val cropperToolbarColor: String?,
72
+ @DoNotStrip
73
+ @Keep
74
+ val cropperToolbarWidgetColor: String?,
75
+ @DoNotStrip
76
+ @Keep
77
+ val cropperStatusBarLight: Boolean?,
78
+ @DoNotStrip
79
+ @Keep
80
+ val cropperNavigationBarLight: Boolean?,
81
+ @DoNotStrip
82
+ @Keep
83
+ val showCropGuidelines: Boolean?,
84
+ @DoNotStrip
85
+ @Keep
86
+ val showCropFrame: Boolean?,
87
+ @DoNotStrip
88
+ @Keep
89
+ val enableRotationGesture: Boolean?,
90
+ @DoNotStrip
91
+ @Keep
92
+ val hideBottomControls: Boolean?,
93
+ @DoNotStrip
94
+ @Keep
95
+ val disableCropperColorSetters: Boolean?
96
+ ) {
97
+ /* primary constructor */
98
+
99
+ override fun equals(other: Any?): Boolean {
100
+ if (this === other) return true
101
+ if (other !is ImageCropPickerOptions) return false
102
+ return Objects.deepEquals(this.width, other.width)
103
+ && Objects.deepEquals(this.height, other.height)
104
+ && Objects.deepEquals(this.cropping, other.cropping)
105
+ && Objects.deepEquals(this.includeBase64, other.includeBase64)
106
+ && Objects.deepEquals(this.compressImageQuality, other.compressImageQuality)
107
+ && Objects.deepEquals(this.compressImageMaxWidth, other.compressImageMaxWidth)
108
+ && Objects.deepEquals(this.compressImageMaxHeight, other.compressImageMaxHeight)
109
+ && Objects.deepEquals(this.freeStyleCropEnabled, other.freeStyleCropEnabled)
110
+ && Objects.deepEquals(this.cropperCircleOverlay, other.cropperCircleOverlay)
111
+ && Objects.deepEquals(this.cropperToolbarTitle, other.cropperToolbarTitle)
112
+ && Objects.deepEquals(this.cropperChooseText, other.cropperChooseText)
113
+ && Objects.deepEquals(this.cropperCancelText, other.cropperCancelText)
114
+ && Objects.deepEquals(this.cropperChooseColor, other.cropperChooseColor)
115
+ && Objects.deepEquals(this.cropperCancelColor, other.cropperCancelColor)
116
+ && Objects.deepEquals(this.cropperRotateButtonsHidden, other.cropperRotateButtonsHidden)
117
+ && Objects.deepEquals(this.cropperActiveWidgetColor, other.cropperActiveWidgetColor)
118
+ && Objects.deepEquals(this.cropperToolbarColor, other.cropperToolbarColor)
119
+ && Objects.deepEquals(this.cropperToolbarWidgetColor, other.cropperToolbarWidgetColor)
120
+ && Objects.deepEquals(this.cropperStatusBarLight, other.cropperStatusBarLight)
121
+ && Objects.deepEquals(this.cropperNavigationBarLight, other.cropperNavigationBarLight)
122
+ && Objects.deepEquals(this.showCropGuidelines, other.showCropGuidelines)
123
+ && Objects.deepEquals(this.showCropFrame, other.showCropFrame)
124
+ && Objects.deepEquals(this.enableRotationGesture, other.enableRotationGesture)
125
+ && Objects.deepEquals(this.hideBottomControls, other.hideBottomControls)
126
+ && Objects.deepEquals(this.disableCropperColorSetters, other.disableCropperColorSetters)
127
+ }
128
+
129
+ override fun hashCode(): Int {
130
+ return arrayOf<Any?>(
131
+ width,
132
+ height,
133
+ cropping,
134
+ includeBase64,
135
+ compressImageQuality,
136
+ compressImageMaxWidth,
137
+ compressImageMaxHeight,
138
+ freeStyleCropEnabled,
139
+ cropperCircleOverlay,
140
+ cropperToolbarTitle,
141
+ cropperChooseText,
142
+ cropperCancelText,
143
+ cropperChooseColor,
144
+ cropperCancelColor,
145
+ cropperRotateButtonsHidden,
146
+ cropperActiveWidgetColor,
147
+ cropperToolbarColor,
148
+ cropperToolbarWidgetColor,
149
+ cropperStatusBarLight,
150
+ cropperNavigationBarLight,
151
+ showCropGuidelines,
152
+ showCropFrame,
153
+ enableRotationGesture,
154
+ hideBottomControls,
155
+ disableCropperColorSetters
156
+ ).contentDeepHashCode()
157
+ }
158
+
159
+ companion object {
160
+ /**
161
+ * Constructor called from C++
162
+ */
163
+ @DoNotStrip
164
+ @Keep
165
+ @Suppress("unused")
166
+ @JvmStatic
167
+ private fun fromCpp(width: Double?, height: Double?, cropping: Boolean?, includeBase64: Boolean?, compressImageQuality: Double?, compressImageMaxWidth: Double?, compressImageMaxHeight: Double?, freeStyleCropEnabled: Boolean?, cropperCircleOverlay: Boolean?, cropperToolbarTitle: String?, cropperChooseText: String?, cropperCancelText: String?, cropperChooseColor: String?, cropperCancelColor: String?, cropperRotateButtonsHidden: Boolean?, cropperActiveWidgetColor: String?, cropperToolbarColor: String?, cropperToolbarWidgetColor: String?, cropperStatusBarLight: Boolean?, cropperNavigationBarLight: Boolean?, showCropGuidelines: Boolean?, showCropFrame: Boolean?, enableRotationGesture: Boolean?, hideBottomControls: Boolean?, disableCropperColorSetters: Boolean?): ImageCropPickerOptions {
168
+ return ImageCropPickerOptions(width, height, cropping, includeBase64, compressImageQuality, compressImageMaxWidth, compressImageMaxHeight, freeStyleCropEnabled, cropperCircleOverlay, cropperToolbarTitle, cropperChooseText, cropperCancelText, cropperChooseColor, cropperCancelColor, cropperRotateButtonsHidden, cropperActiveWidgetColor, cropperToolbarColor, cropperToolbarWidgetColor, cropperStatusBarLight, cropperNavigationBarLight, showCropGuidelines, showCropFrame, enableRotationGesture, hideBottomControls, disableCropperColorSetters)
169
+ }
170
+ }
171
+ }
@@ -0,0 +1,86 @@
1
+ ///
2
+ /// PickedImage.kt
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
+ package com.margelo.nitro.reactnativeimagecroppicker
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "PickedImage".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class PickedImage(
21
+ @DoNotStrip
22
+ @Keep
23
+ val path: String,
24
+ @DoNotStrip
25
+ @Keep
26
+ val size: Double,
27
+ @DoNotStrip
28
+ @Keep
29
+ val width: Double,
30
+ @DoNotStrip
31
+ @Keep
32
+ val height: Double,
33
+ @DoNotStrip
34
+ @Keep
35
+ val mime: String,
36
+ @DoNotStrip
37
+ @Keep
38
+ val data: String?,
39
+ @DoNotStrip
40
+ @Keep
41
+ val cropRect: CropRect?,
42
+ @DoNotStrip
43
+ @Keep
44
+ val filename: String?
45
+ ) {
46
+ /* primary constructor */
47
+
48
+ override fun equals(other: Any?): Boolean {
49
+ if (this === other) return true
50
+ if (other !is PickedImage) return false
51
+ return Objects.deepEquals(this.path, other.path)
52
+ && Objects.deepEquals(this.size, other.size)
53
+ && Objects.deepEquals(this.width, other.width)
54
+ && Objects.deepEquals(this.height, other.height)
55
+ && Objects.deepEquals(this.mime, other.mime)
56
+ && Objects.deepEquals(this.data, other.data)
57
+ && Objects.deepEquals(this.cropRect, other.cropRect)
58
+ && Objects.deepEquals(this.filename, other.filename)
59
+ }
60
+
61
+ override fun hashCode(): Int {
62
+ return arrayOf<Any?>(
63
+ path,
64
+ size,
65
+ width,
66
+ height,
67
+ mime,
68
+ data,
69
+ cropRect,
70
+ filename
71
+ ).contentDeepHashCode()
72
+ }
73
+
74
+ companion object {
75
+ /**
76
+ * Constructor called from C++
77
+ */
78
+ @DoNotStrip
79
+ @Keep
80
+ @Suppress("unused")
81
+ @JvmStatic
82
+ private fun fromCpp(path: String, size: Double, width: Double, height: Double, mime: String, data: String?, cropRect: CropRect?, filename: String?): PickedImage {
83
+ return PickedImage(path, size, width, height, mime, data, cropRect, filename)
84
+ }
85
+ }
86
+ }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// reactnativeimagecroppickerOnLoad.kt
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
+ package com.margelo.nitro.reactnativeimagecroppicker
9
+
10
+ import android.util.Log
11
+
12
+ internal class reactnativeimagecroppickerOnLoad {
13
+ companion object {
14
+ private const val TAG = "reactnativeimagecroppickerOnLoad"
15
+ private var didLoad = false
16
+ /**
17
+ * Initializes the native part of "reactnativeimagecroppicker".
18
+ * This method is idempotent and can be called more than once.
19
+ */
20
+ @JvmStatic
21
+ fun initializeNative() {
22
+ if (didLoad) return
23
+ try {
24
+ Log.i(TAG, "Loading reactnativeimagecroppicker C++ library...")
25
+ System.loadLibrary("reactnativeimagecroppicker")
26
+ Log.i(TAG, "Successfully loaded reactnativeimagecroppicker C++ library!")
27
+ didLoad = true
28
+ } catch (e: Error) {
29
+ Log.e(TAG, "Failed to load reactnativeimagecroppicker C++ library! Is it properly installed and linked? " +
30
+ "Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
31
+ throw e
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,81 @@
1
+ #
2
+ # reactnativeimagecroppicker+autolinking.cmake
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 CMake file that adds all files generated by Nitrogen
9
+ # to the current CMake project.
10
+ #
11
+ # To use it, add this to your CMakeLists.txt:
12
+ # ```cmake
13
+ # include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/reactnativeimagecroppicker+autolinking.cmake)
14
+ # ```
15
+
16
+ # Define a flag to check if we are building properly
17
+ add_definitions(-DBUILDING_REACTNATIVEIMAGECROPPICKER_WITH_GENERATED_CMAKE_PROJECT)
18
+
19
+ # Enable Raw Props parsing in react-native (for Nitro Views)
20
+ add_definitions(-DRN_SERIALIZABLE_STATE)
21
+
22
+ # Add all headers that were generated by Nitrogen
23
+ include_directories(
24
+ "../nitrogen/generated/shared/c++"
25
+ "../nitrogen/generated/android/c++"
26
+ "../nitrogen/generated/android/"
27
+ )
28
+
29
+ # Add all .cpp sources that were generated by Nitrogen
30
+ target_sources(
31
+ # CMake project name (Android C++ library name)
32
+ reactnativeimagecroppicker PRIVATE
33
+ # Autolinking Setup
34
+ ../nitrogen/generated/android/reactnativeimagecroppickerOnLoad.cpp
35
+ # Shared Nitrogen C++ sources
36
+ ../nitrogen/generated/shared/c++/HybridReactNativeImageCropPickerSpec.cpp
37
+ # Android-specific Nitrogen C++ sources
38
+ ../nitrogen/generated/android/c++/JHybridReactNativeImageCropPickerSpec.cpp
39
+ )
40
+
41
+ # From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
42
+ # Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
43
+ target_compile_definitions(
44
+ reactnativeimagecroppicker PRIVATE
45
+ -DFOLLY_NO_CONFIG=1
46
+ -DFOLLY_HAVE_CLOCK_GETTIME=1
47
+ -DFOLLY_USE_LIBCPP=1
48
+ -DFOLLY_CFG_NO_COROUTINES=1
49
+ -DFOLLY_MOBILE=1
50
+ -DFOLLY_HAVE_RECVMMSG=1
51
+ -DFOLLY_HAVE_PTHREAD=1
52
+ # Once we target android-23 above, we can comment
53
+ # the following line. NDK uses GNU style stderror_r() after API 23.
54
+ -DFOLLY_HAVE_XSI_STRERROR_R=1
55
+ )
56
+
57
+ # Add all libraries required by the generated specs
58
+ find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
59
+ find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
60
+ find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
61
+
62
+ # Link all libraries together
63
+ target_link_libraries(
64
+ reactnativeimagecroppicker
65
+ fbjni::fbjni # <-- Facebook C++ JNI helpers
66
+ ReactAndroid::jsi # <-- RN: JSI
67
+ react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
68
+ )
69
+
70
+ # Link react-native (different prefab between RN 0.75 and RN 0.76)
71
+ if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
72
+ target_link_libraries(
73
+ reactnativeimagecroppicker
74
+ ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
75
+ )
76
+ else()
77
+ target_link_libraries(
78
+ reactnativeimagecroppicker
79
+ ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
80
+ )
81
+ endif()
@@ -0,0 +1,27 @@
1
+ ///
2
+ /// reactnativeimagecroppicker+autolinking.gradle
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 Gradle file that adds all files generated by Nitrogen
9
+ /// to the current Gradle project.
10
+ ///
11
+ /// To use it, add this to your build.gradle:
12
+ /// ```gradle
13
+ /// apply from: '../nitrogen/generated/android/reactnativeimagecroppicker+autolinking.gradle'
14
+ /// ```
15
+
16
+ logger.warn("[NitroModules] 🔥 reactnativeimagecroppicker is boosted by nitro!")
17
+
18
+ android {
19
+ sourceSets {
20
+ main {
21
+ java.srcDirs += [
22
+ // Nitrogen files
23
+ "${project.projectDir}/../nitrogen/generated/android/kotlin"
24
+ ]
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,54 @@
1
+ ///
2
+ /// reactnativeimagecroppickerOnLoad.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
+ #ifndef BUILDING_REACTNATIVEIMAGECROPPICKER_WITH_GENERATED_CMAKE_PROJECT
9
+ #error reactnativeimagecroppickerOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
10
+ #endif
11
+
12
+ #include "reactnativeimagecroppickerOnLoad.hpp"
13
+
14
+ #include <jni.h>
15
+ #include <fbjni/fbjni.h>
16
+ #include <NitroModules/HybridObjectRegistry.hpp>
17
+
18
+ #include "JHybridReactNativeImageCropPickerSpec.hpp"
19
+ #include <NitroModules/DefaultConstructableObject.hpp>
20
+
21
+ namespace margelo::nitro::reactnativeimagecroppicker {
22
+
23
+ int initialize(JavaVM* vm) {
24
+ return facebook::jni::initialize(vm, []() {
25
+ ::margelo::nitro::reactnativeimagecroppicker::registerAllNatives();
26
+ });
27
+ }
28
+
29
+ struct JHybridReactNativeImageCropPickerSpecImpl: public jni::JavaClass<JHybridReactNativeImageCropPickerSpecImpl, JHybridReactNativeImageCropPickerSpec::JavaPart> {
30
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativeimagecroppicker/ReactNativeImageCropPicker;";
31
+ static std::shared_ptr<JHybridReactNativeImageCropPickerSpec> create() {
32
+ static const auto constructorFn = javaClassStatic()->getConstructor<JHybridReactNativeImageCropPickerSpecImpl::javaobject()>();
33
+ jni::local_ref<JHybridReactNativeImageCropPickerSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
34
+ return javaPart->getJHybridReactNativeImageCropPickerSpec();
35
+ }
36
+ };
37
+
38
+ void registerAllNatives() {
39
+ using namespace margelo::nitro;
40
+ using namespace margelo::nitro::reactnativeimagecroppicker;
41
+
42
+ // Register native JNI methods
43
+ margelo::nitro::reactnativeimagecroppicker::JHybridReactNativeImageCropPickerSpec::CxxPart::registerNatives();
44
+
45
+ // Register Nitro Hybrid Objects
46
+ HybridObjectRegistry::registerHybridObjectConstructor(
47
+ "ReactNativeImageCropPicker",
48
+ []() -> std::shared_ptr<HybridObject> {
49
+ return JHybridReactNativeImageCropPickerSpecImpl::create();
50
+ }
51
+ );
52
+ }
53
+
54
+ } // namespace margelo::nitro::reactnativeimagecroppicker