fix(live): 라이브룸 전역 표시를 보정한다

This commit is contained in:
Yu Sung
2026-07-14 17:42:05 +09:00
parent dec6fb6fb8
commit 1b26bc28dd
6 changed files with 295 additions and 63 deletions

View File

@@ -38,9 +38,25 @@ class AppState: ObservableObject {
if isShowPlayer {
ContentPlayManager.shared.stopAudio()
ContentPlayerPlayManager.shared.resetPlayer()
return
}
guard let pendingExternalNavigationAction else {
return
}
self.pendingExternalNavigationAction = nil
pendingExternalNavigationCancelAction = nil
DispatchQueue.main.async {
pendingExternalNavigationAction()
}
}
}
@Published private(set) var isShowLeaveLiveNavigationDialog = false
private var pendingExternalNavigationAction: (() -> Void)?
private var pendingExternalNavigationCancelAction: (() -> Void)?
@Published var isShowNotificationSettingsDialog = false
@@ -148,6 +164,37 @@ class AppState: ObservableObject {
}
}
func requestExternalNavigation(
navigationAction: @escaping () -> Void,
cancelAction: @escaping () -> Void
) {
guard isShowPlayer else {
navigationAction()
return
}
pendingExternalNavigationAction = navigationAction
pendingExternalNavigationCancelAction = cancelAction
isShowLeaveLiveNavigationDialog = true
}
func confirmExternalNavigation() {
guard pendingExternalNavigationAction != nil else {
isShowLeaveLiveNavigationDialog = false
return
}
isShowLeaveLiveNavigationDialog = false
NotificationCenter.default.post(name: .requestLiveRoomQuitForExternalNavigation, object: nil)
}
func cancelExternalNavigation() {
isShowLeaveLiveNavigationDialog = false
pendingExternalNavigationAction = nil
pendingExternalNavigationCancelAction?()
pendingExternalNavigationCancelAction = nil
}
func consumePendingDeepLinkAction() -> AppDeepLinkAction? {
let action = pendingDeepLinkAction
pendingDeepLinkAction = nil

View File

@@ -73,6 +73,33 @@ struct ContentView: View {
}
}
}
.overlay {
ZStack {
if appState.isShowPlayer {
LiveRoomViewV2()
}
if appState.isShowLeaveLiveNavigationDialog {
leaveLiveNavigationDialog
}
}
}
}
private var leaveLiveNavigationDialog: some View {
SodaV2ActionModal(
title: I18n.Common.alertTitle,
message: I18n.LiveRoom.leaveLiveForNavigationDesc,
button1: SodaV2ActionModalButton(
label: I18n.Common.confirm,
action: appState.confirmExternalNavigation
),
button2: SodaV2ActionModalButton(
label: I18n.Common.cancel,
action: appState.cancelExternalNavigation
),
onDimmedTap: appState.cancelExternalNavigation
)
}
}

View File

@@ -462,7 +462,6 @@ struct LiveRoomViewV2: View {
}
)
.padding(.top, isV2VCaptionVisible ? -13.3 : 0)
.padding(.bottom, 10)
}
if viewModel.isShowingNewChat {
@@ -1004,7 +1003,6 @@ struct LiveRoomViewV2: View {
viewModel.setMute(true)
shouldRestoreMicMuteAfterCapture = true
}
.ignoresSafeArea(.keyboard)
.edgesIgnoringSafeArea(appliedKeyboardHeight > 0 ? .bottom : .init())
.sheet(
isPresented: $viewModel.isShowShareView,
@@ -1113,6 +1111,8 @@ struct LiveRoomViewV2: View {
}
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.ignoresSafeArea()
}
private func estimatedHeight(for text: String, width: CGFloat) -> CGFloat {
@@ -1198,6 +1198,7 @@ private final class ScreenCaptureSecureHostingController<Content: View>: UIViewC
hostingController = UIHostingController(rootView: rootView)
self.isSecureModeEnabled = isSecureModeEnabled
super.init(nibName: nil, bundle: nil)
hostingController.safeAreaRegions = .container
}
required init?(coder: NSCoder) {

View File

@@ -25,9 +25,6 @@ struct MainView: View {
@State private var isShowAuthView = false
@State private var isShowAuthConfirmView = false
@State private var pendingAction: (() -> Void)? = nil
@State private var isShowLeaveLiveNavigationDialog = false
@State private var pendingExternalNavigationAction: (() -> Void)? = nil
@State private var pendingExternalNavigationCancelAction: (() -> Void)? = nil
@State private var payload = Payload()
var body: some View {
@@ -106,14 +103,6 @@ struct MainView: View {
if isShowPlayer {
ContentPlayerView(isShowing: $isShowPlayer, playlist: [])
}
if appState.isShowPlayer {
LiveRoomViewV2()
}
if isShowLeaveLiveNavigationDialog {
leaveLiveNavigationDialog
}
}
.fullScreenCover(isPresented: $isShowAuthView) {
authView
@@ -124,17 +113,6 @@ struct MainView: View {
.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 {
return
}
self.pendingExternalNavigationAction = nil
self.pendingExternalNavigationCancelAction = nil
DispatchQueue.main.async {
pendingExternalNavigationAction()
}
}
.onAppear {
if appState.pushMessageId > 0 {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
@@ -306,22 +284,6 @@ struct MainView: View {
pendingAction = nil
}
private var leaveLiveNavigationDialog: some View {
SodaV2ActionModal(
title: I18n.Common.alertTitle,
message: I18n.LiveRoom.leaveLiveForNavigationDesc,
button1: SodaV2ActionModalButton(
label: I18n.Common.confirm,
action: confirmExternalNavigation
),
button2: SodaV2ActionModalButton(
label: I18n.Common.cancel,
action: cancelExternalNavigation
),
onDimmedTap: cancelExternalNavigation
)
}
private var authView: some View {
BootpayUI(payload: payload, requestType: BootpayRequest.TYPE_AUTHENTICATION)
.onConfirm { _ in true }
@@ -452,13 +414,10 @@ struct MainView: View {
cancelAction: @escaping () -> Void
) {
guard value > 0 else { return }
if appState.isShowPlayer {
pendingExternalNavigationAction = navigationAction
pendingExternalNavigationCancelAction = cancelAction
isShowLeaveLiveNavigationDialog = true
return
}
navigationAction()
appState.requestExternalNavigation(
navigationAction: navigationAction,
cancelAction: cancelAction
)
}
private func handleHomeCanChargeTap() {
@@ -692,22 +651,6 @@ struct MainView: View {
AppState.shared.setAppStep(step: .contentViewSettings)
}
private func confirmExternalNavigation() {
guard pendingExternalNavigationAction != nil else {
isShowLeaveLiveNavigationDialog = false
return
}
isShowLeaveLiveNavigationDialog = false
NotificationCenter.default.post(name: .requestLiveRoomQuitForExternalNavigation, object: nil)
}
private func cancelExternalNavigation() {
isShowLeaveLiveNavigationDialog = false
pendingExternalNavigationAction = nil
pendingExternalNavigationCancelAction?()
pendingExternalNavigationCancelAction = nil
}
private func pushTokenUpdate() {
let pushToken = UserDefaults.string(forKey: .pushToken)
if !pushToken.trimmingCharacters(in: .whitespaces).isEmpty {