mirror of
https://github.com/MaintainTeam/LastPipeBender.git
synced 2025-03-01 05:48:22 +03:00
BraveNewPipe: use old behaviour for retrieving the new version info data
This commit is contained in:
parent
67be4f2938
commit
d067ed1798
2 changed files with 17 additions and 4 deletions
|
@ -0,0 +1,16 @@
|
||||||
|
package org.schabi.newpipe
|
||||||
|
|
||||||
|
import com.grack.nanojson.JsonObject
|
||||||
|
import com.grack.nanojson.JsonParser
|
||||||
|
import org.schabi.newpipe.extractor.downloader.Response
|
||||||
|
|
||||||
|
object BraveNewVersionWorkerHelper {
|
||||||
|
|
||||||
|
fun getVersionInfo(response: Response): JsonObject {
|
||||||
|
val newpipeVersionInfo = JsonParser.`object`()
|
||||||
|
.from(response.responseBody()).getObject("flavors")
|
||||||
|
.getObject("github").getObject("stable")
|
||||||
|
return newpipeVersionInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -16,7 +16,6 @@ import androidx.work.WorkManager
|
||||||
import androidx.work.Worker
|
import androidx.work.Worker
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import androidx.work.workDataOf
|
import androidx.work.workDataOf
|
||||||
import com.grack.nanojson.JsonParser
|
|
||||||
import com.grack.nanojson.JsonParserException
|
import com.grack.nanojson.JsonParserException
|
||||||
import org.schabi.newpipe.extractor.downloader.Response
|
import org.schabi.newpipe.extractor.downloader.Response
|
||||||
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException
|
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException
|
||||||
|
@ -118,9 +117,7 @@ class NewVersionWorker(
|
||||||
|
|
||||||
// Parse the json from the response.
|
// Parse the json from the response.
|
||||||
try {
|
try {
|
||||||
val newpipeVersionInfo = JsonParser.`object`()
|
val newpipeVersionInfo = BraveNewVersionWorkerHelper.getVersionInfo(response)
|
||||||
.from(response.responseBody()).getObject("flavors")
|
|
||||||
.getObject("newpipe")
|
|
||||||
|
|
||||||
val versionName = newpipeVersionInfo.getString("version")
|
val versionName = newpipeVersionInfo.getString("version")
|
||||||
val versionCode = newpipeVersionInfo.getInt("version_code")
|
val versionCode = newpipeVersionInfo.getInt("version_code")
|
||||||
|
|
Loading…
Add table
Reference in a new issue