diff --git a/clients/android/NewsBlur/app/src/androidTest/java/com/newsblur/ParsingTest.kt b/clients/android/NewsBlur/app/src/androidTest/java/com/newsblur/ParsingTest.kt new file mode 100644 index 0000000000..10a840ea6b --- /dev/null +++ b/clients/android/NewsBlur/app/src/androidTest/java/com/newsblur/ParsingTest.kt @@ -0,0 +1,35 @@ +package com.newsblur + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import com.google.gson.Gson +import com.google.gson.GsonBuilder +import com.google.gson.reflect.TypeToken +import com.newsblur.domain.Classifier +import com.newsblur.domain.Story +import com.newsblur.network.domain.StoriesResponse +import com.newsblur.serialization.BooleanTypeAdapter +import com.newsblur.serialization.ClassifierMapTypeAdapter +import com.newsblur.serialization.DateStringTypeAdapter +import com.newsblur.serialization.StoriesResponseTypeAdapter +import com.newsblur.serialization.StoryTypeAdapter +import org.junit.Test +import org.junit.runner.RunWith +import java.util.Date + +@RunWith(AndroidJUnit4::class) +class ParsingTest { + + @Test + fun test() { + val gson: Gson = GsonBuilder().apply { + registerTypeAdapter(Date::class.java, DateStringTypeAdapter()) + registerTypeAdapter(Boolean::class.java, BooleanTypeAdapter()) + registerTypeAdapter(Boolean::class.javaPrimitiveType, BooleanTypeAdapter()) + registerTypeAdapter(Story::class.java, StoryTypeAdapter()) + registerTypeAdapter(StoriesResponse::class.java, StoriesResponseTypeAdapter()) + registerTypeAdapter(object : TypeToken?>() {}.type, ClassifierMapTypeAdapter()) + }.create() + + val input = """""".trimIndent() + } +} \ No newline at end of file diff --git a/clients/android/NewsBlur/app/src/main/java/com/newsblur/network/domain/FeedFolderResponse.java b/clients/android/NewsBlur/app/src/main/java/com/newsblur/network/domain/FeedFolderResponse.java index 0519c73418..245d81c5c2 100644 --- a/clients/android/NewsBlur/app/src/main/java/com/newsblur/network/domain/FeedFolderResponse.java +++ b/clients/android/NewsBlur/app/src/main/java/com/newsblur/network/domain/FeedFolderResponse.java @@ -59,8 +59,10 @@ public FeedFolderResponse(String json, Gson gson) { if (userProfile != null) { JsonObject profile = (JsonObject) userProfile; this.isPremium = profile.get("is_premium").getAsBoolean(); - this.isArchive = profile.get("is_archive").getAsBoolean(); this.premiumExpire = profile.get("premium_expire").getAsLong(); + if (asJsonObject.has("is_archive")) { + this.isArchive = profile.get("is_archive").getAsBoolean(); + } } JsonElement starredCountElement = asJsonObject.get("starred_count");