Compare commits

...
Author SHA1 Message Date
FooIbar 5b5a2a9a33 Release 1.8.9.2-gms
Releases / Build (push) Has been cancelled
2023-08-15 17:49:53 +08:00
FooIbar 7719312355 Merge branch '1.8.x.x' into 1.8.9.x-gms 2023-08-15 17:49:46 +08:00
FooIbar 4594ac592c Merge branch 'Ehviewer-Overhauled:1.8.x.x' into 1.8.x.x 2023-08-15 17:44:38 +08:00
FooIbar eee0f2dded Fix FavoritesScene crash 2023-08-15 17:24:21 +08:00
FooIbar b4080302c3 Refine GalleryListParser 2023-08-15 16:22:55 +08:00
renovate[bot] 337e210b5b Update dependency com.google.android.material:material to v1.11.0-alpha02 2023-08-15 05:08:26 +00:00
4 changed files with 21 additions and 13 deletions

No files matched your search

+2 -2
View File
@@ -64,7 +64,7 @@ android {
minSdk = 28
targetSdk = 34
versionCode = 180043
versionName = "1.8.9.1-gms"
versionName = "1.8.9.2-gms"
resourceConfigurations.addAll(
listOf(
"zh",
@@ -216,7 +216,7 @@ dependencies {
val accompanist_version = "0.31.6-rc"
implementation("com.google.accompanist:accompanist-themeadapter-material3:$accompanist_version")
implementation("com.google.accompanist:accompanist-webview:$accompanist_version")
implementation("com.google.android.material:material:1.11.0-alpha01")
implementation("com.google.android.material:material:1.11.0-alpha02")
val splitties = "3.0.0"
implementation("com.louiscad.splitties:splitties-appctx:$splitties")
@@ -1,9 +1,12 @@
package com.hippo.ehviewer.client.parser
import com.hippo.ehviewer.EhDB
import com.hippo.ehviewer.R
import com.hippo.ehviewer.client.data.BaseGalleryInfo
import com.hippo.ehviewer.client.data.GalleryInfo.Companion.LOCAL_FAVORITED
import com.hippo.ehviewer.client.data.GalleryInfo.Companion.NOT_FAVORITED
import com.hippo.ehviewer.client.exception.EhException
import com.hippo.ehviewer.client.exception.ParseException
object GalleryListParser {
suspend fun parse(body: String) = runCatching {
@@ -15,13 +18,21 @@ object GalleryListParser {
it.generateSLang()
}
}
}.getOrDefault(GalleryListResult())
}.getOrElse {
if (body.contains("<p>You do not have any watched tags")) {
throw EhException(R.string.gallery_list_empty_hit_subscription)
}
if (body.contains("No hits found</p>")) {
throw EhException(R.string.gallery_list_empty_hit)
}
throw ParseException("Can't parse gallery list", body, it)
}
}
class GalleryListResult(
val prev: String? = null,
val next: String? = null,
val galleryInfoList: ArrayList<BaseGalleryInfo> = arrayListOf(),
val prev: String?,
val next: String?,
val galleryInfoList: ArrayList<BaseGalleryInfo>,
)
private external fun parseGalleryInfoList(e: String): GalleryListResult
@@ -91,6 +91,7 @@ import eu.kanade.tachiyomi.util.lang.launchUI
import eu.kanade.tachiyomi.util.lang.withIOContext
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.flow.collectLatest
import moe.tarsin.coroutines.runSuspendCatching
import rikka.core.res.resolveColor
@@ -337,7 +338,8 @@ class FavoritesScene : SearchBarScene() {
val transition = ViewTransition(binding.refreshLayout, binding.progress, binding.tip)
val empty = getString(R.string.gallery_list_empty_hit)
adapter.addLoadStateListener {
lifecycleScope.launchUI {
viewLifecycleOwner.lifecycleScope.launchUI {
ensureActive()
when (val state = it.refresh) {
is LoadState.Loading -> {
showSearchBar()
@@ -365,7 +365,6 @@ class GalleryListScene : SearchBarScene() {
binding.refreshLayout.setOnRefreshListener { mAdapter?.refresh() }
val transition = ViewTransition(binding.refreshLayout, binding.progress, binding.tip)
val empty = getString(R.string.gallery_list_empty_hit)
val noWatch = getString(R.string.gallery_list_empty_hit_subscription)
adapter.addLoadStateListener {
viewLifecycleOwner.lifecycleScope.launchUI {
ensureActive()
@@ -395,11 +394,7 @@ class GalleryListScene : SearchBarScene() {
delay(500)
binding.refreshLayout.isRefreshing = false
if (mAdapter?.itemCount == 0) {
if (mUrlBuilder.mode == MODE_SUBSCRIPTION) {
binding.tip.text = noWatch
} else {
binding.tip.text = empty
}
binding.tip.text = empty
transition.showView(2)
} else {
transition.showView(0)