Skip to content

Commit 72b5a5d

Browse files
Merge pull request #3 from ionic-team/feat/RMET-4099/edit-media-processor
RMET-4099 :: minor bug fixing and use media processor for edit photos
2 parents d8a9711 + ffba3d6 commit 72b5a5d

50 files changed

Lines changed: 6530 additions & 2473 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/github_actions.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ jobs:
3131
- name: Code Coverage
3232
run: bundle exec fastlane coverage
3333

34-
- name: Setup sonarqube
35-
uses: warchant/setup-sonar-scanner@v8
36-
37-
- name: Send to Sonarcloud
38-
run: bundle exec fastlane sonarqube
39-
env:
40-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
34+
# Commenting Sonarqube steps for now, until we are able to configure Sonarqube in Ionic repos
35+
#- name: Setup sonarqube
36+
# uses: warchant/setup-sonar-scanner@v8
37+
38+
#- name: Send to Sonarcloud
39+
# run: bundle exec fastlane sonarqube
40+
# env:
41+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ android {
6161
"outputs/code-coverage/connected/*coverage.ec"
6262
]))
6363
}
64+
65+
testOptions {
66+
unitTests.returnDefaultValues = true
67+
}
6468
}
6569

6670
repositories {
@@ -88,7 +92,7 @@ dependencies {
8892
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
8993
testImplementation 'org.mockito:mockito-core:5.12.0'
9094
testImplementation 'org.mockito:mockito-inline:5.2.0'
91-
testImplementation 'org.mockito.kotlin:mockito-kotlin:4.0.0'
95+
testImplementation 'org.mockito.kotlin:mockito-kotlin:5.4.0'
9296
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
9397
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
9498
}

src/androidTest/java/io.ionic.libs/ioncameralib/ExampleInstrumentedTest.kt

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/main/AndroidManifest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
<application android:requestLegacyExternalStorage="true">
77
<activity
8-
android:name="io.ionic.libs.ioncameralib.view.IONLoadingActivity"
8+
android:name="io.ionic.libs.ioncameralib.view.IONCAMRLoadingActivity"
99
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
1010
<activity
11-
android:name="io.ionic.libs.ioncameralib.view.ImageEditorActivity"
11+
android:name="io.ionic.libs.ioncameralib.view.IONCAMRImageEditorActivity"
1212
android:theme="@android:style/Theme.Black.NoTitleBar"
1313
android:enableOnBackInvokedCallback="true"
1414
tools:targetApi="33" />
1515
<activity
16-
android:name="io.ionic.libs.ioncameralib.view.IONOpenPhotoPickerActivity"
16+
android:name="io.ionic.libs.ioncameralib.view.IONCAMROpenPhotoPickerActivity"
1717
android:exported="false"
1818
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
1919
<!-- Trigger Google Play services to install the backported photo picker module. -->

src/main/kotlin/io/ionic/libs/ioncameralib/helper/OSCAMRExifHelper.kt renamed to src/main/kotlin/io/ionic/libs/ioncameralib/helper/IONCAMRExifHelper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import android.media.ExifInterface
2323
import android.net.Uri
2424
import java.io.IOException
2525

26-
class OSCAMRExifHelper : OSCAMRExifHelperInterface {
26+
class IONCAMRExifHelper : IONCAMRExifHelperInterface {
2727

2828
private var aperture: String? = null
2929
private var datetime: String? = null

src/main/kotlin/io/ionic/libs/ioncameralib/helper/OSCAMRExifHelperInterface.kt renamed to src/main/kotlin/io/ionic/libs/ioncameralib/helper/IONCAMRExifHelperInterface.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package io.ionic.libs.ioncameralib.helper
33
import android.media.ExifInterface
44
import android.net.Uri
55

6-
interface OSCAMRExifHelperInterface {
6+
interface IONCAMRExifHelperInterface {
77

88
fun createInFile(filePath: String?)
99
fun createOutFile(filePath: String?)

src/main/kotlin/io/ionic/libs/ioncameralib/helper/OSCAMRFileHelper.kt renamed to src/main/kotlin/io/ionic/libs/ioncameralib/helper/IONCAMRFileHelper.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ import java.nio.file.Files
3636
import java.nio.file.attribute.BasicFileAttributes
3737
import java.util.*
3838

39-
class OSCAMRFileHelper: OSCAMRFileHelperInterface {
39+
class IONCAMRFileHelper: IONCAMRFileHelperInterface {
4040

4141
companion object {
42-
private const val LOG_TAG = "OSCAMRFileHelper"
42+
private const val LOG_TAG = "IONCAMRFileHelper"
4343
private const val EXTERNAL_STORAGE = "com.android.externalstorage.documents"
4444
private const val DOWNLOADS_DOCUMENTS = "com.android.providers.downloads.documents"
4545
private const val PROVIDERS_MEDIA = "com.android.providers.media.documents"

src/main/kotlin/io/ionic/libs/ioncameralib/helper/OSCAMRFileHelperInterface.kt renamed to src/main/kotlin/io/ionic/libs/ioncameralib/helper/IONCAMRFileHelperInterface.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import android.net.Uri
77
import java.io.File
88
import java.io.InputStream
99

10-
interface OSCAMRFileHelperInterface {
10+
interface IONCAMRFileHelperInterface {
1111
fun getRealPath(uri: Uri?, context: Context?): String?
1212
fun getRealPath(uriString: String, context: Context): String?
1313
fun getUriFromString(uriString: String): Uri

src/main/kotlin/io/ionic/libs/ioncameralib/helper/OSCAMRGalleryHelper.kt renamed to src/main/kotlin/io/ionic/libs/ioncameralib/helper/IONCAMRGalleryHelper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.ionic.libs.ioncameralib.helper
22

3-
class OSCAMRGalleryHelper(val picturesDirectory: String?, val galleryFileName: String?) {
3+
class IONCAMRGalleryHelper(val picturesDirectory: String?, val galleryFileName: String?) {
44

55
var galleryPath = this.picturesDirectory + "/" + this.galleryFileName
66

src/main/kotlin/io/ionic/libs/ioncameralib/helper/OSCAMRImageHelper.kt renamed to src/main/kotlin/io/ionic/libs/ioncameralib/helper/IONCAMRImageHelper.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import android.graphics.Matrix
1010
import android.net.Uri
1111
import android.util.Base64
1212
import androidx.core.graphics.scale
13-
import io.ionic.libs.ioncameralib.model.IONError
13+
import io.ionic.libs.ioncameralib.model.IONCAMRError
1414
import java.io.*
1515

16-
class OSCAMRImageHelper: OSCAMRImageHelperInterface {
16+
class IONCAMRImageHelper: IONCAMRImageHelperInterface {
1717

1818
companion object {
1919
private const val JPEG = 0
@@ -50,9 +50,9 @@ class OSCAMRImageHelper: OSCAMRImageHelperInterface {
5050
return BitmapFactory.decodeByteArray(byteArray, 0, byteArray.size)
5151
}
5252

53-
override fun compressImage(activity: Activity?, uri: Uri?, bitmap: Bitmap?, compressFormat: CompressFormat, mQuality: Int, onError : (IONError) -> Unit){
53+
override fun compressImage(activity: Activity?, uri: Uri?, bitmap: Bitmap?, compressFormat: CompressFormat, mQuality: Int, onError : (IONCAMRError) -> Unit){
5454
if(bitmap == null || uri == null || activity == null){
55-
onError(IONError.PROCESS_IMAGE_ERROR)
55+
onError(IONCAMRError.PROCESS_IMAGE_ERROR)
5656
return
5757
}
5858
val os: OutputStream? =
@@ -68,7 +68,7 @@ class OSCAMRImageHelper: OSCAMRImageHelperInterface {
6868
*
6969
* @param bitmap
7070
*/
71-
override fun processPicture(bitmap: Bitmap?, encodingType: Int, mQuality: Int, onSuccess : (String) -> Unit, onError : (IONError) -> Unit) {
71+
override fun processPicture(bitmap: Bitmap?, encodingType: Int, mQuality: Int, onSuccess : (String) -> Unit, onError : (IONCAMRError) -> Unit) {
7272
val jpegData = ByteArrayOutputStream()
7373
val compressFormat: CompressFormat =
7474
if (encodingType == JPEG) CompressFormat.JPEG else CompressFormat.PNG
@@ -80,7 +80,7 @@ class OSCAMRImageHelper: OSCAMRImageHelperInterface {
8080
onSuccess(jsOut)
8181
}
8282
} catch (e: Exception) {
83-
onError(IONError.PROCESS_IMAGE_ERROR)
83+
onError(IONCAMRError.PROCESS_IMAGE_ERROR)
8484
}
8585
}
8686

@@ -92,7 +92,7 @@ class OSCAMRImageHelper: OSCAMRImageHelperInterface {
9292
return BitmapFactory.decodeFile(resultImagePath)
9393
}
9494

95-
override fun bitmapToBase64(result: Bitmap?, resolution: Int, quality: Int, onSuccess : (String) -> Unit, onError : (IONError) -> Unit) {
95+
override fun bitmapToBase64(result: Bitmap?, resolution: Int, quality: Int, onSuccess : (String) -> Unit, onError : (IONCAMRError) -> Unit) {
9696
val byteArrayOutputStream = ByteArrayOutputStream()
9797
result?.let {
9898
val resizedImage = this.downsizeBitmapIfNeeded(it, resolution)
@@ -104,7 +104,7 @@ class OSCAMRImageHelper: OSCAMRImageHelperInterface {
104104
}
105105
}
106106

107-
onError(IONError.EDIT_IMAGE_ERROR)
107+
onError(IONCAMRError.EDIT_IMAGE_ERROR)
108108
return
109109
}
110110

0 commit comments

Comments
 (0)