라이브 방 룰렛 - 룰렛 결과 전송 데이터 수정, 룰렛 설정 완료 메시지 수정
This commit is contained in:
parent
e4a92e0f2b
commit
c2b99552da
|
@ -1260,11 +1260,10 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||||
|
|
||||||
private fun spinRoulette() {
|
private fun spinRoulette() {
|
||||||
viewModel.spinRoulette(roomId = roomId) { can, items, randomlySelectedItem ->
|
viewModel.spinRoulette(roomId = roomId) { can, items, randomlySelectedItem ->
|
||||||
val rawMessage = "[$randomlySelectedItem] 당첨!"
|
|
||||||
val rouletteRawMessage = Gson().toJson(
|
val rouletteRawMessage = Gson().toJson(
|
||||||
LiveRoomChatRawMessage(
|
LiveRoomChatRawMessage(
|
||||||
type = LiveRoomChatRawMessageType.ROULETTE_DONATION,
|
type = LiveRoomChatRawMessageType.ROULETTE_DONATION,
|
||||||
message = rawMessage,
|
message = randomlySelectedItem,
|
||||||
can = can,
|
can = can,
|
||||||
donationMessage = "",
|
donationMessage = "",
|
||||||
)
|
)
|
||||||
|
@ -1284,7 +1283,7 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||||
LiveRoomRouletteDonationChat(
|
LiveRoomRouletteDonationChat(
|
||||||
profileUrl = SharedPreferenceManager.profileImage,
|
profileUrl = SharedPreferenceManager.profileImage,
|
||||||
nickname = SharedPreferenceManager.nickname,
|
nickname = SharedPreferenceManager.nickname,
|
||||||
chat = rawMessage
|
rouletteResult = randomlySelectedItem
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
invalidateChat()
|
invalidateChat()
|
||||||
|
@ -1388,7 +1387,7 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
||||||
LiveRoomRouletteDonationChat(
|
LiveRoomRouletteDonationChat(
|
||||||
profileUrl = profileUrl,
|
profileUrl = profileUrl,
|
||||||
nickname = nickname,
|
nickname = nickname,
|
||||||
chat = rawMessage.message
|
rouletteResult = rawMessage.message
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
invalidateChat()
|
invalidateChat()
|
||||||
|
|
|
@ -340,10 +340,11 @@ data class LiveRoomDonationChat(
|
||||||
data class LiveRoomRouletteDonationChat(
|
data class LiveRoomRouletteDonationChat(
|
||||||
@SerializedName("profileUrl") val profileUrl: String,
|
@SerializedName("profileUrl") val profileUrl: String,
|
||||||
@SerializedName("nickname") val nickname: String,
|
@SerializedName("nickname") val nickname: String,
|
||||||
@SerializedName("chat") val chat: String
|
@SerializedName("rouletteResult") val rouletteResult: String
|
||||||
) : LiveRoomChat() {
|
) : LiveRoomChat() {
|
||||||
override fun bind(context: Context, binding: ViewBinding, onClickProfile: ((Long) -> Unit)?) {
|
override fun bind(context: Context, binding: ViewBinding, onClickProfile: ((Long) -> Unit)?) {
|
||||||
val itemBinding = binding as ItemLiveRoomChatBinding
|
val itemBinding = binding as ItemLiveRoomChatBinding
|
||||||
|
val chat = "[$rouletteResult] 당첨!"
|
||||||
val spChat = SpannableString(chat)
|
val spChat = SpannableString(chat)
|
||||||
spChat.setSpan(
|
spChat.setSpan(
|
||||||
ForegroundColorSpan(
|
ForegroundColorSpan(
|
||||||
|
|
|
@ -139,7 +139,12 @@ class RouletteSettingsViewModel(private val repository: RouletteRepository) : Ba
|
||||||
{
|
{
|
||||||
_isLoading.value = false
|
_isLoading.value = false
|
||||||
if (it.success && it.data != null && it.data is Boolean) {
|
if (it.success && it.data != null && it.data is Boolean) {
|
||||||
_toastLiveData.postValue("룰렛이 설정되었습니다.")
|
val message = if (it.data) {
|
||||||
|
"룰렛을 활성화 했습니다."
|
||||||
|
} else {
|
||||||
|
"룰렛을 비활성화 했습니다."
|
||||||
|
}
|
||||||
|
_toastLiveData.postValue(message)
|
||||||
onSuccess(it.data)
|
onSuccess(it.data)
|
||||||
} else {
|
} else {
|
||||||
if (it.message != null) {
|
if (it.message != null) {
|
||||||
|
|
Loading…
Reference in New Issue