-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from f-lab-edu/feature/17
[#17] 상세화면 (DetailScreen) 구현
- Loading branch information
Showing
34 changed files
with
1,045 additions
and
16 deletions.
There are no files selected for viewing
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
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
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
44 changes: 44 additions & 0 deletions
44
app/src/main/java/kr/ksw/visitkorea/data/remote/api/DetailApi.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package kr.ksw.visitkorea.data.remote.api | ||
|
||
import kr.ksw.visitkorea.data.remote.dto.DetailCommonDTO | ||
import kr.ksw.visitkorea.data.remote.dto.DetailImageDTO | ||
import kr.ksw.visitkorea.data.remote.dto.DetailIntroDTO | ||
import kr.ksw.visitkorea.data.remote.model.ApiResponse | ||
import retrofit2.http.GET | ||
import retrofit2.http.Query | ||
|
||
interface DetailApi { | ||
@GET("detailCommon1") | ||
suspend fun getDetailCommon( | ||
@Query("numOfRows") numOfRows: Int = 10, | ||
@Query("pageNo") pageNo: Int = 1, | ||
@Query("defaultYN") defaultYN: String = "Y", | ||
@Query("overviewYN") overviewYN: String = "Y", | ||
@Query("contentId") contentId: String | ||
): ApiResponse<DetailCommonDTO> | ||
|
||
@GET("detailIntro1") | ||
suspend fun getDetailIntro( | ||
@Query("numOfRows") numOfRows: Int = 10, | ||
@Query("pageNo") pageNo: Int = 1, | ||
@Query("contentId") contentId: String, | ||
@Query("contentTypeId") contentTypeId: String | ||
): ApiResponse<DetailIntroDTO> | ||
/* | ||
@GET("detailInfo1") | ||
suspend fun getDetailInfo( | ||
@Query("numOfRows") numOfRows: Int = 10, | ||
@Query("pageNo") pageNo: Int = 1, | ||
@Query("contentId") contentId: Int, | ||
@Query("contentTypeId") contentTypeId: Int | ||
) | ||
*/ | ||
@GET("detailImage1") | ||
suspend fun getDetailImage( | ||
@Query("numOfRows") numOfRows: Int = 10, | ||
@Query("pageNo") pageNo: Int = 1, | ||
@Query("subImageYN") subImageYN: String = "Y", | ||
@Query("imageYN") imageYN: String = "Y", | ||
@Query("contentId") contentId: String, | ||
): ApiResponse<DetailImageDTO> | ||
} |
6 changes: 6 additions & 0 deletions
6
app/src/main/java/kr/ksw/visitkorea/data/remote/dto/DetailCommonDTO.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package kr.ksw.visitkorea.data.remote.dto | ||
|
||
data class DetailCommonDTO( | ||
val homepage: String, | ||
val overview: String | ||
) |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/kr/ksw/visitkorea/data/remote/dto/DetailImageDTO.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package kr.ksw.visitkorea.data.remote.dto | ||
|
||
import com.google.gson.annotations.SerializedName | ||
|
||
data class DetailImageDTO( | ||
@SerializedName("originimgurl") | ||
val originImgUrl: String, | ||
@SerializedName("smallimageurl") | ||
val smallImageUrl: String | ||
) |
55 changes: 55 additions & 0 deletions
55
app/src/main/java/kr/ksw/visitkorea/data/remote/dto/DetailIntroDTO.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package kr.ksw.visitkorea.data.remote.dto | ||
|
||
import com.google.gson.annotations.SerializedName | ||
|
||
data class DetailIntroDTO( | ||
// TouristSpot | ||
val parking: String?, | ||
@SerializedName("restdate") | ||
val restDate: String?, | ||
@SerializedName("usetime") | ||
val useTime: String?, | ||
// Culture Center | ||
@SerializedName("parkingculture") | ||
val parkingCulture: String?, | ||
@SerializedName("restdateculture") | ||
val restDateCulture: String?, | ||
@SerializedName("usefee") | ||
val useFee: String?, | ||
@SerializedName("usetimeculture") | ||
val useTimeCulture: String?, | ||
// Festival | ||
@SerializedName("eventplace") | ||
val eventPlace: String?, | ||
@SerializedName("playtime") | ||
val playTime: String?, | ||
@SerializedName("usetimefestival") | ||
val useTimeFestival: String?, | ||
// Leisure Sports | ||
@SerializedName("parkingleports") | ||
val parkingLeports: String?, | ||
@SerializedName("restdateleports") | ||
val restDateLeports: String?, | ||
@SerializedName("usefeeleports") | ||
val useFeeLeports: String?, | ||
@SerializedName("usetimeleports") | ||
val useTimeLeports: String?, | ||
// Restaurant | ||
@SerializedName("parkingfood") | ||
val parkingFood: String?, | ||
@SerializedName("restdatefood") | ||
val restDateFood: String?, | ||
@SerializedName("opentimefood") | ||
val openTimeFood: String?, | ||
@SerializedName("firstmenu") | ||
val firstMenu: String?, | ||
// Hotel | ||
@SerializedName("checkintime") | ||
val checkInTime: String?, | ||
@SerializedName("checkouttime") | ||
val checkOutTime: String?, | ||
@SerializedName("subfacility") | ||
val subFacility: String?, | ||
@SerializedName("reservationurl") | ||
val reservationUrl: String? | ||
) |
21 changes: 21 additions & 0 deletions
21
app/src/main/java/kr/ksw/visitkorea/data/repository/DetailRepository.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package kr.ksw.visitkorea.data.repository | ||
|
||
import kr.ksw.visitkorea.data.remote.dto.DetailCommonDTO | ||
import kr.ksw.visitkorea.data.remote.dto.DetailImageDTO | ||
import kr.ksw.visitkorea.data.remote.dto.DetailIntroDTO | ||
|
||
interface DetailRepository { | ||
suspend fun getDetailCommon( | ||
contentId: String | ||
): Result<DetailCommonDTO> | ||
|
||
suspend fun getDetailIntro( | ||
contentId: String, | ||
contentTypeId: String | ||
): Result<DetailIntroDTO> | ||
|
||
suspend fun getDetailImage( | ||
contentId: String, | ||
imageYN: String | ||
): Result<List<DetailImageDTO>> | ||
} |
39 changes: 39 additions & 0 deletions
39
app/src/main/java/kr/ksw/visitkorea/data/repository/DetailRepositoryImpl.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package kr.ksw.visitkorea.data.repository | ||
|
||
import kr.ksw.visitkorea.data.mapper.toItems | ||
import kr.ksw.visitkorea.data.remote.api.DetailApi | ||
import kr.ksw.visitkorea.data.remote.dto.DetailCommonDTO | ||
import kr.ksw.visitkorea.data.remote.dto.DetailImageDTO | ||
import kr.ksw.visitkorea.data.remote.dto.DetailIntroDTO | ||
import javax.inject.Inject | ||
|
||
class DetailRepositoryImpl @Inject constructor( | ||
private val detailApi: DetailApi | ||
): DetailRepository { | ||
override suspend fun getDetailCommon( | ||
contentId: String) | ||
: Result<DetailCommonDTO> = runCatching { | ||
detailApi.getDetailCommon( | ||
contentId = contentId | ||
).toItems().first() | ||
} | ||
|
||
override suspend fun getDetailIntro( | ||
contentId: String, | ||
contentTypeId: String | ||
): Result<DetailIntroDTO> = runCatching { | ||
detailApi.getDetailIntro( | ||
contentId = contentId, | ||
contentTypeId = contentTypeId | ||
).toItems().first() | ||
} | ||
|
||
override suspend fun getDetailImage( | ||
contentId: String, | ||
imageYN: String, | ||
): Result<List<DetailImageDTO>> = runCatching { | ||
detailApi.getDetailImage( | ||
contentId = contentId | ||
).toItems() | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
app/src/main/java/kr/ksw/visitkorea/domain/common/ContentTypeId.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package kr.ksw.visitkorea.domain.common | ||
|
||
const val TYPE_TOURIST_SPOT = "12" | ||
const val TYPE_CULTURE = "14" | ||
const val TYPE_LEiSURE = "28" | ||
const val TYPE_RESTAURANT = "39" | ||
const val TYPE_FESTIVAL = "15" |
31 changes: 31 additions & 0 deletions
31
app/src/main/java/kr/ksw/visitkorea/domain/di/DetailModule.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package kr.ksw.visitkorea.domain.di | ||
|
||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.components.ActivityRetainedComponent | ||
import kr.ksw.visitkorea.domain.usecase.detail.GetDetailCommonUseCase | ||
import kr.ksw.visitkorea.domain.usecase.detail.GetDetailCommonUseCaseImpl | ||
import kr.ksw.visitkorea.domain.usecase.detail.GetDetailImageUseCase | ||
import kr.ksw.visitkorea.domain.usecase.detail.GetDetailImageUseCaseUseCaseImpl | ||
import kr.ksw.visitkorea.domain.usecase.detail.GetDetailIntroUseCase | ||
import kr.ksw.visitkorea.domain.usecase.detail.GetDetailIntroUseCaseImpl | ||
|
||
@Module | ||
@InstallIn(ActivityRetainedComponent::class) | ||
abstract class DetailModule { | ||
@Binds | ||
abstract fun bindGetDetailCommonUseCase( | ||
getDetailCommonUseCase: GetDetailCommonUseCaseImpl | ||
): GetDetailCommonUseCase | ||
|
||
@Binds | ||
abstract fun bindGetDetailIntroUseCase( | ||
getDetailIntroUseCase: GetDetailIntroUseCaseImpl | ||
): GetDetailIntroUseCase | ||
|
||
@Binds | ||
abstract fun bindGetDetailImageUseCase( | ||
getDetailImageUseCase: GetDetailImageUseCaseUseCaseImpl | ||
): GetDetailImageUseCase | ||
} |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/kr/ksw/visitkorea/domain/usecase/detail/GetDetailCommonUseCase.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package kr.ksw.visitkorea.domain.usecase.detail | ||
|
||
import kr.ksw.visitkorea.data.remote.dto.DetailCommonDTO | ||
|
||
interface GetDetailCommonUseCase { | ||
suspend operator fun invoke( | ||
contentId: String | ||
): Result<DetailCommonDTO> | ||
} |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/kr/ksw/visitkorea/domain/usecase/detail/GetDetailCommonUseCaseImpl.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package kr.ksw.visitkorea.domain.usecase.detail | ||
|
||
import kr.ksw.visitkorea.data.remote.dto.DetailCommonDTO | ||
import kr.ksw.visitkorea.data.repository.DetailRepository | ||
import javax.inject.Inject | ||
|
||
class GetDetailCommonUseCaseImpl @Inject constructor( | ||
private val detailRepository: DetailRepository | ||
): GetDetailCommonUseCase { | ||
override suspend fun invoke( | ||
contentId: String | ||
): Result<DetailCommonDTO> { | ||
return detailRepository.getDetailCommon(contentId) | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/kr/ksw/visitkorea/domain/usecase/detail/GetDetailImageUseCase.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package kr.ksw.visitkorea.domain.usecase.detail | ||
|
||
import kr.ksw.visitkorea.data.remote.dto.DetailImageDTO | ||
|
||
interface GetDetailImageUseCase { | ||
suspend operator fun invoke( | ||
contentId: String, | ||
imageYN: String | ||
): Result<List<DetailImageDTO>> | ||
} |
19 changes: 19 additions & 0 deletions
19
...src/main/java/kr/ksw/visitkorea/domain/usecase/detail/GetDetailImageUseCaseUseCaseImpl.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package kr.ksw.visitkorea.domain.usecase.detail | ||
|
||
import kr.ksw.visitkorea.data.remote.dto.DetailImageDTO | ||
import kr.ksw.visitkorea.data.repository.DetailRepository | ||
import javax.inject.Inject | ||
|
||
class GetDetailImageUseCaseUseCaseImpl @Inject constructor( | ||
private val detailRepository: DetailRepository | ||
): GetDetailImageUseCase { | ||
override suspend fun invoke( | ||
contentId: String, | ||
imageYN: String | ||
): Result<List<DetailImageDTO>> { | ||
return detailRepository.getDetailImage( | ||
contentId = contentId, | ||
imageYN = imageYN | ||
) | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/kr/ksw/visitkorea/domain/usecase/detail/GetDetailIntroUseCase.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package kr.ksw.visitkorea.domain.usecase.detail | ||
|
||
import kr.ksw.visitkorea.domain.usecase.model.CommonDetail | ||
|
||
interface GetDetailIntroUseCase { | ||
suspend operator fun invoke( | ||
contentId: String, | ||
contentTypeId: String | ||
): Result<CommonDetail> | ||
} |
20 changes: 20 additions & 0 deletions
20
app/src/main/java/kr/ksw/visitkorea/domain/usecase/detail/GetDetailIntroUseCaseImpl.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package kr.ksw.visitkorea.domain.usecase.detail | ||
|
||
import kr.ksw.visitkorea.data.repository.DetailRepository | ||
import kr.ksw.visitkorea.domain.usecase.mapper.toCommonDetail | ||
import kr.ksw.visitkorea.domain.usecase.model.CommonDetail | ||
import javax.inject.Inject | ||
|
||
class GetDetailIntroUseCaseImpl @Inject constructor( | ||
private val detailRepository: DetailRepository | ||
): GetDetailIntroUseCase { | ||
override suspend fun invoke( | ||
contentId: String, | ||
contentTypeId: String | ||
): Result<CommonDetail> = runCatching { | ||
detailRepository.getDetailIntro( | ||
contentId, | ||
contentTypeId | ||
).getOrThrow().toCommonDetail(contentTypeId) | ||
} | ||
} |
Oops, something went wrong.