Fix url sharing
This commit is contained in:
parent
af36b6a677
commit
f52785cbbd
@ -13,11 +13,14 @@ fun Uri.toShareIntent(context: Context, type: String = "image/*", message: Strin
|
||||
val uri = this
|
||||
|
||||
val shareIntent = Intent(Intent.ACTION_SEND).apply {
|
||||
if (uri.scheme == "http" || uri.scheme == "https") putExtra(Intent.EXTRA_TEXT, uri.toString())
|
||||
if (uri.scheme == "content") {
|
||||
if (message != null) putExtra(Intent.EXTRA_TEXT, message)
|
||||
putExtra(Intent.EXTRA_STREAM, uri)
|
||||
}
|
||||
clipData = ClipData.newRawUri(null, uri)
|
||||
setType(type)
|
||||
flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||
setType(type)
|
||||
}
|
||||
|
||||
return Intent.createChooser(shareIntent, context.getString(R.string.action_share)).apply {
|
||||
|
Loading…
x
Reference in New Issue
Block a user