Fix Fever adapters not consuming data to the end

This commit is contained in:
Shinokuni 2021-12-27 13:41:01 +01:00
parent 562f11e2cc
commit 0885a9a3e4
6 changed files with 10 additions and 6 deletions

View File

@ -1,6 +1,7 @@
package com.readrops.api.services.fever.adapters
import com.readrops.api.utils.exceptions.ParseException
import com.readrops.api.utils.extensions.skipField
import com.squareup.moshi.*
class FeverAPIAdapter : JsonAdapter<Boolean>() {
@ -15,16 +16,16 @@ class FeverAPIAdapter : JsonAdapter<Boolean>() {
return try {
beginObject()
skipName()
skipValue()
skipField()
var authenticated = 0
if (nextName() == "auth") {
authenticated = nextInt()
}
skipName()
skipValue()
skipField()
endObject()
authenticated == 1
} catch (e: Exception) {

View File

@ -57,6 +57,7 @@ class FeverFaviconsAdapter {
}
endArray()
endObject()
favicons
} catch (e: Exception) {

View File

@ -54,6 +54,7 @@ class FeverFeedsAdapter {
endArray()
skipToEnd()
endObject()
feeds
} catch (e: Exception) {

View File

@ -49,6 +49,7 @@ class FeverFoldersAdapter {
endArray()
skipToEnd()
endObject()
folders
} catch (e: Exception) {

View File

@ -57,6 +57,7 @@ class FeverItemsAdapter {
}
endArray()
endObject()
items
} catch (e: Exception) {

View File

@ -16,13 +16,12 @@ class FeverItemsIdsAdapter {
@FromJson
fun fromJson(reader: JsonReader): List<String> = with(reader) {
return try {
beginObject()
repeat(3) {
skipField()
}
nextName() // unread_items_ids field
nextName() // (unread|saved)_item_ids field
val ids = nextString().split(",")
endObject()