diff --git a/DevLog/Infra/Service/SocialLogin/GoogleAuthenticationService.swift b/DevLog/Infra/Service/SocialLogin/GoogleAuthenticationService.swift index 0d094154..4b9ff933 100644 --- a/DevLog/Infra/Service/SocialLogin/GoogleAuthenticationService.swift +++ b/DevLog/Infra/Service/SocialLogin/GoogleAuthenticationService.swift @@ -82,11 +82,9 @@ final class GoogleAuthenticationService: AuthenticationService { try await GIDSignIn.sharedInstance.disconnect() } + @MainActor func link(uid: String, email: String) async throws { - let topViewController = await MainActor.run { - provider.topViewController() - } - guard let topViewController = topViewController else { + guard let topViewController = provider.topViewController() else { throw UIError.notFoundTopViewController } diff --git a/DevLog/Presentation/ViewModel/AccountViewModel.swift b/DevLog/Presentation/ViewModel/AccountViewModel.swift index 2914bffa..5f2efd98 100644 --- a/DevLog/Presentation/ViewModel/AccountViewModel.swift +++ b/DevLog/Presentation/ViewModel/AccountViewModel.swift @@ -77,10 +77,10 @@ final class AccountViewModel: Store { effects = [.link(value)] case .unlinkFromProvider(let value): effects = [.unlink(value)] - case .setAlert(let isPresented, let type): - setAlert(&state, isPresented: isPresented, type: type) - case .setToast(let isPresented, let type): - setToast(&state, isPresented: isPresented, type: type) + case .setAlert(let presented, let type): + setAlert(&state, isPresented: presented, type: type) + case .setToast(let presented, let type): + setToast(&state, isPresented: presented, type: type) case .setLoading(let value): state.isLoading = value case .updateProviders(let currentProvider, let allProviders): diff --git a/DevLog/UI/Setting/AccountView.swift b/DevLog/UI/Setting/AccountView.swift index 2f07f8ef..870463e3 100644 --- a/DevLog/UI/Setting/AccountView.swift +++ b/DevLog/UI/Setting/AccountView.swift @@ -79,6 +79,12 @@ struct AccountView: View { } message: { Text(viewModel.state.alertMessage) } + .toast(isPresented: Binding( + get: { viewModel.state.showToast }, + set: { viewModel.send(.setToast(isPresented: $0)) } + )) { + Text(viewModel.state.toastMessage) + } .overlay { if viewModel.state.isLoading { LoadingView()