Skip to content
This repository has been archived by the owner on Sep 5, 2022. It is now read-only.

Commit

Permalink
update moshi from 1.8.0 to 1.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sal0max committed Mar 9, 2021
1 parent 181428c commit 2ab1a3e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import java.io.FileInputStream
plugins {
id("com.android.application")
kotlin("android")
kotlin("kapt")
}

android {
Expand Down Expand Up @@ -71,18 +72,19 @@ android {
}

dependencies {
val fuelVersion = "2.3.1"

// kotlin
implementation(kotlin("stdlib-jdk7", version = rootProject.extra["kotlinVersion"] as String))
// support libs
implementation("androidx.core:core-ktx:1.3.2")
implementation("androidx.work:work-runtime-ktx:2.5.0")
// downloader
val fuelVersion = "2.3.1"
implementation("com.github.kittinunf.fuel:fuel:$fuelVersion")
implementation("com.github.kittinunf.fuel:fuel-android:$fuelVersion")
implementation("com.github.kittinunf.fuel:fuel-moshi:$fuelVersion")
implementation("com.squareup.moshi:moshi:1.8.0") // normally provided as dependency with fuel-moshi... strange!
val moshiVersion = "1.11.0"
implementation("com.squareup.moshi:moshi-kotlin:$moshiVersion")
kapt("com.squareup.moshi:moshi-kotlin-codegen:$moshiVersion")
// permissions
implementation("com.github.fondesa:kpermissions:3.1.3")
// test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.github.kittinunf.fuel.core.FuelError
import com.github.kittinunf.fuel.core.Response
import com.github.kittinunf.fuel.moshi.moshiDeserializerOf
import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import java.util.*

object InstagramService {
Expand All @@ -18,6 +19,7 @@ object InstagramService {
.add(PostAdapter())
.add(Date::class.java, UnixTimestampDateJsonAdapter())
.add(Uri::class.java, UriStringJsonAdapter())
.add(KotlinJsonAdapterFactory())
.build()
.adapter(Post::class.java)
val (_, response, result) = Fuel
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/kotlin/de/salomax/kraken/data/Model.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package de.salomax.kraken.data

import android.net.Uri
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
import java.util.*

/*
Expand Down Expand Up @@ -49,15 +50,18 @@ data class User(
* garbage from API ********************************************************************************
*/

@JsonClass(generateAdapter = true)
data class Result(
@field:Json(name = "graphql") val graphQl: GraphQl
)

@JsonClass(generateAdapter = true)
data class GraphQl(
@field:Json(name = "shortcode_media") val shortcodeMedia: ShortcodeMedia?,
@field:Json(name = "user") val user: GraphUser?
)

@JsonClass(generateAdapter = true)
data class ShortcodeMedia(
@field:Json(name = "id") val id: Long,
@field:Json(name = "shortcode") val shortCode: String,
Expand All @@ -70,14 +74,17 @@ data class ShortcodeMedia(
@field:Json(name = "accessibility_caption") val accessibilityCaption: String?
)

@JsonClass(generateAdapter = true)
data class EdgeSidecarToChildren(
@field:Json(name = "edges") val edges: List<Edge>
)

@JsonClass(generateAdapter = true)
data class Edge(
@field:Json(name = "node") val node: Node
)

@JsonClass(generateAdapter = true)
data class Node(
@field:Json(name = "id") val id: Long,
@field:Json(name = "shortcode") val shortCode: String,
Expand All @@ -87,6 +94,7 @@ data class Node(
@field:Json(name = "accessibility_caption") val accessibilityCaption: String
)

@JsonClass(generateAdapter = true)
data class GraphUser(
@field:Json(name = "biography") val biography: String?,
@field:Json(name = "edge_followed_by") val followedBy: Count,
Expand All @@ -102,6 +110,7 @@ data class GraphUser(
@field:Json(name = "username") val username: String
)

@JsonClass(generateAdapter = true)
data class Count(
@field:Json(name = "count") val count: Long
)

0 comments on commit 2ab1a3e

Please sign in to comment.