From 3fd5522481c2aa249c7826d7529b8f8c5687c89c Mon Sep 17 00:00:00 2001 From: Anton Shelar Date: Thu, 2 Apr 2020 18:43:12 +0700 Subject: [PATCH 1/2] fixed camera image pick issue --- buildSrc/src/main/kotlin/Versions.kt | 4 ++-- .../dev/icerock/moko/media/picker/MediaPickerController.kt | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 90ee68a..3b47157 100755 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -5,7 +5,7 @@ object Versions { const val minSdk = 16 } - const val kotlin = "1.3.70" + const val kotlin = "1.3.71" object Plugins { const val kotlin = Versions.kotlin @@ -21,7 +21,7 @@ object Versions { object MultiPlatform { const val coroutines = "1.3.4" const val mokoPermissions = "0.5.0" - const val mokoMedia = "0.4.2" + const val mokoMedia = "0.4.3" } } } diff --git a/media/src/iosMain/kotlin/dev/icerock/moko/media/picker/MediaPickerController.kt b/media/src/iosMain/kotlin/dev/icerock/moko/media/picker/MediaPickerController.kt index 61aabec..55da0b3 100755 --- a/media/src/iosMain/kotlin/dev/icerock/moko/media/picker/MediaPickerController.kt +++ b/media/src/iosMain/kotlin/dev/icerock/moko/media/picker/MediaPickerController.kt @@ -33,6 +33,7 @@ import platform.UIKit.UIViewController import platform.darwin.NSObject import kotlin.coroutines.Continuation import kotlin.coroutines.suspendCoroutine +import kotlin.random.Random actual class MediaPickerController( val permissionsController: PermissionsController, @@ -130,14 +131,14 @@ actual class MediaPickerController( ) continuation.resumeWith(Result.success(media)) } else { - if (image == null || mediaUrl == null) { + if (image == null) { continuation.resumeWith(Result.failure(NoAccessToFileException("info: $info"))) // TODO write some info return } val media = Media( - name = mediaUrl.relativeString, - path = mediaUrl.path.orEmpty(), + name = mediaUrl?.relativeString ?: Random.nextLong().toString(), + path = mediaUrl?.path.orEmpty(), preview = Bitmap(image), type = type ) From c359e7127e40c5e3e3b26cd9ab641865213889ba Mon Sep 17 00:00:00 2001 From: Aleksey Mikhailov Date: Thu, 2 Apr 2020 20:07:12 +0700 Subject: [PATCH 2/2] update docs --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 57b443a..db31b95 100755 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ TODO - 0.4.0 - 0.4.1 - 0.4.2 + - 0.4.3 ## Installation root build.gradle @@ -46,7 +47,7 @@ allprojects { project build.gradle ```groovy dependencies { - commonMainApi("dev.icerock.moko:media:0.4.2") + commonMainApi("dev.icerock.moko:media:0.4.3") } ```