Update new version check to match new API structure
See TeamNewPipe/web-api#17
This commit is contained in:
parent
e6965622bd
commit
e39ac885de
|
@ -120,13 +120,13 @@ class NewVersionWorker(
|
||||||
|
|
||||||
// Parse the json from the response.
|
// Parse the json from the response.
|
||||||
try {
|
try {
|
||||||
val githubStableObject = JsonParser.`object`()
|
val newpipeVersionInfo = JsonParser.`object`()
|
||||||
.from(response.responseBody()).getObject("flavors")
|
.from(response.responseBody()).getObject("flavors")
|
||||||
.getObject("github").getObject("stable")
|
.getObject("newpipe")
|
||||||
|
|
||||||
val versionName = githubStableObject.getString("version")
|
val versionName = newpipeVersionInfo.getString("version")
|
||||||
val versionCode = githubStableObject.getInt("version_code")
|
val versionCode = newpipeVersionInfo.getInt("version_code")
|
||||||
val apkLocationUrl = githubStableObject.getString("apk")
|
val apkLocationUrl = newpipeVersionInfo.getString("apk")
|
||||||
compareAppVersionAndShowNotification(versionName, apkLocationUrl, versionCode)
|
compareAppVersionAndShowNotification(versionName, apkLocationUrl, versionCode)
|
||||||
} catch (e: JsonParserException) {
|
} catch (e: JsonParserException) {
|
||||||
// Most likely something is wrong in data received from NEWPIPE_API_URL.
|
// Most likely something is wrong in data received from NEWPIPE_API_URL.
|
||||||
|
|
Loading…
Reference in New Issue