mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-10 12:47:26 +01:00
Fix url sharing
Maybe fixes #8539
Based on f52785cbbd
Co-authored-by: jobobby04 <jobobby04@users.noreply.github.com>
This commit is contained in:
parent
6ad6dae191
commit
5325e590ec
@ -13,8 +13,15 @@ fun Uri.toShareIntent(context: Context, type: String = "image/*", message: Strin
|
|||||||
val uri = this
|
val uri = this
|
||||||
|
|
||||||
val shareIntent = Intent(Intent.ACTION_SEND).apply {
|
val shareIntent = Intent(Intent.ACTION_SEND).apply {
|
||||||
if (message != null) putExtra(Intent.EXTRA_TEXT, message)
|
when (uri.scheme) {
|
||||||
putExtra(Intent.EXTRA_STREAM, uri)
|
"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)
|
clipData = ClipData.newRawUri(null, uri)
|
||||||
setType(type)
|
setType(type)
|
||||||
flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
|
flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||||
|
Loading…
Reference in New Issue
Block a user