콘텐츠 상세 - 폰 언어 설정에 따라 번역 데이터를 조회하도록 수정
This commit is contained in:
@@ -105,6 +105,7 @@ interface AudioContentApi {
|
|||||||
@GET("/audio-content/{id}")
|
@GET("/audio-content/{id}")
|
||||||
fun getAudioContentDetail(
|
fun getAudioContentDetail(
|
||||||
@Path("id") id: Long,
|
@Path("id") id: Long,
|
||||||
|
@Query("languageCode") languageCode: String?,
|
||||||
@Query("timezone") timezone: String,
|
@Query("timezone") timezone: String,
|
||||||
@Header("Authorization") authHeader: String
|
@Header("Authorization") authHeader: String
|
||||||
): Single<ApiResponse<GetAudioContentDetailResponse>>
|
): Single<ApiResponse<GetAudioContentDetailResponse>>
|
||||||
|
|||||||
@@ -70,8 +70,13 @@ class AudioContentRepository(
|
|||||||
authHeader = token
|
authHeader = token
|
||||||
)
|
)
|
||||||
|
|
||||||
fun getAudioContentDetail(audioContentId: Long, token: String) = api.getAudioContentDetail(
|
fun getAudioContentDetail(
|
||||||
|
audioContentId: Long,
|
||||||
|
languageCode: String? = null,
|
||||||
|
token: String
|
||||||
|
) = api.getAudioContentDetail(
|
||||||
id = audioContentId,
|
id = audioContentId,
|
||||||
|
languageCode = languageCode,
|
||||||
timezone = TimeZone.getDefault().id,
|
timezone = TimeZone.getDefault().id,
|
||||||
authHeader = token
|
authHeader = token
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import kr.co.vividnext.sodalive.common.Constants
|
|||||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||||
import kr.co.vividnext.sodalive.common.Utils
|
import kr.co.vividnext.sodalive.common.Utils
|
||||||
|
import kr.co.vividnext.sodalive.common.Utils.getCurrentLanguageCode
|
||||||
import kr.co.vividnext.sodalive.databinding.ActivityAudioContentDetailBinding
|
import kr.co.vividnext.sodalive.databinding.ActivityAudioContentDetailBinding
|
||||||
import kr.co.vividnext.sodalive.explorer.profile.CreatorFollowNotifyFragment
|
import kr.co.vividnext.sodalive.explorer.profile.CreatorFollowNotifyFragment
|
||||||
import kr.co.vividnext.sodalive.explorer.profile.UserProfileActivity
|
import kr.co.vividnext.sodalive.explorer.profile.UserProfileActivity
|
||||||
@@ -129,6 +130,7 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
|||||||
}
|
}
|
||||||
|
|
||||||
bindData()
|
bindData()
|
||||||
|
viewModel.languageCode = getCurrentLanguageCode(applicationContext)
|
||||||
viewModel.getAudioContentDetail(audioContentId = audioContentId) { finish() }
|
viewModel.getAudioContentDetail(audioContentId = audioContentId) { finish() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,7 +455,7 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
title = it.title
|
title = it.translated?.title ?: it.title
|
||||||
setupCreatorArea(it.creator)
|
setupCreatorArea(it.creator)
|
||||||
setupMosaicArea(it.isMosaic)
|
setupMosaicArea(it.isMosaic)
|
||||||
setupPlayArea(it)
|
setupPlayArea(it)
|
||||||
@@ -907,13 +909,13 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
|||||||
binding.tvRemainingTime.visibility = View.GONE
|
binding.tvRemainingTime.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.tvTitle.text = response.title
|
binding.tvTitle.text = response.translated?.title ?: response.title
|
||||||
binding.tvDetail.text = response.detail
|
binding.tvDetail.text = response.translated?.detail ?: response.detail
|
||||||
binding.tvDetail.setOnClickListener { viewModel.toggleExpandDetail() }
|
binding.tvDetail.setOnClickListener { viewModel.toggleExpandDetail() }
|
||||||
|
|
||||||
if (response.tag.isNotBlank()) {
|
if (response.tag.isNotBlank()) {
|
||||||
binding.tvTag.visibility = View.VISIBLE
|
binding.tvTag.visibility = View.VISIBLE
|
||||||
binding.tvTag.text = response.tag
|
binding.tvTag.text = response.translated?.tags ?: response.tag
|
||||||
} else {
|
} else {
|
||||||
binding.tvTag.visibility = View.GONE
|
binding.tvTag.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,10 +55,15 @@ class AudioContentDetailViewModel(
|
|||||||
val isContentPlayLoopLiveData: LiveData<Boolean>
|
val isContentPlayLoopLiveData: LiveData<Boolean>
|
||||||
get() = _isContentPlayLoopLiveData
|
get() = _isContentPlayLoopLiveData
|
||||||
|
|
||||||
|
var languageCode: String = "ko"
|
||||||
|
|
||||||
private fun getString(@StringRes resId: Int, vararg args: Any) =
|
private fun getString(@StringRes resId: Int, vararg args: Any) =
|
||||||
SodaLiveApplicationHolder.get().getString(resId, *args)
|
SodaLiveApplicationHolder.get().getString(resId, *args)
|
||||||
|
|
||||||
fun getAudioContentDetail(audioContentId: Long, onFailure: (() -> Unit)? = null) {
|
fun getAudioContentDetail(
|
||||||
|
audioContentId: Long,
|
||||||
|
onFailure: (() -> Unit)? = null
|
||||||
|
) {
|
||||||
if (!isLoading.value!!) {
|
if (!isLoading.value!!) {
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
}
|
}
|
||||||
@@ -66,6 +71,7 @@ class AudioContentDetailViewModel(
|
|||||||
compositeDisposable.add(
|
compositeDisposable.add(
|
||||||
repository.getAudioContentDetail(
|
repository.getAudioContentDetail(
|
||||||
audioContentId = audioContentId,
|
audioContentId = audioContentId,
|
||||||
|
languageCode = languageCode,
|
||||||
token = "Bearer ${SharedPreferenceManager.token}"
|
token = "Bearer ${SharedPreferenceManager.token}"
|
||||||
)
|
)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ data class GetAudioContentDetailResponse(
|
|||||||
@SerializedName("previousContent") val previousContent: OtherContentResponse?,
|
@SerializedName("previousContent") val previousContent: OtherContentResponse?,
|
||||||
@SerializedName("nextContent") val nextContent: OtherContentResponse?,
|
@SerializedName("nextContent") val nextContent: OtherContentResponse?,
|
||||||
@SerializedName("buyerList") val buyerList: List<ContentBuyer>,
|
@SerializedName("buyerList") val buyerList: List<ContentBuyer>,
|
||||||
@SerializedName("isAvailableUsePoint") val isAvailableUsePoint: Boolean
|
@SerializedName("isAvailableUsePoint") val isAvailableUsePoint: Boolean,
|
||||||
|
@SerializedName("translated") val translated: TranslatedContent?
|
||||||
)
|
)
|
||||||
|
|
||||||
@Keep
|
@Keep
|
||||||
@@ -68,3 +69,10 @@ data class ContentBuyer(
|
|||||||
@SerializedName("nickname") val nickname: String,
|
@SerializedName("nickname") val nickname: String,
|
||||||
@SerializedName("profileImageUrl") val profileImageUrl: String
|
@SerializedName("profileImageUrl") val profileImageUrl: String
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
data class TranslatedContent(
|
||||||
|
@SerializedName("title") val title: String?,
|
||||||
|
@SerializedName("detail") val detail: String?,
|
||||||
|
@SerializedName("tags") val tags: String?
|
||||||
|
)
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class AlarmActivity : BaseActivity<ActivityAlarmBinding>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getContent(contentId: Long) {
|
private fun getContent(contentId: Long) {
|
||||||
contentViewModel.getAudioContentDetail(contentId) {}
|
contentViewModel.getAudioContentDetail(contentId, {},)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bindData() {
|
private fun bindData() {
|
||||||
|
|||||||
Reference in New Issue
Block a user