Tweak EhEngine transformException
This commit is contained in:
1 parent
8cfbdf46e0
commit
fe0c3176d8
4 files changed
+9
-7
No files matched your search
@@ -85,7 +85,7 @@ object EhEngine {
|
||||
}
|
||||
|
||||
// Check sad panda(without panda)
|
||||
if (headers != null && "text/html; charset=UTF-8" == headers["Content-Type"] && "0" == headers["Content-Length"]) {
|
||||
if (headers != null && "text/html; charset=UTF-8" == headers["Content-Type"] && "0" == headers["Content-Length"] && EhUtils.isExHentai) {
|
||||
throw EhException("Sad Panda\n(without panda)")
|
||||
}
|
||||
|
||||
@@ -99,6 +99,9 @@ object EhEngine {
|
||||
throw EhException(error)
|
||||
}
|
||||
}
|
||||
if (code >= 400) {
|
||||
throw StatusCodeException(code)
|
||||
}
|
||||
if (e is ParseException) {
|
||||
if (body != null && !body.contains("<")) {
|
||||
throw EhException(body)
|
||||
@@ -111,9 +114,6 @@ object EhEngine {
|
||||
throw EhException(GetText.getString(R.string.error_parse_error))
|
||||
}
|
||||
}
|
||||
if (code >= 400) {
|
||||
throw StatusCodeException(code)
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(Throwable::class)
|
||||
|
||||
@@ -66,6 +66,9 @@ object EhUtils {
|
||||
)
|
||||
private val CATEGORY_STRINGS = CATEGORY_VALUES.entries.map { (k, v) -> v to k }
|
||||
|
||||
val isExHentai: Boolean
|
||||
get() = Settings.getGallerySite() == EhUrl.SITE_EX
|
||||
|
||||
@JvmStatic
|
||||
fun getCategory(type: String?): Int {
|
||||
for (entry in CATEGORY_STRINGS) {
|
||||
|
||||
@@ -1492,7 +1492,7 @@ class GalleryDetailScene : CollapsingToolbarScene(), View.OnClickListener, Downl
|
||||
if (funds != null) {
|
||||
var fundsGP = funds.fundsGP.toString()
|
||||
// Ex GP numbers are rounded down to the nearest thousand
|
||||
if (Settings.getGallerySite() == EhUrl.SITE_EX) {
|
||||
if (EhUtils.isExHentai) {
|
||||
fundsGP += "+"
|
||||
}
|
||||
mDialog!!.setTitle(getString(R.string.current_funds, fundsGP, funds.fundsC))
|
||||
|
||||
@@ -71,7 +71,6 @@ import com.hippo.ehviewer.Settings
|
||||
import com.hippo.ehviewer.WindowInsetsAnimationHelper
|
||||
import com.hippo.ehviewer.client.EhClient
|
||||
import com.hippo.ehviewer.client.EhRequest
|
||||
import com.hippo.ehviewer.client.EhUrl
|
||||
import com.hippo.ehviewer.client.EhUtils
|
||||
import com.hippo.ehviewer.client.data.GalleryInfo
|
||||
import com.hippo.ehviewer.client.data.ListUrlBuilder
|
||||
@@ -259,7 +258,7 @@ class GalleryListScene : SearchBarScene(), OnDragHandlerListener, SearchLayout.H
|
||||
}
|
||||
|
||||
private fun setSearchBarHint() {
|
||||
setEditTextHint(getString(if (EhUrl.SITE_EX == Settings.getGallerySite()) R.string.gallery_list_search_bar_hint_exhentai else R.string.gallery_list_search_bar_hint_e_hentai))
|
||||
setEditTextHint(getString(if (EhUtils.isExHentai) R.string.gallery_list_search_bar_hint_exhentai else R.string.gallery_list_search_bar_hint_e_hentai))
|
||||
}
|
||||
|
||||
private fun setSearchBarSuggestionProvider() {
|
||||
|
||||
Reference in new issue
Block a user