From 3d7258fa589b7ecf8f3126e6b861bd2ad81ff7e8 Mon Sep 17 00:00:00 2001 From: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com> Date: Fri, 3 Nov 2023 07:11:26 +0800 Subject: [PATCH] android: fixed QR code sharing (#3311) * android: fixed QR code sharing * remove mime type change --------- Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> --- .../kotlin/chat/simplex/common/platform/Share.android.kt | 2 +- .../kotlin/chat/simplex/common/views/helpers/Utils.android.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/platform/Share.android.kt b/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/platform/Share.android.kt index a370bbf405..cf3fcbaae7 100644 --- a/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/platform/Share.android.kt +++ b/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/platform/Share.android.kt @@ -36,7 +36,7 @@ actual fun shareFile(text: String, fileSource: CryptoFile) { tmpFile.deleteOnExit() ChatModel.filesToDelete.add(tmpFile) decryptCryptoFile(getAppFilePath(fileSource.filePath), fileSource.cryptoArgs, tmpFile.absolutePath) - FileProvider.getUriForFile(androidAppContext, "$APPLICATION_ID.provider", File(tmpFile.absolutePath)).toURI() + getAppFileUri(tmpFile.absolutePath) } else { getAppFileUri(fileSource.filePath) } diff --git a/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/views/helpers/Utils.android.kt b/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/views/helpers/Utils.android.kt index 127f13cd5c..18442d7791 100644 --- a/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/views/helpers/Utils.android.kt +++ b/apps/multiplatform/common/src/androidMain/kotlin/chat/simplex/common/views/helpers/Utils.android.kt @@ -152,7 +152,7 @@ private fun spannableStringToAnnotatedString( } actual fun getAppFileUri(fileName: String): URI = - FileProvider.getUriForFile(androidAppContext, "$APPLICATION_ID.provider", File(getAppFilePath(fileName))).toURI() + FileProvider.getUriForFile(androidAppContext, "$APPLICATION_ID.provider", if (File(fileName).isAbsolute) File(fileName) else File(getAppFilePath(fileName))).toURI() // https://developer.android.com/training/data-storage/shared/documents-files#bitmap actual fun getLoadedImage(file: CIFile?): Pair? {