라이브 메인

- 로그인 하지 않고도 페이지를 조회할 수 있도록 수정
This commit is contained in:
klaus 2025-03-22 06:47:56 +09:00
parent 7ab2779805
commit 489b968ea3
5 changed files with 128 additions and 60 deletions

View File

@ -51,6 +51,7 @@ import kr.co.vividnext.sodalive.live.room.dialog.LiveCancelDialog
import kr.co.vividnext.sodalive.live.room.dialog.LivePaymentDialog import kr.co.vividnext.sodalive.live.room.dialog.LivePaymentDialog
import kr.co.vividnext.sodalive.live.room.dialog.LiveRoomPasswordDialog import kr.co.vividnext.sodalive.live.room.dialog.LiveRoomPasswordDialog
import kr.co.vividnext.sodalive.live.room.update.LiveRoomEditActivity import kr.co.vividnext.sodalive.live.room.update.LiveRoomEditActivity
import kr.co.vividnext.sodalive.main.MainActivity
import kr.co.vividnext.sodalive.message.MessageActivity import kr.co.vividnext.sodalive.message.MessageActivity
import kr.co.vividnext.sodalive.settings.event.EventDetailActivity import kr.co.vividnext.sodalive.settings.event.EventDetailActivity
import kr.co.vividnext.sodalive.settings.notification.MemberRole import kr.co.vividnext.sodalive.settings.notification.MemberRole
@ -105,11 +106,15 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
setupCommunityPost() setupCommunityPost()
binding.llReviewLive.setOnClickListener { binding.llReviewLive.setOnClickListener {
startActivity( if (SharedPreferenceManager.token.isNotBlank()) {
Intent(requireContext(), AudioContentAllByThemeActivity::class.java).apply { startActivity(
putExtra(Constants.EXTRA_THEME_ID, 7L) Intent(requireContext(), AudioContentAllByThemeActivity::class.java).apply {
} putExtra(Constants.EXTRA_THEME_ID, 7L)
) }
)
} else {
(requireActivity() as MainActivity).showLoginActivity()
}
} }
message = "라이브를 불러오고 있습니다." message = "라이브를 불러오고 있습니다."
@ -155,8 +160,20 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
private fun setupRecommendLive() { private fun setupRecommendLive() {
binding.layoutRecommendLive.ivMessage.visibility = if (
SharedPreferenceManager.token.isNotBlank()
) {
View.VISIBLE
} else {
View.GONE
}
binding.layoutRecommendLive.ivMessage.setOnClickListener { binding.layoutRecommendLive.ivMessage.setOnClickListener {
startActivity(Intent(requireContext(), MessageActivity::class.java)) if (SharedPreferenceManager.token.isNotBlank()) {
startActivity(Intent(requireContext(), MessageActivity::class.java))
} else {
(requireActivity() as MainActivity).showLoginActivity()
}
} }
val layoutParams = binding val layoutParams = binding
@ -176,11 +193,15 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
binding.layoutRecommendLive.pager.apply { binding.layoutRecommendLive.pager.apply {
adapter = RecommendLiveAdapter(requireContext(), pagerWidth.roundToInt(), pagerHeight) { adapter = RecommendLiveAdapter(requireContext(), pagerWidth.roundToInt(), pagerHeight) {
startActivity( if (SharedPreferenceManager.token.isNotBlank()) {
Intent(requireContext(), UserProfileActivity::class.java).apply { startActivity(
putExtra(Constants.EXTRA_USER_ID, it) Intent(requireContext(), UserProfileActivity::class.java).apply {
} putExtra(Constants.EXTRA_USER_ID, it)
) }
)
} else {
(requireActivity() as MainActivity).showLoginActivity()
}
} as BaseBannerAdapter<Any> } as BaseBannerAdapter<Any>
setLifecycleRegistry(lifecycle) setLifecycleRegistry(lifecycle)
@ -215,14 +236,22 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
private fun setupRecommendChannel() { private fun setupRecommendChannel() {
liveRecommendChannelAdapter = LiveRecommendChannelAdapter( liveRecommendChannelAdapter = LiveRecommendChannelAdapter(
onClick = { onClick = {
startActivity( if (SharedPreferenceManager.token.isNotBlank()) {
Intent(requireContext(), UserProfileActivity::class.java).apply { startActivity(
putExtra(Constants.EXTRA_USER_ID, it) Intent(requireContext(), UserProfileActivity::class.java).apply {
} putExtra(Constants.EXTRA_USER_ID, it)
) }
)
} else {
(requireActivity() as MainActivity).showLoginActivity()
}
}, },
onClickMore = { onClickMore = {
startActivity(Intent(requireContext(), FollowingCreatorActivity::class.java)) if (SharedPreferenceManager.token.isNotBlank()) {
startActivity(Intent(requireContext(), FollowingCreatorActivity::class.java))
} else {
(requireActivity() as MainActivity).showLoginActivity()
}
} }
) )
@ -264,8 +293,16 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
}) })
binding.layoutRecommendChannel.rvRecommendChannel.adapter = liveRecommendChannelAdapter binding.layoutRecommendChannel.rvRecommendChannel.adapter = liveRecommendChannelAdapter
binding.layoutRecommendChannel.ivSwitch.setOnClickListener {
viewModel.toggleIsFollowedCreatorLive() if (SharedPreferenceManager.token.isNotBlank()) {
binding.layoutRecommendChannel.tvFollowingChannel.visibility = View.VISIBLE
binding.layoutRecommendChannel.ivSwitch.visibility = View.VISIBLE
binding.layoutRecommendChannel.ivSwitch.setOnClickListener {
viewModel.toggleIsFollowedCreatorLive()
}
} else {
binding.layoutRecommendChannel.tvFollowingChannel.visibility = View.GONE
binding.layoutRecommendChannel.ivSwitch.visibility = View.GONE
} }
viewModel.recommendChannelLiveData.observe(viewLifecycleOwner) { viewModel.recommendChannelLiveData.observe(viewLifecycleOwner) {
@ -297,7 +334,11 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
.layoutLiveNow .layoutLiveNow
.tvAllView .tvAllView
.setOnClickListener { .setOnClickListener {
startActivity(Intent(requireContext(), LiveNowAllActivity::class.java)) if (SharedPreferenceManager.token.isNotBlank()) {
startActivity(Intent(requireContext(), LiveNowAllActivity::class.java))
} else {
(requireActivity() as MainActivity).showLoginActivity()
}
} }
binding binding
@ -389,20 +430,24 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
.rvSudaReservation .rvSudaReservation
liveReservationAdapter = LiveReservationAdapter(isMain = true) { liveReservationAdapter = LiveReservationAdapter(isMain = true) {
val detailFragment = LiveRoomDetailFragment( if (SharedPreferenceManager.token.isNotBlank()) {
it.roomId, val detailFragment = LiveRoomDetailFragment(
onClickParticipant = {}, it.roomId,
onClickReservation = { reservationRoom(it.roomId) }, onClickParticipant = {},
onClickModify = { roomDetailResponse -> modifyLive(roomDetailResponse) }, onClickReservation = { reservationRoom(it.roomId) },
onClickStart = { startLive(it.roomId) }, onClickModify = { roomDetailResponse -> modifyLive(roomDetailResponse) },
onClickCancel = { cancelLive(it.roomId) } onClickStart = { startLive(it.roomId) },
) onClickCancel = { cancelLive(it.roomId) }
if (detailFragment.isAdded) return@LiveReservationAdapter )
if (detailFragment.isAdded) return@LiveReservationAdapter
detailFragment.show( detailFragment.show(
requireActivity().supportFragmentManager, requireActivity().supportFragmentManager,
detailFragment.tag detailFragment.tag
) )
} else {
(requireActivity() as MainActivity).showLoginActivity()
}
} }
recyclerView.layoutManager = LinearLayoutManager( recyclerView.layoutManager = LinearLayoutManager(
@ -465,9 +510,16 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
} }
binding.layoutLiveReservation.tvAllView.setOnClickListener { binding.layoutLiveReservation.tvAllView.setOnClickListener {
startActivity( if (SharedPreferenceManager.token.isNotBlank()) {
Intent(requireContext(), LiveReservationAllActivity::class.java) startActivity(
) Intent(
requireContext(),
LiveReservationAllActivity::class.java
)
)
} else {
(requireActivity() as MainActivity).showLoginActivity()
}
} }
} }
@ -480,17 +532,21 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
binding.eventBannerSlider.apply { binding.eventBannerSlider.apply {
adapter = EventBannerAdapter(requireContext()) { adapter = EventBannerAdapter(requireContext()) {
if (it.detailImageUrl != null) { if (SharedPreferenceManager.token.isNotBlank()) {
val intent = Intent(requireActivity(), EventDetailActivity::class.java) if (it.detailImageUrl != null) {
intent.putExtra(Constants.EXTRA_EVENT, it) val intent = Intent(requireActivity(), EventDetailActivity::class.java)
startActivity(intent) intent.putExtra(Constants.EXTRA_EVENT, it)
} else if (!it.link.isNullOrBlank()) { startActivity(intent)
startActivity( } else if (!it.link.isNullOrBlank()) {
Intent( startActivity(
Intent.ACTION_VIEW, Intent(
Uri.parse(it.link) Intent.ACTION_VIEW,
Uri.parse(it.link)
)
) )
) }
} else {
(requireActivity() as MainActivity).showLoginActivity()
} }
} as BaseBannerAdapter<Any> } as BaseBannerAdapter<Any>
setLifecycleRegistry(lifecycle) setLifecycleRegistry(lifecycle)
@ -558,25 +614,29 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
}) })
creatorCommunityAdapter = CreatorCommunityAdapter { creatorCommunityAdapter = CreatorCommunityAdapter {
startActivity( if (SharedPreferenceManager.token.isNotBlank()) {
Intent( startActivity(
requireActivity(), Intent(
CreatorCommunityAllActivity::class.java requireActivity(),
).apply { CreatorCommunityAllActivity::class.java
putExtra(Constants.EXTRA_COMMUNITY_CREATOR_ID, it) ).apply {
} putExtra(Constants.EXTRA_COMMUNITY_CREATOR_ID, it)
) }
)
} else {
(requireActivity() as MainActivity).showLoginActivity()
}
} }
binding.rvCommunityPost.adapter = creatorCommunityAdapter recyclerView.adapter = creatorCommunityAdapter
viewModel.communityPostItemLiveData.observe(viewLifecycleOwner) { viewModel.communityPostItemLiveData.observe(viewLifecycleOwner) {
if (it.isNotEmpty()) { if (it.isNotEmpty()) {
binding.rvCommunityPost.visibility = View.VISIBLE recyclerView.visibility = View.VISIBLE
creatorCommunityAdapter.items.clear() creatorCommunityAdapter.items.clear()
creatorCommunityAdapter.items.addAll(it) creatorCommunityAdapter.items.addAll(it)
creatorCommunityAdapter.notifyDataSetChanged() creatorCommunityAdapter.notifyDataSetChanged()
} else { } else {
binding.rvCommunityPost.visibility = View.GONE recyclerView.visibility = View.GONE
} }
} }
} }

View File

@ -179,7 +179,10 @@ class LiveViewModel(
} else { } else {
getRecommendChannelList() getRecommendChannelList()
} }
getLatestPostListFromCreatorsYouFollow()
if (SharedPreferenceManager.token.isNotBlank()) {
getLatestPostListFromCreatorsYouFollow()
}
val liveNow = repository.roomList( val liveNow = repository.roomList(
status = LiveRoomStatus.NOW, status = LiveRoomStatus.NOW,

View File

@ -188,7 +188,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl
override fun onNewIntent(intent: Intent) { override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent) super.onNewIntent(intent)
executeDeeplink(intent)
if (SharedPreferenceManager.token.isNotBlank()) {
executeDeeplink(intent)
}
} }
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {

View File

@ -75,7 +75,8 @@
android:id="@+id/rv_community_post" android:id="@+id/rv_community_post"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="40dp" /> android:layout_marginTop="40dp"
android:visibility="gone" />
<include <include
android:id="@+id/layout_live_reservation" android:id="@+id/layout_live_reservation"

View File

@ -60,6 +60,7 @@
</LinearLayout> </LinearLayout>
<TextView <TextView
android:id="@+id/tv_following_channel"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"