react-native-picture-selector 1.0.29 → 1.0.30

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.
@@ -18,21 +18,3 @@ include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NitroPictureSelector+a
18
18
  target_sources(${CMAKE_PROJECT_NAME} PRIVATE
19
19
  src/main/cpp/cpp-adapter.cpp
20
20
  )
21
-
22
- # Directly link libNitroModules.so from its stable cmake build output path.
23
- # The prefab for react-native-nitro-modules is header-only at CMake configure
24
- # time (fix-prefab.gradle updates it only after native build), so we link
25
- # the .so directly to avoid undefined symbol errors on fresh builds.
26
- #
27
- # Use a generator expression so the correct variant (debug/release) is picked
28
- # automatically — avoids breaking assembleRelease / EAS production builds.
29
- string(TOLOWER "${CMAKE_BUILD_TYPE}" _build_type_lower)
30
- if(_build_type_lower STREQUAL "release")
31
- set(NITRO_BUILD_VARIANT "release")
32
- else()
33
- set(NITRO_BUILD_VARIANT "debug")
34
- endif()
35
-
36
- target_link_libraries(${CMAKE_PROJECT_NAME}
37
- ${CMAKE_SOURCE_DIR}/../../react-native-nitro-modules/android/build/intermediates/cmake/${NITRO_BUILD_VARIANT}/obj/${ANDROID_ABI}/libNitroModules.so
38
- )
@@ -15,28 +15,20 @@ import java.io.File
15
15
  * (io.github.lucksiege:compress). This engine is invoked after selection
16
16
  * when compression is enabled.
17
17
  *
18
- * API REQUIRES VERIFICATION: The exact Luban API (OnNewCompressListener
19
- * callback method signatures) should be confirmed against the bundled
20
- * Luban version in io.github.lucksiege:compress:v3.11.2.
18
+ * Luban handles compression quality internally using an adaptive algorithm
19
+ * based on image dimensions. Direct JPEG quality control is not supported
20
+ * by this bundled version. Use [ignoreBy] to skip already-small files.
21
21
  */
22
- class LubanCompressEngine(
23
- private val quality: Int,
24
- private val maxWidth: Int,
25
- private val maxHeight: Int,
26
- ) : CompressFileEngine {
22
+ class LubanCompressEngine : CompressFileEngine {
27
23
 
28
24
  override fun onStartCompress(
29
25
  context: Context,
30
26
  source: ArrayList<Uri>,
31
27
  call: OnKeyValueResultCallbackListener,
32
28
  ) {
33
- // API REQUIRES VERIFICATION: setQuality() method name in bundled Luban version.
34
- // In most Luban forks bundled with PictureSelector, quality is set via .quality(Int)
35
- // or .setCompressQuality(Int). Adjust the method name after verifying against
36
- // io.github.lucksiege:compress:v3.11.2 source.
37
29
  Luban.with(context)
38
30
  .load(source)
39
- .ignoreBy(100) // skip files under 100 KB
31
+ .ignoreBy(100) // skip files already under 100 KB
40
32
  .setTargetDir(context.cacheDir.absolutePath)
41
33
  .setCompressListener(object : OnNewCompressListener {
42
34
  override fun onStart() {
@@ -13,11 +13,10 @@ import java.io.File
13
13
  * 3. Real file path (realPath != null)
14
14
  * 4. Fallback (path — may be content:// URI)
15
15
  *
16
- * API REQUIRES VERIFICATION:
17
- * - LocalMedia.bucketDisplayName field name in v3.11.2
18
- * (may be bucketDisplayName or albumName).
19
- * - LocalMedia.size field name (may be size or fileSize).
20
- * - LocalMedia.duration unit (ms in v3; confirm).
16
+ * Field mapping verified against PictureSelector v3.11.2:
17
+ * - LocalMedia.size — file size in bytes (Long)
18
+ * - LocalMedia.duration duration in milliseconds (Long)
19
+ * - LocalMedia.parentFolderName album/bucket display name (String)
21
20
  */
22
21
  object MediaAssetMapper {
23
22
 
@@ -44,7 +43,7 @@ object MediaAssetMapper {
44
43
  height = media.height.toDouble(),
45
44
  duration = media.duration.toDouble(), // milliseconds
46
45
  fileName = fileName,
47
- fileSize = media.size.toDouble(), // API REQUIRES VERIFICATION: field name
46
+ fileSize = media.size.toDouble(),
48
47
  editedUri = editedPath,
49
48
  isOriginal = null,
50
49
  bucketName = media.parentFolderName,
@@ -18,13 +18,6 @@ import com.margelo.nitro.com.margelo.pictureselector.NitroPictureSelectorOnLoad
18
18
  * // MainApplication.kt
19
19
  * override fun getPackages() = PackageList(this).packages + NitroPictureSelectorPackage()
20
20
  * ```
21
- *
22
- * API REQUIRES VERIFICATION:
23
- * - NitroModules.addHybridObjectCreator is the actual registration API in
24
- * react-native-nitro-modules for Android. Verify against the installed
25
- * version of the library. The creator name ("PictureSelector") must
26
- * exactly match the string passed to NitroModules.createHybridObject()
27
- * on the JS side.
28
21
  */
29
22
  class NitroPictureSelectorPackage : ReactPackage {
30
23
 
@@ -12,11 +12,7 @@ import com.margelo.nitro.com.margelo.pictureselector.PictureSelectorOptions
12
12
  * [PictureSelector.create(activity).openGallery()] /
13
13
  * [PictureSelector.create(activity).openCamera()].
14
14
  *
15
- * API REQUIRES VERIFICATION:
16
- * - setSelectVideoMaxDuration / setSelectVideoMinDuration unit (seconds vs ms).
17
- * In v3.11.2 these accept seconds. Confirm in the library source.
18
- * - setSelectorUIStyle builder method name & enum values.
19
- * - setSelectedData signature for pre-selected items.
15
+ * Video duration methods accept seconds in v3.11.2.
20
16
  */
21
17
  object PictureSelectorOptionsMapper {
22
18
 
@@ -37,9 +33,8 @@ object PictureSelectorOptionsMapper {
37
33
  // Show camera button inside gallery
38
34
  builder.isDisplayCamera(options.enableCamera ?: true)
39
35
 
40
- // Pre-selected assets requires conversion to LocalMedia list
41
- // API REQUIRES VERIFICATION: setSelectedData(List<LocalMedia>) signature
42
- // options.selectedAssets is currently unused in v1; add in future.
36
+ // Pre-selected assets: selectedAssets (file:// URIs) conversion to LocalMedia
37
+ // is not yet implemented; skipped intentionally.
43
38
  }
44
39
 
45
40
  /**
@@ -68,10 +63,7 @@ object PictureSelectorOptionsMapper {
68
63
 
69
64
  val compress = options.compress
70
65
  if (compress != null && compress.enabled) {
71
- val quality = (((compress.quality ?: 0.8) * 100).toInt()).coerceIn(10, 100)
72
- val maxWidth = (compress.maxWidth ?: 1920.0).toInt()
73
- val maxHeight = (compress.maxHeight ?: 1920.0).toInt()
74
- builder.setCompressEngine(LubanCompressEngine(quality, maxWidth, maxHeight))
66
+ builder.setCompressEngine(LubanCompressEngine())
75
67
  }
76
68
  }
77
69
 
@@ -104,11 +96,7 @@ object PictureSelectorOptionsMapper {
104
96
  // ── Compress engine ───────────────────────────────────────────────────
105
97
  val compress = options.compress
106
98
  if (compress != null && compress.enabled) {
107
- val quality = (((compress.quality ?: 0.8) * 100).toInt()).coerceIn(10, 100)
108
- val maxWidth = (compress.maxWidth ?: 1920.0).toInt()
109
- val maxHeight = (compress.maxHeight ?: 1920.0).toInt()
110
-
111
- builder.setCompressEngine(LubanCompressEngine(quality, maxWidth, maxHeight))
99
+ builder.setCompressEngine(LubanCompressEngine())
112
100
  }
113
101
  }
114
102
 
@@ -17,7 +17,7 @@
17
17
  // Defined in HybridPictureSelector.swift via @_cdecl.
18
18
  // Creates a HybridPictureSelector instance and returns a retained raw pointer
19
19
  // to its HybridHybridPictureSelectorSpec_cxx wrapper.
20
- extern "C" void* NitroPictureSelectorMakeHybrid();
20
+ extern "C" void* NitroPictureSelectorMakeHybrid() noexcept;
21
21
 
22
22
  using namespace margelo::nitro;
23
23
  using namespace margelo::nitro::pictureselector;
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://nitro.margelo.com/nitro.schema.json",
3
+ "cxxNamespace": ["margelo", "nitro", "pictureselector"],
4
+ "outputDirectory": "./nitrogen",
5
+ "specs": ["./src/specs"],
6
+ "ios": {
7
+ "iosModuleName": "NitroPictureSelector"
8
+ },
9
+ "android": {
10
+ "androidNamespace": ["com", "margelo", "pictureselector"],
11
+ "androidCxxLibName": "NitroPictureSelector"
12
+ },
13
+ "autolinking": {
14
+ "PictureSelector": {
15
+ "swift": "HybridPictureSelector",
16
+ "kotlin": "HybridPictureSelector"
17
+ }
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-picture-selector",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
4
4
  "description": "High-performance photo/video picker for React Native using Nitro Modules",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -13,7 +13,7 @@
13
13
  "android",
14
14
  "ios",
15
15
  "nitrogen",
16
- "nitro.json",
16
+ "nitrogen.config.json",
17
17
  "*.podspec"
18
18
  ],
19
19
  "scripts": {
@@ -51,15 +51,6 @@
51
51
  "react-native-nitro-modules": ">=0.20.0",
52
52
  "typescript": "^5.3.0"
53
53
  },
54
- "nitro": {
55
- "ios": {
56
- "iosModuleName": "NitroPictureSelector"
57
- },
58
- "android": {
59
- "androidNamespace": "com.nitro.pictureselector",
60
- "androidCxxLibName": "NitroPictureSelector"
61
- }
62
- },
63
54
  "react-native-builder-bob": {
64
55
  "source": "src",
65
56
  "output": "lib",
package/nitro.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "cxxNamespace": ["pictureselector"],
3
- "ios": {
4
- "iosModuleName": "NitroPictureSelector"
5
- },
6
- "android": {
7
- "androidNamespace": ["com", "margelo", "pictureselector"],
8
- "androidCxxLibName": "NitroPictureSelector"
9
- },
10
- "autolinking": {}
11
- }