Merge pull request #3892 from jivesh/main

Android QoL: use Android sharesheet when sharing article links
This commit is contained in:
Jackson Harper
2024-05-03 08:43:52 +08:00
committed by GitHub

View File

@ -157,12 +157,13 @@ class WebReaderViewModel @Inject constructor(
fun showShareLinkSheet(context: Context) {
webReaderParamsLiveData.value?.let {
val browserIntent = Intent(Intent.ACTION_SEND)
val sendIntent = Intent(Intent.ACTION_SEND)
browserIntent.setType("text/plain")
browserIntent.putExtra(Intent.EXTRA_TEXT, it.item.pageURLString)
browserIntent.putExtra(Intent.EXTRA_SUBJECT, it.item.title)
context.startActivity(browserIntent)
sendIntent.setType("text/plain")
sendIntent.putExtra(Intent.EXTRA_TEXT, it.item.pageURLString)
sendIntent.putExtra(Intent.EXTRA_SUBJECT, it.item.title)
val shareIntent = Intent.createChooser(sendIntent, null)
context.startActivity(shareIntent)
}
}