diff --git a/HMH_Tuist_iOS/Projects/Features/LoginFeature/Sources/LoginUseCase 2.swift b/HMH_Tuist_iOS/Projects/Features/LoginFeature/Sources/LoginUseCase 2.swift deleted file mode 100644 index 272c858..0000000 --- a/HMH_Tuist_iOS/Projects/Features/LoginFeature/Sources/LoginUseCase 2.swift +++ /dev/null @@ -1,62 +0,0 @@ -// -// LoginUseCase.swift -// LoginFeature -// -// Created by Seonwoo Kim on 11/8/24. -// Copyright © 2024 HMH-iOS. All rights reserved. -// - -import Foundation -import Combine - -import Domain -import Core - -public enum LoginResponseType { - case loginSuccess - case loginFailure - case onboardingNeeded -} - -public protocol LoginUseCaseType { - func login(provider: OAuthProviderType) -> AnyPublisher -} - -public final class LoginUseCase: LoginUseCaseType { - - private let repository: AuthRepositoryType - - public init(repository: AuthRepositoryType) { - self.repository = repository - } - - public func login(provider: OAuthProviderType) -> AnyPublisher { - repository.authorize(provider) - .handleEvents(receiveOutput: { socialToken in - UserManager.shared.socialToken = socialToken - }) - .flatMap { [weak self] _ -> AnyPublisher in - guard let self = self else { - return Fail(error: AuthError.appleAuthrizeError).eraseToAnyPublisher() - } - - return self.repository.socialLogin(socialPlatform: provider.rawValue) - .map { _ in LoginResponseType.loginSuccess } - .catch { error -> AnyPublisher in - switch error { - case .unregisteredUser: - return Just(.onboardingNeeded) - .setFailureType(to: AuthError.self) - .eraseToAnyPublisher() - default: - return Just(.loginFailure) - .setFailureType(to: AuthError.self) - .eraseToAnyPublisher() - } - } - .eraseToAnyPublisher() - } - .eraseToAnyPublisher() - } -} - diff --git a/HMH_Tuist_iOS/Projects/Features/OnboardingFeature/Sources/ViewModels/OnboardingViewModel.swift b/HMH_Tuist_iOS/Projects/Features/OnboardingFeature/Sources/ViewModels/OnboardingViewModel.swift index 933431d..0846d84 100644 --- a/HMH_Tuist_iOS/Projects/Features/OnboardingFeature/Sources/ViewModels/OnboardingViewModel.swift +++ b/HMH_Tuist_iOS/Projects/Features/OnboardingFeature/Sources/ViewModels/OnboardingViewModel.swift @@ -212,5 +212,4 @@ public final class OnboardingViewModel : ObservableObject { } .store(in: cancelBag) } - }