mirror of
https://github.com/Corewala/Buran
synced 2024-12-22 07:42:43 +00:00
Fixed bug where current uri would be changed by resolving long-taps and image dialogs
This commit is contained in:
parent
bedbc9fb98
commit
867688a075
3 changed files with 17 additions and 8 deletions
|
@ -73,7 +73,7 @@ class OmniTerm(private val listener: Listener) {
|
|||
return when {
|
||||
reference.contains(":") -> reference
|
||||
reference.startsWith("//") -> "gemini:$reference"
|
||||
else -> uri.resolve(reference)
|
||||
else -> uri.resolve(reference, false)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,25 +35,26 @@ class OppenURI constructor(private var ouri: String) {
|
|||
}
|
||||
}
|
||||
|
||||
fun resolve(reference: String): String{
|
||||
fun resolve(reference: String, persistent: Boolean): String{
|
||||
if(ouri == "$GEMSCHEME$host") ouri = "$ouri/"
|
||||
var resolvedUri = ""
|
||||
when {
|
||||
reference.startsWith(GEMSCHEME) -> set(reference)
|
||||
reference.startsWith(SOLIDUS) -> ouri = "$scheme://$host$reference"
|
||||
reference.startsWith(SOLIDUS) -> resolvedUri = "$scheme://$host$reference"
|
||||
reference.startsWith(TRAVERSE) -> {
|
||||
if(!ouri.endsWith(DIREND)) ouri = ouri.removeFile()
|
||||
if(!ouri.endsWith(DIREND)) resolvedUri = ouri.removeFile()
|
||||
val traversalCount = reference.split(TRAVERSE).size - 1
|
||||
ouri = traverse(traversalCount) + reference.replace(TRAVERSE, "")
|
||||
resolvedUri = traverse(traversalCount) + reference.replace(TRAVERSE, "")
|
||||
}
|
||||
reference.startsWith(QUERY) -> {
|
||||
ouri = if(reference.contains(QUERY)){
|
||||
resolvedUri = if(reference.contains(QUERY)){
|
||||
ouri.substringBefore(QUERY) + reference
|
||||
}else{
|
||||
ouri + reference
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
ouri = when {
|
||||
resolvedUri = when {
|
||||
ouri.endsWith(DIREND) -> {
|
||||
"${ouri}$reference"
|
||||
}
|
||||
|
@ -61,7 +62,14 @@ class OppenURI constructor(private var ouri: String) {
|
|||
}
|
||||
}
|
||||
}
|
||||
return ouri
|
||||
if(persistent){
|
||||
ouri = resolvedUri
|
||||
}
|
||||
return resolvedUri
|
||||
}
|
||||
|
||||
fun resolve(reference: String): String{
|
||||
return resolve(reference, true)
|
||||
}
|
||||
|
||||
private fun traverse(count: Int): String{
|
||||
|
|
|
@ -747,6 +747,7 @@ class GemActivity : AppCompatActivity() {
|
|||
intent.putExtra(Intent.EXTRA_TITLE, File(state.uri.path).name)
|
||||
startActivityForResult(intent, CREATE_IMAGE_FILE_REQ)
|
||||
}
|
||||
omniTerm.set(omniTerm.goBack())
|
||||
}
|
||||
|
||||
private fun renderBinary(state: GemState.ResponseBinary) = runOnUiThread{
|
||||
|
|
Loading…
Reference in a new issue