Skip to content

Commit 0cca9e4

Browse files
committed
feat : PolymorphicJsonAdapterFactory 추가해서 알람 데이터 저장
1 parent b963d3c commit 0cca9e4

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

data/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ dependencies {
6767
// Moshi
6868
implementation 'com.squareup.moshi:moshi-kotlin:1.14.0'
6969
implementation 'com.squareup.moshi:moshi:1.14.0'
70+
implementation 'com.squareup.moshi:moshi-adapters:1.14.0'
7071
kapt 'com.squareup.moshi:moshi-kotlin-codegen:1.14.0'
7172

7273
// xml parser

data/src/main/java/com/stop/data/di/NetworkModule.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
package com.stop.data.di
22

33
import com.squareup.moshi.Moshi
4+
import com.squareup.moshi.adapters.PolymorphicJsonAdapterFactory
45
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
56
import com.stop.data.BuildConfig
67
import com.stop.data.remote.ResultCallAdapter
8+
import com.stop.domain.model.route.tmap.custom.Route
9+
import com.stop.domain.model.route.tmap.custom.TransportRoute
10+
import com.stop.domain.model.route.tmap.custom.WalkRoute
711
import com.tickaroo.tikxml.TikXml
812
import com.tickaroo.tikxml.retrofit.TikXmlConverterFactory
913
import dagger.Module
@@ -46,6 +50,11 @@ internal object NetworkModule {
4650
@Singleton
4751
fun provideMoshi(): Moshi {
4852
return Moshi.Builder()
53+
.add(PolymorphicJsonAdapterFactory
54+
.of(Route::class.java,"Route")
55+
.withSubtype(TransportRoute::class.java, "TransportRoute")
56+
.withSubtype(WalkRoute::class.java, "WalkRoute")
57+
)
4958
.addLast(KotlinJsonAdapterFactory())
5059
.build()
5160
}

domain/src/main/java/com/stop/domain/model/route/tmap/custom/Route.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.stop.domain.model.route.tmap.custom
22

33
interface Route {
4-
54
val distance: Double
65
val end: Place
76
val mode: MoveType

0 commit comments

Comments
 (0)