feat(main): 생성 메뉴를 홈에 추가한다

This commit is contained in:
Yu Sung
2026-07-20 19:14:02 +09:00
parent 9a0e75a391
commit 70af4923c6
6 changed files with 213 additions and 12 deletions

View File

@@ -24,10 +24,14 @@ struct MainView: View {
@State private var isShowPlayer = false
@State private var isShowAuthView = false
@State private var isShowAuthConfirmView = false
@State private var isCreatorActionMenuPresented = false
@State private var pendingAction: (() -> Void)? = nil
@State private var payload = Payload()
@State private var hasLoadedMainData = false
private let mainTabBarHeight: CGFloat = 66
private let miniPlayerHeight: CGFloat = 58.1
var body: some View {
GeometryReader { proxy in
ZStack(alignment: .bottom) {
@@ -104,6 +108,16 @@ struct MainView: View {
}
}
if shouldShowCreatorActionMenu {
CreatorContentCreationFloatingActionMenu(
isPresented: $isCreatorActionMenuPresented,
bottomPadding: creatorActionMenuBottomPadding,
onTapCommunityPost: showMainCommunityWrite,
onTapAudioContent: showMainAudioContentUpload,
onTapCreateLive: showMainCreateLive
)
}
if isShowPlayer {
ContentPlayerView(isShowing: $isShowPlayer, playlist: [])
}
@@ -117,6 +131,11 @@ struct MainView: View {
.valueChanged(value: appState.pushAudioContentId) { handlePushAudioContentId($0) }
.valueChanged(value: appState.pushSeriesId) { handlePushSeriesId($0) }
.valueChanged(value: appState.pendingMainChatFilter) { handlePendingMainChatFilter($0) }
.onChange(of: viewModel.currentTab) { currentTab in
if currentTab != .home {
isCreatorActionMenuPresented = false
}
}
.onAppear {
if appState.pushMessageId > 0 {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
@@ -132,6 +151,21 @@ struct MainView: View {
}
}
private var shouldShowCreatorActionMenu: Bool {
UserDefaults.string(forKey: .role) == MemberRole.CREATOR.rawValue && viewModel.currentTab == .home
}
private var creatorActionMenuBottomPadding: CGFloat {
var bottomPadding = mainTabBarHeight + SodaSpacing.s14
if contentPlayerPlayManager.isShowingMiniPlayer {
bottomPadding += miniPlayerHeight
}
if contentPlayManager.isShowingMiniPlayer {
bottomPadding += miniPlayerHeight
}
return bottomPadding
}
@ViewBuilder
private var contentView: some View {
switch viewModel.currentTab {
@@ -584,6 +618,28 @@ struct MainView: View {
}
}
private func showMainCommunityWrite() {
isCreatorActionMenuPresented = false
appState.setAppStep(step: .creatorCommunityWrite(onSuccess: {}))
}
private func showMainAudioContentUpload() {
isCreatorActionMenuPresented = false
appState.setAppStep(step: .createContent(onSuccess: {}))
}
private func showMainCreateLive() {
isCreatorActionMenuPresented = false
appState.setAppStep(step: .createLive(timeSettingMode: .NOW, onSuccess: handleMainCreateLiveSuccess))
}
private func handleMainCreateLiveSuccess(response: CreateLiveRoomResponse) {
liveViewModel.getLiveMain()
if let _ = response.channelName {
liveViewModel.enterRoom(roomId: response.id!)
}
}
private func openRecommendationBannerLink(_ link: String?) {
guard let link = link?.trimmingCharacters(in: .whitespacesAndNewlines),
!link.isEmpty else {