From 5325e590ec61df487f6350bbccdbcf26de2449c3 Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 18 Nov 2022 22:49:54 -0500 Subject: [PATCH] Fix url sharing Maybe fixes #8539 Based on https://github.com/jobobby04/TachiyomiSY/commit/f52785cbbd2a0f68fd4b5f12aa4180d0182c1ad1 Co-authored-by: jobobby04 --- .../kanade/tachiyomi/util/system/IntentExtensions.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/IntentExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/IntentExtensions.kt index 38261857a..29dfdf601 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/IntentExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/IntentExtensions.kt @@ -13,8 +13,15 @@ fun Uri.toShareIntent(context: Context, type: String = "image/*", message: Strin val uri = this val shareIntent = Intent(Intent.ACTION_SEND).apply { - if (message != null) putExtra(Intent.EXTRA_TEXT, message) - putExtra(Intent.EXTRA_STREAM, uri) + when (uri.scheme) { + "http", "https" -> { + putExtra(Intent.EXTRA_TEXT, uri.toString()) + } + "content" -> { + message?.let { putExtra(Intent.EXTRA_TEXT, it) } + putExtra(Intent.EXTRA_STREAM, uri) + } + } clipData = ClipData.newRawUri(null, uri) setType(type) flags = Intent.FLAG_GRANT_READ_URI_PERMISSION