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 home: String
|
||||
|
||||
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(":")){
|
||||
|
@ -157,6 +159,19 @@ class GemActivity : AppCompatActivity() {
|
|||
|
||||
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()){
|
||||
initialise()
|
||||
}else{
|
||||
|
@ -286,12 +301,8 @@ class GemActivity : AppCompatActivity() {
|
|||
}
|
||||
|
||||
binding.home.setOnClickListener {
|
||||
val home = PreferenceManager.getDefaultSharedPreferences(this).getString(
|
||||
"home_capsule",
|
||||
Buran.DEFAULT_HOME_CAPSULE
|
||||
)
|
||||
omniTerm.history.clear()
|
||||
gemRequest(home!!, false)
|
||||
gemRequest(home, false)
|
||||
}
|
||||
|
||||
binding.pullToRefresh.setOnRefreshListener {
|
||||
|
@ -317,6 +328,19 @@ class GemActivity : AppCompatActivity() {
|
|||
override fun 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 {
|
||||
prefs.contains("background_colour") -> {
|
||||
when (val backgroundColor = prefs.getString("background_colour", "#XXXXXX")) {
|
||||
|
@ -773,24 +797,8 @@ class GemActivity : AppCompatActivity() {
|
|||
bookmarkDatasource = db.bookmarks()
|
||||
|
||||
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(
|
||||
home = prefs.getString(
|
||||
"home_capsule",
|
||||
Buran.DEFAULT_HOME_CAPSULE
|
||||
) ?: Buran.DEFAULT_HOME_CAPSULE,
|
||||
home = home,
|
||||
gemini = Datasource.factory(this, db.history()),
|
||||
db = db,
|
||||
onState = this::handleState
|
||||
|
|
Loading…
Reference in a new issue