diff --git a/SodaLive/Sources/Explorer/Profile/UserProfileView.swift b/SodaLive/Sources/Explorer/Profile/UserProfileView.swift index 48920e3..742a514 100644 --- a/SodaLive/Sources/Explorer/Profile/UserProfileView.swift +++ b/SodaLive/Sources/Explorer/Profile/UserProfileView.swift @@ -24,6 +24,8 @@ struct UserProfileView: View { @State private var isShowMenuSettings: Bool = false @State private var isShowCreatorDetailDialog: Bool = false @State private var isShowChannelDonationDialog: Bool = false + @State private var didTriggerAutoBackOnLoadFailure: Bool = false + @State private var isViewVisible: Bool = false @State private var maxCommunityPostHeight: CGFloat? = nil @@ -392,11 +394,7 @@ struct UserProfileView: View { HStack(spacing: 14) { Button { - if presentationMode.wrappedValue.isPresented { - presentationMode.wrappedValue.dismiss() - } else { - AppState.shared.back() - } + goBack() } label: { Image("ic_back") .resizable() @@ -635,9 +633,34 @@ struct UserProfileView: View { } ) .onAppear { + isViewVisible = true + didTriggerAutoBackOnLoadFailure = false viewModel.getCreatorProfile(userId: userId) AppState.shared.pushChannelId = 0 } + .onDisappear { + isViewVisible = false + } + .onChange(of: viewModel.isShowPopup) { isShowing in + guard isShowing else { return } + guard viewModel.creatorProfile == nil else { return } + guard !didTriggerAutoBackOnLoadFailure else { return } + + didTriggerAutoBackOnLoadFailure = true + + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + guard isViewVisible else { return } + goBack() + } + } + } + } + + private func goBack() { + if presentationMode.wrappedValue.isPresented { + presentationMode.wrappedValue.dismiss() + } else { + AppState.shared.back() } } diff --git a/docs/20260225_차단유저프로필진입복귀수정.md b/docs/20260225_차단유저프로필진입복귀수정.md new file mode 100644 index 0000000..631c702 --- /dev/null +++ b/docs/20260225_차단유저프로필진입복귀수정.md @@ -0,0 +1,20 @@ +# 2026-02-25 차단 유저 프로필 진입 복귀 수정 + +## 구현 체크리스트 +- [x] `UserProfileView` 차단/진입 실패 시 복귀 조건 점검 +- [x] 토스트 표시 후 이전 화면 복귀 트리거 추가 +- [x] 중복 복귀 방지 처리 추가 +- [x] 진단/빌드 검증 수행 및 결과 기록 + +## 검증 기록 +- 무엇/왜/어떻게: 차단된 유저 프로필 진입 시 `creatorProfile == nil` 상태에서 토스트만 표시되고 화면이 빈 상태로 남는 문제를 수정했다. `UserProfileView`에 자동 복귀 상태(`didTriggerAutoBackOnLoadFailure`, `isViewVisible`)를 추가하고, 토스트가 표시되는 시점(`viewModel.isShowPopup == true`)에 최초 1회만 2초 후 `goBack()`을 실행하도록 구현했다. 기존 수동 뒤로가기 버튼도 동일한 `goBack()` 경로를 사용하도록 정리해 복귀 방식 일관성을 맞췄다. +- 실행 명령: `lsp_diagnostics` (`SodaLive/Sources/Explorer/Profile/UserProfileView.swift`) +- 결과: SourceKit 진단에서 외부 모듈 해석 한계로 `No such module 'Kingfisher'` 오류가 보고되어 정적 진단 신뢰성이 제한됨. +- 실행 명령: `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug build -quiet` +- 결과: 성공 (경고만 존재, 빌드 완료) +- 실행 명령: `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive-dev" -configuration Debug build -quiet` +- 결과: 성공 (경고만 존재, 빌드 완료) +- 실행 명령: `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" test -quiet` +- 결과: 실패 (`Scheme SodaLive is not currently configured for the test action.`) +- 실행 명령: `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive-dev" test -quiet` +- 결과: 실패 (`Scheme SodaLive-dev is not currently configured for the test action.`)