Skip to content

Commit 10d71e1

Browse files
authored
fix: fix #179 Same watermark image is behaving differently on ANDROID and iOS (#180)
* fix: fix #179 Same watermark image is behaving differently on ANDROID and IOS * ci: update gh action use changed-files * docs: update readme * chore: release 1.1.11 --------- Co-authored-by: JimmyDaddy <[email protected]>
1 parent 9c673c2 commit 10d71e1

File tree

10 files changed

+197
-79
lines changed

10 files changed

+197
-79
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
uses: actions/checkout@v4
1515

1616
- name: Verify Dev Changed files
17-
uses: tj-actions/verify-changed-files@v16.1.1
17+
uses: tj-actions/changed-files@v40
1818
id: verify-dev-changed-files
1919
with:
2020
files: |
@@ -25,28 +25,28 @@ jobs:
2525
- uses: actions/cache@v3
2626
name: Cache node_modules
2727
id: cache-node-modules
28-
if: steps.verify-dev-changed-files.outputs.files_changed == 'true'
28+
if: steps.verify-dev-changed-files.outputs.any_changed == 'true'
2929
with:
3030
path: |
3131
node_modules
3232
example/node_modules
3333
key: ${{ runner.os }}-nodeModules-${{ hashFiles('package.json') }}-${{ hashFiles('example/package.json') }}
3434

3535
- name: Set up Ruby
36-
if: steps.verify-dev-changed-files.outputs.files_changed == 'true'
36+
if: steps.verify-dev-changed-files.outputs.any_changed == 'true'
3737
uses: ruby/setup-ruby@v1
3838
with:
3939
ruby-version: 2.7
4040
bundler-cache: true
4141

4242
- name: Setup node 16
43-
if: steps.verify-dev-changed-files.outputs.files_changed == 'true'
43+
if: steps.verify-dev-changed-files.outputs.any_changed == 'true'
4444
uses: actions/setup-node@v3
4545
with:
4646
node-version: '16'
4747

4848
- name: Install npm dependencies
49-
if: steps.cache-node-modules.outputs.cache-hit != 'true' && steps.verify-dev-changed-files.outputs.files_changed == 'true'
49+
if: steps.cache-node-modules.outputs.cache-hit != 'true' && steps.verify-dev-changed-files.outputs.any_changed == 'true'
5050
run: |
5151
ls
5252
pwd
@@ -65,7 +65,7 @@ jobs:
6565
uses: actions/checkout@v4
6666

6767
- name: Verify Android Changed files
68-
uses: tj-actions/verify-changed-files@v16.1.1
68+
uses: tj-actions/changed-files@v40
6969
id: verify-android-changed-files
7070
with:
7171
files: |
@@ -77,7 +77,7 @@ jobs:
7777
7878
- uses: actions/cache@v3
7979
name: Cache node_modules
80-
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
80+
if: steps.verify-android-changed-files.outputs.any_changed == 'true'
8181
id: cache-node-modules
8282
with:
8383
path: |
@@ -89,7 +89,7 @@ jobs:
8989
- uses: actions/cache@v3
9090
id: cache-gradle
9191
name: Cache Gradle dependencies
92-
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
92+
if: steps.verify-android-changed-files.outputs.any_changed == 'true'
9393
with:
9494
path: |
9595
~/.gradle/caches
@@ -98,46 +98,46 @@ jobs:
9898

9999
- name: Set up Ruby
100100
uses: ruby/setup-ruby@v1
101-
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
101+
if: steps.verify-android-changed-files.outputs.any_changed == 'true'
102102
with:
103103
ruby-version: 2.7
104104
bundler-cache: true
105105

106106
- name: Setup node 16
107107
uses: actions/setup-node@v3
108-
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
108+
if: steps.verify-android-changed-files.outputs.any_changed == 'true'
109109
with:
110110
node-version: '16'
111111

112112
- name: Set up JDK
113113
uses: actions/setup-java@v3
114-
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
114+
if: steps.verify-android-changed-files.outputs.any_changed == 'true'
115115
with:
116116
distribution: 'zulu'
117117
java-version: 11
118118

119119
- name: Install Gradle dependencies
120-
if: steps.cache-gradle.outputs.cache-hit != 'true' && steps.verify-android-changed-files.outputs.files_changed == 'true'
120+
if: steps.cache-gradle.outputs.cache-hit != 'true' && steps.verify-android-changed-files.outputs.any_changed == 'true'
121121
run: |
122122
cd example/android
123123
./gradlew build --stacktrace
124124
125125
- name: Run unit tests
126-
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
126+
if: steps.verify-android-changed-files.outputs.any_changed == 'true'
127127
run: |
128128
cd example/android
129129
./gradlew test --stacktrace
130130
131131
- name: Build APK
132-
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
132+
if: steps.verify-android-changed-files.outputs.any_changed == 'true'
133133
run: |
134134
npm run prepack
135135
cd example/android
136136
./gradlew assembleRelease
137137
mv app/build/outputs/apk/release/app-release.apk app-release-${{ github.sha }}.apk
138138
139139
- name: Upload APK
140-
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
140+
if: steps.verify-android-changed-files.outputs.any_changed == 'true'
141141
uses: actions/upload-artifact@v3
142142
with:
143143
name: app-release-${{ github.sha }}.apk
@@ -156,7 +156,7 @@ jobs:
156156
uses: actions/checkout@v4
157157

158158
- name: Verify Android Changed files
159-
uses: tj-actions/verify-changed-files@v16.1.1
159+
uses: tj-actions/changed-files@v40
160160
id: verify-android-changed-files
161161
with:
162162
files: |
@@ -168,7 +168,7 @@ jobs:
168168
169169
- uses: actions/cache@v3
170170
name: Cache node_modules
171-
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
171+
if: steps.verify-android-changed-files.outputs.any_changed == 'true'
172172
id: cache-node-modules
173173
with:
174174
path: |
@@ -179,7 +179,7 @@ jobs:
179179

180180
- uses: actions/cache@v3
181181
name: Cache Gradle dependencies
182-
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
182+
if: steps.verify-android-changed-files.outputs.any_changed == 'true'
183183
id: cache-gradle
184184
with:
185185
path: |
@@ -190,27 +190,27 @@ jobs:
190190

191191
- name: Set up Ruby
192192
uses: ruby/setup-ruby@v1
193-
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
193+
if: steps.verify-android-changed-files.outputs.any_changed == 'true'
194194
with:
195195
ruby-version: 2.7
196196
bundler-cache: true
197197

198198
- name: Setup node 16
199199
uses: actions/setup-node@v3
200-
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
200+
if: steps.verify-android-changed-files.outputs.any_changed == 'true'
201201
with:
202202
node-version: '16'
203203

204204
- name: Set up JDK
205205
uses: actions/setup-java@v3
206-
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
206+
if: steps.verify-android-changed-files.outputs.any_changed == 'true'
207207
with:
208208
distribution: 'zulu'
209209
java-version: 11
210210

211211
- name: Instrumentation Tests
212212
uses: reactivecircus/android-emulator-runner@v2
213-
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
213+
if: steps.verify-android-changed-files.outputs.any_changed == 'true'
214214
with:
215215
api-level: ${{ matrix.api-level }}
216216
target: ${{ matrix.target }}
@@ -221,7 +221,7 @@ jobs:
221221
222222
- name: Upload Reports
223223
uses: actions/upload-artifact@v3
224-
if: steps.verify-android-changed-files.outputs.files_changed == 'true'
224+
if: steps.verify-android-changed-files.outputs.any_changed == 'true'
225225
with:
226226
name: Test-Reports
227227
path: ${{ github.workspace }}/example/android/app/build/reports
@@ -238,7 +238,7 @@ jobs:
238238
uses: actions/checkout@v4
239239

240240
- name: Verify iOS Changed files
241-
uses: tj-actions/verify-changed-files@v16.1.1
241+
uses: tj-actions/changed-files@v40
242242
id: verify-iOS-changed-files
243243
with:
244244
files: |
@@ -251,7 +251,7 @@ jobs:
251251
- uses: actions/cache@v3
252252
name: Cache node_modules
253253
id: cache-node-modules
254-
if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
254+
if: steps.verify-iOS-changed-files.outputs.any_changed == 'true'
255255
with:
256256
path: |
257257
node_modules
@@ -262,47 +262,47 @@ jobs:
262262
- name: Cache Pods
263263
id: cache-pods
264264
uses: actions/cache@v3
265-
if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
265+
if: steps.verify-iOS-changed-files.outputs.any_changed == 'true'
266266
with:
267267
path: example/ios/Pods
268268
key: ${{ runner.os }}-pods-${{ matrix.cocoapods }}-${{ hashFiles('**/Podfile.lock') }}
269269

270270
- name: Set up Ruby
271271
uses: ruby/setup-ruby@v1
272-
if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
272+
if: steps.verify-iOS-changed-files.outputs.any_changed == 'true'
273273
with:
274274
ruby-version: 2.7
275275
bundler-cache: true
276276

277277
- name: Install Cocoapods
278-
if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
278+
if: steps.verify-iOS-changed-files.outputs.any_changed == 'true'
279279
run: gem install cocoapods -v ${{ matrix.cocoapods }}
280280

281281
- name: Setup node 16
282-
if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
282+
if: steps.verify-iOS-changed-files.outputs.any_changed == 'true'
283283
uses: actions/setup-node@v3
284284
with:
285285
node-version: '16'
286286

287287
- name: Install Pods
288-
if: steps.cache-pods.outputs.cache-hit != 'true' && steps.verify-iOS-changed-files.outputs.files_changed == 'true'
288+
if: steps.cache-pods.outputs.cache-hit != 'true' && steps.verify-iOS-changed-files.outputs.any_changed == 'true'
289289
run: |
290290
cd example/ios
291291
pod cache clean --all
292292
pod install
293293
294294
- name: Install xcpretty
295-
if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
295+
if: steps.verify-iOS-changed-files.outputs.any_changed == 'true'
296296
run: gem install xcpretty
297297

298298
- name: Build
299-
if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
299+
if: steps.verify-iOS-changed-files.outputs.any_changed == 'true'
300300
run: |
301301
cd example/ios
302302
xcodebuild -workspace ImageMarkerExample.xcworkspace -scheme ImageMarkerExample -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 12' | xcpretty
303303
304304
- name: Test
305-
if: steps.verify-iOS-changed-files.outputs.files_changed == 'true'
305+
if: steps.verify-iOS-changed-files.outputs.any_changed == 'true'
306306
run: |
307307
cd example/ios
308308
xcodebuild -workspace ImageMarkerExample.xcworkspace -scheme ImageMarkerExample -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 12' test | xcpretty

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11

22

3+
## [1.1.11](https://github.com/JimmyDaddy/react-native-image-marker/compare/v1.1.8...v1.1.11) (2023-12-21)
4+
5+
6+
### Bug Fixes
7+
8+
* 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))
9+
* 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))
10+
* 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))
11+
312
## [1.1.10](https://github.com/JimmyDaddy/react-native-image-marker/compare/v1.1.8...v1.1.10) (2023-11-29)
413

514

README.MD

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
</div>
88
<div align="center">
99

10-
[![npm version](https://img.shields.io/npm/v/react-native-image-marker.svg?logo=npm)](https://www.npmjs.com/package/react-native-image-marker)
11-
[![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)
12-
[![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)
13-
[![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)
14-
[![github](https://img.shields.io/badge/github-repo-blue?logo=github)](https://github.com/JimmyDaddy/react-native-image-marker)
15-
[![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)
16-
![platform-iOS](https://img.shields.io/badge/iOS-black?logo=Apple) ![platform-Android](https://img.shields.io/badge/Android-black?logo=Android)
10+
[![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)
11+
[![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)
12+
[![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)
13+
[![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)
14+
[![github](https://img.shields.io/badge/github-repo-blue?logo=github&style=for-the-badge)](https://github.com/JimmyDaddy/react-native-image-marker)
15+
[![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)
16+
![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)
1717
<br/>
1818

1919
</div>

android/src/main/java/com/jimmydaddy/imagemarker/base/WatermarkImageOptions.kt

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,23 @@ package com.jimmydaddy.imagemarker.base
33
import com.facebook.react.bridge.ReadableMap
44

55
data class WatermarkImageOptions(val options: ReadableMap?) {
6-
var imageOption: ImageOptions
7-
var x: String?
8-
var y: String?
9-
var positionEnum: PositionEnum?
6+
lateinit var imageOption: ImageOptions
7+
var x: String? = null
8+
var y: String? = null
9+
var positionEnum: PositionEnum? = null
1010

1111
init {
12-
imageOption = options?.let { ImageOptions(it) }!!
13-
val positionOptions =
14-
if (null != options.getMap("position")) options.getMap("position") else null
15-
x = if (positionOptions!!.hasKey("X")) Utils.handleDynamicToString(positionOptions.getDynamic("X")) else null
16-
y = if (positionOptions.hasKey("Y")) Utils.handleDynamicToString(positionOptions.getDynamic("Y")) else null
17-
positionEnum =
18-
if (null != positionOptions.getString("position")) PositionEnum.getPosition(
19-
positionOptions.getString("position")
20-
) else null
12+
if (options != null) {
13+
imageOption = options?.let { ImageOptions(it) }!!
14+
val positionOptions =
15+
if (null != options.getMap("position")) options.getMap("position") else null
16+
x = if (positionOptions!!.hasKey("X")) Utils.handleDynamicToString(positionOptions.getDynamic("X")) else null
17+
y = if (positionOptions.hasKey("Y")) Utils.handleDynamicToString(positionOptions.getDynamic("Y")) else null
18+
positionEnum =
19+
if (null != positionOptions.getString("position")) PositionEnum.getPosition(
20+
positionOptions.getString("position")
21+
) else null
22+
}
2123
}
2224

2325
constructor(watermarkImage: ImageOptions, x: String?, y: String?, position: PositionEnum?) : this(null) {

0 commit comments

Comments
 (0)