fix(creator): 본인 채널 DM 확인을 추가한다

This commit is contained in:
Yu Sung
2026-07-12 18:48:27 +09:00
parent caa74c607d
commit 4f271a77ee
18 changed files with 63 additions and 12 deletions

View File

@@ -123,7 +123,8 @@ struct CreatorChannelAudioTabView: View {
.foregroundColor(Color.gray500)
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(.vertical, 48)
.padding(.top, 20)
.padding(.bottom, 48)
}
}

View File

@@ -26,9 +26,11 @@ final class CreatorChannelAudioViewModel: ObservableObject {
@Published var isShowPopup = false
var displayThemes: [CreatorChannelAudioThemeItem] {
let themes = response?.themes.map {
guard let response else { return [] }
let themes = response.themes.map {
CreatorChannelAudioThemeItem(themeId: $0.themeId, themeName: $0.themeName)
} ?? []
}
return [CreatorChannelAudioThemeItem.all] + themes
}

View File

@@ -10,7 +10,7 @@ struct CreatorChannelCommunityEmptyView: View {
.lineSpacing(SodaSpacing.s4)
}
.frame(maxWidth: .infinity)
.padding(.top, 316)
.padding(.top, 20)
.padding(.bottom, 120)
}
}

View File

@@ -3,6 +3,7 @@ import Kingfisher
struct CreatorChannelHeaderSection: View {
let creator: CreatorChannelCreatorResponse
let isOwnCreatorChannel: Bool
let onTapTalk: () -> Void
let onTapDm: () -> Void
@@ -54,6 +55,7 @@ struct CreatorChannelHeaderSection: View {
CreatorChannelTalkActionSection(
isAiChatAvailable: creator.isAiChatAvailable,
isDmAvailable: creator.isDmAvailable,
isOwnCreatorChannel: isOwnCreatorChannel,
onTapTalk: onTapTalk,
onTapDm: onTapDm
)

View File

@@ -236,6 +236,7 @@ struct CreatorChannelView: View {
if let creator = viewModel.response?.creator {
CreatorChannelHeaderSection(
creator: creator,
isOwnCreatorChannel: isOwnCreatorChannel,
onTapTalk: handleTalkTap,
onTapDm: handleDmTap
)
@@ -557,6 +558,12 @@ struct CreatorChannelView: View {
return
}
if isOwnCreatorChannel {
AppState.shared.setPendingMainChatFilter(.dm)
AppState.shared.setAppStep(step: .main)
return
}
AppState.shared.setAppStep(step: .userCreatorChatCreator(creatorId: creatorId))
}

View File

@@ -36,7 +36,8 @@ struct CreatorChannelDonationEmptyView: View {
}
}
.frame(maxWidth: .infinity)
.padding(.vertical, 48)
.padding(.top, 20)
.padding(.bottom, 48)
}
}

View File

@@ -36,6 +36,7 @@ struct CreatorChannelFanTalkEmptyView: View {
}
}
.frame(maxWidth: .infinity)
.padding(.vertical, 48)
.padding(.top, 20)
.padding(.bottom, 48)
}
}

View File

@@ -3,6 +3,7 @@ import SwiftUI
struct CreatorChannelTalkActionSection: View {
let isAiChatAvailable: Bool
let isDmAvailable: Bool
let isOwnCreatorChannel: Bool
let onTapTalk: () -> Void
let onTapDm: () -> Void
@@ -37,7 +38,7 @@ struct CreatorChannelTalkActionSection: View {
.resizable()
.frame(width: 20, height: 20)
Text(I18n.CreatorChannelHome.dm)
Text(isOwnCreatorChannel ? I18n.CreatorChannelHome.checkDm : I18n.CreatorChannelHome.dm)
.appFont(size: 16, weight: .medium)
.foregroundColor(.white)
}

View File

@@ -105,7 +105,8 @@ struct CreatorChannelLiveTabView: View {
.foregroundColor(Color.gray500)
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(.vertical, 48)
.padding(.top, 20)
.padding(.bottom, 48)
}
}

View File

@@ -94,7 +94,8 @@ struct CreatorChannelSeriesTabView: View {
.foregroundColor(Color.gray500)
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding(.vertical, 48)
.padding(.top, 20)
.padding(.bottom, 48)
}
}

View File

@@ -5,6 +5,7 @@ struct MainChatView: View {
let onTapSearch: () -> Void
@StateObject private var viewModel = MainChatViewModel()
@StateObject private var appState = AppState.shared
var body: some View {
VStack(spacing: 0) {
@@ -28,7 +29,14 @@ struct MainChatView: View {
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
.background(Color.black.ignoresSafeArea())
.onAppear { viewModel.fetchFirstPageIfNeeded() }
.onAppear {
if applyPendingFilterIfNeeded() == false {
viewModel.fetchFirstPageIfNeeded()
}
}
.valueChanged(value: appState.pendingMainChatFilter) { _ in
_ = applyPendingFilterIfNeeded()
}
.sodaToast(
isPresented: $viewModel.isShowPopup,
message: viewModel.errorMessage,
@@ -89,6 +97,12 @@ struct MainChatView: View {
AppState.shared.setAppStep(step: .userCreatorChatRoom(roomId: roomId))
}
}
private func applyPendingFilterIfNeeded() -> Bool {
guard let filter = appState.consumePendingMainChatFilter() else { return false }
viewModel.applyFilter(filter)
return true
}
}
struct MainChatView_Previews: PreviewProvider {

View File

@@ -123,6 +123,7 @@ struct MainView: View {
.valueChanged(value: appState.pushMessageId) { handlePushMessageId($0) }
.valueChanged(value: appState.pushAudioContentId) { handlePushAudioContentId($0) }
.valueChanged(value: appState.pushSeriesId) { handlePushSeriesId($0) }
.valueChanged(value: appState.pendingMainChatFilter) { handlePendingMainChatFilter($0) }
.valueChanged(value: appState.isShowPlayer) { isShowPlayer in
guard !isShowPlayer,
let pendingExternalNavigationAction = pendingExternalNavigationAction else {
@@ -408,6 +409,11 @@ struct MainView: View {
}
}
private func handlePendingMainChatFilter(_ filter: MainChatFilter?) {
guard filter != nil else { return }
viewModel.currentTab = .chat
}
private func handlePushAudioContentId(_ value: Int) {
guard value > 0 else { return }
let contentId = value