라이브 - 커버이미지 수정방식 변경

AS-IS : 방 정보를 가져올 때 마다 변경
TO-BE : 이전 이미지 url과 다른 경우 에만 커버이미지 변경
This commit is contained in:
klaus 2024-01-01 21:08:04 +09:00
parent bf3e6230a0
commit bd1800c2b5
2 changed files with 12 additions and 3 deletions

View File

@ -30,9 +30,7 @@ import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import coil.ImageLoader
import coil.load
import coil.request.CachePolicy
import coil.transform.CircleCropTransformation
import com.github.dhaval2404.imagepicker.ImagePicker
import com.google.gson.Gson
@ -675,7 +673,6 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
}
binding.tvTitle.text = response.title
binding.ivCover.loadUrl(response.coverImageUrl)
binding.flDonation.visibility =
if (response.creatorId != SharedPreferenceManager.userId) {
@ -859,6 +856,10 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
viewModel.totalDonationCan.observe(this) {
binding.tvTotalCan.text = it.moneyFormat()
}
viewModel.coverImageUrlLiveData.observe(this) {
binding.ivCover.loadUrl(it)
}
}
private fun initRouletteSettingButton(isHost: Boolean) {

View File

@ -66,6 +66,10 @@ class LiveRoomViewModel(
val userProfileLiveData: LiveData<GetLiveRoomUserProfileResponse>
get() = _userProfileLiveData
private val _coverImageUrlLiveData = MutableLiveData("")
val coverImageUrlLiveData: LiveData<String>
get() = _coverImageUrlLiveData
lateinit var roomInfoResponse: GetRoomInfoResponse
fun isRoomInfoInitialized() = this::roomInfoResponse.isInitialized
@ -195,6 +199,10 @@ class LiveRoomViewModel(
Logger.e("data: ${it.data}")
_roomInfoLiveData.postValue(roomInfoResponse)
if (_coverImageUrlLiveData.value!! != roomInfoResponse.coverImageUrl) {
_coverImageUrlLiveData.value = roomInfoResponse.coverImageUrl
}
getTotalDonationCan(roomId = roomId)
if (userId > 0 && it.data.creatorId == SharedPreferenceManager.userId) {