This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class Article( | |
val id: String, | |
val title: String, | |
@Json(name = "cell_image") val image: Image, | |
val author: User, | |
val video: Video? = null, | |
val subtitle: String = EMPTY_STRING, | |
val content: List<Content> = listOf(), | |
@Json(name = "like_count") val likeCount: Int = 0, | |
val comments: List<Comment> = listOf(), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Article { | |
public String id; | |
public String title; | |
public Image cell_image; | |
public Video video; | |
public User author; | |
public String subtitle; | |
public List<Content> content; | |
public int like_count; | |
public List<Comment> comments; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ajnsnewmedia.kitchenstories.moshi.adapter | |
import com.squareup.moshi.JsonAdapter | |
import com.squareup.moshi.JsonReader | |
import com.squareup.moshi.JsonWriter | |
import com.squareup.moshi.Moshi | |
import timber.log.Timber | |
import java.io.IOException | |
import java.lang.reflect.Type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ajnsnewmedia.kitchenstories.moshi.adapter | |
import com.squareup.moshi.* | |
import java.io.IOException | |
import java.lang.reflect.Type | |
class FilterNullValuesFromListAdapter<T : Any> private constructor(private val delegate: JsonAdapter<List<T?>>) : JsonAdapter<List<T>>() { | |
@Throws(IOException::class) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class Video( | |
val id: String, | |
@Json(name = "video_url") val videoUrl: String, | |
@Json(name = "preview_image") val previewImage: Image, | |
@Json(name = "video_title") val videoTitle: String = EMPTY_STRING, | |
val duration: Int = 0, | |
@Json(name = "view_count") val viewCount: Int = 0, | |
val type: VideoType = VideoType.unknown | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class Image( | |
val url: String, | |
val source: String? = null | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val moshi = Moshi.Builder() | |
.add(DefaultOnDataMismatchAdapter.newFactory(VideoType::class.java, VideoType.unknown)) /* 1 */ | |
.add(DefaultOnDataMismatchAdapter.newFactory(Video::class.java, null)) /* 2 */ | |
.add(DefaultOnDataMismatchAdapter.newFactory(Content::class.java, null)) /* 3 */ | |
.add(FilterNullValuesFromListAdapter.newFactory(Content::class.java)) /* 4 */ | |
.add(DefaultOnDataMismatchAdapter.newFactory(Article::class.java, null)) /* 5 */ | |
.add(KotlinJsonAdapterFactory()) | |
.build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.from(document.querySelectorAll('div')) | |
.filter(el => el.textContent === 'Load diff') | |
.forEach(it => it.click()) |