Skip to content

Commit d662ade

Browse files
committed
[NDGL-66] refactor: loadPlaceDetail() 로직을 다른 화면들과 통일
1 parent e553118 commit d662ade

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

feature/travel/src/main/java/com/yapp/ndgl/feature/travel/placedetail/PlaceDetailViewModel.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import dagger.assisted.AssistedInject
1919
import dagger.hilt.android.lifecycle.HiltViewModel
2020
import kotlinx.coroutines.delay
2121
import kotlinx.coroutines.launch
22-
import kotlin.time.Duration.Companion.hours
2322

2423
@HiltViewModel(assistedFactory = PlaceDetailViewModel.Factory::class)
2524
class PlaceDetailViewModel @AssistedInject constructor(
@@ -60,11 +59,10 @@ class PlaceDetailViewModel @AssistedInject constructor(
6059
rating = place.rating,
6160
userRatingCount = place.userRatingCount,
6261
address = place.formattedAddress,
63-
phoneNumber = place.nationalPhoneNumber,
62+
phoneNumber = place.nationalPhoneNumber ?: place.internationalPhoneNumber,
6463
openingHours = place.regularOpeningHours?.joinToString("\n"),
6564
googleMapsUri = place.googleMapsUri,
6665
websiteUrl = place.websiteUri,
67-
estimatedDuration = 1.hours,
6866
thumbnail = place.thumbnail.orEmpty(),
6967
tipContent = tipContent?.let { TipContent(creatorName = it.creatorName, tips = it.tips) },
7068
alternativePlaces = alternativePlaces.map { routePlace ->
@@ -86,7 +84,7 @@ class PlaceDetailViewModel @AssistedInject constructor(
8684
}
8785

8886
private fun loadPlacePhotos() = viewModelScope.launch {
89-
repeat(3) { index ->
87+
repeat(3) {
9088
delay(1000)
9189
val result = suspendRunCatching { placeRepository.getPlacePhotos(placeId) }
9290
val photos = result.getOrNull()?.photos
@@ -151,7 +149,7 @@ class PlaceDetailViewModel @AssistedInject constructor(
151149
fun create(
152150
placeId: String,
153151
tipContent: RouteTipContent?,
154-
alternativePlaces: List<RouteAlternativePlace>,
152+
alternativePlaces: List<RouteAlternativePlace>?,
155153
): PlaceDetailViewModel
156154
}
157155
}

0 commit comments

Comments
 (0)