라이브 방 룰렛 - 룰렛 결과 전송 데이터 수정, 룰렛 설정 완료 메시지 수정

This commit is contained in:
klaus 2023-12-07 04:18:42 +09:00
parent e4a92e0f2b
commit c2b99552da
3 changed files with 11 additions and 6 deletions

View File

@ -1260,11 +1260,10 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
private fun spinRoulette() {
viewModel.spinRoulette(roomId = roomId) { can, items, randomlySelectedItem ->
val rawMessage = "[$randomlySelectedItem] 당첨!"
val rouletteRawMessage = Gson().toJson(
LiveRoomChatRawMessage(
type = LiveRoomChatRawMessageType.ROULETTE_DONATION,
message = rawMessage,
message = randomlySelectedItem,
can = can,
donationMessage = "",
)
@ -1284,7 +1283,7 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
LiveRoomRouletteDonationChat(
profileUrl = SharedPreferenceManager.profileImage,
nickname = SharedPreferenceManager.nickname,
chat = rawMessage
rouletteResult = randomlySelectedItem
)
)
invalidateChat()
@ -1388,7 +1387,7 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
LiveRoomRouletteDonationChat(
profileUrl = profileUrl,
nickname = nickname,
chat = rawMessage.message
rouletteResult = rawMessage.message
)
)
invalidateChat()

View File

@ -340,10 +340,11 @@ data class LiveRoomDonationChat(
data class LiveRoomRouletteDonationChat(
@SerializedName("profileUrl") val profileUrl: String,
@SerializedName("nickname") val nickname: String,
@SerializedName("chat") val chat: String
@SerializedName("rouletteResult") val rouletteResult: String
) : LiveRoomChat() {
override fun bind(context: Context, binding: ViewBinding, onClickProfile: ((Long) -> Unit)?) {
val itemBinding = binding as ItemLiveRoomChatBinding
val chat = "[$rouletteResult] 당첨!"
val spChat = SpannableString(chat)
spChat.setSpan(
ForegroundColorSpan(

View File

@ -139,7 +139,12 @@ class RouletteSettingsViewModel(private val repository: RouletteRepository) : Ba
{
_isLoading.value = false
if (it.success && it.data != null && it.data is Boolean) {
_toastLiveData.postValue("룰렛이 설정되었습니다.")
val message = if (it.data) {
"룰렛을 활성화 했습니다."
} else {
"룰렛을 비활성화 했습니다."
}
_toastLiveData.postValue(message)
onSuccess(it.data)
} else {
if (it.message != null) {