feat(home): 최근 활동 LIVE 라우팅을 추가한다
This commit is contained in:
@@ -707,6 +707,10 @@ class HomeMainFragment : BaseFragment<FragmentV2MainHomeBinding>(
|
||||
private fun onRecentActivityClick(item: HomeRecommendationRecentlyActiveCreatorUiModel) {
|
||||
val route = item.toHomeRecommendationRecentlyActiveCreatorRoute() ?: return
|
||||
when (route) {
|
||||
is HomeRecommendationRecentlyActiveCreatorRoute.LiveRoom -> liveActionCoordinator.enterLiveRoom(route.roomId)
|
||||
is HomeRecommendationRecentlyActiveCreatorRoute.CreatorChannel -> handleCreatorAction(
|
||||
CreatorActionCommand.Profile(route.creatorId)
|
||||
)
|
||||
is HomeRecommendationRecentlyActiveCreatorRoute.AudioContent -> handleContentAction(
|
||||
ContentActionCommand.AudioDetail(audioContentId = route.contentId)
|
||||
)
|
||||
|
||||
+1
@@ -34,6 +34,7 @@ data class HomeBannerItem(
|
||||
|
||||
@Keep
|
||||
data class HomeActiveCreatorItem(
|
||||
@SerializedName("creatorId") val creatorId: Long,
|
||||
@SerializedName("creatorNickname") val creatorNickname: String,
|
||||
@SerializedName("creatorProfileImage") val creatorProfileImage: String,
|
||||
@SerializedName("activityType") val activityType: String,
|
||||
|
||||
+1
@@ -44,6 +44,7 @@ fun HomeBannerItem.toUiModel(): HomeRecommendationBannerUiModel = HomeRecommenda
|
||||
fun HomeActiveCreatorItem.toUiModel(): HomeRecommendationRecentlyActiveCreatorUiModel {
|
||||
val creatorActivityType = CreatorActivityType.from(activityType)
|
||||
return HomeRecommendationRecentlyActiveCreatorUiModel(
|
||||
creatorId = creatorId,
|
||||
nickname = creatorNickname,
|
||||
profileImage = creatorProfileImage,
|
||||
activityType = creatorActivityType,
|
||||
|
||||
+15
-4
@@ -116,6 +116,7 @@ fun HomeRecommendationBannerRoute.toHomeRecommendationBannerIntent(context: Cont
|
||||
private fun homeRecommendationAppLinkHost(): String = "${BuildConfig.APPSCHEME}.onelink.me"
|
||||
|
||||
data class HomeRecommendationRecentlyActiveCreatorUiModel(
|
||||
val creatorId: Long,
|
||||
val nickname: String,
|
||||
val profileImage: String,
|
||||
val activityType: CreatorActivityType?,
|
||||
@@ -125,6 +126,10 @@ data class HomeRecommendationRecentlyActiveCreatorUiModel(
|
||||
)
|
||||
|
||||
sealed interface HomeRecommendationRecentlyActiveCreatorRoute {
|
||||
data class LiveRoom(val roomId: Long) : HomeRecommendationRecentlyActiveCreatorRoute
|
||||
|
||||
data class CreatorChannel(val creatorId: Long) : HomeRecommendationRecentlyActiveCreatorRoute
|
||||
|
||||
data class AudioContent(val contentId: Long) : HomeRecommendationRecentlyActiveCreatorRoute
|
||||
|
||||
data class Community(val postId: Long) : HomeRecommendationRecentlyActiveCreatorRoute
|
||||
@@ -132,12 +137,18 @@ sealed interface HomeRecommendationRecentlyActiveCreatorRoute {
|
||||
|
||||
fun HomeRecommendationRecentlyActiveCreatorUiModel.toHomeRecommendationRecentlyActiveCreatorRoute():
|
||||
HomeRecommendationRecentlyActiveCreatorRoute? {
|
||||
val routeTargetId = targetId?.takeIf { it > 0 } ?: return null
|
||||
return when (activityType) {
|
||||
CreatorActivityType.Live -> null
|
||||
CreatorActivityType.Live -> when {
|
||||
targetId == null -> creatorId.takeIf { it > 0L }
|
||||
?.let(HomeRecommendationRecentlyActiveCreatorRoute::CreatorChannel)
|
||||
targetId > 0L -> HomeRecommendationRecentlyActiveCreatorRoute.LiveRoom(targetId)
|
||||
else -> null
|
||||
}
|
||||
CreatorActivityType.LiveReplay,
|
||||
CreatorActivityType.Audio -> HomeRecommendationRecentlyActiveCreatorRoute.AudioContent(routeTargetId)
|
||||
CreatorActivityType.Community -> HomeRecommendationRecentlyActiveCreatorRoute.Community(routeTargetId)
|
||||
CreatorActivityType.Audio -> targetId?.takeIf { it > 0L }
|
||||
?.let(HomeRecommendationRecentlyActiveCreatorRoute::AudioContent)
|
||||
CreatorActivityType.Community -> targetId?.takeIf { it > 0L }
|
||||
?.let(HomeRecommendationRecentlyActiveCreatorRoute::Community)
|
||||
null -> null
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user