Added handler for sharing local links

This commit is contained in:
Corewala 2022-01-08 21:18:23 -05:00
parent 959d42e335
commit 20623fc4aa
1 changed files with 8 additions and 1 deletions

View File

@ -71,9 +71,16 @@ class GemActivity : AppCompatActivity() {
private val onLink: (link: URI, longTap: Boolean, adapterPosition: Int) -> Unit = { uri, longTap, position: Int ->
if(longTap){
var fullUri = uri.toString()
if(uri.toString().first() == '/'){
if (omniTerm.getCurrent().last() == '/'){
fullUri = fullUri.drop(1)
}
fullUri = omniTerm.getCurrent() + fullUri
}
Intent().apply {
action = Intent.ACTION_SEND
putExtra(Intent.EXTRA_TEXT, uri.toString())
putExtra(Intent.EXTRA_TEXT, fullUri)
type = "text/plain"
startActivity(Intent.createChooser(this, null))
}