mirror of https://github.com/readrops/Readrops.git
Fix Fever adapters not consuming data to the end
This commit is contained in:
parent
562f11e2cc
commit
0885a9a3e4
|
@ -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) {
|
||||
|
|
|
@ -57,6 +57,7 @@ class FeverFaviconsAdapter {
|
|||
}
|
||||
|
||||
endArray()
|
||||
endObject()
|
||||
|
||||
favicons
|
||||
} catch (e: Exception) {
|
||||
|
|
|
@ -54,6 +54,7 @@ class FeverFeedsAdapter {
|
|||
|
||||
endArray()
|
||||
skipToEnd()
|
||||
endObject()
|
||||
|
||||
feeds
|
||||
} catch (e: Exception) {
|
||||
|
|
|
@ -49,6 +49,7 @@ class FeverFoldersAdapter {
|
|||
|
||||
endArray()
|
||||
skipToEnd()
|
||||
endObject()
|
||||
|
||||
folders
|
||||
} catch (e: Exception) {
|
||||
|
|
|
@ -57,6 +57,7 @@ class FeverItemsAdapter {
|
|||
}
|
||||
|
||||
endArray()
|
||||
endObject()
|
||||
|
||||
items
|
||||
} catch (e: Exception) {
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue