WeComics: Update logic and error message for paid chapters. (#7598)

This commit is contained in:
Vetle Ledaal 2021-06-11 03:11:34 +02:00 committed by GitHub
parent fcb929f4e6
commit 675d44272a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'WeComics' extName = 'WeComics'
pkgNameSuffix = 'en.wecomics' pkgNameSuffix = 'en.wecomics'
extClass = '.WeComics' extClass = '.WeComics'
extVersionCode = 1 extVersionCode = 2
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -163,10 +163,10 @@ class WeComics : HttpSource() {
// Error code 401 when not logged in and data is empty when logged in, // Error code 401 when not logged in and data is empty when logged in,
// assuming this is populated after a purchase // assuming this is populated after a purchase
val jsonObject = gson.fromJson<JsonObject>(response.body!!.string()) val jsonObject = gson.fromJson<JsonObject>(response.body!!.string())
if (jsonObject["error_code"].asInt != 2 && if (jsonObject["error_code"].asInt == 401 ||
jsonObject["data"]["chapter"]["data"].asString != "" jsonObject["data"]["chapter"]["data"].asString == ""
) )
throw Exception("Chapter is currently not available.") throw Exception("Chapter is currently not available.\nLog in through WebView if purchased.")
val data = jsonObject["data"]["chapter"]["data"].asString val data = jsonObject["data"]["chapter"]["data"].asString
val key = data.substring(0, 8) val key = data.substring(0, 8)