fix(live-room): 라이브 룸 팔로우 버튼 알림 상태를 반영한다
This commit is contained in:
@@ -200,9 +200,13 @@ class LiveRepository(
|
|||||||
|
|
||||||
fun creatorFollow(
|
fun creatorFollow(
|
||||||
creatorId: Long,
|
creatorId: Long,
|
||||||
|
notify: Boolean = true,
|
||||||
token: String
|
token: String
|
||||||
) = userApi.creatorFollow(
|
) = userApi.creatorFollow(
|
||||||
request = CreatorFollowRequestRequest(creatorId = creatorId),
|
request = CreatorFollowRequestRequest(
|
||||||
|
creatorId = creatorId,
|
||||||
|
isNotify = notify
|
||||||
|
),
|
||||||
authHeader = token
|
authHeader = token
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
|||||||
import kr.co.vividnext.sodalive.common.SodaLiveService
|
import kr.co.vividnext.sodalive.common.SodaLiveService
|
||||||
import kr.co.vividnext.sodalive.databinding.ActivityLiveRoomBinding
|
import kr.co.vividnext.sodalive.databinding.ActivityLiveRoomBinding
|
||||||
import kr.co.vividnext.sodalive.dialog.LiveDialog
|
import kr.co.vividnext.sodalive.dialog.LiveDialog
|
||||||
|
import kr.co.vividnext.sodalive.explorer.profile.CreatorFollowNotifyFragment
|
||||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||||
import kr.co.vividnext.sodalive.extensions.loadUrl
|
import kr.co.vividnext.sodalive.extensions.loadUrl
|
||||||
import kr.co.vividnext.sodalive.extensions.moneyFormat
|
import kr.co.vividnext.sodalive.extensions.moneyFormat
|
||||||
@@ -156,6 +157,7 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
|||||||
private var isAvailableLikeHeart = false
|
private var isAvailableLikeHeart = false
|
||||||
private var buttonPosition = IntArray(2)
|
private var buttonPosition = IntArray(2)
|
||||||
private var isEntryMessageEnabled = true
|
private var isEntryMessageEnabled = true
|
||||||
|
private var isCreatorFollowNotifyEnabled = true
|
||||||
|
|
||||||
// joinChannel 중복 호출 방지 플래그
|
// joinChannel 중복 호출 방지 플래그
|
||||||
private var hasInvokedJoinChannel = false
|
private var hasInvokedJoinChannel = false
|
||||||
@@ -694,6 +696,92 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun bindCreatorFollowButton(response: GetRoomInfoResponse) {
|
||||||
|
val isMyRoom = response.creatorId == SharedPreferenceManager.userId
|
||||||
|
|
||||||
|
if (isMyRoom) {
|
||||||
|
binding.ivCreatorFollow.visibility = View.GONE
|
||||||
|
binding.ivCreatorFollow.setOnClickListener(null)
|
||||||
|
binding.llViewUsers.visibility = View.VISIBLE
|
||||||
|
binding.llViewUsers.setOnClickListener { roomProfileDialog.show() }
|
||||||
|
isCreatorFollowNotifyEnabled = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.llViewUsers.visibility = View.GONE
|
||||||
|
binding.llViewUsers.setOnClickListener(null)
|
||||||
|
binding.ivCreatorFollow.visibility = View.VISIBLE
|
||||||
|
|
||||||
|
if (!response.isFollowing) {
|
||||||
|
isCreatorFollowNotifyEnabled = true
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.ivCreatorFollow.setImageResource(
|
||||||
|
if (response.isFollowing) {
|
||||||
|
if (isCreatorFollowNotifyEnabled) {
|
||||||
|
R.drawable.btn_following_big
|
||||||
|
} else {
|
||||||
|
R.drawable.btn_following_no_alarm_big
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
R.drawable.btn_follow_big
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
binding.ivCreatorFollow.setOnClickListener {
|
||||||
|
if (response.isFollowing) {
|
||||||
|
showCreatorFollowNotifyDialog(response.creatorId)
|
||||||
|
} else {
|
||||||
|
isCreatorFollowNotifyEnabled = true
|
||||||
|
viewModel.creatorFollow(
|
||||||
|
creatorId = response.creatorId,
|
||||||
|
roomId = roomId
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showCreatorFollowNotifyDialog(creatorId: Long) {
|
||||||
|
if (
|
||||||
|
supportFragmentManager.findFragmentByTag(
|
||||||
|
CreatorFollowNotifyFragment::class.java.simpleName
|
||||||
|
) != null
|
||||||
|
) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val notifyFragment = CreatorFollowNotifyFragment(
|
||||||
|
onClickNotifyAll = {
|
||||||
|
isCreatorFollowNotifyEnabled = true
|
||||||
|
viewModel.creatorFollow(
|
||||||
|
creatorId = creatorId,
|
||||||
|
roomId = roomId,
|
||||||
|
notify = true
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onClickNotifyNone = {
|
||||||
|
isCreatorFollowNotifyEnabled = false
|
||||||
|
viewModel.creatorFollow(
|
||||||
|
creatorId = creatorId,
|
||||||
|
roomId = roomId,
|
||||||
|
notify = false
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onClickUnFollow = {
|
||||||
|
isCreatorFollowNotifyEnabled = true
|
||||||
|
viewModel.creatorUnFollow(
|
||||||
|
creatorId = creatorId,
|
||||||
|
roomId = roomId
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
notifyFragment.show(
|
||||||
|
supportFragmentManager,
|
||||||
|
CreatorFollowNotifyFragment::class.java.simpleName
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
private fun bindData() {
|
private fun bindData() {
|
||||||
viewModel.isBgOn.observe(this) {
|
viewModel.isBgOn.observe(this) {
|
||||||
@@ -958,12 +1046,7 @@ class LiveRoomActivity : BaseActivity<ActivityLiveRoomBinding>(ActivityLiveRoomB
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.creatorId == SharedPreferenceManager.userId) {
|
bindCreatorFollowButton(response)
|
||||||
binding.llViewUsers.visibility = View.VISIBLE
|
|
||||||
binding.llViewUsers.setOnClickListener { roomProfileDialog.show() }
|
|
||||||
} else {
|
|
||||||
binding.llViewUsers.visibility = View.GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.tvParticipate.text = "${response.participantsCount}"
|
binding.tvParticipate.text = "${response.participantsCount}"
|
||||||
setNoticeAndClickableUrl(binding.tvNotice, response.notice)
|
setNoticeAndClickableUrl(binding.tvNotice, response.notice)
|
||||||
|
|||||||
@@ -432,12 +432,18 @@ class LiveRoomViewModel(
|
|||||||
onSuccess(message)
|
onSuccess(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun creatorFollow(creatorId: Long, roomId: Long, isGetUserProfile: Boolean = false) {
|
fun creatorFollow(
|
||||||
|
creatorId: Long,
|
||||||
|
roomId: Long,
|
||||||
|
notify: Boolean = true,
|
||||||
|
isGetUserProfile: Boolean = false
|
||||||
|
) {
|
||||||
_isLoading.value = true
|
_isLoading.value = true
|
||||||
compositeDisposable.add(
|
compositeDisposable.add(
|
||||||
repository.creatorFollow(
|
repository.creatorFollow(
|
||||||
creatorId,
|
creatorId = creatorId,
|
||||||
"Bearer ${SharedPreferenceManager.token}"
|
notify = notify,
|
||||||
|
token = "Bearer ${SharedPreferenceManager.token}"
|
||||||
)
|
)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
|||||||
@@ -526,6 +526,15 @@
|
|||||||
tools:text="999,999" />
|
tools:text="999,999" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_creator_follow"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="5.3dp"
|
||||||
|
android:contentDescription="@null"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:src="@drawable/btn_follow_big" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll_view_users"
|
android:id="@+id/ll_view_users"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|||||||
14
docs/20260305_라이브룸팔로우버튼추가.md
Normal file
14
docs/20260305_라이브룸팔로우버튼추가.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# 라이브 룸 팔로우/팔로잉 버튼 추가
|
||||||
|
|
||||||
|
## 구현 체크리스트
|
||||||
|
- [x] `activity_live_room.xml`에 방장 팔로우/팔로잉 이미지 버튼 위치 추가(참여자 수 영역)
|
||||||
|
- [x] `LiveRoomActivity.kt`에 방장 본인 제외 노출 조건 및 팔로우/팔로잉 버튼 상태 처리 추가
|
||||||
|
- [x] `UserProfileActivity`의 팔로잉 다이얼로그(`CreatorFollowNotifyFragment`) 패턴을 라이브 룸에 거의 동일하게 적용
|
||||||
|
- [x] 관련 뷰모델/리포지토리 팔로우 호출 파라미터 정렬
|
||||||
|
- [x] 변경 파일 진단 및 테스트 수행
|
||||||
|
|
||||||
|
## 검증 기록
|
||||||
|
- (대기) 구현 후 기록 예정
|
||||||
|
- 2026-03-05: `./gradlew :app:testDebugUnitTest :app:assembleDebug` 실행, 단위 테스트/디버그 빌드 모두 성공(BUILD SUCCESSFUL).
|
||||||
|
- 2026-03-05: `./gradlew :app:ktlintCheck` 실행, 저장소 전반의 기존 규칙 위반(`:app:ktlintMainSourceSetCheck`)으로 실패 확인(이번 변경 파일 한정 이슈 아님).
|
||||||
|
- 2026-03-05: Kotlin/XML LSP 진단 도구는 현재 환경에 서버 미구성으로 실행 불가(`No LSP server configured for extension: .kt/.xml`).
|
||||||
Reference in New Issue
Block a user