-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat] #465 - 회원가입 초기 Domain, Interface 틀 구현
- Loading branch information
Showing
13 changed files
with
303 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
SOPT-iOS/Projects/Domain/Sources/Error/PhoneVerifyError.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// SignUpError.swift | ||
// Domain | ||
// | ||
// Created by 장석우 on 12/20/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public enum PhoneVerifyError: Error { | ||
case invalidVerifyCode //인증 내역은 유효하나 제출한 “인증 번호”가 일치하지 않을 경우 | ||
case timeout // 시간 초과 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// SignUpError.swift | ||
// Domain | ||
// | ||
// Created by 장석우 on 12/20/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public enum SignUpError: Error { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// OAuthType.swift | ||
// Domain | ||
// | ||
// Created by 장석우 on 12/20/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public enum OAuthType { | ||
case google | ||
case apple | ||
} |
28 changes: 28 additions & 0 deletions
28
SOPT-iOS/Projects/Domain/Sources/Model/PhoneVerifyModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// SignUpPhoneVerificationModel.swift | ||
// Domain | ||
// | ||
// Created by 장석우 on 12/20/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public enum PhoneVerifyType: String { | ||
case register = "REGISTER" // 회원가입 | ||
case change = "CHANGE" // 소설계정재설정 | ||
case search = "SEARCH" // 계정 찾기 | ||
} | ||
|
||
public struct PhoneSendModel { | ||
let name: String? | ||
let phone: String | ||
let type: PhoneVerifyType | ||
} | ||
|
||
public struct PhoneVerifyModel { | ||
let name: String? | ||
let phone: String | ||
let code: String | ||
let type: PhoneVerifyType | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// SignUpModel.swift | ||
// Domain | ||
// | ||
// Created by 장석우 on 12/20/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct SignUpModel { | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
SOPT-iOS/Projects/Domain/Sources/RepositoryInterface/AuthRepositoryInterface.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// AuthRepositoryInterface.swift | ||
// Domain | ||
// | ||
// Created by 장석우 on 12/20/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Combine | ||
|
||
// Apple, Google, Makers를 의존하지 않아도 소셜 로그인을 수행할 수 있도록 추상화 | ||
// Apple, Google, Makers 의존은 DefaultAuthRepository에서 수행 | ||
|
||
public protocol AuthRepositoryInterface { | ||
func requestSignIn(token: String) -> AnyPublisher<Bool, Error> | ||
func oauthLogin(_ type: OAuthType) -> AnyPublisher<String, Error> | ||
func changeSocialAccount() -> AnyPublisher<Void, Error> | ||
func signUp(_ model: SignUpModel) -> AnyPublisher<Void, Error> | ||
} |
14 changes: 14 additions & 0 deletions
14
SOPT-iOS/Projects/Domain/Sources/RepositoryInterface/PhoneVerifyRepositoryInterface.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// PhoneVerifyRepositoryInterface.swift | ||
// Domain | ||
// | ||
// Created by 장석우 on 12/20/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Combine | ||
|
||
public protocol PhoneVerifyRepositoryInterface { | ||
func send(_ model: PhoneSendModel) -> AnyPublisher<Void, PhoneVerifyError> | ||
func verify(_ model: PhoneVerifyModel) -> AnyPublisher<Void, PhoneVerifyError> | ||
} |
59 changes: 59 additions & 0 deletions
59
SOPT-iOS/Projects/Domain/Sources/UseCase/PhoneVerifyUseCase.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// | ||
// PhoneVerifyUseCase.swift | ||
// Domain | ||
// | ||
// Created by 장석우 on 12/20/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Combine | ||
|
||
import Core | ||
|
||
public protocol PhoneVerifyUseCase { | ||
var sideEffect: PassthroughSubject<PhoneVerifyError, Never> { get } | ||
|
||
func send(_ model: PhoneSendModel) -> AnyPublisher<Void, Never> | ||
func verify(_ model: PhoneVerifyModel) -> AnyPublisher<Void, Never> | ||
} | ||
|
||
|
||
public struct DefaultPhoneVerifyUseCase: PhoneVerifyUseCase { | ||
|
||
private let repository: PhoneVerifyRepositoryInterface | ||
public let sideEffect = PassthroughSubject<PhoneVerifyError, Never>() | ||
|
||
init(repository: PhoneVerifyRepositoryInterface) { | ||
self.repository = repository | ||
} | ||
|
||
public func send(_ model: PhoneSendModel) -> AnyPublisher<Void, Never> { | ||
return repository.send(model) | ||
.catch { | ||
sideEffect.send($0) | ||
return Empty<Void, Never>() | ||
}.eraseToAnyPublisher() | ||
} | ||
|
||
public func verify(_ model: PhoneVerifyModel) -> AnyPublisher<Void, Never> { | ||
return repository.verify(model) | ||
.catch { | ||
sideEffect.send($0) | ||
return Empty<Void, Never>() | ||
}.eraseToAnyPublisher() | ||
} | ||
|
||
|
||
} | ||
|
||
public struct StubPhoneVerifyUseCase: PhoneVerifyUseCase { | ||
public var sideEffect = PassthroughSubject<PhoneVerifyError, Never>() | ||
|
||
public func send(_ model: PhoneSendModel) -> AnyPublisher<Void, Never> { | ||
return Just(()).eraseToAnyPublisher() | ||
} | ||
|
||
public func verify(_ model: PhoneVerifyModel) -> AnyPublisher<Void, Never> { | ||
return Just(()).eraseToAnyPublisher() | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
SOPT-iOS/Projects/Features/AuthFeature/Interface/Sources/SignUpPhoneVerifyPresentable.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// SignUpPhoneVerifyViewControllable.swift | ||
// AuthFeature | ||
// | ||
// Created by 장석우 on 12/20/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import BaseFeatureDependency | ||
import Core | ||
import Domain | ||
|
||
public protocol SignUpPhoneVerifyViewControllable: ViewControllable {} | ||
|
||
public protocol SignUpPhoneVerifyCoordinatable {} | ||
|
||
public typealias SignUpPhoneVerifyViewModelType = ViewModelType & SignUpPhoneVerifyCoordinatable | ||
public typealias SignUpPhoneVerifyPresentable = (vc: SignUpPhoneVerifyViewControllable, vm: any SignUpPhoneVerifyViewModelType) |
File renamed without changes.
File renamed without changes.
53 changes: 53 additions & 0 deletions
53
SOPT-iOS/Projects/Features/AuthFeature/Sources/SignUpScene/VC/SignUpPhoneVerifyVC.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// SignUpPhoneVerificationVC.swift | ||
// AuthFeature | ||
// | ||
// Created by 장석우 on 12/20/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import Combine | ||
|
||
import DSKit | ||
import Core | ||
import Domain | ||
|
||
import AuthFeatureInterface | ||
import BaseFeatureDependency | ||
|
||
import SnapKit | ||
import Then | ||
|
||
public class SignUpPhoneVerifyVC: UIViewController, SignUpPhoneVerifyViewControllable { | ||
|
||
|
||
// MARK: - UI Components | ||
|
||
|
||
// MARK: - View Life Cycle | ||
|
||
public override func viewDidLoad() { | ||
super.viewDidLoad() | ||
setUI() | ||
setLayout() | ||
} | ||
} | ||
|
||
// MARK: - UI & Layout | ||
|
||
extension SignUpPhoneVerifyVC { | ||
|
||
private func setUI() { | ||
|
||
} | ||
|
||
private func setLayout() { | ||
} | ||
} | ||
|
||
// MARK: - Methods | ||
|
||
extension SignUpPhoneVerifyVC { | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
...jects/Features/AuthFeature/Sources/SignUpScene/ViewModel/SignUpPhoneVerifyViewModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// | ||
// SignUpPhoneVerifiyViewModel.swift | ||
// AuthFeature | ||
// | ||
// Created by 장석우 on 12/20/24. | ||
// Copyright © 2024 SOPT-iOS. All rights reserved. | ||
// | ||
|
||
import Combine | ||
|
||
import AuthFeatureInterface | ||
import Domain | ||
import Core | ||
|
||
public class SignUpPhoneVerifyViewModel: SignUpPhoneVerifyViewModelType { | ||
|
||
private let useCase: PhoneVerifyUseCase | ||
// private let clock: Clock | ||
private let cancelBag = CancelBag() | ||
|
||
// MARK: - Inputs | ||
|
||
public struct Input { | ||
let viewDidLoad: Driver<Void> | ||
let sendButtonTapped: Driver<Void> | ||
let signUpButtonTapped: Driver<Void> | ||
let phoneTextFieldText: Driver<String> | ||
let codeTextFieldText: Driver<String> | ||
} | ||
|
||
// MARK: - Outputs | ||
|
||
public struct Output { | ||
let verifySuccess = PassthroughSubject<Void, Never>() | ||
let verifyFail = PassthroughSubject<Error, Never>() | ||
let showToast = PassthroughSubject<String, Never>() | ||
let timeLeft = CurrentValueSubject<Int, Never>(180) | ||
let signUpButtonIsEnabled = PassthroughSubject<Bool, Never>() | ||
} | ||
|
||
// MARK: - init | ||
|
||
init(useCase: PhoneVerifyUseCase) { | ||
self.useCase = useCase | ||
} | ||
} | ||
|
||
extension SignUpPhoneVerifyViewModel { | ||
public func transform(from input: Input, cancelBag: CancelBag) -> Output { | ||
let output = Output() | ||
self.bindOutput(output: output, cancelBag: cancelBag) | ||
return output | ||
} | ||
|
||
private func bindOutput(output: Output, cancelBag: CancelBag) { | ||
} | ||
} | ||
|