Drop isFavorited field

This commit is contained in:
tarsin committed 2023-07-04 10:11:54 +08:00
1 parent ee68b421d6
commit b90f221ede
4 files changed
+2 -9

No files matched your search

@@ -49,7 +49,6 @@ class GalleryDetail(
var language: String? = null,
var size: String? = null,
var favoriteCount: Int = 0,
var isFavorited: Boolean = false,
var ratingCount: Int = 0,
val tags: Array<GalleryTagGroup>,
var comments: GalleryCommentList,
@@ -198,11 +198,9 @@ object GalleryDetailParser {
// isFavorited
val gdf = gm.getElementById("gdf")
gd.isFavorited = false
if (gdf != null) {
val favoriteName = gdf.text().trim()
if (favoriteName != "Add to Favorites") {
gd.isFavorited = true
gd.favoriteName = gdf.text().trim()
PATTERN_FAVORITE_SLOT.find(body)?.run {
gd.favoriteSlot = ((groupValues[1].toIntOrNull() ?: 2) - 2) / 19
@@ -96,7 +96,7 @@ fun GalleryInfoBottomSheet(
pages.toString(),
size,
favoriteCount.toString(),
isFavorited.toString(),
(favoriteSlot >= 0).toString(),
ratingCount.toString(),
rating.toString(),
torrentCount.toString(),
@@ -875,10 +875,7 @@ class GalleryDetailScene : BaseScene() {
private fun updateFavoriteDrawable() {
val gd = composeBindingGD ?: return
lifecycleScope.launchIO {
val containLocalFav = EhDB.containLocalFavorites(gd.gid)
if (gd.isFavorited || containLocalFav) {
favButtonText = gd.favoriteName ?: getString(R.string.local_favorites)
}
favButtonText = gd.favoriteName ?: getString(R.string.local_favorites)
}
}
@@ -1268,7 +1265,6 @@ class GalleryDetailScene : BaseScene() {
private fun onModifyFavoritesSuccess() {
if (composeBindingGD != null) {
composeBindingGD!!.isFavorited = composeBindingGD!!.favoriteName != null
updateFavoriteDrawable()
}
}