From 358e9367b760c705f59719ae8bc6f94432c6ae3a Mon Sep 17 00:00:00 2001 From: kim-seonwoo Date: Mon, 25 Nov 2024 19:08:24 +0900 Subject: [PATCH] =?UTF-8?q?[Del/#114]=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=ED=8C=8C=EC=9D=BC=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LoginFeature/Sources/LoginUseCase 2.swift | 62 ------------------- .../ViewModels/OnboardingViewModel.swift | 1 - 2 files changed, 63 deletions(-) delete mode 100644 HMH_Tuist_iOS/Projects/Features/LoginFeature/Sources/LoginUseCase 2.swift 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 272c858e..00000000 --- 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 933431db..0846d842 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) } - }