feat(creator): 플로팅 액션 진입을 연결한다
This commit is contained in:
@@ -7,6 +7,7 @@ struct CreatorChannelView: View {
|
||||
|
||||
@StateObject private var viewModel = CreatorChannelViewModel()
|
||||
@StateObject private var channelDonationViewModel = ChannelDonationViewModel()
|
||||
@StateObject private var liveViewModel = LiveViewModel()
|
||||
@StateObject private var mypageViewModel = MyPageViewModel()
|
||||
@AppStorage("token") private var token: String = UserDefaults.string(forKey: UserDefaultsKey.token)
|
||||
@AppStorage("auth") private var auth: Bool = UserDefaults.bool(forKey: UserDefaultsKey.auth)
|
||||
@@ -15,6 +16,7 @@ struct CreatorChannelView: View {
|
||||
@State private var isShowChannelDonationDialog = 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()
|
||||
|
||||
@@ -84,6 +86,15 @@ struct CreatorChannelView: View {
|
||||
LoadingView()
|
||||
}
|
||||
|
||||
if isOwnCreatorChannel && viewModel.selectedTab == .home && !viewModel.isLoading {
|
||||
CreatorChannelFloatingActionMenu(
|
||||
isPresented: $isCreatorActionMenuPresented,
|
||||
onTapCommunityPost: showCommunityWrite,
|
||||
onTapAudioContent: showAudioContentUpload,
|
||||
onTapCreateLive: showCreateLive
|
||||
)
|
||||
}
|
||||
|
||||
if isShowAuthConfirmView {
|
||||
authConfirmDialog
|
||||
}
|
||||
@@ -123,6 +134,11 @@ struct CreatorChannelView: View {
|
||||
}
|
||||
.sodaToast(isPresented: $viewModel.isShowPopup, message: viewModel.errorMessage, autohideIn: 1)
|
||||
.sodaToast(isPresented: $channelDonationViewModel.isShowPopup, message: channelDonationViewModel.errorMessage, autohideIn: 2)
|
||||
.onChange(of: viewModel.selectedTab) { selectedTab in
|
||||
if selectedTab != .home {
|
||||
isCreatorActionMenuPresented = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func titleBar(backgroundProgress: CGFloat) -> some View {
|
||||
@@ -289,6 +305,37 @@ struct CreatorChannelView: View {
|
||||
AppState.shared.setAppStep(step: .creatorCommunityAll(creatorId: creatorId))
|
||||
}
|
||||
|
||||
private func showCommunityWrite() {
|
||||
isCreatorActionMenuPresented = false
|
||||
AppState.shared.setAppStep(
|
||||
step: .creatorCommunityWrite(onSuccess: {
|
||||
viewModel.fetchHome(creatorId: creatorId)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
private func showAudioContentUpload() {
|
||||
isCreatorActionMenuPresented = false
|
||||
AppState.shared.setAppStep(
|
||||
step: .createContent(onSuccess: {
|
||||
viewModel.fetchHome(creatorId: creatorId)
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
private func showCreateLive() {
|
||||
isCreatorActionMenuPresented = false
|
||||
AppState.shared.setAppStep(step: .createLive(timeSettingMode: .NOW, onSuccess: handleCreateLiveSuccess))
|
||||
}
|
||||
|
||||
private func handleCreateLiveSuccess(response: CreateLiveRoomResponse) {
|
||||
liveViewModel.getLiveMain()
|
||||
if let _ = response.channelName {
|
||||
liveViewModel.enterRoom(roomId: response.id!)
|
||||
}
|
||||
viewModel.fetchHome(creatorId: creatorId)
|
||||
}
|
||||
|
||||
private func handleScheduleTap(type: CreatorActivityType, targetId: Int) {
|
||||
guard targetId > 0 else { return }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user