Skip to content

Commit 25435b3

Browse files
authored
[#253] AccountView에서 구글 계정을 링크 할 시 Main Thread Checker가 뜨는 이슈를 해결한다 (#265)
* fix: 메인액터에서 link 메서드를 호출하도록 개선하여 해결 * feat: 토스트 추가
1 parent 53e9bd9 commit 25435b3

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

DevLog/Infra/Service/SocialLogin/GoogleAuthenticationService.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,9 @@ final class GoogleAuthenticationService: AuthenticationService {
8282
try await GIDSignIn.sharedInstance.disconnect()
8383
}
8484

85+
@MainActor
8586
func link(uid: String, email: String) async throws {
86-
let topViewController = await MainActor.run {
87-
provider.topViewController()
88-
}
89-
guard let topViewController = topViewController else {
87+
guard let topViewController = provider.topViewController() else {
9088
throw UIError.notFoundTopViewController
9189
}
9290

DevLog/Presentation/ViewModel/AccountViewModel.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ final class AccountViewModel: Store {
7777
effects = [.link(value)]
7878
case .unlinkFromProvider(let value):
7979
effects = [.unlink(value)]
80-
case .setAlert(let isPresented, let type):
81-
setAlert(&state, isPresented: isPresented, type: type)
82-
case .setToast(let isPresented, let type):
83-
setToast(&state, isPresented: isPresented, type: type)
80+
case .setAlert(let presented, let type):
81+
setAlert(&state, isPresented: presented, type: type)
82+
case .setToast(let presented, let type):
83+
setToast(&state, isPresented: presented, type: type)
8484
case .setLoading(let value):
8585
state.isLoading = value
8686
case .updateProviders(let currentProvider, let allProviders):

DevLog/UI/Setting/AccountView.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ struct AccountView: View {
7979
} message: {
8080
Text(viewModel.state.alertMessage)
8181
}
82+
.toast(isPresented: Binding(
83+
get: { viewModel.state.showToast },
84+
set: { viewModel.send(.setToast(isPresented: $0)) }
85+
)) {
86+
Text(viewModel.state.toastMessage)
87+
}
8288
.overlay {
8389
if viewModel.state.isLoading {
8490
LoadingView()

0 commit comments

Comments
 (0)