Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix #179 Same watermark image is behaving differently on ANDROID and iOS #180

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -25,28 +25,28 @@ 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
example/node_modules
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
Expand All @@ -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: |
Expand All @@ -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: |
Expand All @@ -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
Expand All @@ -98,46 +98,46 @@ 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
./gradlew assembleRelease
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
Expand All @@ -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: |
Expand All @@ -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: |
Expand All @@ -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: |
Expand All @@ -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 }}
Expand All @@ -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
Expand All @@ -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: |
Expand All @@ -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
Expand All @@ -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
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
14 changes: 7 additions & 7 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
</div>
<div align="center">

[![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)
<br/>

</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading
Loading