react-native-nitro-image-pipeline 0.3.2 → 0.3.4

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.
@@ -65,12 +65,18 @@ class HybridNitroImagePipeline: HybridNitroImagePipelineSpec {
65
65
  default: []
66
66
  }
67
67
 
68
+ var processors: [any ImageProcessing] = []
69
+ if let blur = options?.blur, blur > 0 {
70
+ processors.append(.gaussianBlur(radius: Int(blur)))
71
+ }
72
+ if let cornerRadius = options?.cornerRadius, cornerRadius > 0 {
73
+ processors.append(.roundedCorners(radius: cornerRadius))
74
+ }
75
+
68
76
  let imgRequest = ImageRequest(
69
77
  url: URL(string: url),
70
- processors: [
71
- .gaussianBlur(radius: Int(options?.blur ?? 0)),
72
- .roundedCorners(radius: options?.cornerRadius ?? 0)
73
- ], options: cacheOptions
78
+ processors: processors,
79
+ options: cacheOptions
74
80
  )
75
81
 
76
82
  let image = try await ImagePipeline.shared.image(for: imgRequest)
@@ -15,7 +15,7 @@ namespace margelo::nitro::nitroimagepipeline {
15
15
  using namespace facebook;
16
16
 
17
17
  /**
18
- * The C++ JNI bridge between the C++ enum "CacheOption" and the the Kotlin enum "CacheOption".
18
+ * The C++ JNI bridge between the C++ enum "CacheOption" and the Kotlin enum "CacheOption".
19
19
  */
20
20
  struct JCacheOption final: public jni::JavaClass<JCacheOption> {
21
21
  public:
@@ -94,16 +94,16 @@ namespace margelo::nitro::nitroimagepipeline {
94
94
  }
95
95
  std::shared_ptr<Promise<void>> JHybridNitroImagePipelineSpec::preLoadImages(const std::vector<std::string>& urls) {
96
96
  static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JArrayClass<jni::JString>> /* urls */)>("preLoadImages");
97
- auto __result = method(_javaPart, [&]() {
98
- size_t __size = urls.size();
97
+ auto __result = method(_javaPart, [&](auto&& __input) {
98
+ size_t __size = __input.size();
99
99
  jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
100
100
  for (size_t __i = 0; __i < __size; __i++) {
101
- const auto& __element = urls[__i];
101
+ const auto& __element = __input[__i];
102
102
  auto __elementJni = jni::make_jstring(__element);
103
103
  __array->setElement(__i, *__elementJni);
104
104
  }
105
105
  return __array;
106
- }());
106
+ }(urls));
107
107
  return [&]() {
108
108
  auto __promise = Promise<void>::create();
109
109
  __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
@@ -19,7 +19,7 @@ namespace margelo::nitro::nitroimagepipeline {
19
19
  using namespace facebook;
20
20
 
21
21
  /**
22
- * The C++ JNI bridge between the C++ struct "Options" and the the Kotlin data class "Options".
22
+ * The C++ JNI bridge between the C++ struct "Options" and the Kotlin data class "Options".
23
23
  */
24
24
  struct JOptions final: public jni::JavaClass<JOptions> {
25
25
  public:
@@ -10,6 +10,7 @@ package com.margelo.nitro.nitroimagepipeline
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.jni.HybridData
12
12
  import com.facebook.proguard.annotations.DoNotStrip
13
+ import dalvik.annotation.optimization.FastNative
13
14
  import com.margelo.nitro.image.HybridImageSpec
14
15
  import com.margelo.nitro.core.Promise
15
16
  import com.margelo.nitro.core.HybridObject
@@ -60,6 +61,7 @@ abstract class HybridNitroImagePipelineSpec: HybridObject() {
60
61
  @Keep
61
62
  protected open class CxxPart(javaPart: HybridNitroImagePipelineSpec): HybridObject.CxxPart(javaPart) {
62
63
  // C++ JHybridNitroImagePipelineSpec::CxxPart::initHybrid(...)
64
+ @FastNative
63
65
  external override fun initHybrid(): HybridData
64
66
  }
65
67
  override fun createCxxPart(): CxxPart {
@@ -9,6 +9,7 @@ package com.margelo.nitro.nitroimagepipeline
9
9
 
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
12
13
 
13
14
 
14
15
  /**
@@ -29,6 +30,22 @@ data class Options(
29
30
  ) {
30
31
  /* primary constructor */
31
32
 
33
+ override fun equals(other: Any?): Boolean {
34
+ if (this === other) return true
35
+ if (other !is Options) return false
36
+ return Objects.deepEquals(this.blur, other.blur)
37
+ && Objects.deepEquals(this.cache, other.cache)
38
+ && Objects.deepEquals(this.cornerRadius, other.cornerRadius)
39
+ }
40
+
41
+ override fun hashCode(): Int {
42
+ return arrayOf<Any?>(
43
+ blur,
44
+ cache,
45
+ cornerRadius
46
+ ).contentDeepHashCode()
47
+ }
48
+
32
49
  companion object {
33
50
  /**
34
51
  * Constructor called from C++
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nitro-image-pipeline",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "High-performance image loading, caching, and processing for React Native, built with Nitro Modules",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -59,19 +59,19 @@
59
59
  "registry": "https://registry.npmjs.org/"
60
60
  },
61
61
  "devDependencies": {
62
- "@biomejs/biome": "^2.4.10",
63
- "@semantic-release/changelog": "^6.0.3",
64
- "@semantic-release/git": "^10.0.1",
65
- "@types/bun": "^1.3.12",
62
+ "@biomejs/biome": "^2.5.6",
63
+ "@semantic-release/changelog": "^7.0.0",
64
+ "@semantic-release/git": "^11.0.1",
65
+ "@types/bun": "^1.3.14",
66
66
  "@types/jest": "^30.0.0",
67
- "@types/react": "19.2.0",
68
- "conventional-changelog-conventionalcommits": "^9.1.0",
69
- "nitrogen": "0.36.1",
67
+ "@types/react": "19.2.18",
68
+ "conventional-changelog-conventionalcommits": "^10.2.1",
69
+ "nitrogen": "0.36.5",
70
70
  "react": "19.2.3",
71
71
  "react-native": "0.84.1",
72
72
  "react-native-builder-bob": "^0.43.0",
73
- "react-native-nitro-modules": "0.36.1",
74
- "semantic-release": "^25.0.5",
73
+ "react-native-nitro-modules": "0.36.5",
74
+ "semantic-release": "^25.0.8",
75
75
  "typescript": "^5.8.3"
76
76
  },
77
77
  "peerDependencies": {