mirror of
https://github.com/Corewala/Buran
synced 2024-12-22 07:42:43 +00:00
Fixed sharing of relative links
This commit is contained in:
parent
13f21bc09b
commit
319b0b4d14
3 changed files with 9 additions and 7 deletions
|
@ -58,7 +58,6 @@ class OmniTerm(private val listener: Listener) {
|
|||
link.startsWith("//") -> uri.set("gemini:$link")
|
||||
link.startsWith("http://") or link.startsWith("https://") -> {
|
||||
uri.set(link)
|
||||
println("MALD?")
|
||||
}
|
||||
link.contains(":") -> listener.openExternal(link)
|
||||
else -> uri.resolve(link)
|
||||
|
@ -70,6 +69,14 @@ class OmniTerm(private val listener: Listener) {
|
|||
println("OmniTerm resolved address: $address")
|
||||
}
|
||||
|
||||
fun getGlobalUri(reference: String): String {
|
||||
when {
|
||||
reference.contains(":") -> return reference
|
||||
reference.startsWith("//") -> return "gemini:$reference"
|
||||
else -> return uri.resolve(reference)
|
||||
}
|
||||
}
|
||||
|
||||
fun reset(){
|
||||
uri = penultimate.copy()
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ class OppenURI constructor(private var ouri: String) {
|
|||
|
||||
fun resolve(reference: String): String{
|
||||
if(ouri == "$GEMSCHEME$host") ouri = "$ouri/"
|
||||
println(host)
|
||||
when {
|
||||
reference.startsWith(GEMSCHEME) -> set(reference)
|
||||
reference.startsWith(SOLIDUS) -> ouri = "$scheme://$host$reference"
|
||||
|
|
|
@ -97,11 +97,7 @@ class GemActivity : AppCompatActivity() {
|
|||
|
||||
private val onLink: (link: URI, longTap: Boolean, adapterPosition: Int) -> Unit = { uri, longTap, _: Int ->
|
||||
if(longTap){
|
||||
val globalURI = if(!uri.toString().contains("//") and !uri.toString().contains(":")){
|
||||
(omniTerm.getCurrent() + uri.toString()).replace("//", "/").replace(":/", "://")
|
||||
} else {
|
||||
uri.toString()
|
||||
}
|
||||
val globalURI = omniTerm.getGlobalUri(uri.toString())
|
||||
Intent().apply {
|
||||
action = Intent.ACTION_SEND
|
||||
putExtra(Intent.EXTRA_TEXT, globalURI)
|
||||
|
|
Loading…
Reference in a new issue