mirror of
https://github.com/Corewala/Buran
synced 2024-12-22 07:42:43 +00:00
Fixed broken check for valid URI
This commit is contained in:
parent
28fa72f59e
commit
c12702ef2f
1 changed files with 30 additions and 22 deletions
|
@ -86,6 +86,8 @@ class GemActivity : AppCompatActivity() {
|
||||||
|
|
||||||
lateinit var adapter: AbstractGemtextAdapter
|
lateinit var adapter: AbstractGemtextAdapter
|
||||||
|
|
||||||
|
lateinit var home: String
|
||||||
|
|
||||||
private val onLink: (link: URI, longTap: Boolean, adapterPosition: Int) -> Unit = { uri, longTap, _: Int ->
|
private val onLink: (link: URI, longTap: Boolean, adapterPosition: Int) -> Unit = { uri, longTap, _: Int ->
|
||||||
if(longTap){
|
if(longTap){
|
||||||
val globalURI = if(!uri.toString().contains("//") and !uri.toString().contains(":")){
|
val globalURI = if(!uri.toString().contains("//") and !uri.toString().contains(":")){
|
||||||
|
@ -157,6 +159,19 @@ class GemActivity : AppCompatActivity() {
|
||||||
|
|
||||||
binding.gemtextRecycler.adapter = adapter
|
binding.gemtextRecycler.adapter = adapter
|
||||||
|
|
||||||
|
home = prefs.getString(
|
||||||
|
"home_capsule",
|
||||||
|
Buran.DEFAULT_HOME_CAPSULE
|
||||||
|
) ?: Buran.DEFAULT_HOME_CAPSULE
|
||||||
|
|
||||||
|
if(
|
||||||
|
!home.startsWith("gemini://")
|
||||||
|
or home.contains(" ")
|
||||||
|
or !home.contains(".")
|
||||||
|
){
|
||||||
|
home = ""
|
||||||
|
}
|
||||||
|
|
||||||
if(getInternetStatus()){
|
if(getInternetStatus()){
|
||||||
initialise()
|
initialise()
|
||||||
}else{
|
}else{
|
||||||
|
@ -286,12 +301,8 @@ class GemActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.home.setOnClickListener {
|
binding.home.setOnClickListener {
|
||||||
val home = PreferenceManager.getDefaultSharedPreferences(this).getString(
|
|
||||||
"home_capsule",
|
|
||||||
Buran.DEFAULT_HOME_CAPSULE
|
|
||||||
)
|
|
||||||
omniTerm.history.clear()
|
omniTerm.history.clear()
|
||||||
gemRequest(home!!, false)
|
gemRequest(home, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.pullToRefresh.setOnRefreshListener {
|
binding.pullToRefresh.setOnRefreshListener {
|
||||||
|
@ -317,6 +328,19 @@ class GemActivity : AppCompatActivity() {
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
|
|
||||||
|
home = prefs.getString(
|
||||||
|
"home_capsule",
|
||||||
|
Buran.DEFAULT_HOME_CAPSULE
|
||||||
|
) ?: Buran.DEFAULT_HOME_CAPSULE
|
||||||
|
|
||||||
|
if(
|
||||||
|
!home.startsWith("gemini://")
|
||||||
|
or home.contains(" ")
|
||||||
|
or !home.contains(".")
|
||||||
|
){
|
||||||
|
home = ""
|
||||||
|
}
|
||||||
|
|
||||||
when {
|
when {
|
||||||
prefs.contains("background_colour") -> {
|
prefs.contains("background_colour") -> {
|
||||||
when (val backgroundColor = prefs.getString("background_colour", "#XXXXXX")) {
|
when (val backgroundColor = prefs.getString("background_colour", "#XXXXXX")) {
|
||||||
|
@ -773,24 +797,8 @@ class GemActivity : AppCompatActivity() {
|
||||||
bookmarkDatasource = db.bookmarks()
|
bookmarkDatasource = db.bookmarks()
|
||||||
|
|
||||||
if(intent.data == null){
|
if(intent.data == null){
|
||||||
var home = prefs.getString(
|
|
||||||
"home_capsule",
|
|
||||||
Buran.DEFAULT_HOME_CAPSULE
|
|
||||||
) ?: Buran.DEFAULT_HOME_CAPSULE
|
|
||||||
|
|
||||||
if(
|
|
||||||
home.startsWith("gemini://")
|
|
||||||
and !home.contains(" ")
|
|
||||||
and home.contains(".")
|
|
||||||
){
|
|
||||||
home = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
model.initialise(
|
model.initialise(
|
||||||
home = prefs.getString(
|
home = home,
|
||||||
"home_capsule",
|
|
||||||
Buran.DEFAULT_HOME_CAPSULE
|
|
||||||
) ?: Buran.DEFAULT_HOME_CAPSULE,
|
|
||||||
gemini = Datasource.factory(this, db.history()),
|
gemini = Datasource.factory(this, db.history()),
|
||||||
db = db,
|
db = db,
|
||||||
onState = this::handleState
|
onState = this::handleState
|
||||||
|
|
Loading…
Reference in a new issue