refactor(v2): 도메인 액션 경로를 통합한다
This commit is contained in:
@@ -5,19 +5,22 @@ import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import kr.co.vividnext.sodalive.audio_content.detail.AudioContentDetailActivity
|
||||
import kr.co.vividnext.sodalive.audio_content.series.detail.SeriesDetailActivity
|
||||
import kr.co.vividnext.sodalive.app.SodaLiveApp
|
||||
import kr.co.vividnext.sodalive.audition.AuditionActivity
|
||||
import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.explorer.profile.creator_community.all.CreatorCommunityAllActivity
|
||||
import kr.co.vividnext.sodalive.live.room.LiveRoomActivity
|
||||
import kr.co.vividnext.sodalive.message.MessageActivity
|
||||
import kr.co.vividnext.sodalive.mypage.can.payment.CanPaymentActivity
|
||||
import kr.co.vividnext.sodalive.splash.SplashActivity
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.CreatorChannelActivity
|
||||
import kr.co.vividnext.sodalive.v2.chat.action.ChatActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.chat.action.handleChatAction
|
||||
import kr.co.vividnext.sodalive.v2.community.action.CommunityActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.community.action.handleCommunityAction
|
||||
import kr.co.vividnext.sodalive.v2.content.action.ContentActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.content.action.handleContentAction
|
||||
import kr.co.vividnext.sodalive.v2.creator.action.CreatorActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.creator.action.handleCreatorAction
|
||||
import kr.co.vividnext.sodalive.v2.main.MainV2Activity
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.dm.DmChatRoomActivity
|
||||
import java.util.Locale
|
||||
|
||||
class DeepLinkActivity : AppCompatActivity() {
|
||||
@@ -276,7 +279,7 @@ class DeepLinkActivity : AppCompatActivity() {
|
||||
?: bundle.getLong(Constants.EXTRA_COMMUNITY_POST_ID).takeIf { it > 0 }
|
||||
|
||||
if (isDmChatDeepLink(bundle) && roomId != null && roomId > 0) {
|
||||
startActivity(DmChatRoomActivity.newIntentByRoomId(applicationContext, roomId))
|
||||
handleChatAction(ChatActionCommand.DmRoom(roomId))
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -286,36 +289,29 @@ class DeepLinkActivity : AppCompatActivity() {
|
||||
return true
|
||||
}
|
||||
|
||||
communityPostId != null && communityPostId > 0 -> {
|
||||
handleCommunityAction(CommunityActionCommand.PostDetail(communityPostId))
|
||||
return true
|
||||
}
|
||||
|
||||
channelId != null && channelId > 0 -> {
|
||||
startActivity(
|
||||
CreatorChannelActivity.newIntent(applicationContext, channelId)
|
||||
)
|
||||
handleCreatorAction(CreatorActionCommand.Profile(channelId))
|
||||
return true
|
||||
}
|
||||
|
||||
contentId != null && contentId > 0 -> {
|
||||
startActivity(
|
||||
Intent(applicationContext, AudioContentDetailActivity::class.java).apply {
|
||||
putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, contentId)
|
||||
}
|
||||
)
|
||||
handleContentAction(ContentActionCommand.AudioDetail(contentId))
|
||||
return true
|
||||
}
|
||||
|
||||
messageId != null && messageId > 0 -> {
|
||||
// messageId는 DM room ID가 아니므로 과거 알림 수신 호환만 유지한다.
|
||||
startActivity(Intent(applicationContext, MessageActivity::class.java))
|
||||
return true
|
||||
}
|
||||
|
||||
communityCreatorId != null && communityCreatorId > 0 -> {
|
||||
startActivity(
|
||||
Intent(applicationContext, CreatorCommunityAllActivity::class.java).apply {
|
||||
putExtra(Constants.EXTRA_COMMUNITY_CREATOR_ID, communityCreatorId)
|
||||
if (communityPostId != null && communityPostId > 0) {
|
||||
putExtra(Constants.EXTRA_COMMUNITY_POST_ID, communityPostId)
|
||||
}
|
||||
}
|
||||
)
|
||||
handleCreatorAction(CreatorActionCommand.Profile(communityCreatorId))
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -345,11 +341,7 @@ class DeepLinkActivity : AppCompatActivity() {
|
||||
return false
|
||||
}
|
||||
|
||||
startActivity(
|
||||
Intent(applicationContext, SeriesDetailActivity::class.java).apply {
|
||||
putExtra(Constants.EXTRA_SERIES_ID, deepLinkValueId)
|
||||
}
|
||||
)
|
||||
handleContentAction(ContentActionCommand.SeriesDetail(deepLinkValueId))
|
||||
true
|
||||
}
|
||||
|
||||
@@ -358,11 +350,7 @@ class DeepLinkActivity : AppCompatActivity() {
|
||||
return false
|
||||
}
|
||||
|
||||
startActivity(
|
||||
Intent(applicationContext, AudioContentDetailActivity::class.java).apply {
|
||||
putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, deepLinkValueId)
|
||||
}
|
||||
)
|
||||
handleContentAction(ContentActionCommand.AudioDetail(deepLinkValueId))
|
||||
true
|
||||
}
|
||||
|
||||
@@ -371,9 +359,7 @@ class DeepLinkActivity : AppCompatActivity() {
|
||||
return false
|
||||
}
|
||||
|
||||
startActivity(
|
||||
CreatorChannelActivity.newIntent(applicationContext, deepLinkValueId)
|
||||
)
|
||||
handleCreatorAction(CreatorActionCommand.Profile(deepLinkValueId))
|
||||
true
|
||||
}
|
||||
|
||||
@@ -391,15 +377,13 @@ class DeepLinkActivity : AppCompatActivity() {
|
||||
return false
|
||||
}
|
||||
|
||||
startActivity(
|
||||
Intent(applicationContext, CreatorCommunityAllActivity::class.java).apply {
|
||||
putExtra(Constants.EXTRA_COMMUNITY_CREATOR_ID, deepLinkValueId)
|
||||
}
|
||||
)
|
||||
// deepLinkValueId는 legacy creatorId이며 postId는 routeForegroundDeepLink에서 먼저 처리한다.
|
||||
handleCreatorAction(CreatorActionCommand.Profile(deepLinkValueId))
|
||||
true
|
||||
}
|
||||
|
||||
"message" -> {
|
||||
// 현재 DM은 chat/{roomId} 계약을 사용하며 message는 legacy fallback이다.
|
||||
startActivity(Intent(applicationContext, MessageActivity::class.java))
|
||||
true
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package kr.co.vividnext.sodalive.v2.chat.action
|
||||
|
||||
import kr.co.vividnext.sodalive.v2.access.AccessRequirement
|
||||
|
||||
class ChatAction {
|
||||
fun execute(
|
||||
command: ChatActionCommand,
|
||||
ensureAccess: (AccessRequirement) -> Boolean
|
||||
): ChatActionResult {
|
||||
return when (command) {
|
||||
is ChatActionCommand.AiRoom -> {
|
||||
if (command.roomId <= 0L) return ChatActionResult.Ignored
|
||||
if (!ensureAccess(AccessRequirement.Login)) return ChatActionResult.Blocked(AccessRequirement.Login)
|
||||
ChatActionResult.NavigateToAiRoom(command.roomId)
|
||||
}
|
||||
is ChatActionCommand.DmRoom -> {
|
||||
if (command.roomId <= 0L) return ChatActionResult.Ignored
|
||||
if (!ensureAccess(AccessRequirement.Login)) return ChatActionResult.Blocked(AccessRequirement.Login)
|
||||
ChatActionResult.NavigateToDmRoom(command.roomId)
|
||||
}
|
||||
is ChatActionCommand.DmCreator -> {
|
||||
if (command.creatorId <= 0L) return ChatActionResult.Ignored
|
||||
if (!ensureAccess(AccessRequirement.Login)) return ChatActionResult.Blocked(AccessRequirement.Login)
|
||||
ChatActionResult.NavigateToCreatorDm(command.creatorId)
|
||||
}
|
||||
ChatActionCommand.OwnerDmList -> {
|
||||
if (!ensureAccess(AccessRequirement.Login)) return ChatActionResult.Blocked(AccessRequirement.Login)
|
||||
ChatActionResult.NavigateToOwnerDmList
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sealed interface ChatActionResult {
|
||||
data object Ignored : ChatActionResult
|
||||
|
||||
data class Blocked(
|
||||
val requirement: AccessRequirement
|
||||
) : ChatActionResult
|
||||
|
||||
data class NavigateToAiRoom(
|
||||
val roomId: Long
|
||||
) : ChatActionResult
|
||||
|
||||
data class NavigateToDmRoom(
|
||||
val roomId: Long
|
||||
) : ChatActionResult
|
||||
|
||||
data class NavigateToCreatorDm(
|
||||
val creatorId: Long
|
||||
) : ChatActionResult
|
||||
|
||||
data object NavigateToOwnerDmList : ChatActionResult
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package kr.co.vividnext.sodalive.v2.chat.action
|
||||
|
||||
sealed interface ChatActionCommand {
|
||||
data class AiRoom(
|
||||
val roomId: Long
|
||||
) : ChatActionCommand
|
||||
|
||||
data class DmRoom(
|
||||
val roomId: Long
|
||||
) : ChatActionCommand
|
||||
|
||||
data class DmCreator(
|
||||
val creatorId: Long
|
||||
) : ChatActionCommand
|
||||
|
||||
data object OwnerDmList : ChatActionCommand
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package kr.co.vividnext.sodalive.v2.chat.action
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import androidx.annotation.OptIn
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import kr.co.vividnext.sodalive.chat.talk.room.ChatRoomActivity
|
||||
import kr.co.vividnext.sodalive.v2.access.AccessRequirement
|
||||
import kr.co.vividnext.sodalive.v2.access.ensureV2Access
|
||||
import kr.co.vividnext.sodalive.v2.main.MainV2Activity
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.dm.DmChatRoomActivity
|
||||
|
||||
internal class ChatActionHandler(
|
||||
private val action: ChatAction = ChatAction()
|
||||
) {
|
||||
@OptIn(UnstableApi::class)
|
||||
fun handle(
|
||||
context: Context,
|
||||
command: ChatActionCommand,
|
||||
ensureAccess: (AccessRequirement) -> Boolean
|
||||
): ChatActionResult {
|
||||
val result = action.execute(command, ensureAccess)
|
||||
when (result) {
|
||||
is ChatActionResult.NavigateToAiRoom -> context.startActivity(
|
||||
ChatRoomActivity.newIntent(context, result.roomId)
|
||||
)
|
||||
is ChatActionResult.NavigateToDmRoom -> context.startActivity(
|
||||
DmChatRoomActivity.newIntentByRoomId(context, result.roomId)
|
||||
)
|
||||
is ChatActionResult.NavigateToCreatorDm -> context.startActivity(
|
||||
DmChatRoomActivity.newIntentByCreatorId(context, result.creatorId)
|
||||
)
|
||||
ChatActionResult.NavigateToOwnerDmList -> context.startActivity(MainV2Activity.newChatDmIntent(context))
|
||||
is ChatActionResult.Blocked,
|
||||
ChatActionResult.Ignored -> Unit
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
fun Activity.handleChatAction(command: ChatActionCommand): ChatActionResult {
|
||||
return ChatActionHandler().handle(this, command, ::ensureV2Access)
|
||||
}
|
||||
|
||||
fun Fragment.handleChatAction(command: ChatActionCommand): ChatActionResult {
|
||||
return ChatActionHandler().handle(requireContext(), command, ::ensureV2Access)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package kr.co.vividnext.sodalive.v2.community.action
|
||||
|
||||
import kr.co.vividnext.sodalive.v2.access.AccessRequirement
|
||||
|
||||
class CommunityAction {
|
||||
fun execute(
|
||||
command: CommunityActionCommand,
|
||||
ensureAccess: (AccessRequirement) -> Boolean
|
||||
): CommunityActionResult {
|
||||
val postId = when (command) {
|
||||
is CommunityActionCommand.PostDetail -> command.postId
|
||||
}
|
||||
if (postId <= 0L) return CommunityActionResult.Ignored
|
||||
|
||||
val requirement = AccessRequirement.Login
|
||||
if (!ensureAccess(requirement)) return CommunityActionResult.Blocked(requirement)
|
||||
|
||||
return when (command) {
|
||||
is CommunityActionCommand.PostDetail -> CommunityActionResult.NavigateToPostDetail(postId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sealed interface CommunityActionResult {
|
||||
data object Ignored : CommunityActionResult
|
||||
|
||||
data class Blocked(
|
||||
val requirement: AccessRequirement
|
||||
) : CommunityActionResult
|
||||
|
||||
data class NavigateToPostDetail(
|
||||
val postId: Long
|
||||
) : CommunityActionResult
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package kr.co.vividnext.sodalive.v2.community.action
|
||||
|
||||
sealed interface CommunityActionCommand {
|
||||
data class PostDetail(
|
||||
val postId: Long
|
||||
) : CommunityActionCommand
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
package kr.co.vividnext.sodalive.v2.community.action
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.fragment.app.Fragment
|
||||
import kr.co.vividnext.sodalive.v2.access.AccessRequirement
|
||||
import kr.co.vividnext.sodalive.v2.access.ensureV2Access
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.community.detail.CreatorChannelCommunityDetailActivity
|
||||
|
||||
internal class CommunityActionHandler(
|
||||
private val action: CommunityAction = CommunityAction()
|
||||
) {
|
||||
fun handle(
|
||||
context: Context,
|
||||
command: CommunityActionCommand,
|
||||
ensureAccess: (AccessRequirement) -> Boolean,
|
||||
launchIntent: ((Intent) -> Unit)? = null
|
||||
): CommunityActionResult {
|
||||
val result = action.execute(command, ensureAccess)
|
||||
if (result is CommunityActionResult.NavigateToPostDetail) {
|
||||
val intent = CreatorChannelCommunityDetailActivity.newIntent(context, result.postId)
|
||||
if (launchIntent != null) {
|
||||
launchIntent(intent)
|
||||
} else {
|
||||
context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
fun Activity.handleCommunityAction(
|
||||
command: CommunityActionCommand,
|
||||
launchIntent: ((Intent) -> Unit)? = null
|
||||
): CommunityActionResult {
|
||||
return CommunityActionHandler().handle(this, command, ::ensureV2Access, launchIntent)
|
||||
}
|
||||
|
||||
fun Fragment.handleCommunityAction(command: CommunityActionCommand): CommunityActionResult {
|
||||
return CommunityActionHandler().handle(requireContext(), command, ::ensureV2Access)
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package kr.co.vividnext.sodalive.v2.community.action
|
||||
|
||||
import android.app.Activity
|
||||
|
||||
enum class CommunityActivityResultSource {
|
||||
Write,
|
||||
Modify,
|
||||
Detail
|
||||
}
|
||||
|
||||
fun resolveCommunityActivityResult(
|
||||
source: CommunityActivityResultSource,
|
||||
resultCode: Int
|
||||
): CommunityChange {
|
||||
if (resultCode != Activity.RESULT_OK) return CommunityChange.Ignored
|
||||
return when (source) {
|
||||
CommunityActivityResultSource.Write -> CommunityChange.Created
|
||||
CommunityActivityResultSource.Modify,
|
||||
CommunityActivityResultSource.Detail -> CommunityChange.Updated
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package kr.co.vividnext.sodalive.v2.community.action
|
||||
|
||||
sealed interface CommunityChange {
|
||||
data object Ignored : CommunityChange
|
||||
|
||||
data object Created : CommunityChange
|
||||
|
||||
data object Updated : CommunityChange
|
||||
|
||||
data class Deleted(
|
||||
val postId: Long
|
||||
) : CommunityChange
|
||||
|
||||
data class PinChanged(
|
||||
val postId: Long
|
||||
) : CommunityChange
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package kr.co.vividnext.sodalive.v2.creator.action
|
||||
|
||||
import kr.co.vividnext.sodalive.v2.access.AccessRequirement
|
||||
|
||||
class CreatorAction {
|
||||
fun execute(
|
||||
command: CreatorActionCommand,
|
||||
ensureAccess: (AccessRequirement) -> Boolean
|
||||
): CreatorActionResult {
|
||||
val creatorId = when (command) {
|
||||
is CreatorActionCommand.Profile -> command.creatorId
|
||||
}
|
||||
if (creatorId <= 0L) return CreatorActionResult.Ignored
|
||||
|
||||
val requirement = AccessRequirement.Login
|
||||
if (!ensureAccess(requirement)) return CreatorActionResult.Blocked(requirement)
|
||||
|
||||
return when (command) {
|
||||
is CreatorActionCommand.Profile -> CreatorActionResult.NavigateToCreatorProfile(creatorId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sealed interface CreatorActionResult {
|
||||
data object Ignored : CreatorActionResult
|
||||
|
||||
data class Blocked(
|
||||
val requirement: AccessRequirement
|
||||
) : CreatorActionResult
|
||||
|
||||
data class NavigateToCreatorProfile(
|
||||
val creatorId: Long
|
||||
) : CreatorActionResult
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package kr.co.vividnext.sodalive.v2.creator.action
|
||||
|
||||
sealed interface CreatorActionCommand {
|
||||
data class Profile(
|
||||
val creatorId: Long
|
||||
) : CreatorActionCommand
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package kr.co.vividnext.sodalive.v2.creator.action
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import androidx.fragment.app.Fragment
|
||||
import kr.co.vividnext.sodalive.v2.access.AccessRequirement
|
||||
import kr.co.vividnext.sodalive.v2.access.ensureV2Access
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.CreatorChannelActivity
|
||||
|
||||
internal class CreatorActionHandler(
|
||||
private val action: CreatorAction = CreatorAction()
|
||||
) {
|
||||
fun handle(
|
||||
context: Context,
|
||||
command: CreatorActionCommand,
|
||||
ensureAccess: (AccessRequirement) -> Boolean
|
||||
): CreatorActionResult {
|
||||
val result = action.execute(command, ensureAccess)
|
||||
if (result is CreatorActionResult.NavigateToCreatorProfile) {
|
||||
context.startActivity(CreatorChannelActivity.newIntent(context, result.creatorId))
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
fun Activity.handleCreatorAction(command: CreatorActionCommand): CreatorActionResult {
|
||||
return CreatorActionHandler().handle(this, command, ::ensureV2Access)
|
||||
}
|
||||
|
||||
fun Fragment.handleCreatorAction(command: CreatorActionCommand): CreatorActionResult {
|
||||
return CreatorActionHandler().handle(requireContext(), command, ::ensureV2Access)
|
||||
}
|
||||
+35
-23
@@ -27,7 +27,6 @@ import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.audio_content.upload.AudioContentUploadActivity
|
||||
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.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
@@ -47,13 +46,19 @@ import kr.co.vividnext.sodalive.live.room.donation.LiveRoomDonationDialog
|
||||
import kr.co.vividnext.sodalive.report.UserReportDialog
|
||||
import kr.co.vividnext.sodalive.v2.access.AccessRequirement
|
||||
import kr.co.vividnext.sodalive.v2.access.ensureV2Access
|
||||
import kr.co.vividnext.sodalive.v2.chat.action.ChatActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.chat.action.handleChatAction
|
||||
import kr.co.vividnext.sodalive.v2.community.action.CommunityActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.community.action.CommunityActivityResultSource
|
||||
import kr.co.vividnext.sodalive.v2.community.action.CommunityChange
|
||||
import kr.co.vividnext.sodalive.v2.community.action.handleCommunityAction
|
||||
import kr.co.vividnext.sodalive.v2.community.action.resolveCommunityActivityResult
|
||||
import kr.co.vividnext.sodalive.v2.content.action.ContentActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.content.action.handleContentAction
|
||||
import kr.co.vividnext.sodalive.v2.components.modal.V2ModalDialog
|
||||
import kr.co.vividnext.sodalive.v2.common.CreatorActivityType
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.audio.CreatorChannelAudioFragment
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.community.CreatorChannelCommunityFragment
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.community.detail.CreatorChannelCommunityDetailActivity
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.community.model.CreatorChannelCommunityPostUiModel
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelAudioContentResponse
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelLiveResponse
|
||||
@@ -74,8 +79,6 @@ import kr.co.vividnext.sodalive.v2.creator.channel.series.CreatorChannelSeriesFr
|
||||
import kr.co.vividnext.sodalive.v2.live.action.LiveActionCoordinator
|
||||
import kr.co.vividnext.sodalive.v2.live.action.LiveCreationResult
|
||||
import kr.co.vividnext.sodalive.v2.live.action.resolveLiveCreationResult
|
||||
import kr.co.vividnext.sodalive.v2.main.MainV2Activity
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.dm.DmChatRoomActivity
|
||||
import okhttp3.MediaType.Companion.toMediaType
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import org.koin.android.ext.android.inject
|
||||
@@ -118,24 +121,23 @@ class CreatorChannelActivity :
|
||||
private val communityWriteLauncher = registerForActivityResult(
|
||||
ActivityResultContracts.StartActivityForResult()
|
||||
) { result ->
|
||||
if (result.resultCode == RESULT_OK) {
|
||||
homeActionDelegate?.refreshHome()
|
||||
refreshCreatorChannelCommunity()
|
||||
}
|
||||
handleCommunityChange(
|
||||
resolveCommunityActivityResult(CommunityActivityResultSource.Write, result.resultCode)
|
||||
)
|
||||
}
|
||||
private val communityPostModifyLauncher = registerForActivityResult(
|
||||
ActivityResultContracts.StartActivityForResult()
|
||||
) { result ->
|
||||
if (result.resultCode == RESULT_OK) {
|
||||
refreshCreatorChannelCommunity()
|
||||
}
|
||||
handleCommunityChange(
|
||||
resolveCommunityActivityResult(CommunityActivityResultSource.Modify, result.resultCode)
|
||||
)
|
||||
}
|
||||
private val communityDetailLauncher = registerForActivityResult(
|
||||
ActivityResultContracts.StartActivityForResult()
|
||||
) { result ->
|
||||
if (result.resultCode == RESULT_OK) {
|
||||
refreshCreatorChannelCommunity()
|
||||
}
|
||||
handleCommunityChange(
|
||||
resolveCommunityActivityResult(CommunityActivityResultSource.Detail, result.resultCode)
|
||||
)
|
||||
}
|
||||
private val fanTalkWriteLauncher = registerForActivityResult(
|
||||
ActivityResultContracts.StartActivityForResult()
|
||||
@@ -242,9 +244,9 @@ class CreatorChannelActivity :
|
||||
}
|
||||
binding.tvDmButton.setOnClickListener {
|
||||
if (currentHeader?.isOwner == true) {
|
||||
startActivity(MainV2Activity.newChatDmIntent(this))
|
||||
handleChatAction(ChatActionCommand.OwnerDmList)
|
||||
} else {
|
||||
startActivity(DmChatRoomActivity.newIntentByCreatorId(this, creatorId))
|
||||
handleChatAction(ChatActionCommand.DmCreator(creatorId))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -538,7 +540,7 @@ class CreatorChannelActivity :
|
||||
}
|
||||
|
||||
override fun onCreatorChannelChatRoomCreated(chatRoomId: Long) {
|
||||
startActivity(ChatRoomActivity.newIntent(this, chatRoomId))
|
||||
handleChatAction(ChatActionCommand.AiRoom(chatRoomId))
|
||||
}
|
||||
|
||||
override fun onCreatorChannelScheduleClicked(schedule: CreatorChannelScheduleResponse) {
|
||||
@@ -612,10 +614,7 @@ class CreatorChannelActivity :
|
||||
}
|
||||
|
||||
override fun onCreatorChannelCommunityPostClicked(postId: Long) {
|
||||
if (postId <= 0L) return
|
||||
ensureV2Access(AccessRequirement.Login) {
|
||||
communityDetailLauncher.launch(CreatorChannelCommunityDetailActivity.newIntent(this, postId))
|
||||
}
|
||||
handleCommunityAction(CommunityActionCommand.PostDetail(postId), communityDetailLauncher::launch)
|
||||
}
|
||||
|
||||
override fun onCreatorChannelFanTalkContentChanged() {
|
||||
@@ -736,7 +735,7 @@ class CreatorChannelActivity :
|
||||
.subscribe(
|
||||
{ response ->
|
||||
if (response.success) {
|
||||
refreshCreatorChannelCommunity()
|
||||
handleCommunityChange(CommunityChange.PinChanged(item.postId))
|
||||
} else {
|
||||
response.message?.let(::showToast)
|
||||
}
|
||||
@@ -763,7 +762,7 @@ class CreatorChannelActivity :
|
||||
.subscribe(
|
||||
{ response ->
|
||||
if (response.success) {
|
||||
refreshCreatorChannelCommunity()
|
||||
handleCommunityChange(CommunityChange.Deleted(item.postId))
|
||||
} else {
|
||||
response.message?.let(::showToast)
|
||||
}
|
||||
@@ -779,6 +778,19 @@ class CreatorChannelActivity :
|
||||
findCommunityFragment()?.onCreatorChannelCommunityRefreshRequested()
|
||||
}
|
||||
|
||||
private fun handleCommunityChange(change: CommunityChange) {
|
||||
when (change) {
|
||||
CommunityChange.Ignored -> Unit
|
||||
CommunityChange.Created -> {
|
||||
homeActionDelegate?.refreshHome()
|
||||
refreshCreatorChannelCommunity()
|
||||
}
|
||||
CommunityChange.Updated,
|
||||
is CommunityChange.Deleted,
|
||||
is CommunityChange.PinChanged -> refreshCreatorChannelCommunity()
|
||||
}
|
||||
}
|
||||
|
||||
private fun refreshCreatorChannelFanTalk() {
|
||||
findFanTalkFragment()?.onCreatorChannelFanTalkRefreshRequested()
|
||||
}
|
||||
|
||||
@@ -37,14 +37,14 @@ import kr.co.vividnext.sodalive.audio_content.AudioContentPlayService
|
||||
import kr.co.vividnext.sodalive.audio_content.detail.AudioContentDetailActivity
|
||||
import kr.co.vividnext.sodalive.audio_content.player.AudioContentPlayerFragment
|
||||
import kr.co.vividnext.sodalive.audio_content.player.AudioContentPlayerService
|
||||
import kr.co.vividnext.sodalive.audio_content.series.detail.SeriesDetailActivity
|
||||
import kr.co.vividnext.sodalive.audition.AuditionActivity
|
||||
import kr.co.vividnext.sodalive.base.BaseActivity
|
||||
import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
import kr.co.vividnext.sodalive.databinding.ActivityMainV2Binding
|
||||
import kr.co.vividnext.sodalive.explorer.profile.creator_community.all.CreatorCommunityAllActivity
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
import kr.co.vividnext.sodalive.live.LiveViewModel
|
||||
import kr.co.vividnext.sodalive.main.EventPopupDialogFragment
|
||||
import kr.co.vividnext.sodalive.message.MessageActivity
|
||||
import kr.co.vividnext.sodalive.mypage.MyPageFragment
|
||||
@@ -53,10 +53,17 @@ import kr.co.vividnext.sodalive.settings.notification.NotificationSettingsDialog
|
||||
import kr.co.vividnext.sodalive.v2.access.AccessRequirement
|
||||
import kr.co.vividnext.sodalive.v2.access.ensureV2Access
|
||||
import kr.co.vividnext.sodalive.v2.access.isV2AccessAllowed
|
||||
import kr.co.vividnext.sodalive.v2.chat.action.ChatActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.chat.action.handleChatAction
|
||||
import kr.co.vividnext.sodalive.v2.common.data.ContentSort
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.CreatorChannelActivity
|
||||
import kr.co.vividnext.sodalive.v2.community.action.CommunityActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.community.action.handleCommunityAction
|
||||
import kr.co.vividnext.sodalive.v2.content.action.ContentActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.content.action.handleContentAction
|
||||
import kr.co.vividnext.sodalive.v2.creator.action.CreatorActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.creator.action.handleCreatorAction
|
||||
import kr.co.vividnext.sodalive.v2.live.action.LiveActionCoordinator
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.ChatMainFragment
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.dm.DmChatRoomActivity
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.model.ChatRoomFilter
|
||||
import kr.co.vividnext.sodalive.v2.main.content.ContentMainFragment
|
||||
import kr.co.vividnext.sodalive.v2.main.content.data.MainContentAllType
|
||||
@@ -72,19 +79,37 @@ import kotlin.math.max
|
||||
class MainV2Activity : BaseActivity<ActivityMainV2Binding>(ActivityMainV2Binding::inflate) {
|
||||
|
||||
private val viewModel: MainV2ViewModel by inject()
|
||||
private val liveViewModel: LiveViewModel by inject()
|
||||
private val liveActionCoordinator: LiveActionCoordinator by lazy {
|
||||
LiveActionCoordinator(
|
||||
activity = this,
|
||||
layoutInflater = layoutInflater,
|
||||
fragmentManager = supportFragmentManager,
|
||||
liveViewModel = liveViewModel,
|
||||
screenWidthProvider = { screenWidth },
|
||||
refreshHome = {}
|
||||
)
|
||||
}
|
||||
|
||||
private lateinit var notificationSettingsDialog: NotificationSettingsDialog
|
||||
private lateinit var routeLoadingDialog: LoadingDialog
|
||||
private var mediaController: MediaController? = null
|
||||
private var mediaControllerFuture: ListenableFuture<MediaController>? = null
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private val showMiniPlayerRunnable = Runnable { initAndVisibleMiniPlayer() }
|
||||
private val audioContentReceiver = AudioContentReceiver()
|
||||
private var playerStateJob: Job? = null
|
||||
private var isDeferredRouteLoading = false
|
||||
private var isLiveEntryLoading = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
overrideRootWindowInsets()
|
||||
|
||||
isDeferredRouteLoading =
|
||||
intent.hasExtra(Constants.EXTRA_DATA) || intent.hasExtra(EXTRA_AUDIO_NOTIFICATION_ROUTE)
|
||||
updateRouteLoadingDialog()
|
||||
|
||||
checkPermissions()
|
||||
trackAppLaunchIfNeeded()
|
||||
pushTokenUpdate()
|
||||
@@ -93,6 +118,8 @@ class MainV2Activity : BaseActivity<ActivityMainV2Binding>(ActivityMainV2Binding
|
||||
if (!handleAudioNotificationRoute(intent) && isV2AccessAllowed(AccessRequirement.Login)) {
|
||||
executeDeeplink(intent)
|
||||
}
|
||||
isDeferredRouteLoading = false
|
||||
updateRouteLoadingDialog()
|
||||
}, 1000)
|
||||
|
||||
if (isV2AccessAllowed(AccessRequirement.Login)) {
|
||||
@@ -172,12 +199,32 @@ class MainV2Activity : BaseActivity<ActivityMainV2Binding>(ActivityMainV2Binding
|
||||
)
|
||||
}
|
||||
|
||||
setupLiveEntryObservers()
|
||||
setupBottomNavigation()
|
||||
if (intent.hasExtra(EXTRA_CHAT_FILTER)) {
|
||||
selectChatTabWithLoginGuard()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupLiveEntryObservers() {
|
||||
routeLoadingDialog = LoadingDialog(this, layoutInflater)
|
||||
liveViewModel.toastLiveData.observe(this) {
|
||||
it?.let(::showToast)
|
||||
}
|
||||
liveViewModel.isLoading.observe(this) { isLoading ->
|
||||
isLiveEntryLoading = isLoading
|
||||
updateRouteLoadingDialog()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateRouteLoadingDialog() {
|
||||
if (isDeferredRouteLoading || isLiveEntryLoading) {
|
||||
routeLoadingDialog.show(screenWidth)
|
||||
} else {
|
||||
routeLoadingDialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
fun openChatTab() {
|
||||
selectChatTabWithLoginGuard()
|
||||
}
|
||||
@@ -433,15 +480,7 @@ class MainV2Activity : BaseActivity<ActivityMainV2Binding>(ActivityMainV2Binding
|
||||
val contentId = intent.getLongExtra(Constants.EXTRA_AUDIO_CONTENT_ID, 0)
|
||||
intent.removeExtra(Constants.EXTRA_AUDIO_CONTENT_ID)
|
||||
if (contentId > 0) {
|
||||
ensureV2Access(AccessRequirement.Login) {
|
||||
startActivity(
|
||||
Intent(applicationContext, AudioContentDetailActivity::class.java).apply {
|
||||
putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, contentId)
|
||||
}
|
||||
)
|
||||
}
|
||||
} else if (!isV2AccessAllowed(AccessRequirement.Login)) {
|
||||
ensureV2Access(AccessRequirement.Login)
|
||||
handleContentAction(ContentActionCommand.AudioDetail(contentId))
|
||||
}
|
||||
contentId > 0
|
||||
}
|
||||
@@ -566,9 +605,16 @@ class MainV2Activity : BaseActivity<ActivityMainV2Binding>(ActivityMainV2Binding
|
||||
putQuery("content_id")
|
||||
putQuery("deep_link_value")
|
||||
putQuery("deep_link_sub5")
|
||||
putQuery("postId")
|
||||
putQuery(Constants.EXTRA_COMMUNITY_CREATOR_ID)
|
||||
putQuery(Constants.EXTRA_COMMUNITY_POST_ID)
|
||||
|
||||
extras.getString("postId")?.takeIf { it.isNotBlank() }?.let {
|
||||
if (!extras.containsKey(Constants.EXTRA_COMMUNITY_POST_ID)) {
|
||||
extras.putString(Constants.EXTRA_COMMUNITY_POST_ID, it)
|
||||
}
|
||||
}
|
||||
|
||||
applyPathDeepLink(data = data) { key, value ->
|
||||
if (!value.isNullOrBlank() && !extras.containsKey(key)) {
|
||||
extras.putString(key, value)
|
||||
@@ -652,41 +698,39 @@ class MainV2Activity : BaseActivity<ActivityMainV2Binding>(ActivityMainV2Binding
|
||||
?: bundle.getLong(Constants.EXTRA_COMMUNITY_POST_ID).takeIf { it > 0 }
|
||||
|
||||
if (isDmChatDeepLink(bundle) && roomId != null && roomId > 0) {
|
||||
startActivity(DmChatRoomActivity.newIntentByRoomId(applicationContext, roomId))
|
||||
handleChatAction(ChatActionCommand.DmRoom(roomId))
|
||||
return true
|
||||
}
|
||||
|
||||
when {
|
||||
roomId != null && roomId > 0 -> {
|
||||
liveActionCoordinator.enterLiveRoom(roomId)
|
||||
return true
|
||||
}
|
||||
|
||||
communityPostId != null && communityPostId > 0 -> {
|
||||
handleCommunityAction(CommunityActionCommand.PostDetail(communityPostId))
|
||||
return true
|
||||
}
|
||||
|
||||
channelId != null && channelId > 0 -> {
|
||||
startActivity(
|
||||
CreatorChannelActivity.newIntent(applicationContext, channelId)
|
||||
)
|
||||
handleCreatorAction(CreatorActionCommand.Profile(channelId))
|
||||
return true
|
||||
}
|
||||
|
||||
contentId != null && contentId > 0 -> {
|
||||
startActivity(
|
||||
Intent(applicationContext, AudioContentDetailActivity::class.java).apply {
|
||||
putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, contentId)
|
||||
}
|
||||
)
|
||||
handleContentAction(ContentActionCommand.AudioDetail(contentId))
|
||||
return true
|
||||
}
|
||||
|
||||
messageId != null && messageId > 0 -> {
|
||||
// messageId는 DM room ID가 아니므로 과거 알림 수신 호환만 유지한다.
|
||||
startActivity(Intent(applicationContext, MessageActivity::class.java))
|
||||
return true
|
||||
}
|
||||
|
||||
communityCreatorId != null && communityCreatorId > 0 -> {
|
||||
startActivity(
|
||||
Intent(applicationContext, CreatorCommunityAllActivity::class.java).apply {
|
||||
putExtra(Constants.EXTRA_COMMUNITY_CREATOR_ID, communityCreatorId)
|
||||
if (communityPostId != null && communityPostId > 0) {
|
||||
putExtra(Constants.EXTRA_COMMUNITY_POST_ID, communityPostId)
|
||||
}
|
||||
}
|
||||
)
|
||||
handleCreatorAction(CreatorActionCommand.Profile(communityCreatorId))
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -711,11 +755,7 @@ class MainV2Activity : BaseActivity<ActivityMainV2Binding>(ActivityMainV2Binding
|
||||
if (deepLinkValueId == null || deepLinkValueId <= 0) {
|
||||
return false
|
||||
}
|
||||
startActivity(
|
||||
Intent(applicationContext, SeriesDetailActivity::class.java).apply {
|
||||
putExtra(Constants.EXTRA_SERIES_ID, deepLinkValueId)
|
||||
}
|
||||
)
|
||||
handleContentAction(ContentActionCommand.SeriesDetail(deepLinkValueId))
|
||||
true
|
||||
}
|
||||
|
||||
@@ -723,11 +763,7 @@ class MainV2Activity : BaseActivity<ActivityMainV2Binding>(ActivityMainV2Binding
|
||||
if (deepLinkValueId == null || deepLinkValueId <= 0) {
|
||||
return false
|
||||
}
|
||||
startActivity(
|
||||
Intent(applicationContext, AudioContentDetailActivity::class.java).apply {
|
||||
putExtra(Constants.EXTRA_AUDIO_CONTENT_ID, deepLinkValueId)
|
||||
}
|
||||
)
|
||||
handleContentAction(ContentActionCommand.AudioDetail(deepLinkValueId))
|
||||
true
|
||||
}
|
||||
|
||||
@@ -735,9 +771,15 @@ class MainV2Activity : BaseActivity<ActivityMainV2Binding>(ActivityMainV2Binding
|
||||
if (deepLinkValueId == null || deepLinkValueId <= 0) {
|
||||
return false
|
||||
}
|
||||
startActivity(
|
||||
CreatorChannelActivity.newIntent(applicationContext, deepLinkValueId)
|
||||
)
|
||||
handleCreatorAction(CreatorActionCommand.Profile(deepLinkValueId))
|
||||
true
|
||||
}
|
||||
|
||||
"live" -> {
|
||||
if (deepLinkValueId == null || deepLinkValueId <= 0) {
|
||||
return false
|
||||
}
|
||||
liveActionCoordinator.enterLiveRoom(deepLinkValueId)
|
||||
true
|
||||
}
|
||||
|
||||
@@ -745,15 +787,13 @@ class MainV2Activity : BaseActivity<ActivityMainV2Binding>(ActivityMainV2Binding
|
||||
if (deepLinkValueId == null || deepLinkValueId <= 0) {
|
||||
return false
|
||||
}
|
||||
startActivity(
|
||||
Intent(applicationContext, CreatorCommunityAllActivity::class.java).apply {
|
||||
putExtra(Constants.EXTRA_COMMUNITY_CREATOR_ID, deepLinkValueId)
|
||||
}
|
||||
)
|
||||
// deepLinkValueId는 legacy creatorId이며 postId는 executeBundleRoute에서 먼저 처리한다.
|
||||
handleCreatorAction(CreatorActionCommand.Profile(deepLinkValueId))
|
||||
true
|
||||
}
|
||||
|
||||
"message" -> {
|
||||
// 현재 DM은 chat/{roomId} 계약을 사용하며 message는 legacy fallback이다.
|
||||
startActivity(Intent(applicationContext, MessageActivity::class.java))
|
||||
true
|
||||
}
|
||||
|
||||
@@ -11,14 +11,14 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.base.BaseFragment
|
||||
import kr.co.vividnext.sodalive.chat.talk.room.ChatRoomActivity
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.databinding.FragmentV2MainChatBinding
|
||||
import kr.co.vividnext.sodalive.mypage.can.charge.CanChargeActivity
|
||||
import kr.co.vividnext.sodalive.search.SearchActivity
|
||||
import kr.co.vividnext.sodalive.v2.access.AccessRequirement
|
||||
import kr.co.vividnext.sodalive.v2.access.ensureV2Access
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.dm.DmChatRoomActivity
|
||||
import kr.co.vividnext.sodalive.v2.chat.action.ChatActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.chat.action.handleChatAction
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.model.ChatRoomFilter
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.model.ChatRoomListUiItem
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.model.ChatRoomListUiState
|
||||
@@ -173,8 +173,8 @@ class ChatMainFragment : BaseFragment<FragmentV2MainChatBinding>(
|
||||
|
||||
private fun onChatRoomClick(item: ChatRoomListUiItem) {
|
||||
when (item.chatType) {
|
||||
ChatRoomType.AI -> startActivity(ChatRoomActivity.newIntent(requireContext(), item.roomId))
|
||||
ChatRoomType.DM -> startActivity(DmChatRoomActivity.newIntentByRoomId(requireContext(), item.roomId))
|
||||
ChatRoomType.AI -> handleChatAction(ChatActionCommand.AiRoom(item.roomId))
|
||||
ChatRoomType.DM -> handleChatAction(ChatActionCommand.DmRoom(item.roomId))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ import kr.co.vividnext.sodalive.v2.access.AccessRequirement
|
||||
import kr.co.vividnext.sodalive.v2.access.ensureV2Access
|
||||
import kr.co.vividnext.sodalive.v2.content.action.ContentActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.content.action.handleContentAction
|
||||
import kr.co.vividnext.sodalive.v2.creator.action.CreatorActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.creator.action.handleCreatorAction
|
||||
import kr.co.vividnext.sodalive.v2.main.content.data.AudioRankingType
|
||||
import kr.co.vividnext.sodalive.v2.main.content.data.MainContentAllType
|
||||
import kr.co.vividnext.sodalive.v2.main.content.model.AudioRankingsUiState
|
||||
@@ -617,6 +619,9 @@ class ContentMainFragment : BaseFragment<FragmentV2MainContentBinding>(
|
||||
private fun onBannerClick(item: ContentBannerUiModel) {
|
||||
val route = item.toContentBannerRoute() ?: return
|
||||
when (route) {
|
||||
is ContentBannerRoute.Creator -> handleCreatorAction(
|
||||
CreatorActionCommand.Profile(route.creatorId)
|
||||
)
|
||||
is ContentBannerRoute.Series -> handleContentAction(
|
||||
ContentActionCommand.SeriesDetail(seriesId = route.seriesId)
|
||||
)
|
||||
|
||||
+1
-2
@@ -7,7 +7,6 @@ import kr.co.vividnext.sodalive.BuildConfig
|
||||
import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.settings.event.EventDetailActivity
|
||||
import kr.co.vividnext.sodalive.settings.event.EventItem
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.CreatorChannelActivity
|
||||
import kr.co.vividnext.sodalive.v2.widget.AudioContentTag
|
||||
|
||||
data class ContentBannerSection(
|
||||
@@ -68,7 +67,7 @@ fun ContentBannerRoute.toContentBannerIntent(context: Context): Intent? {
|
||||
putExtra(Constants.EXTRA_EVENT, eventItem)
|
||||
}
|
||||
|
||||
is ContentBannerRoute.Creator -> CreatorChannelActivity.newIntent(context, creatorId)
|
||||
is ContentBannerRoute.Creator -> null
|
||||
|
||||
is ContentBannerRoute.Series -> null
|
||||
|
||||
|
||||
@@ -6,28 +6,30 @@ import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.base.BaseFragment
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.common.ToastMessage
|
||||
import kr.co.vividnext.sodalive.common.formatUtcRelativeTimeText
|
||||
import kr.co.vividnext.sodalive.databinding.FragmentV2MainHomeBinding
|
||||
import kr.co.vividnext.sodalive.databinding.ViewSectionTitleBinding
|
||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||
import kr.co.vividnext.sodalive.following.FollowingCreatorActivity
|
||||
import kr.co.vividnext.sodalive.chat.talk.room.ChatRoomActivity
|
||||
import kr.co.vividnext.sodalive.home.pushnotification.PushNotificationListActivity
|
||||
import kr.co.vividnext.sodalive.live.LiveViewModel
|
||||
import kr.co.vividnext.sodalive.mypage.can.charge.CanChargeActivity
|
||||
import kr.co.vividnext.sodalive.search.SearchActivity
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.CreatorChannelActivity
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.community.detail.CreatorChannelCommunityDetailActivity
|
||||
import kr.co.vividnext.sodalive.v2.live.onair.HomeOnAirLiveActivity
|
||||
import kr.co.vividnext.sodalive.v2.live.action.LiveActionCoordinator
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.dm.DmChatRoomActivity
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.model.ChatRoomListUiItem
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.model.ChatRoomType
|
||||
import kr.co.vividnext.sodalive.v2.access.AccessRequirement
|
||||
import kr.co.vividnext.sodalive.v2.access.ensureV2Access
|
||||
import kr.co.vividnext.sodalive.v2.chat.action.ChatActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.chat.action.handleChatAction
|
||||
import kr.co.vividnext.sodalive.v2.community.action.CommunityActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.community.action.handleCommunityAction
|
||||
import kr.co.vividnext.sodalive.v2.content.action.ContentActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.content.action.handleContentAction
|
||||
import kr.co.vividnext.sodalive.v2.creator.action.CreatorActionCommand
|
||||
import kr.co.vividnext.sodalive.v2.creator.action.handleCreatorAction
|
||||
import kr.co.vividnext.sodalive.v2.live.action.LiveActionCoordinator
|
||||
import kr.co.vividnext.sodalive.v2.live.onair.HomeOnAirLiveActivity
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.model.ChatRoomListUiItem
|
||||
import kr.co.vividnext.sodalive.v2.main.chat.model.ChatRoomType
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeFollowingChatSection
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeFollowingCreatorSection
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeFollowingLiveSection
|
||||
@@ -45,6 +47,7 @@ import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationBannerRoute
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationBannerUiModel
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationCheerCreatorSection
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationGenreCreatorSection
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationAiCharacterRoute
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationLiveSection
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationLiveUiModel
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationPopularCommunityPostSection
|
||||
@@ -56,7 +59,6 @@ import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationRecentlyAct
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeRecommendationUiState
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.toHomeRecommendationBannerIntent
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.toHomeRecommendationBannerRoute
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.toHomeRecommendationAiCharacterIntent
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.toHomeRecommendationAiCharacterRoute
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.toHomeRecommendationRecentlyActiveCreatorRoute
|
||||
import kr.co.vividnext.sodalive.v2.main.home.ui.HomeAiCharacterAdapter
|
||||
@@ -556,9 +558,7 @@ class HomeMainFragment : BaseFragment<FragmentV2MainHomeBinding>(
|
||||
val community = item as? HomeFollowingNewsUiItem.Community ?: return
|
||||
val postId = community.postId
|
||||
if (postId <= 0L) return
|
||||
ensureV2Access(AccessRequirement.Login) {
|
||||
startActivity(CreatorChannelCommunityDetailActivity.newIntent(requireContext(), postId))
|
||||
}
|
||||
handleCommunityAction(CommunityActionCommand.PostDetail(postId))
|
||||
}
|
||||
|
||||
private fun openFollowingCreatorAll() {
|
||||
@@ -568,17 +568,18 @@ class HomeMainFragment : BaseFragment<FragmentV2MainHomeBinding>(
|
||||
}
|
||||
|
||||
private fun openFollowingChat(item: ChatRoomListUiItem) {
|
||||
ensureV2Access(AccessRequirement.Login) {
|
||||
when (item.chatType) {
|
||||
ChatRoomType.AI -> startActivity(ChatRoomActivity.newIntent(requireContext(), item.roomId))
|
||||
ChatRoomType.DM -> startActivity(DmChatRoomActivity.newIntentByRoomId(requireContext(), item.roomId))
|
||||
}
|
||||
when (item.chatType) {
|
||||
ChatRoomType.AI -> handleChatAction(ChatActionCommand.AiRoom(item.roomId))
|
||||
ChatRoomType.DM -> handleChatAction(ChatActionCommand.DmRoom(item.roomId))
|
||||
}
|
||||
}
|
||||
|
||||
private fun onBannerClick(item: HomeRecommendationBannerUiModel) {
|
||||
val route = item.toHomeRecommendationBannerRoute() ?: return
|
||||
when (route) {
|
||||
is HomeRecommendationBannerRoute.Creator -> handleCreatorAction(
|
||||
CreatorActionCommand.Profile(route.creatorId)
|
||||
)
|
||||
is HomeRecommendationBannerRoute.Series -> handleContentAction(
|
||||
ContentActionCommand.SeriesDetail(seriesId = route.seriesId)
|
||||
)
|
||||
@@ -594,16 +595,18 @@ class HomeMainFragment : BaseFragment<FragmentV2MainHomeBinding>(
|
||||
is HomeRecommendationRecentlyActiveCreatorRoute.AudioContent -> handleContentAction(
|
||||
ContentActionCommand.AudioDetail(audioContentId = route.contentId)
|
||||
)
|
||||
is HomeRecommendationRecentlyActiveCreatorRoute.Community -> ensureV2Access(AccessRequirement.Login) {
|
||||
startActivity(CreatorChannelCommunityDetailActivity.newIntent(requireContext(), route.postId))
|
||||
}
|
||||
is HomeRecommendationRecentlyActiveCreatorRoute.Community -> handleCommunityAction(
|
||||
CommunityActionCommand.PostDetail(route.postId)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun onAiCharacterClick(item: HomeRecommendationAiCharacterUiModel) {
|
||||
val route = item.toHomeRecommendationAiCharacterRoute() ?: return
|
||||
ensureV2Access(AccessRequirement.Login) {
|
||||
startActivity(route.toHomeRecommendationAiCharacterIntent(requireContext()))
|
||||
when (route) {
|
||||
is HomeRecommendationAiCharacterRoute.Creator -> handleCreatorAction(
|
||||
CreatorActionCommand.Profile(route.creatorId)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -613,18 +616,12 @@ class HomeMainFragment : BaseFragment<FragmentV2MainHomeBinding>(
|
||||
}
|
||||
|
||||
private fun openCreatorProfile(creatorId: Long) {
|
||||
ensureV2Access(AccessRequirement.Login) {
|
||||
startActivity(
|
||||
CreatorChannelActivity.newIntent(requireContext(), creatorId)
|
||||
)
|
||||
}
|
||||
handleCreatorAction(CreatorActionCommand.Profile(creatorId))
|
||||
}
|
||||
|
||||
private fun openPopularCommunityPost(item: FeedItem.Community) {
|
||||
val postId = item.postId.toLongOrNull() ?: return
|
||||
ensureV2Access(AccessRequirement.Login) {
|
||||
startActivity(CreatorChannelCommunityDetailActivity.newIntent(requireContext(), postId))
|
||||
}
|
||||
handleCommunityAction(CommunityActionCommand.PostDetail(postId))
|
||||
}
|
||||
|
||||
private fun showToast(toastMessage: ToastMessage) {
|
||||
|
||||
+3
-11
@@ -8,10 +8,10 @@ import kr.co.vividnext.sodalive.common.Constants
|
||||
import kr.co.vividnext.sodalive.settings.event.EventDetailActivity
|
||||
import kr.co.vividnext.sodalive.settings.event.EventItem
|
||||
import kr.co.vividnext.sodalive.v2.common.CreatorActivityType
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.CreatorChannelActivity
|
||||
import kr.co.vividnext.sodalive.v2.widget.characterchatthumbnail.CharacterChatThumbnailItem
|
||||
import kr.co.vividnext.sodalive.v2.widget.feed.FeedItem
|
||||
import java.util.Locale
|
||||
import androidx.core.net.toUri
|
||||
|
||||
data class HomeRecommendationLiveSection(
|
||||
val items: List<HomeRecommendationLiveUiModel>
|
||||
@@ -105,13 +105,11 @@ fun HomeRecommendationBannerRoute.toHomeRecommendationBannerIntent(context: Cont
|
||||
}
|
||||
}
|
||||
|
||||
is HomeRecommendationBannerRoute.Creator -> {
|
||||
CreatorChannelActivity.newIntent(context, creatorId)
|
||||
}
|
||||
is HomeRecommendationBannerRoute.Creator -> null
|
||||
|
||||
is HomeRecommendationBannerRoute.Series -> null
|
||||
|
||||
is HomeRecommendationBannerRoute.Link -> Intent(Intent.ACTION_VIEW, Uri.parse(url))
|
||||
is HomeRecommendationBannerRoute.Link -> Intent(Intent.ACTION_VIEW, url.toUri())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,12 +161,6 @@ fun HomeRecommendationAiCharacterUiModel.toHomeRecommendationAiCharacterRoute():
|
||||
return creatorId.takeIf { it > 0L }?.let(HomeRecommendationAiCharacterRoute::Creator)
|
||||
}
|
||||
|
||||
fun HomeRecommendationAiCharacterRoute.toHomeRecommendationAiCharacterIntent(context: Context): Intent {
|
||||
return when (this) {
|
||||
is HomeRecommendationAiCharacterRoute.Creator -> CreatorChannelActivity.newIntent(context, creatorId)
|
||||
}
|
||||
}
|
||||
|
||||
data class HomeRecommendationGenreCreatorGroupUiModel(
|
||||
val genre: String,
|
||||
val creators: List<HomeRecommendationCreatorUiModel>,
|
||||
|
||||
Reference in New Issue
Block a user