Skip to content

Commit 619e6bb

Browse files
committed
+ fixed open in browser button
1 parent 84919e1 commit 619e6bb

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

app/src/main/java/com/lagradost/quicknovel/providers/RoyalRoadProvider.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,11 +318,11 @@ class RoyalRoadProvider : MainAPI() {
318318
}
319319
}
320320

321-
override suspend fun load(url: String): LoadResponse? {
321+
override suspend fun load(url: String): LoadResponse {
322322
val response = app.get(url)
323323
val document = response.document
324324
val name = document.selectFirst("h1.font-white")?.text()
325-
?: throw ErrorLoadingException("Null name")
325+
?: throw ErrorLoadingException("Name not found for '$url'\nmight be deleted or simply a malformed url")
326326
val fictionId =
327327
response.text.substringAfter("window.fictionId = ").substringBefore(";").toIntOrNull()
328328

app/src/main/java/com/lagradost/quicknovel/ui/result/ResultFragment.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,16 +365,15 @@ class ResultFragment : Fragment() {
365365
viewModel.openInBrowser()
366366
}
367367

368+
resultReloadConnectionOpenInBrowser.setOnClickListener {
369+
viewModel.openInBrowser()
370+
}
371+
368372
reviewsFab.setOnClickListener {
369373
resultReviews.smoothScrollToPosition(0) // NEEDS THIS TO RESET VELOCITY
370374
resultMainscroll.smoothScrollTo(0, 0)
371375
}
372376

373-
resultOpeninbrower.setOnClickListener {
374-
viewModel.openInBrowser()
375-
}
376-
377-
378377
val backParameter = resultBack.layoutParams as CoordinatorLayout.LayoutParams
379378
backParameter.setMargins(
380379
backParameter.leftMargin,

app/src/main/java/com/lagradost/quicknovel/ui/result/ResultViewModel.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import com.lagradost.quicknovel.util.ResultCached
4343
import kotlinx.coroutines.launch
4444
import kotlinx.coroutines.sync.Mutex
4545
import kotlinx.coroutines.sync.withLock
46+
import androidx.core.net.toUri
4647

4748
class ResultViewModel : ViewModel() {
4849
fun clear() {
@@ -145,7 +146,7 @@ class ResultViewModel : ViewModel() {
145146
loadMutex.withLock {
146147
if (loadUrl.isBlank()) return@launch
147148
val i = Intent(Intent.ACTION_VIEW)
148-
i.data = Uri.parse(loadUrl)
149+
i.data = loadUrl.toUri()
149150
activity?.startActivity(i)
150151
}
151152
}

0 commit comments

Comments
 (0)