From 19f5cc8ad68eed3f0305bdad6249979a58a97cf0 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Fri, 13 Mar 2026 15:45:39 +0900 Subject: [PATCH] =?UTF-8?q?fix(notification):=20=EC=95=8C=EB=A6=BC=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EB=9D=BC=EC=9D=B4=EB=B8=8C=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99=20=EB=B6=84=EA=B8=B0=EB=A5=BC=20=EB=B3=B4?= =?UTF-8?q?=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SodaLive/Sources/App/AppDeepLinkHandler.swift | 19 ++++++++--- .../List/PushNotificationListViewModel.swift | 2 +- docs/20260313_알림리스트라이브이동분기수정.md | 32 +++++++++++++++++++ 3 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 docs/20260313_알림리스트라이브이동분기수정.md diff --git a/SodaLive/Sources/App/AppDeepLinkHandler.swift b/SodaLive/Sources/App/AppDeepLinkHandler.swift index 263f3de..86d69a4 100644 --- a/SodaLive/Sources/App/AppDeepLinkHandler.swift +++ b/SodaLive/Sources/App/AppDeepLinkHandler.swift @@ -9,8 +9,13 @@ enum AppDeepLinkAction { case audition } +enum AppDeepLinkSource { + case external + case notificationList +} + enum AppDeepLinkHandler { - static func handle(url: URL) -> Bool { + static func handle(url: URL, source: AppDeepLinkSource = .external) -> Bool { guard isSupportedScheme(url) else { return false } @@ -25,26 +30,30 @@ enum AppDeepLinkHandler { return } - apply(action: action) + apply(action: action, source: source) } return true } - static func handle(urlString: String) -> Bool { + static func handle(urlString: String, source: AppDeepLinkSource = .external) -> Bool { let trimmed = urlString.trimmingCharacters(in: .whitespacesAndNewlines) guard let url = URL(string: trimmed) else { return false } - return handle(url: url) + return handle(url: url, source: source) } static func apply(action: AppDeepLinkAction) { + apply(action: action, source: .external) + } + + private static func apply(action: AppDeepLinkAction, source: AppDeepLinkSource) { switch action { case .live(let roomId): guard roomId > 0 else { return } - AppState.shared.isPushRoomFromDeepLink = true + AppState.shared.isPushRoomFromDeepLink = source == .external AppState.shared.pushRoomId = 0 AppState.shared.pushRoomId = roomId diff --git a/SodaLive/Sources/Notification/List/PushNotificationListViewModel.swift b/SodaLive/Sources/Notification/List/PushNotificationListViewModel.swift index 5af75d4..8f0996f 100644 --- a/SodaLive/Sources/Notification/List/PushNotificationListViewModel.swift +++ b/SodaLive/Sources/Notification/List/PushNotificationListViewModel.swift @@ -118,7 +118,7 @@ final class PushNotificationListViewModel: ObservableObject { return } - _ = AppDeepLinkHandler.handle(urlString: deepLink) + _ = AppDeepLinkHandler.handle(urlString: deepLink, source: .notificationList) } private var requestCategory: String? { diff --git a/docs/20260313_알림리스트라이브이동분기수정.md b/docs/20260313_알림리스트라이브이동분기수정.md new file mode 100644 index 0000000..88d3ad8 --- /dev/null +++ b/docs/20260313_알림리스트라이브이동분기수정.md @@ -0,0 +1,32 @@ +# 20260313 알림 리스트 라이브 이동 분기 수정 + +## 작업 목표 +- 알림 리스트에서 라이브 알림을 탭했을 때 화면이 `HomeView` 뒤에서 동작해 확인 불가한 문제를 해소한다. +- 라이브 알림 탭 시 알림 리스트를 벗어난 뒤 이동되도록 보정한다. +- 라이브 상태(예약/진행)는 기존 `HomeView -> LiveViewModel.enterLiveRoom(roomId:)` 흐름의 상태 판별을 사용해 분기한다. + +## 구현 체크리스트 +- [x] 알림 리스트 라이브 딥링크 탭 전용 처리 소스를 추가한다. +- [x] 라이브 알림 탭 시 `.main` 복귀가 보장되도록 라우팅 플래그를 조정한다. +- [x] 비라이브 딥링크/기존 외부 딥링크 동작을 유지한다. +- [x] 진단/빌드/테스트 검증 및 결과를 문서에 기록한다. + +## 수용 기준 +- [x] 알림 리스트에서 라이브 알림 탭 시 알림 리스트 화면을 빠져나온 뒤 라이브 이동 흐름이 보인다. +- [x] 예약 라이브는 기존 `enterLiveRoom`의 예약 상세 분기(`channelName == nil`)를 탄다. +- [x] 진행 라이브는 기존 `enterLiveRoom`의 입장 분기를 탄다. + +## 검증 기록 +- 무엇/왜/어떻게: `AppDeepLinkHandler`에 `AppDeepLinkSource`(`external`, `notificationList`)를 추가하고, `.live` 액션에서만 `isPushRoomFromDeepLink` 값을 소스 기반으로 설정하도록 변경했다. 알림 리스트 진입(`notificationList`)에서는 `false`가 설정되어 `HomeView`의 `pushRoomId` 처리에서 `.main` 복귀 후 `enterLiveRoom(roomId:)`가 실행된다. 외부/일반 딥링크는 기본값 `external`로 기존 동작을 유지한다. +- 무엇/왜/어떻게: `PushNotificationListViewModel.onTapItem(_:)`에서 `AppDeepLinkHandler.handle(urlString:source:)`를 `source: .notificationList`로 호출하도록 변경해 알림 리스트 라이브 탭에만 화면 복귀 보정을 적용했다. +- 실행 명령: `lsp_diagnostics` (`SodaLive/Sources/App/AppDeepLinkHandler.swift`, `SodaLive/Sources/Notification/List/PushNotificationListViewModel.swift`) +- 결과: SourceKit 단독 컨텍스트에서 모듈/심볼(`AppState`, `I18n`, `PushNotificationRepository` 등) 미해결 오류가 출력됐다. 동일 파일은 아래 Xcode 빌드로 컴파일 성공을 확인했다. +- 실행 명령: `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug build` +- 결과: `** BUILD SUCCEEDED **` +- 실행 명령: `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive-dev" -configuration Debug build` +- 결과: `** BUILD SUCCEEDED **` +- 실행 명령: `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" test` +- 결과: `Scheme SodaLive is not currently configured for the test action.` +- 실행 명령: `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive-dev" test` +- 결과: `Scheme SodaLive-dev is not currently configured for the test action.` +- 수동 QA: 코드 경로 점검으로 `PushNotificationListViewModel.onTapItem` → `AppDeepLinkHandler(.notificationList)` → `HomeView.valueChanged(pushRoomId)` → `.main` 복귀 후 `LiveViewModel.enterLiveRoom` 호출 흐름을 확인했다. 이 흐름에서 예약/진행 분기는 기존 `enterLiveRoom`의 `channelName` 기반 로직을 그대로 사용한다.