Skip to content

Commit ae45e4b

Browse files
yonghanJubngsh
andcommitted
✨ RunningFinishData Serializable 구현, RunningHistoryUiModel 맴버로 갖도록 변경
Co-authored-by: bngsh <[email protected]>
1 parent d1b3e41 commit ae45e4b

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

presentation/src/main/java/com/whyranoid/presentation/model/RunningHistoryUiModel.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package com.whyranoid.presentation.model
22

3-
import android.os.Parcelable
43
import com.whyranoid.domain.model.RunningHistory
5-
import kotlinx.parcelize.Parcelize
64

7-
@Parcelize
85
data class RunningHistoryUiModel(
96
val historyId: String,
107
val date: String,
@@ -13,7 +10,7 @@ data class RunningHistoryUiModel(
1310
val finishedAt: String,
1411
val totalDistance: String,
1512
val pace: String
16-
) : Parcelable
13+
) : java.io.Serializable
1714

1815
// TODO 원하는 형태로 변환하도록 코드 수정해야함
1916
fun RunningHistory.toRunningHistoryUiModel(): RunningHistoryUiModel {

presentation/src/main/java/com/whyranoid/presentation/running/RunningPosition.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import com.naver.maps.geometry.LatLng
55
data class RunningPosition(
66
val latitude: Double,
77
val longitude: Double
8-
)
8+
) : java.io.Serializable
99

1010
fun RunningPosition.toLatLng(): LatLng {
1111
return LatLng(

presentation/src/main/java/com/whyranoid/presentation/running/RunningRepository.kt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package com.whyranoid.presentation.running
22

33
import android.location.Location
4-
import com.whyranoid.domain.model.RunningHistory
4+
import com.whyranoid.presentation.model.RunningHistoryUiModel
55
import kotlinx.coroutines.flow.MutableStateFlow
66
import kotlinx.coroutines.flow.asStateFlow
7-
import java.util.UUID
7+
import java.util.*
88
import javax.inject.Inject
99
import javax.inject.Singleton
1010

@@ -120,9 +120,9 @@ data class RunningData(
120120
)
121121

122122
data class RunningFinishData(
123-
val runningHistory: RunningHistory,
123+
val runningHistory: RunningHistoryUiModel,
124124
val runningPositionList: List<List<RunningPosition>>
125-
)
125+
) : java.io.Serializable
126126

127127
sealed interface RunningState {
128128
val runningData: RunningData
@@ -136,13 +136,14 @@ sealed interface RunningState {
136136

137137
fun RunningData.toRunningFinishData() =
138138
RunningFinishData(
139-
RunningHistory(
139+
RunningHistoryUiModel(
140140
historyId = UUID.randomUUID().toString(),
141-
startedAt = startTime,
142-
finishedAt = System.currentTimeMillis(),
143-
totalRunningTime = runningTime,
144-
pace = pace,
145-
totalDistance = totalDistance
141+
date = "date",
142+
startedAt = startTime.toString(),
143+
finishedAt = System.currentTimeMillis().toString(),
144+
totalRunningTime = runningTime.toString(),
145+
pace = pace.toString(),
146+
totalDistance = totalDistance.toString()
146147
),
147148
runningPositionList
148149
)

0 commit comments

Comments
 (0)