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
|
package com.readrops.api.services.fever.adapters
|
||||||
|
|
||||||
import com.readrops.api.utils.exceptions.ParseException
|
import com.readrops.api.utils.exceptions.ParseException
|
||||||
|
import com.readrops.api.utils.extensions.skipField
|
||||||
import com.squareup.moshi.*
|
import com.squareup.moshi.*
|
||||||
|
|
||||||
class FeverAPIAdapter : JsonAdapter<Boolean>() {
|
class FeverAPIAdapter : JsonAdapter<Boolean>() {
|
||||||
@ -15,16 +16,16 @@ class FeverAPIAdapter : JsonAdapter<Boolean>() {
|
|||||||
return try {
|
return try {
|
||||||
beginObject()
|
beginObject()
|
||||||
|
|
||||||
skipName()
|
skipField()
|
||||||
skipValue()
|
|
||||||
|
|
||||||
var authenticated = 0
|
var authenticated = 0
|
||||||
if (nextName() == "auth") {
|
if (nextName() == "auth") {
|
||||||
authenticated = nextInt()
|
authenticated = nextInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
skipName()
|
skipField()
|
||||||
skipValue()
|
endObject()
|
||||||
|
|
||||||
|
|
||||||
authenticated == 1
|
authenticated == 1
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
@ -57,6 +57,7 @@ class FeverFaviconsAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
endArray()
|
endArray()
|
||||||
|
endObject()
|
||||||
|
|
||||||
favicons
|
favicons
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
@ -54,6 +54,7 @@ class FeverFeedsAdapter {
|
|||||||
|
|
||||||
endArray()
|
endArray()
|
||||||
skipToEnd()
|
skipToEnd()
|
||||||
|
endObject()
|
||||||
|
|
||||||
feeds
|
feeds
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
@ -49,6 +49,7 @@ class FeverFoldersAdapter {
|
|||||||
|
|
||||||
endArray()
|
endArray()
|
||||||
skipToEnd()
|
skipToEnd()
|
||||||
|
endObject()
|
||||||
|
|
||||||
folders
|
folders
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
@ -57,6 +57,7 @@ class FeverItemsAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
endArray()
|
endArray()
|
||||||
|
endObject()
|
||||||
|
|
||||||
items
|
items
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
@ -16,13 +16,12 @@ class FeverItemsIdsAdapter {
|
|||||||
@FromJson
|
@FromJson
|
||||||
fun fromJson(reader: JsonReader): List<String> = with(reader) {
|
fun fromJson(reader: JsonReader): List<String> = with(reader) {
|
||||||
return try {
|
return try {
|
||||||
|
|
||||||
beginObject()
|
beginObject()
|
||||||
repeat(3) {
|
repeat(3) {
|
||||||
skipField()
|
skipField()
|
||||||
}
|
}
|
||||||
|
|
||||||
nextName() // unread_items_ids field
|
nextName() // (unread|saved)_item_ids field
|
||||||
val ids = nextString().split(",")
|
val ids = nextString().split(",")
|
||||||
|
|
||||||
endObject()
|
endObject()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user