diff --git a/examples/imageviewer/shared/src/androidMain/kotlin/example/imageviewer/storage/AndroidImageStorage.kt b/examples/imageviewer/shared/src/androidMain/kotlin/example/imageviewer/storage/AndroidImageStorage.kt index 5210b17a85..7484a1bb4d 100644 --- a/examples/imageviewer/shared/src/androidMain/kotlin/example/imageviewer/storage/AndroidImageStorage.kt +++ b/examples/imageviewer/shared/src/androidMain/kotlin/example/imageviewer/storage/AndroidImageStorage.kt @@ -106,6 +106,9 @@ class AndroidImageStorage( @OptIn(ExperimentalResourceApi::class) suspend fun getUri(context: Context, picture: PictureData): Uri = withContext(Dispatchers.IO) { + if (!sharedImagesDir.exists()) { + sharedImagesDir.mkdirs() + } val tempFileToShare: File = sharedImagesDir.resolve("share_picture.jpg") when (picture) { is PictureData.Camera -> { @@ -113,6 +116,9 @@ class AndroidImageStorage( } is PictureData.Resource -> { + if (!tempFileToShare.exists()) { + tempFileToShare.createNewFile() + } tempFileToShare.writeBytes(resource(picture.resource).readBytes()) } } diff --git a/examples/imageviewer/shared/src/androidMain/kotlin/example/imageviewer/view/ImageViewer.android.kt b/examples/imageviewer/shared/src/androidMain/kotlin/example/imageviewer/view/ImageViewer.android.kt index 4c6fac9344..23faf137a2 100755 --- a/examples/imageviewer/shared/src/androidMain/kotlin/example/imageviewer/view/ImageViewer.android.kt +++ b/examples/imageviewer/shared/src/androidMain/kotlin/example/imageviewer/view/ImageViewer.android.kt @@ -57,6 +57,10 @@ private fun getDependencies( Intent.EXTRA_STREAM, imageStorage.getUri(context.androidContext, picture) ) + putExtra( + Intent.EXTRA_TEXT, + picture.description + ) type = "image/jpeg" flags = Intent.FLAG_GRANT_READ_URI_PERMISSION } diff --git a/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/ImageViewer.ios.kt b/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/ImageViewer.ios.kt index d693b51a7d..1f40b9740a 100755 --- a/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/ImageViewer.ios.kt +++ b/examples/imageviewer/shared/src/iosMain/kotlin/example/imageviewer/ImageViewer.ios.kt @@ -57,7 +57,10 @@ fun getDependencies(ioScope: CoroutineScope, toastState: MutableState