Fix FeverFeedsAdapter parsing (fixes #228)

This commit is contained in:
Shinokuni 2024-11-18 21:35:59 +01:00
parent d306bff63e
commit d2dff633e1
2 changed files with 16 additions and 9 deletions

View File

@ -31,14 +31,12 @@ class FeverFeedsAdapter : JsonAdapter<FeverFeeds>() {
beginObject() beginObject()
// skip based fields (api_version, auth, last_refreshed...) while (nextName() != "feeds") {
repeat(3) { skipValue()
skipField()
} }
nextName() // beginning of feeds array // feeds array
beginArray() beginArray()
while (hasNext()) { while (hasNext()) {
beginObject() beginObject()
@ -62,9 +60,12 @@ class FeverFeedsAdapter : JsonAdapter<FeverFeeds>() {
endArray() endArray()
nextName() while (nextName() != "feeds_groups") {
beginArray() skipValue()
}
// feeds_groups array
beginArray()
while (hasNext()) { while (hasNext()) {
beginObject() beginObject()
@ -83,6 +84,11 @@ class FeverFeedsAdapter : JsonAdapter<FeverFeeds>() {
} }
endArray() endArray()
while (peek() != JsonReader.Token.END_OBJECT) {
skipField()
}
endObject() endObject()
FeverFeeds( FeverFeeds(

View File

@ -1,7 +1,6 @@
{ {
"api_version": 3, "api_version": 3,
"auth": 1, "auth": 1,
"last_refreshed_on_time": 1640284745,
"feeds": [ "feeds": [
{ {
"id": 32, "id": 32,
@ -13,10 +12,12 @@
"last_updated_on_time": 1640364024 "last_updated_on_time": 1640364024
} }
], ],
"last_refreshed_on_time": 1640284745,
"feeds_groups": [ "feeds_groups": [
{ {
"group_id": 3, "group_id": 3,
"feed_ids": "5,4" "feed_ids": "5,4"
} }
] ],
"another_field": "another_value"
} }