Skip to content

Commit d2d5fb8

Browse files
committed
refactor: module android impl from Java to Kotlin
- convert files from Java to Kotlin - replace deprecated onCatalystInstanceDestroy with invalidate - replace deprecated AsyncTask classes with Kotlin Coroutines
1 parent fd0c87b commit d2d5fb8

File tree

10 files changed

+557
-636
lines changed

10 files changed

+557
-636
lines changed

android/build.gradle

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
buildscript {
22
repositories {
3-
google()
43
mavenCentral()
4+
google()
55
}
66

7+
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['RNImageEditor_kotlinVersion']
8+
79
dependencies {
810
classpath "com.android.tools.build:gradle:7.2.1"
11+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
912
}
1013
}
1114

@@ -14,6 +17,7 @@ def isNewArchitectureEnabled() {
1417
}
1518

1619
apply plugin: "com.android.library"
20+
apply plugin: "kotlin-android"
1721

1822
if (isNewArchitectureEnabled()) {
1923
apply plugin: "com.facebook.react"
@@ -70,6 +74,9 @@ android {
7074
sourceCompatibility JavaVersion.VERSION_1_8
7175
targetCompatibility JavaVersion.VERSION_1_8
7276
}
77+
packagingOptions {
78+
resources.excludes += "DebugProbesKt.bin"
79+
}
7380

7481
sourceSets {
7582
main {
@@ -87,9 +94,14 @@ repositories {
8794
google()
8895
}
8996

97+
def kotlinx_coroutines_version = getExtOrDefault('kotlinxCoroutinesVersion')
98+
def androidx_exifinterface_version = getExtOrDefault('androidxExifinterfaceVersion')
99+
90100
dependencies {
91101
// For < 0.71, this will be from the local maven repo
92102
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
93103
//noinspection GradleDynamicVersion
94104
implementation "com.facebook.react:react-native:+"
105+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinx_coroutines_version"
106+
implementation "androidx.exifinterface:exifinterface:$androidx_exifinterface_version"
95107
}

android/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
RNImageEditor_compileSdkVersion=34
22
RNImageEditor_targetSdkVersion=34
33
RNImageEditor_minSdkVersion=21
4+
RNImageEditor_kotlinxCoroutinesVersion=1.7.3
5+
RNImageEditor_androidxExifinterfaceVersion=1.3.6
6+
RNImageEditor_kotlinVersion=1.7.22

0 commit comments

Comments
 (0)