라이브 입장 메시지 on/off 스위치 추가

- 라이브 정보 수정 가장 아래에 입장 메시지 on/off 스위치 추가
This commit is contained in:
klaus 2025-04-15 16:19:10 +09:00
parent c5a173138c
commit 710015d89e
4 changed files with 75 additions and 6 deletions

View File

@ -175,6 +175,7 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
private var isShowSignatureImage = false
private var isAvailableLikeHeart = false
private var buttonPosition = IntArray(2)
private var isEntryMessageEnabled = true
private val countDownTimer = object : CountDownTimer(remainingNoChattingTime * 1000, 1000) {
override fun onTick(millisUntilFinished: Long) {
@ -865,7 +866,8 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
if (it && !SharedPreferenceManager.isAuth) {
agora.muteAllRemoteAudioStreams(true)
binding.rvChat.visibility = View.INVISIBLE
SodaDialog(this@LiveRoomActivity,
SodaDialog(
this@LiveRoomActivity,
layoutInflater,
"알림",
"지금 참여하던 라이브는 '19세 이상' 연령제한이 설정되어 정보통신망 이용촉진 및 정보 보호 등에 관한 법률 및 청소년 보호법의 규정에 의해 만 19세 미만의 청소년은 이용할 수 없습니다.\n마이페이지에서 본인인증 후 다시 이용하시기 바랍니다.",
@ -949,11 +951,16 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
roomInfoEditDialog.setRoomInfo(
response.title,
response.notice,
response.isAdult
response.isAdult,
isEntryMessageEnabled
)
roomInfoEditDialog.setCoverImageUrl(response.coverImageUrl)
roomInfoEditDialog.setMenuPreset(it)
roomInfoEditDialog.setConfirmAction { newTitle, newContent, newCoverImageUri, isActivateMenu, menuId, menu, isAdult ->
roomInfoEditDialog.setConfirmAction { newTitle, newContent, newCoverImageUri, isActivateMenu, menuId, menu, isAdult, isEntryMessageEnabled ->
if (isEntryMessageEnabled != null) {
this.isEntryMessageEnabled = isEntryMessageEnabled
}
viewModel.editLiveRoomInfo(
response.roomId,
newTitle,
@ -1843,7 +1850,7 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
override fun onMemberJoined(member: RtmChannelMember) {
Logger.e("onMemberJoined: ${member.userId}")
viewModel.getRoomInfo(roomId, member.userId.toInt()) {
if (it.isNotBlank()) {
if (it.isNotBlank() && isEntryMessageEnabled) {
chatAdapter.items.add(LiveRoomJoinChat(it))
invalidateChat()
}

View File

@ -452,6 +452,15 @@ class LiveRoomViewModel(
isAdult = isAdult
)
if (
request.title == null &&
request.notice == null &&
menu == roomInfoResponse.menuPan &&
request.isAdult == null
) {
return
}
val requestJson = if (
request.title != null ||
request.notice != null ||

View File

@ -42,11 +42,13 @@ class LiveRoomInfoEditDialog(
private val isAdultLiveData = MutableLiveData(false)
private val isActivateMenuLiveData = MutableLiveData(false)
private val isEntryMessageEnabledLiveData = MutableLiveData(true)
private val selectedMenuLiveData = MutableLiveData<LiveRoomCreateViewModel.SelectedMenu>()
private var menu: String = ""
private var isAdult: Boolean = false
private var isActivateMenu: Boolean? = null
private var isEntryMessageEnabled: Boolean = false
private lateinit var selectedMenu: LiveRoomCreateViewModel.SelectedMenu
@ -108,6 +110,10 @@ class LiveRoomInfoEditDialog(
dialogView.llAdult.visibility = View.GONE
}
dialogView.ivEntryMessageSwitch.setOnClickListener {
isEntryMessageEnabledLiveData.value = !isEntryMessageEnabledLiveData.value!!
}
selectedMenuLiveData.observe(activity) {
deselectAllMenuPreset()
@ -151,18 +157,32 @@ class LiveRoomInfoEditDialog(
}
)
}
isEntryMessageEnabledLiveData.observe(activity) {
dialogView.ivEntryMessageSwitch.setImageResource(
if (it) {
R.drawable.btn_toggle_on_big
} else {
R.drawable.btn_toggle_off_big
}
)
}
}
fun setRoomInfo(
currentTitle: String,
currentContent: String,
isAdult: Boolean
isAdult: Boolean,
isEntryMessageEnabled: Boolean
) {
dialogView.etTitle.setText(currentTitle)
dialogView.etNotice.setText(currentContent)
this.isAdult = isAdult
isAdultLiveData.value = isAdult
this.isEntryMessageEnabled = isEntryMessageEnabled
isEntryMessageEnabledLiveData.value = isEntryMessageEnabled
}
fun setCoverImageUri(coverImageUri: Uri) {
@ -202,7 +222,9 @@ class LiveRoomInfoEditDialog(
}
}
fun setConfirmAction(confirmAction: (String, String, Uri?, Boolean?, Long, String, Boolean?) -> Unit) {
fun setConfirmAction(
confirmAction: (String, String, Uri?, Boolean?, Long, String, Boolean?, Boolean?) -> Unit
) {
dialogView.tvConfirm.setOnClickListener {
alertDialog.dismiss()
@ -233,6 +255,11 @@ class LiveRoomInfoEditDialog(
isAdultLiveData.value!!
} else {
null
},
if (isEntryMessageEnabled != isEntryMessageEnabledLiveData.value!!) {
isEntryMessageEnabledLiveData.value!!
} else {
null
}
)
coverImageUri = null

View File

@ -343,6 +343,32 @@
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="13.3dp"
android:layout_marginTop="33.3dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:fontFamily="@font/gmarket_sans_bold"
android:lineSpacingExtra="5sp"
android:text="입장 메시지"
android:textColor="@color/color_eeeeee"
android:textSize="16.7sp" />
<ImageView
android:id="@+id/iv_entry_message_switch"
android:layout_width="33.3dp"
android:layout_height="20dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:contentDescription="@null"
android:src="@drawable/btn_toggle_on_big" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"