fix(creator): 본인 채널 DM 확인을 추가한다
This commit is contained in:
@@ -64,6 +64,7 @@ class AppState: ObservableObject {
|
||||
@Published var eventPopup: EventItem? = nil
|
||||
@Published var purchasedContentId = 0
|
||||
@Published var purchasedContentOrderType = OrderType.KEEP
|
||||
@Published private(set) var pendingMainChatFilter: MainChatFilter? = nil
|
||||
|
||||
@Published var isRestartApp = false
|
||||
@Published var startTab: HomeViewModel.CurrentTab = .home
|
||||
@@ -191,6 +192,16 @@ class AppState: ObservableObject {
|
||||
pendingContentSettingsGuideMessage = nil
|
||||
return message
|
||||
}
|
||||
|
||||
func setPendingMainChatFilter(_ filter: MainChatFilter) {
|
||||
pendingMainChatFilter = filter
|
||||
}
|
||||
|
||||
func consumePendingMainChatFilter() -> MainChatFilter? {
|
||||
let filter = pendingMainChatFilter
|
||||
pendingMainChatFilter = nil
|
||||
return filter
|
||||
}
|
||||
|
||||
// 언어 적용 직후 앱을 소프트 재시작(스플래시 -> 메인)하여 전역 UI를 새로고침
|
||||
func softRestart() {
|
||||
|
||||
@@ -3435,6 +3435,7 @@ If you block this user, the following features will be restricted.
|
||||
static var following: String { pick(ko: "팔로잉", en: "Following", ja: "フォロー中") }
|
||||
static var talk: String { pick(ko: "대화하기", en: "Start chat", ja: "会話する") }
|
||||
static var dm: String { pick(ko: "DM 보내기", en: "Send DM", ja: "DMを送る") }
|
||||
static var checkDm: String { pick(ko: "DM 확인하기", en: "Check DM", ja: "DMを確認") }
|
||||
static var uploadCommunityPost: String { pick(ko: "커뮤니티 글 올리기", en: "Upload community post", ja: "コミュニティ投稿を作成") }
|
||||
static var uploadAudioContent: String { pick(ko: "오디오 콘텐츠 올리기", en: "Upload audio content", ja: "オーディオコンテンツを投稿") }
|
||||
static var createLive: String { pick(ko: "라이브 만들기", en: "Create live", ja: "ライブを作成") }
|
||||
|
||||
@@ -123,7 +123,8 @@ struct CreatorChannelAudioTabView: View {
|
||||
.foregroundColor(Color.gray500)
|
||||
.multilineTextAlignment(.center)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 48)
|
||||
.padding(.top, 20)
|
||||
.padding(.bottom, 48)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ struct CreatorChannelCommunityEmptyView: View {
|
||||
.lineSpacing(SodaSpacing.s4)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.top, 316)
|
||||
.padding(.top, 20)
|
||||
.padding(.bottom, 120)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,8 @@ struct CreatorChannelDonationEmptyView: View {
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 48)
|
||||
.padding(.top, 20)
|
||||
.padding(.bottom, 48)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ struct CreatorChannelFanTalkEmptyView: View {
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 48)
|
||||
.padding(.top, 20)
|
||||
.padding(.bottom, 48)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -105,7 +105,8 @@ struct CreatorChannelLiveTabView: View {
|
||||
.foregroundColor(Color.gray500)
|
||||
.multilineTextAlignment(.center)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 48)
|
||||
.padding(.top, 20)
|
||||
.padding(.bottom, 48)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +94,8 @@ struct CreatorChannelSeriesTabView: View {
|
||||
.foregroundColor(Color.gray500)
|
||||
.multilineTextAlignment(.center)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.vertical, 48)
|
||||
.padding(.top, 20)
|
||||
.padding(.bottom, 48)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user