diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1b69af8f..a0c96cc6 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v4
- name: Verify Dev Changed files
- uses: tj-actions/verify-changed-files@v16.1.1
+ uses: tj-actions/changed-files@v40
id: verify-dev-changed-files
with:
files: |
@@ -25,7 +25,7 @@ jobs:
- uses: actions/cache@v3
name: Cache node_modules
id: cache-node-modules
- if: steps.verify-dev-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-dev-changed-files.outputs.any_changed == 'true'
with:
path: |
node_modules
@@ -33,20 +33,20 @@ jobs:
key: ${{ runner.os }}-nodeModules-${{ hashFiles('package.json') }}-${{ hashFiles('example/package.json') }}
- name: Set up Ruby
- if: steps.verify-dev-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-dev-changed-files.outputs.any_changed == 'true'
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: Setup node 16
- if: steps.verify-dev-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-dev-changed-files.outputs.any_changed == 'true'
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install npm dependencies
- if: steps.cache-node-modules.outputs.cache-hit != 'true' && steps.verify-dev-changed-files.outputs.files_changed == 'true'
+ if: steps.cache-node-modules.outputs.cache-hit != 'true' && steps.verify-dev-changed-files.outputs.any_changed == 'true'
run: |
ls
pwd
@@ -65,7 +65,7 @@ jobs:
uses: actions/checkout@v4
- name: Verify Android Changed files
- uses: tj-actions/verify-changed-files@v16.1.1
+ uses: tj-actions/changed-files@v40
id: verify-android-changed-files
with:
files: |
@@ -77,7 +77,7 @@ jobs:
- uses: actions/cache@v3
name: Cache node_modules
- if: steps.verify-android-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-android-changed-files.outputs.any_changed == 'true'
id: cache-node-modules
with:
path: |
@@ -89,7 +89,7 @@ jobs:
- uses: actions/cache@v3
id: cache-gradle
name: Cache Gradle dependencies
- if: steps.verify-android-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-android-changed-files.outputs.any_changed == 'true'
with:
path: |
~/.gradle/caches
@@ -98,38 +98,38 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- if: steps.verify-android-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-android-changed-files.outputs.any_changed == 'true'
with:
ruby-version: 2.7
bundler-cache: true
- name: Setup node 16
uses: actions/setup-node@v3
- if: steps.verify-android-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-android-changed-files.outputs.any_changed == 'true'
with:
node-version: '16'
- name: Set up JDK
uses: actions/setup-java@v3
- if: steps.verify-android-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-android-changed-files.outputs.any_changed == 'true'
with:
distribution: 'zulu'
java-version: 11
- name: Install Gradle dependencies
- if: steps.cache-gradle.outputs.cache-hit != 'true' && steps.verify-android-changed-files.outputs.files_changed == 'true'
+ if: steps.cache-gradle.outputs.cache-hit != 'true' && steps.verify-android-changed-files.outputs.any_changed == 'true'
run: |
cd example/android
./gradlew build --stacktrace
- name: Run unit tests
- if: steps.verify-android-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-android-changed-files.outputs.any_changed == 'true'
run: |
cd example/android
./gradlew test --stacktrace
- name: Build APK
- if: steps.verify-android-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-android-changed-files.outputs.any_changed == 'true'
run: |
npm run prepack
cd example/android
@@ -137,7 +137,7 @@ jobs:
mv app/build/outputs/apk/release/app-release.apk app-release-${{ github.sha }}.apk
- name: Upload APK
- if: steps.verify-android-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-android-changed-files.outputs.any_changed == 'true'
uses: actions/upload-artifact@v3
with:
name: app-release-${{ github.sha }}.apk
@@ -156,7 +156,7 @@ jobs:
uses: actions/checkout@v4
- name: Verify Android Changed files
- uses: tj-actions/verify-changed-files@v16.1.1
+ uses: tj-actions/changed-files@v40
id: verify-android-changed-files
with:
files: |
@@ -168,7 +168,7 @@ jobs:
- uses: actions/cache@v3
name: Cache node_modules
- if: steps.verify-android-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-android-changed-files.outputs.any_changed == 'true'
id: cache-node-modules
with:
path: |
@@ -179,7 +179,7 @@ jobs:
- uses: actions/cache@v3
name: Cache Gradle dependencies
- if: steps.verify-android-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-android-changed-files.outputs.any_changed == 'true'
id: cache-gradle
with:
path: |
@@ -190,27 +190,27 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- if: steps.verify-android-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-android-changed-files.outputs.any_changed == 'true'
with:
ruby-version: 2.7
bundler-cache: true
- name: Setup node 16
uses: actions/setup-node@v3
- if: steps.verify-android-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-android-changed-files.outputs.any_changed == 'true'
with:
node-version: '16'
- name: Set up JDK
uses: actions/setup-java@v3
- if: steps.verify-android-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-android-changed-files.outputs.any_changed == 'true'
with:
distribution: 'zulu'
java-version: 11
- name: Instrumentation Tests
uses: reactivecircus/android-emulator-runner@v2
- if: steps.verify-android-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-android-changed-files.outputs.any_changed == 'true'
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
@@ -221,7 +221,7 @@ jobs:
- name: Upload Reports
uses: actions/upload-artifact@v3
- if: steps.verify-android-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-android-changed-files.outputs.any_changed == 'true'
with:
name: Test-Reports
path: ${{ github.workspace }}/example/android/app/build/reports
@@ -238,7 +238,7 @@ jobs:
uses: actions/checkout@v4
- name: Verify iOS Changed files
- uses: tj-actions/verify-changed-files@v16.1.1
+ uses: tj-actions/changed-files@v40
id: verify-iOS-changed-files
with:
files: |
@@ -251,7 +251,7 @@ jobs:
- uses: actions/cache@v3
name: Cache node_modules
id: cache-node-modules
- if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-iOS-changed-files.outputs.any_changed == 'true'
with:
path: |
node_modules
@@ -262,47 +262,47 @@ jobs:
- name: Cache Pods
id: cache-pods
uses: actions/cache@v3
- if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-iOS-changed-files.outputs.any_changed == 'true'
with:
path: example/ios/Pods
key: ${{ runner.os }}-pods-${{ matrix.cocoapods }}-${{ hashFiles('**/Podfile.lock') }}
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-iOS-changed-files.outputs.any_changed == 'true'
with:
ruby-version: 2.7
bundler-cache: true
- name: Install Cocoapods
- if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-iOS-changed-files.outputs.any_changed == 'true'
run: gem install cocoapods -v ${{ matrix.cocoapods }}
- name: Setup node 16
- if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-iOS-changed-files.outputs.any_changed == 'true'
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install Pods
- if: steps.cache-pods.outputs.cache-hit != 'true' && steps.verify-iOS-changed-files.outputs.files_changed == 'true'
+ if: steps.cache-pods.outputs.cache-hit != 'true' && steps.verify-iOS-changed-files.outputs.any_changed == 'true'
run: |
cd example/ios
pod cache clean --all
pod install
- name: Install xcpretty
- if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-iOS-changed-files.outputs.any_changed == 'true'
run: gem install xcpretty
- name: Build
- if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-iOS-changed-files.outputs.any_changed == 'true'
run: |
cd example/ios
xcodebuild -workspace ImageMarkerExample.xcworkspace -scheme ImageMarkerExample -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 12' | xcpretty
- name: Test
- if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
+ if: steps.verify-iOS-changed-files.outputs.any_changed == 'true'
run: |
cd example/ios
xcodebuild -workspace ImageMarkerExample.xcworkspace -scheme ImageMarkerExample -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 12' test | xcpretty
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c33409fd..a93dd26a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,14 @@
+## [1.1.11](https://github.com/JimmyDaddy/react-native-image-marker/compare/v1.1.8...v1.1.11) (2023-12-21)
+
+
+### Bug Fixes
+
+* fix [#158](https://github.com/JimmyDaddy/react-native-image-marker/issues/158) android release bug style not working ([#160](https://github.com/JimmyDaddy/react-native-image-marker/issues/160)) ([a942e30](https://github.com/JimmyDaddy/react-native-image-marker/commit/a942e30732c61094abc1e95ca5003c883d1e4410))
+* fix [#164](https://github.com/JimmyDaddy/react-native-image-marker/issues/164) Build Failure on CI Due to CocoaPods 1.1.9 in iOS Project ([#165](https://github.com/JimmyDaddy/react-native-image-marker/issues/165)) ([532e8a4](https://github.com/JimmyDaddy/react-native-image-marker/commit/532e8a4d325fd1c30315eac0f1ab81fbf81c144f))
+* fix [#179](https://github.com/JimmyDaddy/react-native-image-marker/issues/179) Same watermark image is behaving differently on ANDROID and IOS ([a269510](https://github.com/JimmyDaddy/react-native-image-marker/commit/a269510ad8887bb5466493ce304714d01f067c6a))
+
## [1.1.10](https://github.com/JimmyDaddy/react-native-image-marker/compare/v1.1.8...v1.1.10) (2023-11-29)
diff --git a/README.MD b/README.MD
index 4388efcf..0339623d 100644
--- a/README.MD
+++ b/README.MD
@@ -7,13 +7,13 @@
- [![npm version](https://img.shields.io/npm/v/react-native-image-marker.svg?logo=npm)](https://www.npmjs.com/package/react-native-image-marker)
- [![npm](https://img.shields.io/npm/dm/react-native-image-marker?logo=npm)](https://www.npmjs.com/package/react-native-image-marker) [![npm](https://img.shields.io/npm/dt/react-native-image-marker.svg?cacheSeconds=88660&logo=npm&label=total%20downloads)](https://www.npmjs.com/package/react-native-image-marker)
- [![stars](https://img.shields.io/github/stars/jimmydaddy/react-native-image-marker?style=social)](https://github.com/JimmyDaddy/react-native-image-marker) [![forks](https://img.shields.io/github/forks/jimmydaddy/react-native-image-marker?style=social)](https://github.com/JimmyDaddy/react-native-image-marker/fork)
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?logo=github)](https://github.com/JimmyDaddy/react-native-image-marker/pulls) ![license](https://img.shields.io/npm/l/react-native-image-marker)
- [![github](https://img.shields.io/badge/github-repo-blue?logo=github)](https://github.com/JimmyDaddy/react-native-image-marker)
- [![Native Build and Test](https://github.com/JimmyDaddy/react-native-image-marker/actions/workflows/native-ci.yml/badge.svg)](https://github.com/JimmyDaddy/react-native-image-marker/actions/workflows/native-ci.yml)
- ![platform-iOS](https://img.shields.io/badge/iOS-black?logo=Apple) ![platform-Android](https://img.shields.io/badge/Android-black?logo=Android)
+ [![npm version](https://img.shields.io/npm/v/react-native-image-marker.svg?logo=npm&style=for-the-badge&label=latest)](https://www.npmjs.com/package/react-native-image-marker)
+ [![npm](https://img.shields.io/npm/dm/react-native-image-marker?logo=npm&style=for-the-badge)](https://www.npmjs.com/package/react-native-image-marker) [![npm](https://img.shields.io/npm/dt/react-native-image-marker.svg?cacheSeconds=88660&logo=npm&label=total%20downloads&style=for-the-badge)](https://www.npmjs.com/package/react-native-image-marker)
+ [![stars](https://img.shields.io/github/stars/jimmydaddy/react-native-image-marker?logo=github&style=for-the-badge)](https://github.com/JimmyDaddy/react-native-image-marker) [![forks](https://img.shields.io/github/forks/jimmydaddy/react-native-image-marker?logo=github&style=for-the-badge)](https://github.com/JimmyDaddy/react-native-image-marker/fork)
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?logo=github&style=for-the-badge)](https://github.com/JimmyDaddy/react-native-image-marker/pulls) ![license](https://img.shields.io/npm/l/react-native-image-marker?style=for-the-badge)
+ [![github](https://img.shields.io/badge/github-repo-blue?logo=github&style=for-the-badge)](https://github.com/JimmyDaddy/react-native-image-marker)
+ [![CI](https://github.com/JimmyDaddy/react-native-image-marker/actions/workflows/ci.yml/badge.svg)](https://github.com/JimmyDaddy/react-native-image-marker/actions/workflows/ci.yml)
+ ![platform-iOS](https://img.shields.io/badge/iOS-black?logo=Apple&style=for-the-badge) ![platform-Android](https://img.shields.io/badge/Android-black?logo=Android&style=for-the-badge)
diff --git a/android/src/main/java/com/jimmydaddy/imagemarker/base/WatermarkImageOptions.kt b/android/src/main/java/com/jimmydaddy/imagemarker/base/WatermarkImageOptions.kt
index 2f07c275..430c4697 100644
--- a/android/src/main/java/com/jimmydaddy/imagemarker/base/WatermarkImageOptions.kt
+++ b/android/src/main/java/com/jimmydaddy/imagemarker/base/WatermarkImageOptions.kt
@@ -3,21 +3,23 @@ package com.jimmydaddy.imagemarker.base
import com.facebook.react.bridge.ReadableMap
data class WatermarkImageOptions(val options: ReadableMap?) {
- var imageOption: ImageOptions
- var x: String?
- var y: String?
- var positionEnum: PositionEnum?
+ lateinit var imageOption: ImageOptions
+ var x: String? = null
+ var y: String? = null
+ var positionEnum: PositionEnum? = null
init {
- imageOption = options?.let { ImageOptions(it) }!!
- val positionOptions =
- if (null != options.getMap("position")) options.getMap("position") else null
- x = if (positionOptions!!.hasKey("X")) Utils.handleDynamicToString(positionOptions.getDynamic("X")) else null
- y = if (positionOptions.hasKey("Y")) Utils.handleDynamicToString(positionOptions.getDynamic("Y")) else null
- positionEnum =
- if (null != positionOptions.getString("position")) PositionEnum.getPosition(
- positionOptions.getString("position")
- ) else null
+ if (options != null) {
+ imageOption = options?.let { ImageOptions(it) }!!
+ val positionOptions =
+ if (null != options.getMap("position")) options.getMap("position") else null
+ x = if (positionOptions!!.hasKey("X")) Utils.handleDynamicToString(positionOptions.getDynamic("X")) else null
+ y = if (positionOptions.hasKey("Y")) Utils.handleDynamicToString(positionOptions.getDynamic("Y")) else null
+ positionEnum =
+ if (null != positionOptions.getString("position")) PositionEnum.getPosition(
+ positionOptions.getString("position")
+ ) else null
+ }
}
constructor(watermarkImage: ImageOptions, x: String?, y: String?, position: PositionEnum?) : this(null) {
diff --git a/example/ios/ImageMarkerExample.xcodeproj/project.pbxproj b/example/ios/ImageMarkerExample.xcodeproj/project.pbxproj
index 5e8641c0..f3f815b1 100644
--- a/example/ios/ImageMarkerExample.xcodeproj/project.pbxproj
+++ b/example/ios/ImageMarkerExample.xcodeproj/project.pbxproj
@@ -11,6 +11,7 @@
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
+ 552FE0025890E32E99AF119A /* libPods-ImageMarkerExample-ImageMarkerExampleUITests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 744A2F230C283E0D140F997B /* libPods-ImageMarkerExample-ImageMarkerExampleUITests.a */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
A119E9E12B162437000C0527 /* ImageMarkerExampleUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A119E9E02B162437000C0527 /* ImageMarkerExampleUITests.swift */; };
A119E9E32B162437000C0527 /* ImageMarkerExampleUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A119E9E22B162437000C0527 /* ImageMarkerExampleUITestsLaunchTests.swift */; };
@@ -33,9 +34,12 @@
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ImageMarkerExample/Images.xcassets; sourceTree = ""; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ImageMarkerExample/Info.plist; sourceTree = ""; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = ImageMarkerExample/main.m; sourceTree = ""; };
+ 26EC0163490429FD1EA48765 /* Pods-ImageMarkerExample-ImageMarkerExampleUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ImageMarkerExample-ImageMarkerExampleUITests.release.xcconfig"; path = "Target Support Files/Pods-ImageMarkerExample-ImageMarkerExampleUITests/Pods-ImageMarkerExample-ImageMarkerExampleUITests.release.xcconfig"; sourceTree = ""; };
3B4392A12AC88292D35C810B /* Pods-ImageMarkerExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ImageMarkerExample.debug.xcconfig"; path = "Target Support Files/Pods-ImageMarkerExample/Pods-ImageMarkerExample.debug.xcconfig"; sourceTree = ""; };
5709B34CF0A7D63546082F79 /* Pods-ImageMarkerExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ImageMarkerExample.release.xcconfig"; path = "Target Support Files/Pods-ImageMarkerExample/Pods-ImageMarkerExample.release.xcconfig"; sourceTree = ""; };
+ 5AF9B3B6D62946E1E270EDB8 /* Pods-ImageMarkerExample-ImageMarkerExampleUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ImageMarkerExample-ImageMarkerExampleUITests.debug.xcconfig"; path = "Target Support Files/Pods-ImageMarkerExample-ImageMarkerExampleUITests/Pods-ImageMarkerExample-ImageMarkerExampleUITests.debug.xcconfig"; sourceTree = ""; };
5DCACB8F33CDC322A6C60F78 /* libPods-ImageMarkerExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ImageMarkerExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 744A2F230C283E0D140F997B /* libPods-ImageMarkerExample-ImageMarkerExampleUITests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ImageMarkerExample-ImageMarkerExampleUITests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = ImageMarkerExample/LaunchScreen.storyboard; sourceTree = ""; };
A119E9DE2B162437000C0527 /* ImageMarkerExampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ImageMarkerExampleUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
A119E9E02B162437000C0527 /* ImageMarkerExampleUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageMarkerExampleUITests.swift; sourceTree = ""; };
@@ -56,6 +60,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 552FE0025890E32E99AF119A /* libPods-ImageMarkerExample-ImageMarkerExampleUITests.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -80,7 +85,7 @@
children = (
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
5DCACB8F33CDC322A6C60F78 /* libPods-ImageMarkerExample.a */,
- 19F6CBCC0A4E27FBF8BF4A61 /* libPods-ImageMarkerExample-ImageMarkerExampleUITests.a */,
+ 744A2F230C283E0D140F997B /* libPods-ImageMarkerExample-ImageMarkerExampleUITests.a */,
);
name = Frameworks;
sourceTree = "";
@@ -130,8 +135,8 @@
children = (
3B4392A12AC88292D35C810B /* Pods-ImageMarkerExample.debug.xcconfig */,
5709B34CF0A7D63546082F79 /* Pods-ImageMarkerExample.release.xcconfig */,
- 5B7EB9410499542E8C5724F5 /* Pods-ImageMarkerExample-ImageMarkerExampleUITests.debug.xcconfig */,
- 89C6BE57DB24E9ADA2F236DE /* Pods-ImageMarkerExample-ImageMarkerExampleUITests.release.xcconfig */,
+ 5AF9B3B6D62946E1E270EDB8 /* Pods-ImageMarkerExample-ImageMarkerExampleUITests.debug.xcconfig */,
+ 26EC0163490429FD1EA48765 /* Pods-ImageMarkerExample-ImageMarkerExampleUITests.release.xcconfig */,
);
path = Pods;
sourceTree = "";
@@ -165,9 +170,12 @@
isa = PBXNativeTarget;
buildConfigurationList = A119E9E62B162437000C0527 /* Build configuration list for PBXNativeTarget "ImageMarkerExampleUITests" */;
buildPhases = (
+ EBC9A7F715DF26D017D78006 /* [CP] Check Pods Manifest.lock */,
A119E9DA2B162437000C0527 /* Sources */,
A119E9DB2B162437000C0527 /* Frameworks */,
A119E9DC2B162437000C0527 /* Resources */,
+ ACF99CEFF8F89F281A68F64E /* [CP] Embed Pods Frameworks */,
+ 00D2AD9DAE49776B6A95E7C2 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
@@ -236,6 +244,23 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
+ 00D2AD9DAE49776B6A95E7C2 /* [CP] Copy Pods Resources */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-ImageMarkerExample-ImageMarkerExampleUITests/Pods-ImageMarkerExample-ImageMarkerExampleUITests-resources-${CONFIGURATION}-input-files.xcfilelist",
+ );
+ name = "[CP] Copy Pods Resources";
+ outputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-ImageMarkerExample-ImageMarkerExampleUITests/Pods-ImageMarkerExample-ImageMarkerExampleUITests-resources-${CONFIGURATION}-output-files.xcfilelist",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ImageMarkerExample-ImageMarkerExampleUITests/Pods-ImageMarkerExample-ImageMarkerExampleUITests-resources.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -269,6 +294,23 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ImageMarkerExample/Pods-ImageMarkerExample-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
+ ACF99CEFF8F89F281A68F64E /* [CP] Embed Pods Frameworks */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-ImageMarkerExample-ImageMarkerExampleUITests/Pods-ImageMarkerExample-ImageMarkerExampleUITests-frameworks-${CONFIGURATION}-input-files.xcfilelist",
+ );
+ name = "[CP] Embed Pods Frameworks";
+ outputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-ImageMarkerExample-ImageMarkerExampleUITests/Pods-ImageMarkerExample-ImageMarkerExampleUITests-frameworks-${CONFIGURATION}-output-files.xcfilelist",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ImageMarkerExample-ImageMarkerExampleUITests/Pods-ImageMarkerExample-ImageMarkerExampleUITests-frameworks.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -308,6 +350,28 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ImageMarkerExample/Pods-ImageMarkerExample-resources.sh\"\n";
showEnvVarsInLog = 0;
};
+ EBC9A7F715DF26D017D78006 /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-ImageMarkerExample-ImageMarkerExampleUITests-checkManifestLockResult.txt",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
+ showEnvVarsInLog = 0;
+ };
FD10A7F022414F080027D42C /* Start Packager */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@@ -550,6 +614,7 @@
};
A119E9E72B162437000C0527 /* Debug */ = {
isa = XCBuildConfiguration;
+ baseConfigurationReference = 5AF9B3B6D62946E1E270EDB8 /* Pods-ImageMarkerExample-ImageMarkerExampleUITests.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
@@ -582,6 +647,7 @@
};
A119E9E82B162437000C0527 /* Release */ = {
isa = XCBuildConfiguration;
+ baseConfigurationReference = 26EC0163490429FD1EA48765 /* Pods-ImageMarkerExample-ImageMarkerExampleUITests.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock
index 64d95e8a..c19eac21 100644
--- a/example/ios/Podfile.lock
+++ b/example/ios/Podfile.lock
@@ -329,11 +329,11 @@ PODS:
- React-jsinspector (0.71.11)
- React-logger (0.71.11):
- glog
- - react-native-blob-util (0.19.2):
+ - react-native-blob-util (0.19.6):
- React-Core
- - react-native-image-marker (1.1.8):
+ - react-native-image-marker (1.1.10):
- React-Core
- - react-native-image-picker (5.6.1):
+ - react-native-image-picker (5.7.0):
- React-Core
- React-perflogger (0.71.11)
- React-RCTActionSheet (0.71.11):
@@ -616,9 +616,9 @@ SPEC CHECKSUMS:
React-jsiexecutor: 18b5b33c5f2687a784a61bc8176611b73524ae77
React-jsinspector: b6ed4cb3ffa27a041cd440300503dc512b761450
React-logger: 186dd536128ae5924bc38ed70932c00aa740cd5b
- react-native-blob-util: c74e4ce87c76d244761c68623df78bf0d1638271
- react-native-image-marker: c30f34263f1868b8bdac7ad770be6fb6c6ce9f86
- react-native-image-picker: 5fcac5a5ffcb3737837f0617d43fd767249290de
+ react-native-blob-util: d8fa1a7f726867907a8e43163fdd8b441d4489ea
+ react-native-image-marker: 4414050c15944297bc24b3a37a1070d951fb57a2
+ react-native-image-picker: 3269f75c251cdcd61ab51b911dd30d6fff8c6169
React-perflogger: e706562ab7eb8eb590aa83a224d26fa13963d7f2
React-RCTActionSheet: 57d4bd98122f557479a3359ad5dad8e109e20c5a
React-RCTAnimation: ccf3ef00101ea74bda73a045d79a658b36728a60
@@ -636,6 +636,6 @@ SPEC CHECKSUMS:
Yoga: f7decafdc5e8c125e6fa0da38a687e35238420fa
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
-PODFILE CHECKSUM: 20401a73c6b88dc06e028faa4ab5ae1c07ac8fa7
+PODFILE CHECKSUM: 4420d5a35a7e9d1bc71140c63c7e29db0be4fdf7
COCOAPODS: 1.12.1
diff --git a/ios/RCTImageMarker/ImageMarker.swift b/ios/RCTImageMarker/ImageMarker.swift
index 2605aac4..0e603376 100644
--- a/ios/RCTImageMarker/ImageMarker.swift
+++ b/ios/RCTImageMarker/ImageMarker.swift
@@ -35,7 +35,13 @@ public final class ImageMarker: NSObject, RCTBridgeModule {
}
} else {
let request = RCTConvert.nsurlRequest(img.src)
- imageLoader.loadImage(with: request!) { error, loadedImage in
+ imageLoader.loadImage(with: request!, size: CGSizeMake(img.rnSrc.width, img.rnSrc.height), scale: img.rnSrc.scale, clipped: false, resizeMode: RCTResizeMode.cover) { progress, total in
+ print("Loading image: \(img.uri) progress: \(progress) total\(total)")
+ } partialLoad: { loadedImage in
+ //
+ } completionBlock: { error, loadedImage in
+ print("Loaded image: ", img.uri)
+
if let loadedImage = loadedImage {
continuation.resume(returning: (index, loadedImage))
} else if let error = error {
@@ -45,6 +51,17 @@ public final class ImageMarker: NSObject, RCTBridgeModule {
continuation.resume(throwing: error)
}
}
+
+// imageLoader.loadImage(with: request!) { error, loadedImage in
+// if let loadedImage = loadedImage {
+// continuation.resume(returning: (index, loadedImage))
+// } else if let error = error {
+// continuation.resume(throwing: error)
+// } else {
+// let error = NSError(domain: ErrorDomainEnum.BASE.rawValue, code: 3, userInfo: [NSLocalizedDescriptionKey: "Failed to load image"])
+// continuation.resume(throwing: error)
+// }
+// }
}
}
}
@@ -102,13 +119,9 @@ public final class ImageMarker: NSObject, RCTBridgeModule {
func markerImgWithText(_ image: UIImage, _ opts: MarkTextOptions) -> UIImage? {
var bg = image;
- if (opts.backgroundImage.scale > 0) {
- bg = UIImage(cgImage: image.cgImage!, scale: 1 / opts.backgroundImage.scale, orientation: image.imageOrientation)
- }
-
let w = bg.size.width
let h = bg.size.height
- UIGraphicsBeginImageContextWithOptions(bg.size, false, 1 / opts.backgroundImage.scale)
+ UIGraphicsBeginImageContextWithOptions(bg.size, false, opts.backgroundImage.scale)
guard let context = UIGraphicsGetCurrentContext() else {
return nil
@@ -261,20 +274,16 @@ public final class ImageMarker: NSObject, RCTBridgeModule {
func markeImage(with image: UIImage, waterImages: [UIImage], options: MarkImageOptions) -> UIImage? {
var bg = image;
- if (options.backgroundImage.scale > 0) {
- bg = UIImage(cgImage: image.cgImage!, scale: 1 / options.backgroundImage.scale, orientation: image.imageOrientation)
- }
-
let w = bg.size.width
let h = bg.size.height
- UIGraphicsBeginImageContextWithOptions(bg.size, false, 1 / options.backgroundImage.scale)
+ UIGraphicsBeginImageContextWithOptions(bg.size, false, options.backgroundImage.scale)
let canvasRect = CGRect(x: 0, y: 0, width: CGFloat(w), height: CGFloat(h))
let transform = CGAffineTransform(translationX: 0, y: canvasRect.height)
.scaledBy(x: 1, y: -1)
var context: CGContext?
if options.backgroundImage.alpha != 1.0 {
- UIGraphicsBeginImageContextWithOptions(image.size, false, 0)
+ UIGraphicsBeginImageContextWithOptions(image.size, false, options.backgroundImage.scale)
context = UIGraphicsGetCurrentContext()
context?.saveGState()
context?.concatenate(transform)
@@ -302,10 +311,11 @@ public final class ImageMarker: NSObject, RCTBridgeModule {
if (options.backgroundImage.scale > 0) {
markerImg = UIImage(cgImage: waterImage.cgImage!, scale: 1 / watermarkOptions.imageOption.scale, orientation: waterImage.imageOrientation)
}
+
let ww = markerImg.size.width
let wh = markerImg.size.height
- let diagonal = sqrt(pow(ww, 2) + pow(ww, 2)) // 计算对角线长度
+ let diagonal = sqrt(pow(ww, 2) + pow(wh, 2)) // 计算对角线长度
let size = CGSize(width: CGFloat(diagonal), height: CGFloat(diagonal))
var rect: CGRect
if watermarkOptions.position != .none {
@@ -331,7 +341,7 @@ public final class ImageMarker: NSObject, RCTBridgeModule {
rect = CGRect(x: Utils.parseSpreadValue(v: watermarkOptions.X, relativeTo: w) ?? 20, y: Utils.parseSpreadValue(v: watermarkOptions.Y, relativeTo: h) ?? 20, width: CGFloat(ww), height: CGFloat(wh))
}
- UIGraphicsBeginImageContextWithOptions(CGSize(width: diagonal, height: diagonal), false, watermarkOptions.imageOption.scale)
+ UIGraphicsBeginImageContextWithOptions(CGSize(width: diagonal, height: diagonal), false, 1)
let markerContext = UIGraphicsGetCurrentContext()
markerContext?.saveGState()
@@ -350,6 +360,14 @@ public final class ImageMarker: NSObject, RCTBridgeModule {
markerContext?.restoreGState()
let waterImageRes = UIGraphicsGetImageFromCurrentImageContext()!
+// if watermarkOptions.imageOption.scale > 0 {
+// rect = CGRect(
+// x: rect.origin.x,
+// y: rect.origin.y,
+// width: rect.size.width * watermarkOptions.imageOption.scale,
+// height: rect.size.height * watermarkOptions.imageOption.scale
+// )
+// }
context?.draw(waterImageRes.cgImage!, in: rect)
UIGraphicsEndImageContext()
context?.restoreGState()
diff --git a/ios/RCTImageMarker/ImageOptions.swift b/ios/RCTImageMarker/ImageOptions.swift
index 3b8a5153..fa379d45 100644
--- a/ios/RCTImageMarker/ImageOptions.swift
+++ b/ios/RCTImageMarker/ImageOptions.swift
@@ -14,12 +14,14 @@ class ImageOptions: NSObject {
var scale: CGFloat = 1.0
var rotate: CGFloat = 0
var alpha: CGFloat = 1.0
+ var rnSrc: RNImageSRC
init(dicOpts opts: [AnyHashable: Any]) throws {
guard let src = opts["src"] as? [AnyHashable: Any], !Utils.isNULL(src) else {
throw NSError(domain: ErrorDomainEnum.PARAMS_REQUIRED.rawValue, code: 0, userInfo: [NSLocalizedDescriptionKey: "image is required"])
}
self.src = src
+ self.rnSrc = RNImageSRC(dicOpts: src)
self.uri = src["uri"] as! String
self.scale = opts["scale"] as? CGFloat ?? 1.0
self.rotate = opts["rotate"] as? CGFloat ?? 0
diff --git a/ios/RCTImageMarker/RNImageSRC.swift b/ios/RCTImageMarker/RNImageSRC.swift
new file mode 100644
index 00000000..221ba116
--- /dev/null
+++ b/ios/RCTImageMarker/RNImageSRC.swift
@@ -0,0 +1,22 @@
+//
+// RNImageSRC.swift
+// react-native-image-marker
+//
+// Created by Jimmydaddy on 2023/12/21.
+//
+
+import Foundation
+
+struct RNImageSRC {
+ var width: CGFloat = 0
+ var height: CGFloat = 0
+ var scale: CGFloat = 1
+ var uri: String = ""
+
+ init(dicOpts opts: [AnyHashable: Any]?) {
+ width = opts?["width"] as? CGFloat ?? 0
+ height = opts?["height"] as? CGFloat ?? 0
+ scale = opts?["scale"] as? CGFloat ?? 1
+ uri = opts?["uri"] as? String ?? ""
+ }
+}
diff --git a/package.json b/package.json
index 52c51a8f..381882b2 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "react-native-image-marker",
- "version": "1.1.10",
+ "version": "1.1.11",
"description": "Add text or icon watermark to your images",
"main": "lib/commonjs/index",
"module": "lib/module/index",
@@ -93,7 +93,6 @@
"engines": {
"node": ">= 16.0.0"
},
- "packageManager": "^yarn@1.22.15",
"jest": {
"preset": "react-native",
"modulePathIgnorePatterns": [