From 8f1383760f032d1106c3d8828f0dccc97120405b Mon Sep 17 00:00:00 2001 From: Melt Date: Tue, 14 Jan 2025 21:16:32 +0900 Subject: [PATCH] =?UTF-8?q?[Fix]=20#102=20-=20exit=20API=20->=20history=20?= =?UTF-8?q?API=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Feature/MatchRoom/ViewModel/FinishViewModel.swift | 2 +- .../SantaManito-iOS/Feature/Splash/SplashView.swift | 4 ++-- .../SantaManito-iOS/Feature/Splash/SplashViewModel.swift | 9 ++++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/SantaManito-iOS/SantaManito-iOS/Feature/MatchRoom/ViewModel/FinishViewModel.swift b/SantaManito-iOS/SantaManito-iOS/Feature/MatchRoom/ViewModel/FinishViewModel.swift index 671be0c..058554a 100644 --- a/SantaManito-iOS/SantaManito-iOS/Feature/MatchRoom/ViewModel/FinishViewModel.swift +++ b/SantaManito-iOS/SantaManito-iOS/Feature/MatchRoom/ViewModel/FinishViewModel.swift @@ -108,7 +108,7 @@ class FinishViewModel: ObservableObject { case .alert(.exitRoom): state.exitRoomAlertIsPresented = false - roomService.exitRoom(with: state.roomInfo.id) + roomService.deleteHistoryRoom(with: state.roomInfo.id) .catch { _ in Empty() } .receive(on: RunLoop.main) .sink(receiveValue: { [weak self] _ in diff --git a/SantaManito-iOS/SantaManito-iOS/Feature/Splash/SplashView.swift b/SantaManito-iOS/SantaManito-iOS/Feature/Splash/SplashView.swift index ec63d0f..58a61f4 100644 --- a/SantaManito-iOS/SantaManito-iOS/Feature/Splash/SplashView.swift +++ b/SantaManito-iOS/SantaManito-iOS/Feature/Splash/SplashView.swift @@ -46,8 +46,8 @@ struct SplashView: View { isPresented: viewModel.state.serverCheckAlert.isPresented, title: viewModel.state.serverCheckAlert.message, - primaryButton: ("확인 후 앱 닫기", { - exit(0) + primaryButton: ("확인", { + viewModel.send(.alert(.confirm)) }) ) diff --git a/SantaManito-iOS/SantaManito-iOS/Feature/Splash/SplashViewModel.swift b/SantaManito-iOS/SantaManito-iOS/Feature/Splash/SplashViewModel.swift index d7c2001..854009e 100644 --- a/SantaManito-iOS/SantaManito-iOS/Feature/Splash/SplashViewModel.swift +++ b/SantaManito-iOS/SantaManito-iOS/Feature/Splash/SplashViewModel.swift @@ -14,6 +14,7 @@ class SplashViewModel: ObservableObject { enum Action { case onAppear + case alert(Alert) } @@ -22,6 +23,10 @@ class SplashViewModel: ObservableObject { var serverCheckAlert: (isPresented: Bool, message: String) = (false, "서버 점검 시간입니다") } + enum Alert { + case confirm + } + //MARK: - Dependency private let appService: AppServiceType @@ -57,6 +62,7 @@ class SplashViewModel: ObservableObject { weak var owner = self guard let owner else { return } switch action { + case .onAppear: appService.isLatestVersion() @@ -95,7 +101,8 @@ class SplashViewModel: ObservableObject { } .store(in: cancelBag) - + case .alert(.confirm): + state.serverCheckAlert.isPresented = false }