diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/CreatorChannelActivity.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/CreatorChannelActivity.kt index fb49a428..b84ba2e5 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/CreatorChannelActivity.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/CreatorChannelActivity.kt @@ -6,7 +6,7 @@ import android.graphics.Color import android.view.View import android.view.View.MeasureSpec import android.widget.LinearLayout -import android.widget.Toast +import androidx.appcompat.app.AlertDialog import androidx.core.view.ViewCompat import androidx.core.view.WindowCompat import androidx.core.view.WindowInsetsCompat @@ -22,11 +22,12 @@ import kr.co.vividnext.sodalive.base.BaseActivity import kr.co.vividnext.sodalive.chat.talk.room.ChatRoomActivity import kr.co.vividnext.sodalive.common.Constants import kr.co.vividnext.sodalive.databinding.ActivityCreatorChannelBinding -import kr.co.vividnext.sodalive.explorer.profile.CreatorFollowNotifyFragment import kr.co.vividnext.sodalive.extensions.dpToPx import kr.co.vividnext.sodalive.extensions.loadUrl import kr.co.vividnext.sodalive.extensions.moneyFormat import kr.co.vividnext.sodalive.live.room.detail.LiveRoomDetailFragment +import kr.co.vividnext.sodalive.report.ProfileReportDialog +import kr.co.vividnext.sodalive.report.UserReportDialog import kr.co.vividnext.sodalive.v2.common.CreatorActivityType import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelAudioContentResponse import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelScheduleResponse @@ -34,6 +35,7 @@ import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelHeaderUiM import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelScrollState import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelTab import kr.co.vividnext.sodalive.v2.creator.channel.model.CreatorChannelTitleBarState +import kr.co.vividnext.sodalive.v2.main.MainV2Activity import kr.co.vividnext.sodalive.v2.main.chat.dm.DmChatRoomActivity class CreatorChannelActivity : @@ -68,18 +70,23 @@ class CreatorChannelActivity : private fun setupClickListeners() { binding.ivBack.setOnClickListener { finish() } binding.ivMore.setOnClickListener { onMoreClicked() } - binding.layoutFollowCapsule.setOnClickListener { onFollowActionClicked() } - binding.ivBell.setOnClickListener { onFollowActionClicked() } + binding.layoutFollowCapsule.setOnClickListener { onFollowCapsuleClicked() } + binding.ivBell.setOnClickListener { onBellClicked() } binding.tvChatButton.setOnClickListener { currentHeader?.characterId?.let { characterId -> homeActionDelegate?.createChatRoom(characterId) } } binding.tvDmButton.setOnClickListener { - startActivity(DmChatRoomActivity.newIntentByCreatorId(this, creatorId)) + if (currentHeader?.isOwner == true) { + startActivity(MainV2Activity.newChatDmIntent(this)) + } else { + startActivity(DmChatRoomActivity.newIntentByCreatorId(this, creatorId)) + } } } private fun bindHeader(header: CreatorChannelHeaderUiModel) { binding.tvNickname.text = header.nickname + binding.tvTitleNickname.text = header.nickname binding.tvFollowerCount.text = getString( R.string.creator_channel_follower_count, header.followerCount.moneyFormat() @@ -89,12 +96,24 @@ class CreatorChannelActivity : error(R.drawable.ic_placeholder_profile) } updateActionButtonLayout( - isChatVisible = header.isAiChatAvailable && header.characterId != null, - isDmVisible = header.isDmAvailable + isChatVisible = !header.isOwner && header.isAiChatAvailable && header.characterId != null, + isDmVisible = header.isOwner || header.isDmAvailable + ) + binding.tvDmButton.setText( + if (header.isOwner) R.string.creator_channel_dm_check_button else R.string.creator_channel_dm_button ) } private fun bindTitleBar(header: CreatorChannelHeaderUiModel) { + if (header.isOwner) { + binding.layoutFollowCapsule.visibility = View.GONE + binding.ivBell.visibility = View.GONE + binding.ivMore.visibility = View.GONE + return + } + + binding.layoutFollowCapsule.visibility = View.VISIBLE + binding.ivMore.visibility = View.VISIBLE val titleBarState = CreatorChannelTitleBarState.from( isFollow = header.isFollow, isNotify = header.isNotify, @@ -122,24 +141,25 @@ class CreatorChannelActivity : } } - private fun onFollowActionClicked() { + private fun onFollowCapsuleClicked() { if (isFollowInProgress) return val header = currentHeader ?: return + if (header.isOwner) return if (!header.isFollow) { homeActionDelegate?.follow(follow = true, notify = true) return } - showFollowNotifyFragment() + homeActionDelegate?.follow(follow = false, notify = false) } - private fun showFollowNotifyFragment() { - val notifyFragment = CreatorFollowNotifyFragment( - onClickNotifyAll = { homeActionDelegate?.follow(follow = true, notify = true) }, - onClickNotifyNone = { homeActionDelegate?.follow(follow = true, notify = false) }, - onClickUnFollow = { homeActionDelegate?.follow(follow = false, notify = false) } - ) - notifyFragment.show(supportFragmentManager, CreatorFollowNotifyFragment::class.java.simpleName) + private fun onBellClicked() { + if (isFollowInProgress) return + val header = currentHeader ?: return + if (header.isOwner) return + if (!header.isFollow) return + + homeActionDelegate?.follow(follow = true, notify = !header.isNotify) } private fun setTitleBarTopInset() { @@ -181,6 +201,7 @@ class CreatorChannelActivity : binding.titleBarContainer.setBackgroundColor( if (shouldUseBlackTitleBar) Color.BLACK else Color.TRANSPARENT ) + binding.tvTitleNickname.isVisible = shouldUseBlackTitleBar } private fun setStatusBarIconAppearance() { @@ -196,7 +217,38 @@ class CreatorChannelActivity : } private fun onMoreClicked() { - Toast.makeText(applicationContext, getString(R.string.creator_channel_more_ready), Toast.LENGTH_SHORT).show() + val header = currentHeader ?: return + if (header.isOwner) return + + CreatorChannelMoreBottomSheet.newInstance().apply { + onClickBlock = { showUserBlockDialog() } + onClickUserReport = { showUserReportDialog() } + onClickProfileReport = { showProfileReportDialog() } + }.show(supportFragmentManager, CreatorChannelMoreBottomSheet::class.java.simpleName) + } + + private fun showUserBlockDialog() { + val nickname = currentHeader?.nickname.orEmpty() + AlertDialog.Builder(this) + .setTitle(getString(R.string.screen_live_room_block_title)) + .setMessage(getString(R.string.screen_live_room_block_message_user, nickname)) + .setPositiveButton(getString(R.string.screen_live_room_block_confirm)) { _, _ -> + homeActionDelegate?.blockUser() + } + .setNegativeButton(getString(R.string.cancel)) { _, _ -> } + .show() + } + + private fun showUserReportDialog() { + UserReportDialog(this, layoutInflater) { reason -> + homeActionDelegate?.reportUser(reason) + }.show(resources.displayMetrics.widthPixels) + } + + private fun showProfileReportDialog() { + ProfileReportDialog(this, layoutInflater) { + homeActionDelegate?.reportProfile() + }.show(resources.displayMetrics.widthPixels) } private fun setupTabsAndPager() { diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/CreatorChannelHomeFragment.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/CreatorChannelHomeFragment.kt index 839e3f24..b2d3f9a6 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/CreatorChannelHomeFragment.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/creator/channel/CreatorChannelHomeFragment.kt @@ -37,6 +37,18 @@ class CreatorChannelHomeFragment : BaseFragment 0L) { @@ -98,6 +110,9 @@ class CreatorChannelHomeFragment : BaseFragment%1$s followers Chat Now Send DM + Check DMs Follow + Following has been canceled. + Blocked. Live now Latest audio Support @@ -299,7 +302,6 @@ %1$s · Total %2$d Be the first\nto cheer them on! Leave support - Live %1$d · %2$d hours · %3$d contributors · Audio %4$d · Series %5$d Debut %1$s (%2$s) Total lives diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index ba862d6a..b79d68c9 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -281,7 +281,10 @@ フォロワー %1$s人 トークする DMを送る + DMを確認 フォロー + フォローを解除しました。 + ブロックしました。 配信中 最新オーディオ 応援 @@ -299,7 +302,6 @@ %1$s · 全体 %2$d 最初の応援を\n待っています! 応援を残す - ライブ %1$d回 · 累計 %2$d時間 · 参加者 %3$d人 · オーディオ %4$d件 · シリーズ %5$d件 デビュー %1$s(%2$s) ライブ総配信数 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4e30531a..682a5afd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -280,7 +280,10 @@ 팔로워 %1$s명 대화하기 DM 보내기 + DM 확인하기 팔로우 + 팔로잉이 취소되었습니다. + 차단하였습니다. 현재 라이브 최신 오디오 후원 @@ -298,7 +301,6 @@ %1$s · 전체 %2$d 당신의 첫 응원을\n기다리고 있어요! 응원 남기기 - 라이브 %1$d회 · 누적 %2$d시간 · 참여자 %3$d명 · 오디오 %4$d개 · 시리즈 %5$d개 데뷔 %1$s(%2$s) 라이브 총 진행 수