Skip to content

Commit 19df32b

Browse files
author
Niklas Bachmann
committed
Add version 2.6.0
1 parent 3f29b5e commit 19df32b

File tree

5 files changed

+34
-20
lines changed

5 files changed

+34
-20
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## [2.6.0]
2+
3+
### Fixed
4+
5+
* Support for Android version 8.0.4 upwards.
6+
7+
## Changed
8+
9+
* Minimal version 8.0.4.
10+
111
## [2.5.0]
212

313
### Removed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ For older React Native versions autolinking is not available and PhotoEditor SDK
8282
maven { url "https://artifactory.img.ly/artifactory/imgly" }
8383
}
8484
dependencies {
85-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
86-
classpath 'ly.img.android.sdk:plugin:7.6.0'
85+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10"
86+
classpath 'ly.img.android.sdk:plugin:8.0.4'
8787
}
8888
}
8989
```
90-
In order to update PhotoEditor SDK for Android replace the version string `7.6.0` with a [newer release](https://github.com/imgly/pesdk-android-demo/releases).
90+
In order to update PhotoEditor SDK for Android replace the version string `8.0.4` with a [newer release](https://github.com/imgly/pesdk-android-demo/releases).
9191

9292
3. Configure PhotoEditor SDK for Android by opening the `android/app/build.gradle` file (**not** `android/build.gradle`) and adding the following lines under `apply plugin: "com.android.application"`:
9393
```groovy

android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ imglyConfig {
2020
}
2121
}
2222

23-
def MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION = "7.6.0"
23+
def MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION = "8.0.4"
2424

2525
task checkVersion {
2626
if (imglyConfig.convertToVersionNumber(imglyConfig.getVersion()) < imglyConfig.convertToVersionNumber(MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION)) {
2727
String WRONG_VERSION = "" +
2828
"┌───────────────────────────────────────────────────────────────────────┐\n"+
2929
"│ PhotoEditor SDK update required! │\n"+
3030
"│ Please update the plugin version in your 'android/build.gradle' file. │\n"+
31-
"│ Minimum required dependency: 'ly.img.android.sdk:plugin:${MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION}' │\n"+
32-
"│ Your are currently using: 'ly.img.android.sdk:plugin:${imglyConfig.getVersion()}' │\n"+
31+
"│ Minimum required dependency: 'ly.img.android.sdk:plugin:${MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION}' \n"+
32+
"│ Your are currently using: 'ly.img.android.sdk:plugin:${imglyConfig.getVersion()}' \n"+
3333
"└───────────────────────────────────────────────────────────────────────┘\n"
3434

3535
throw new GradleScriptException(WRONG_VERSION, new IllegalArgumentException(WRONG_VERSION))

android/src/main/java/ly/img/react_native/pesdk/RNPhotoEditorSDKModule.kt

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ import ly.img.android.pesdk.utils.MainThreadRunnable
2323
import ly.img.android.pesdk.utils.SequenceRunnable
2424
import ly.img.android.pesdk.utils.UriHelper
2525
import ly.img.android.sdk.config.*
26-
import ly.img.android.serializer._3._0._0.PESDKFileReader
27-
import ly.img.android.serializer._3._0._0.PESDKFileWriter
2826
import org.json.JSONArray
2927
import org.json.JSONException
3028
import org.json.JSONObject
3129
import java.io.File
30+
import ly.img.android.pesdk.backend.encoder.Encoder
31+
import ly.img.android.serializer._3.IMGLYFileReader
32+
import ly.img.android.serializer._3.IMGLYFileWriter
33+
3234

3335

3436
class RNPhotoEditorSDKModule(val reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext), ActivityEventListener, PermissionListener {
@@ -77,15 +79,18 @@ class RNPhotoEditorSDKModule(val reactContext: ReactApplicationContext) : ReactC
7779
}
7880
when (serializationConfig.exportType) {
7981
SerializationExportType.FILE_URL -> {
80-
val file = serializationConfig.filename?.let { Export.convertPathToFile(it) }
81-
?: File.createTempFile("serialization", ".json")
82-
PESDKFileWriter(settingsList).writeJson(file)
83-
Uri.fromFile(file).toString()
82+
val uri = serializationConfig.filename?.let {
83+
Uri.parse(it)
84+
} ?: Uri.fromFile(File.createTempFile("serialization", ".json"))
85+
Encoder.createOutputStream(uri).use { outputStream ->
86+
IMGLYFileWriter(settingsList).writeJson(outputStream);
87+
}
88+
uri.toString()
8489
}
8590
SerializationExportType.OBJECT -> {
8691
ReactJSON.convertJsonToMap(
8792
JSONObject(
88-
PESDKFileWriter(settingsList).writeJsonAsString()
93+
IMGLYFileWriter(settingsList).writeJsonAsString()
8994
)
9095
) as Any?
9196
}
@@ -139,18 +144,16 @@ class RNPhotoEditorSDKModule(val reactContext: ReactApplicationContext) : ReactC
139144
settingsList.configure<LoadSettings> { loadSettings ->
140145
image?.also {
141146
if (it.startsWith("data:")) {
142-
loadSettings.setSource(UriHelper.createFromBase64String(it.substringAfter("base64,")), deleteProtectedSource = false)
147+
loadSettings.source = UriHelper.createFromBase64String(it.substringAfter("base64,"))
143148
} else {
144149
val potentialFile = continueWithExceptions { File(it) }
145150
if (potentialFile?.exists() == true) {
146-
loadSettings.setSource(Uri.fromFile(potentialFile), deleteProtectedSource = true)
151+
loadSettings.source = Uri.fromFile(potentialFile)
147152
} else {
148-
loadSettings.setSource(ConfigLoader.parseUri(it), deleteProtectedSource = true)
153+
loadSettings.source = ConfigLoader.parseUri(it)
149154
}
150155
}
151156
}
152-
}.configure<SaveSettings> {
153-
it.savePolicy = SaveSettings.SavePolicy.RETURN_SOURCE_OR_CREATE_OUTPUT_IF_NECESSARY
154157
}
155158

156159
readSerialisation(settingsList, serialization, image == null)
@@ -180,14 +183,15 @@ class RNPhotoEditorSDKModule(val reactContext: ReactApplicationContext) : ReactC
180183
private fun readSerialisation(settingsList: SettingsList, serialization: String?, readImage: Boolean) {
181184
if (serialization != null) {
182185
skipIfNotExists {
183-
PESDKFileReader(settingsList).also {
186+
IMGLYFileReader(settingsList).also {
184187
it.readJson(serialization, readImage)
185188
}
186189
}
187190
}
188191
}
189192

190193
private fun startEditor(settingsList: PhotoEditorSettingsList?) {
194+
val currentActivity = this.currentActivity ?: throw RuntimeException("Can't start the Editor because there is no current activity")
191195
if (settingsList != null) {
192196
(currentActivity as? PermissionAwareActivity)?.also {
193197
for (permission in PermissionRequest.NEEDED_EDITOR_PERMISSIONS) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-native-photoeditorsdk",
33
"title": "React Native module for PhotoEditor SDK",
4-
"version": "2.5.0",
4+
"version": "2.6.0",
55
"description": "A React Native module for PhotoEditor SDK. Integrate the photo editor into your own HTML5, iOS or Android app - in minutes!",
66
"main": "index.js",
77
"typings": "index.d.ts",

0 commit comments

Comments
 (0)