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.
Files changed (99) hide show
  1. package/README.md +627 -0
  2. package/android/CMakeLists.txt +30 -0
  3. package/android/build.gradle +79 -0
  4. package/android/proguard-rules.pro +21 -0
  5. package/android/src/main/AndroidManifest.xml +39 -0
  6. package/android/src/main/kotlin/com/margelo/pictureselector/GlideEngine.kt +80 -0
  7. package/android/src/main/kotlin/com/margelo/pictureselector/HybridPictureSelector.kt +138 -0
  8. package/android/src/main/kotlin/com/margelo/pictureselector/LubanCompressEngine.kt +58 -0
  9. package/android/src/main/kotlin/com/margelo/pictureselector/MediaAssetMapper.kt +69 -0
  10. package/android/src/main/kotlin/com/margelo/pictureselector/NitroPictureSelectorPackage.kt +52 -0
  11. package/android/src/main/kotlin/com/margelo/pictureselector/PictureSelectorOptionsMapper.kt +105 -0
  12. package/android/src/main/kotlin/com/margelo/pictureselector/UCropEngine.kt +57 -0
  13. package/android/src/main/res/xml/file_paths.xml +8 -0
  14. package/ios/HybridPictureSelector.swift +386 -0
  15. package/ios/NitroPictureSelector.podspec +39 -0
  16. package/lib/commonjs/PictureSelector.js +74 -0
  17. package/lib/commonjs/PictureSelector.js.map +1 -0
  18. package/lib/commonjs/index.js +39 -0
  19. package/lib/commonjs/index.js.map +1 -0
  20. package/lib/commonjs/package.json +1 -0
  21. package/lib/commonjs/specs/PictureSelector.nitro.js +34 -0
  22. package/lib/commonjs/specs/PictureSelector.nitro.js.map +1 -0
  23. package/lib/commonjs/types.js +44 -0
  24. package/lib/commonjs/types.js.map +1 -0
  25. package/lib/commonjs/usePictureSelector.js +122 -0
  26. package/lib/commonjs/usePictureSelector.js.map +1 -0
  27. package/lib/module/PictureSelector.js +71 -0
  28. package/lib/module/PictureSelector.js.map +1 -0
  29. package/lib/module/index.js +6 -0
  30. package/lib/module/index.js.map +1 -0
  31. package/lib/module/package.json +1 -0
  32. package/lib/module/specs/PictureSelector.nitro.js +36 -0
  33. package/lib/module/specs/PictureSelector.nitro.js.map +1 -0
  34. package/lib/module/types.js +29 -0
  35. package/lib/module/types.js.map +1 -0
  36. package/lib/module/usePictureSelector.js +119 -0
  37. package/lib/module/usePictureSelector.js.map +1 -0
  38. package/lib/typescript/PictureSelector.d.ts +23 -0
  39. package/lib/typescript/PictureSelector.d.ts.map +1 -0
  40. package/lib/typescript/index.d.ts +6 -0
  41. package/lib/typescript/index.d.ts.map +1 -0
  42. package/lib/typescript/specs/PictureSelector.nitro.d.ts +96 -0
  43. package/lib/typescript/specs/PictureSelector.nitro.d.ts.map +1 -0
  44. package/lib/typescript/types.d.ts +16 -0
  45. package/lib/typescript/types.d.ts.map +1 -0
  46. package/lib/typescript/usePictureSelector.d.ts +26 -0
  47. package/lib/typescript/usePictureSelector.d.ts.map +1 -0
  48. package/nitro.json +11 -0
  49. package/nitrogen/generated/.gitattributes +1 -0
  50. package/nitrogen/generated/android/NitroPictureSelector+autolinking.cmake +81 -0
  51. package/nitrogen/generated/android/NitroPictureSelector+autolinking.gradle +27 -0
  52. package/nitrogen/generated/android/NitroPictureSelectorOnLoad.cpp +41 -0
  53. package/nitrogen/generated/android/NitroPictureSelectorOnLoad.hpp +34 -0
  54. package/nitrogen/generated/android/c++/JCompressOptions.hpp +69 -0
  55. package/nitrogen/generated/android/c++/JCropOptions.hpp +73 -0
  56. package/nitrogen/generated/android/c++/JHybridHybridPictureSelectorSpec.cpp +125 -0
  57. package/nitrogen/generated/android/c++/JHybridHybridPictureSelectorSpec.hpp +64 -0
  58. package/nitrogen/generated/android/c++/JMediaAsset.hpp +98 -0
  59. package/nitrogen/generated/android/c++/JMediaType.hpp +61 -0
  60. package/nitrogen/generated/android/c++/JPickerTheme.hpp +64 -0
  61. package/nitrogen/generated/android/c++/JPictureSelectorOptions.hpp +121 -0
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/margelo/pictureselector/CompressOptions.kt +47 -0
  63. package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/margelo/pictureselector/CropOptions.kt +50 -0
  64. package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/margelo/pictureselector/HybridHybridPictureSelectorSpec.kt +59 -0
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/margelo/pictureselector/MediaAsset.kt +68 -0
  66. package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/margelo/pictureselector/MediaType.kt +24 -0
  67. package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/margelo/pictureselector/NitroPictureSelectorOnLoad.kt +35 -0
  68. package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/margelo/pictureselector/PickerTheme.kt +25 -0
  69. package/nitrogen/generated/android/kotlin/com/margelo/nitro/com/margelo/pictureselector/PictureSelectorOptions.kt +65 -0
  70. package/nitrogen/generated/ios/NitroPictureSelector+autolinking.rb +60 -0
  71. package/nitrogen/generated/ios/NitroPictureSelector-Swift-Cxx-Bridge.cpp +49 -0
  72. package/nitrogen/generated/ios/NitroPictureSelector-Swift-Cxx-Bridge.hpp +270 -0
  73. package/nitrogen/generated/ios/NitroPictureSelector-Swift-Cxx-Umbrella.hpp +65 -0
  74. package/nitrogen/generated/ios/c++/HybridHybridPictureSelectorSpecSwift.cpp +11 -0
  75. package/nitrogen/generated/ios/c++/HybridHybridPictureSelectorSpecSwift.hpp +110 -0
  76. package/nitrogen/generated/ios/swift/CompressOptions.swift +83 -0
  77. package/nitrogen/generated/ios/swift/CropOptions.swift +101 -0
  78. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  79. package/nitrogen/generated/ios/swift/Func_void_std__vector_MediaAsset_.swift +46 -0
  80. package/nitrogen/generated/ios/swift/HybridHybridPictureSelectorSpec.swift +56 -0
  81. package/nitrogen/generated/ios/swift/HybridHybridPictureSelectorSpec_cxx.swift +176 -0
  82. package/nitrogen/generated/ios/swift/MediaAsset.swift +118 -0
  83. package/nitrogen/generated/ios/swift/MediaType.swift +44 -0
  84. package/nitrogen/generated/ios/swift/PickerTheme.swift +48 -0
  85. package/nitrogen/generated/ios/swift/PictureSelectorOptions.swift +182 -0
  86. package/nitrogen/generated/shared/c++/CompressOptions.hpp +95 -0
  87. package/nitrogen/generated/shared/c++/CropOptions.hpp +99 -0
  88. package/nitrogen/generated/shared/c++/HybridHybridPictureSelectorSpec.cpp +22 -0
  89. package/nitrogen/generated/shared/c++/HybridHybridPictureSelectorSpec.hpp +69 -0
  90. package/nitrogen/generated/shared/c++/MediaAsset.hpp +124 -0
  91. package/nitrogen/generated/shared/c++/MediaType.hpp +80 -0
  92. package/nitrogen/generated/shared/c++/PickerTheme.hpp +84 -0
  93. package/nitrogen/generated/shared/c++/PictureSelectorOptions.hpp +132 -0
  94. package/package.json +76 -0
  95. package/src/PictureSelector.ts +72 -0
  96. package/src/index.ts +16 -0
  97. package/src/specs/PictureSelector.nitro.ts +121 -0
  98. package/src/types.ts +38 -0
  99. package/src/usePictureSelector.ts +102 -0
@@ -0,0 +1,61 @@
1
+ ///
2
+ /// JMediaType.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 "MediaType.hpp"
12
+
13
+ namespace margelo::nitro::margelo::pictureselector {
14
+
15
+ using namespace facebook;
16
+
17
+ /**
18
+ * The C++ JNI bridge between the C++ enum "MediaType" and the the Kotlin enum "MediaType".
19
+ */
20
+ struct JMediaType final: public jni::JavaClass<JMediaType> {
21
+ public:
22
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/com/margelo/pictureselector/MediaType;";
23
+
24
+ public:
25
+ /**
26
+ * Convert this Java/Kotlin-based enum to the C++ enum MediaType.
27
+ */
28
+ [[maybe_unused]]
29
+ [[nodiscard]]
30
+ MediaType toCpp() const {
31
+ static const auto clazz = javaClassStatic();
32
+ static const auto fieldOrdinal = clazz->getField<int>("value");
33
+ int ordinal = this->getFieldValue(fieldOrdinal);
34
+ return static_cast<MediaType>(ordinal);
35
+ }
36
+
37
+ public:
38
+ /**
39
+ * Create a Java/Kotlin-based enum with the given C++ enum's value.
40
+ */
41
+ [[maybe_unused]]
42
+ static jni::alias_ref<JMediaType> fromCpp(MediaType value) {
43
+ static const auto clazz = javaClassStatic();
44
+ switch (value) {
45
+ case MediaType::IMAGE:
46
+ static const auto fieldIMAGE = clazz->getStaticField<JMediaType>("IMAGE");
47
+ return clazz->getStaticFieldValue(fieldIMAGE);
48
+ case MediaType::VIDEO:
49
+ static const auto fieldVIDEO = clazz->getStaticField<JMediaType>("VIDEO");
50
+ return clazz->getStaticFieldValue(fieldVIDEO);
51
+ case MediaType::ALL:
52
+ static const auto fieldALL = clazz->getStaticField<JMediaType>("ALL");
53
+ return clazz->getStaticFieldValue(fieldALL);
54
+ default:
55
+ std::string stringValue = std::to_string(static_cast<int>(value));
56
+ throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
57
+ }
58
+ }
59
+ };
60
+
61
+ } // namespace margelo::nitro::margelo::pictureselector
@@ -0,0 +1,64 @@
1
+ ///
2
+ /// JPickerTheme.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 "PickerTheme.hpp"
12
+
13
+ namespace margelo::nitro::margelo::pictureselector {
14
+
15
+ using namespace facebook;
16
+
17
+ /**
18
+ * The C++ JNI bridge between the C++ enum "PickerTheme" and the the Kotlin enum "PickerTheme".
19
+ */
20
+ struct JPickerTheme final: public jni::JavaClass<JPickerTheme> {
21
+ public:
22
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/com/margelo/pictureselector/PickerTheme;";
23
+
24
+ public:
25
+ /**
26
+ * Convert this Java/Kotlin-based enum to the C++ enum PickerTheme.
27
+ */
28
+ [[maybe_unused]]
29
+ [[nodiscard]]
30
+ PickerTheme toCpp() const {
31
+ static const auto clazz = javaClassStatic();
32
+ static const auto fieldOrdinal = clazz->getField<int>("value");
33
+ int ordinal = this->getFieldValue(fieldOrdinal);
34
+ return static_cast<PickerTheme>(ordinal);
35
+ }
36
+
37
+ public:
38
+ /**
39
+ * Create a Java/Kotlin-based enum with the given C++ enum's value.
40
+ */
41
+ [[maybe_unused]]
42
+ static jni::alias_ref<JPickerTheme> fromCpp(PickerTheme value) {
43
+ static const auto clazz = javaClassStatic();
44
+ switch (value) {
45
+ case PickerTheme::DEFAULT:
46
+ static const auto fieldDEFAULT = clazz->getStaticField<JPickerTheme>("DEFAULT");
47
+ return clazz->getStaticFieldValue(fieldDEFAULT);
48
+ case PickerTheme::WECHAT:
49
+ static const auto fieldWECHAT = clazz->getStaticField<JPickerTheme>("WECHAT");
50
+ return clazz->getStaticFieldValue(fieldWECHAT);
51
+ case PickerTheme::WHITE:
52
+ static const auto fieldWHITE = clazz->getStaticField<JPickerTheme>("WHITE");
53
+ return clazz->getStaticFieldValue(fieldWHITE);
54
+ case PickerTheme::DARK:
55
+ static const auto fieldDARK = clazz->getStaticField<JPickerTheme>("DARK");
56
+ return clazz->getStaticFieldValue(fieldDARK);
57
+ default:
58
+ std::string stringValue = std::to_string(static_cast<int>(value));
59
+ throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
60
+ }
61
+ }
62
+ };
63
+
64
+ } // namespace margelo::nitro::margelo::pictureselector
@@ -0,0 +1,121 @@
1
+ ///
2
+ /// JPictureSelectorOptions.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 "PictureSelectorOptions.hpp"
12
+
13
+ #include "CompressOptions.hpp"
14
+ #include "CropOptions.hpp"
15
+ #include "JCompressOptions.hpp"
16
+ #include "JCropOptions.hpp"
17
+ #include "JMediaType.hpp"
18
+ #include "JPickerTheme.hpp"
19
+ #include "MediaType.hpp"
20
+ #include "PickerTheme.hpp"
21
+ #include <optional>
22
+ #include <string>
23
+ #include <vector>
24
+
25
+ namespace margelo::nitro::margelo::pictureselector {
26
+
27
+ using namespace facebook;
28
+
29
+ /**
30
+ * The C++ JNI bridge between the C++ struct "PictureSelectorOptions" and the the Kotlin data class "PictureSelectorOptions".
31
+ */
32
+ struct JPictureSelectorOptions final: public jni::JavaClass<JPictureSelectorOptions> {
33
+ public:
34
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/com/margelo/pictureselector/PictureSelectorOptions;";
35
+
36
+ public:
37
+ /**
38
+ * Convert this Java/Kotlin-based struct to the C++ struct PictureSelectorOptions by copying all values to C++.
39
+ */
40
+ [[maybe_unused]]
41
+ [[nodiscard]]
42
+ PictureSelectorOptions toCpp() const {
43
+ static const auto clazz = javaClassStatic();
44
+ static const auto fieldMediaType = clazz->getField<JMediaType>("mediaType");
45
+ jni::local_ref<JMediaType> mediaType = this->getFieldValue(fieldMediaType);
46
+ static const auto fieldMaxCount = clazz->getField<jni::JDouble>("maxCount");
47
+ jni::local_ref<jni::JDouble> maxCount = this->getFieldValue(fieldMaxCount);
48
+ static const auto fieldEnableCamera = clazz->getField<jni::JBoolean>("enableCamera");
49
+ jni::local_ref<jni::JBoolean> enableCamera = this->getFieldValue(fieldEnableCamera);
50
+ static const auto fieldCrop = clazz->getField<JCropOptions>("crop");
51
+ jni::local_ref<JCropOptions> crop = this->getFieldValue(fieldCrop);
52
+ static const auto fieldCompress = clazz->getField<JCompressOptions>("compress");
53
+ jni::local_ref<JCompressOptions> compress = this->getFieldValue(fieldCompress);
54
+ static const auto fieldMaxVideoDuration = clazz->getField<jni::JDouble>("maxVideoDuration");
55
+ jni::local_ref<jni::JDouble> maxVideoDuration = this->getFieldValue(fieldMaxVideoDuration);
56
+ static const auto fieldMinVideoDuration = clazz->getField<jni::JDouble>("minVideoDuration");
57
+ jni::local_ref<jni::JDouble> minVideoDuration = this->getFieldValue(fieldMinVideoDuration);
58
+ static const auto fieldTheme = clazz->getField<JPickerTheme>("theme");
59
+ jni::local_ref<JPickerTheme> theme = this->getFieldValue(fieldTheme);
60
+ static const auto fieldThemeColor = clazz->getField<jni::JString>("themeColor");
61
+ jni::local_ref<jni::JString> themeColor = this->getFieldValue(fieldThemeColor);
62
+ static const auto fieldSelectedAssets = clazz->getField<jni::JArrayClass<jni::JString>>("selectedAssets");
63
+ jni::local_ref<jni::JArrayClass<jni::JString>> selectedAssets = this->getFieldValue(fieldSelectedAssets);
64
+ return PictureSelectorOptions(
65
+ mediaType != nullptr ? std::make_optional(mediaType->toCpp()) : std::nullopt,
66
+ maxCount != nullptr ? std::make_optional(maxCount->value()) : std::nullopt,
67
+ enableCamera != nullptr ? std::make_optional(static_cast<bool>(enableCamera->value())) : std::nullopt,
68
+ crop != nullptr ? std::make_optional(crop->toCpp()) : std::nullopt,
69
+ compress != nullptr ? std::make_optional(compress->toCpp()) : std::nullopt,
70
+ maxVideoDuration != nullptr ? std::make_optional(maxVideoDuration->value()) : std::nullopt,
71
+ minVideoDuration != nullptr ? std::make_optional(minVideoDuration->value()) : std::nullopt,
72
+ theme != nullptr ? std::make_optional(theme->toCpp()) : std::nullopt,
73
+ themeColor != nullptr ? std::make_optional(themeColor->toStdString()) : std::nullopt,
74
+ selectedAssets != nullptr ? std::make_optional([&]() {
75
+ size_t __size = selectedAssets->size();
76
+ std::vector<std::string> __vector;
77
+ __vector.reserve(__size);
78
+ for (size_t __i = 0; __i < __size; __i++) {
79
+ auto __element = selectedAssets->getElement(__i);
80
+ __vector.push_back(__element->toStdString());
81
+ }
82
+ return __vector;
83
+ }()) : std::nullopt
84
+ );
85
+ }
86
+
87
+ public:
88
+ /**
89
+ * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
90
+ */
91
+ [[maybe_unused]]
92
+ static jni::local_ref<JPictureSelectorOptions::javaobject> fromCpp(const PictureSelectorOptions& value) {
93
+ using JSignature = JPictureSelectorOptions(jni::alias_ref<JMediaType>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<JCropOptions>, jni::alias_ref<JCompressOptions>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<JPickerTheme>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JArrayClass<jni::JString>>);
94
+ static const auto clazz = javaClassStatic();
95
+ static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
96
+ return create(
97
+ clazz,
98
+ value.mediaType.has_value() ? JMediaType::fromCpp(value.mediaType.value()) : nullptr,
99
+ value.maxCount.has_value() ? jni::JDouble::valueOf(value.maxCount.value()) : nullptr,
100
+ value.enableCamera.has_value() ? jni::JBoolean::valueOf(value.enableCamera.value()) : nullptr,
101
+ value.crop.has_value() ? JCropOptions::fromCpp(value.crop.value()) : nullptr,
102
+ value.compress.has_value() ? JCompressOptions::fromCpp(value.compress.value()) : nullptr,
103
+ value.maxVideoDuration.has_value() ? jni::JDouble::valueOf(value.maxVideoDuration.value()) : nullptr,
104
+ value.minVideoDuration.has_value() ? jni::JDouble::valueOf(value.minVideoDuration.value()) : nullptr,
105
+ value.theme.has_value() ? JPickerTheme::fromCpp(value.theme.value()) : nullptr,
106
+ value.themeColor.has_value() ? jni::make_jstring(value.themeColor.value()) : nullptr,
107
+ value.selectedAssets.has_value() ? [&]() {
108
+ size_t __size = value.selectedAssets.value().size();
109
+ jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
110
+ for (size_t __i = 0; __i < __size; __i++) {
111
+ const auto& __element = value.selectedAssets.value()[__i];
112
+ auto __elementJni = jni::make_jstring(__element);
113
+ __array->setElement(__i, *__elementJni);
114
+ }
115
+ return __array;
116
+ }() : nullptr
117
+ );
118
+ }
119
+ };
120
+
121
+ } // namespace margelo::nitro::margelo::pictureselector
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// CompressOptions.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.com.margelo.pictureselector
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "CompressOptions".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class CompressOptions(
20
+ @DoNotStrip
21
+ @Keep
22
+ val enabled: Boolean,
23
+ @DoNotStrip
24
+ @Keep
25
+ val quality: Double?,
26
+ @DoNotStrip
27
+ @Keep
28
+ val maxWidth: Double?,
29
+ @DoNotStrip
30
+ @Keep
31
+ val maxHeight: Double?
32
+ ) {
33
+ /* primary constructor */
34
+
35
+ companion object {
36
+ /**
37
+ * Constructor called from C++
38
+ */
39
+ @DoNotStrip
40
+ @Keep
41
+ @Suppress("unused")
42
+ @JvmStatic
43
+ private fun fromCpp(enabled: Boolean, quality: Double?, maxWidth: Double?, maxHeight: Double?): CompressOptions {
44
+ return CompressOptions(enabled, quality, maxWidth, maxHeight)
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,50 @@
1
+ ///
2
+ /// CropOptions.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.com.margelo.pictureselector
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "CropOptions".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class CropOptions(
20
+ @DoNotStrip
21
+ @Keep
22
+ val enabled: Boolean,
23
+ @DoNotStrip
24
+ @Keep
25
+ val freeStyle: Boolean?,
26
+ @DoNotStrip
27
+ @Keep
28
+ val circular: Boolean?,
29
+ @DoNotStrip
30
+ @Keep
31
+ val ratioX: Double?,
32
+ @DoNotStrip
33
+ @Keep
34
+ val ratioY: Double?
35
+ ) {
36
+ /* primary constructor */
37
+
38
+ companion object {
39
+ /**
40
+ * Constructor called from C++
41
+ */
42
+ @DoNotStrip
43
+ @Keep
44
+ @Suppress("unused")
45
+ @JvmStatic
46
+ private fun fromCpp(enabled: Boolean, freeStyle: Boolean?, circular: Boolean?, ratioX: Double?, ratioY: Double?): CropOptions {
47
+ return CropOptions(enabled, freeStyle, circular, ratioX, ratioY)
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,59 @@
1
+ ///
2
+ /// HybridHybridPictureSelectorSpec.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.com.margelo.pictureselector
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.Promise
14
+ import com.margelo.nitro.core.HybridObject
15
+
16
+ /**
17
+ * A Kotlin class representing the HybridPictureSelector HybridObject.
18
+ * Implement this abstract class to create Kotlin-based instances of HybridPictureSelector.
19
+ */
20
+ @DoNotStrip
21
+ @Keep
22
+ @Suppress(
23
+ "KotlinJniMissingFunction", "unused",
24
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
25
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
26
+ )
27
+ abstract class HybridHybridPictureSelectorSpec: HybridObject() {
28
+ // Properties
29
+
30
+
31
+ // Methods
32
+ @DoNotStrip
33
+ @Keep
34
+ abstract fun openPicker(options: PictureSelectorOptions): Promise<Array<MediaAsset>>
35
+
36
+ @DoNotStrip
37
+ @Keep
38
+ abstract fun openCamera(options: PictureSelectorOptions): Promise<Array<MediaAsset>>
39
+
40
+ // Default implementation of `HybridObject.toString()`
41
+ override fun toString(): String {
42
+ return "[HybridObject HybridPictureSelector]"
43
+ }
44
+
45
+ // C++ backing class
46
+ @DoNotStrip
47
+ @Keep
48
+ protected open class CxxPart(javaPart: HybridHybridPictureSelectorSpec): HybridObject.CxxPart(javaPart) {
49
+ // C++ JHybridHybridPictureSelectorSpec::CxxPart::initHybrid(...)
50
+ external override fun initHybrid(): HybridData
51
+ }
52
+ override fun createCxxPart(): CxxPart {
53
+ return CxxPart(this)
54
+ }
55
+
56
+ companion object {
57
+ protected const val TAG = "HybridHybridPictureSelectorSpec"
58
+ }
59
+ }
@@ -0,0 +1,68 @@
1
+ ///
2
+ /// MediaAsset.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.com.margelo.pictureselector
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "MediaAsset".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class MediaAsset(
20
+ @DoNotStrip
21
+ @Keep
22
+ val uri: String,
23
+ @DoNotStrip
24
+ @Keep
25
+ val type: String,
26
+ @DoNotStrip
27
+ @Keep
28
+ val mimeType: String,
29
+ @DoNotStrip
30
+ @Keep
31
+ val width: Double,
32
+ @DoNotStrip
33
+ @Keep
34
+ val height: Double,
35
+ @DoNotStrip
36
+ @Keep
37
+ val duration: Double,
38
+ @DoNotStrip
39
+ @Keep
40
+ val fileName: String,
41
+ @DoNotStrip
42
+ @Keep
43
+ val fileSize: Double,
44
+ @DoNotStrip
45
+ @Keep
46
+ val editedUri: String?,
47
+ @DoNotStrip
48
+ @Keep
49
+ val isOriginal: Boolean?,
50
+ @DoNotStrip
51
+ @Keep
52
+ val bucketName: String?
53
+ ) {
54
+ /* primary constructor */
55
+
56
+ companion object {
57
+ /**
58
+ * Constructor called from C++
59
+ */
60
+ @DoNotStrip
61
+ @Keep
62
+ @Suppress("unused")
63
+ @JvmStatic
64
+ private fun fromCpp(uri: String, type: String, mimeType: String, width: Double, height: Double, duration: Double, fileName: String, fileSize: Double, editedUri: String?, isOriginal: Boolean?, bucketName: String?): MediaAsset {
65
+ return MediaAsset(uri, type, mimeType, width, height, duration, fileName, fileSize, editedUri, isOriginal, bucketName)
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,24 @@
1
+ ///
2
+ /// MediaType.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.com.margelo.pictureselector
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+ /**
14
+ * Represents the JavaScript enum/union "MediaType".
15
+ */
16
+ @DoNotStrip
17
+ @Keep
18
+ enum class MediaType(@DoNotStrip @Keep val value: Int) {
19
+ IMAGE(0),
20
+ VIDEO(1),
21
+ ALL(2);
22
+
23
+ companion object
24
+ }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// NitroPictureSelectorOnLoad.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.com.margelo.pictureselector
9
+
10
+ import android.util.Log
11
+
12
+ internal class NitroPictureSelectorOnLoad {
13
+ companion object {
14
+ private const val TAG = "NitroPictureSelectorOnLoad"
15
+ private var didLoad = false
16
+ /**
17
+ * Initializes the native part of "NitroPictureSelector".
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 NitroPictureSelector C++ library...")
25
+ System.loadLibrary("NitroPictureSelector")
26
+ Log.i(TAG, "Successfully loaded NitroPictureSelector C++ library!")
27
+ didLoad = true
28
+ } catch (e: Error) {
29
+ Log.e(TAG, "Failed to load NitroPictureSelector 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,25 @@
1
+ ///
2
+ /// PickerTheme.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.com.margelo.pictureselector
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+ /**
14
+ * Represents the JavaScript enum/union "PickerTheme".
15
+ */
16
+ @DoNotStrip
17
+ @Keep
18
+ enum class PickerTheme(@DoNotStrip @Keep val value: Int) {
19
+ DEFAULT(0),
20
+ WECHAT(1),
21
+ WHITE(2),
22
+ DARK(3);
23
+
24
+ companion object
25
+ }
@@ -0,0 +1,65 @@
1
+ ///
2
+ /// PictureSelectorOptions.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.com.margelo.pictureselector
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+
14
+ /**
15
+ * Represents the JavaScript object/struct "PictureSelectorOptions".
16
+ */
17
+ @DoNotStrip
18
+ @Keep
19
+ data class PictureSelectorOptions(
20
+ @DoNotStrip
21
+ @Keep
22
+ val mediaType: MediaType?,
23
+ @DoNotStrip
24
+ @Keep
25
+ val maxCount: Double?,
26
+ @DoNotStrip
27
+ @Keep
28
+ val enableCamera: Boolean?,
29
+ @DoNotStrip
30
+ @Keep
31
+ val crop: CropOptions?,
32
+ @DoNotStrip
33
+ @Keep
34
+ val compress: CompressOptions?,
35
+ @DoNotStrip
36
+ @Keep
37
+ val maxVideoDuration: Double?,
38
+ @DoNotStrip
39
+ @Keep
40
+ val minVideoDuration: Double?,
41
+ @DoNotStrip
42
+ @Keep
43
+ val theme: PickerTheme?,
44
+ @DoNotStrip
45
+ @Keep
46
+ val themeColor: String?,
47
+ @DoNotStrip
48
+ @Keep
49
+ val selectedAssets: Array<String>?
50
+ ) {
51
+ /* primary constructor */
52
+
53
+ companion object {
54
+ /**
55
+ * Constructor called from C++
56
+ */
57
+ @DoNotStrip
58
+ @Keep
59
+ @Suppress("unused")
60
+ @JvmStatic
61
+ private fun fromCpp(mediaType: MediaType?, maxCount: Double?, enableCamera: Boolean?, crop: CropOptions?, compress: CompressOptions?, maxVideoDuration: Double?, minVideoDuration: Double?, theme: PickerTheme?, themeColor: String?, selectedAssets: Array<String>?): PictureSelectorOptions {
62
+ return PictureSelectorOptions(mediaType, maxCount, enableCamera, crop, compress, maxVideoDuration, minVideoDuration, theme, themeColor, selectedAssets)
63
+ }
64
+ }
65
+ }
@@ -0,0 +1,60 @@
1
+ #
2
+ # NitroPictureSelector+autolinking.rb
3
+ # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ # https://github.com/mrousavy/nitro
5
+ # Copyright © Marc Rousavy @ Margelo
6
+ #
7
+
8
+ # This is a Ruby script that adds all files generated by Nitrogen
9
+ # to the given podspec.
10
+ #
11
+ # To use it, add this to your .podspec:
12
+ # ```ruby
13
+ # Pod::Spec.new do |spec|
14
+ # # ...
15
+ #
16
+ # # Add all files generated by Nitrogen
17
+ # load 'nitrogen/generated/ios/NitroPictureSelector+autolinking.rb'
18
+ # add_nitrogen_files(spec)
19
+ # end
20
+ # ```
21
+
22
+ def add_nitrogen_files(spec)
23
+ Pod::UI.puts "[NitroModules] 🔥 NitroPictureSelector is boosted by nitro!"
24
+
25
+ spec.dependency "NitroModules"
26
+
27
+ current_source_files = Array(spec.attributes_hash['source_files'])
28
+ spec.source_files = current_source_files + [
29
+ # Generated cross-platform specs
30
+ "nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
31
+ # Generated bridges for the cross-platform specs
32
+ "nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
33
+ ]
34
+
35
+ current_public_header_files = Array(spec.attributes_hash['public_header_files'])
36
+ spec.public_header_files = current_public_header_files + [
37
+ # Generated specs
38
+ "nitrogen/generated/shared/**/*.{h,hpp}",
39
+ # Swift to C++ bridging helpers
40
+ "nitrogen/generated/ios/NitroPictureSelector-Swift-Cxx-Bridge.hpp"
41
+ ]
42
+
43
+ current_private_header_files = Array(spec.attributes_hash['private_header_files'])
44
+ spec.private_header_files = current_private_header_files + [
45
+ # iOS specific specs
46
+ "nitrogen/generated/ios/c++/**/*.{h,hpp}",
47
+ # Views are framework-specific and should be private
48
+ "nitrogen/generated/shared/**/views/**/*"
49
+ ]
50
+
51
+ current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
52
+ spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
53
+ # Use C++ 20
54
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
55
+ # Enables C++ <-> Swift interop (by default it's only ObjC)
56
+ "SWIFT_OBJC_INTEROP_MODE" => "objcxx",
57
+ # Enables stricter modular headers
58
+ "DEFINES_MODULE" => "YES",
59
+ })
60
+ end