diff --git a/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/Contents 2.json b/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/Contents 2.json new file mode 100644 index 0000000..02bf8c9 --- /dev/null +++ b/CMC/Resources/Assets.xcassets/Components/24x24/24x24dropDown.imageset/Contents 2.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "24x24dropDown.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "24x24dropDown@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "24x24dropDown@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Contents.json b/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Contents.json new file mode 100644 index 0000000..a5b4375 --- /dev/null +++ b/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "Group 1171275642.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Group 1171275642@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Group 1171275642@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642.png b/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642.png new file mode 100644 index 0000000..e1a789d Binary files /dev/null and b/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642.png differ diff --git a/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642@2x.png b/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642@2x.png new file mode 100644 index 0000000..61b9235 Binary files /dev/null and b/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642@2x.png differ diff --git a/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642@3x.png b/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642@3x.png new file mode 100644 index 0000000..55377ad Binary files /dev/null and b/CMC/Resources/Assets.xcassets/SignUpCompleted.imageset/Group 1171275642@3x.png differ diff --git a/CMC/Sources/App/AppCoordinator.swift b/CMC/Sources/App/AppCoordinator.swift index a966ecc..c321711 100644 --- a/CMC/Sources/App/AppCoordinator.swift +++ b/CMC/Sources/App/AppCoordinator.swift @@ -70,12 +70,11 @@ class AppCoordinator: CoordinatorType { extension AppCoordinator: CoordinatorDelegate{ func didFinish(childCoordinator: CoordinatorType) { -// self.navigationController.popViewController(animated: true) -// if childCoordinator is AuthCoordinator { -// self.userActionState.accept(.tabBar) -// } else { -// self.userActionState.accept(.auth) -// } - // 여기는 회원가입까지 끝나고 ㅎ + self.navigationController.popViewController(animated: true) + if childCoordinator is AuthCoordinator { + self.userActionState.accept(.tabBar) + } else { + self.userActionState.accept(.auth) + } } } diff --git a/CMC/Sources/Presenter/Auth/SignUp/SignUpCompletedViewController.swift b/CMC/Sources/Presenter/Auth/SignUp/SignUpCompletedViewController.swift new file mode 100644 index 0000000..c0565a0 --- /dev/null +++ b/CMC/Sources/Presenter/Auth/SignUp/SignUpCompletedViewController.swift @@ -0,0 +1,109 @@ +// +// SignUpCompletedViewController.swift +// CMC +// +// Created by Siri on 11/15/23. +// Copyright © 2023 com.softsquared.cmc. All rights reserved. +// + +import Foundation + +import RxCocoa +import RxSwift + +import DesignSystem +import SnapKit + +import UIKit + +class SignUpCompletedViewController: BaseViewController { + + // MARK: - UI + private lazy var signUpCompletedLabel: UILabel = { + let label = UILabel() + label.text = "회원가입 신청이\n완료되었어요!" + label.font = CMCFontFamily.Pretendard.bold.font(size: 26) + label.textColor = CMCAsset.gray50.color + label.numberOfLines = 2 + return label + }() + + private lazy var signUpCompletedSubLabel: UILabel = { + let label = UILabel() + label.text = "신청이 수락될 때까지 조금만 기다려주세요 :)" + label.font = CMCFontFamily.Pretendard.medium.font(size: 14) + label.textColor = CMCAsset.gray700.color + return label + }() + + private lazy var signUpCompletedImageView: UIImageView = { + let imageView = UIImageView() + imageView.image = CMCAsset.signUpCompleted.image + imageView.contentMode = .scaleAspectFit + return imageView + }() + + private lazy var completedButton: CMCButton = { + let button = CMCButton( + isRound: false, + type: .login(.inactive), + title: "확인" + ) + return button + }() + + // MARK: - Properties + private let viewModel: SignUpCompletedViewModel + + // MARK: - Initializers + init( + viewModel: SignUpCompletedViewModel + ) { + self.viewModel = viewModel + super.init() + } + + // MARK: - LifeCycle + + // MARK: - Methods + + + override func setAddSubView() { + self.view.addSubview(self.signUpCompletedLabel) + self.view.addSubview(self.signUpCompletedSubLabel) + self.view.addSubview(self.signUpCompletedImageView) + self.view.addSubview(self.completedButton) + } + + override func setConstraint() { + self.signUpCompletedLabel.snp.makeConstraints { make in + make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top).offset(100) + make.leading.equalToSuperview().offset(24) + } + + self.signUpCompletedSubLabel.snp.makeConstraints { make in + make.top.equalTo(self.signUpCompletedLabel.snp.bottom).offset(15) + make.leading.equalTo(self.signUpCompletedLabel.snp.leading) + } + + self.signUpCompletedImageView.snp.makeConstraints { make in + make.top.equalTo(self.signUpCompletedSubLabel.snp.bottom).offset(40) + make.centerX.equalToSuperview() + make.width.equalTo(200) + make.height.equalTo(200) + } + + self.completedButton.snp.makeConstraints { make in + make.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom).offset(-20) + make.leading.equalToSuperview().offset(20) + make.trailing.equalToSuperview().offset(-20) + make.height.equalTo(56) + } + } + + override func bind() { + let input = SignUpCompletedViewModel.Input(completedBtnTapped: completedButton.rx.tap.asObservable()) + let _ = viewModel.transform(input: input) + } + +} diff --git a/CMC/Sources/Presenter/Auth/SignUp/SignUpCompletedViewModel.swift b/CMC/Sources/Presenter/Auth/SignUp/SignUpCompletedViewModel.swift new file mode 100644 index 0000000..117b8b2 --- /dev/null +++ b/CMC/Sources/Presenter/Auth/SignUp/SignUpCompletedViewModel.swift @@ -0,0 +1,49 @@ +// +// SignUpCompletedViewModel.swift +// CMC +// +// Created by Siri on 11/15/23. +// Copyright © 2023 com.softsquared.cmc. All rights reserved. +// + +import Foundation + +import RxCocoa +import RxSwift + +import UIKit + +final class SignUpCompletedViewModel: ViewModelType { + + struct Input { + let completedBtnTapped: Observable + } + + struct Output { + + } + + var disposeBag: DisposeBag = DisposeBag() + weak var coordinator: AuthCoordinator? + + // MARK: - Initializers + init( + coordinator: AuthCoordinator? + ) { + self.coordinator = coordinator + } + + func transform(input: Input) -> Output { + input.completedBtnTapped + .withUnretained(self) + .subscribe(onNext: { owner, _ in + owner.coordinator?.dismissViewController { + owner.coordinator?.popViewController() + } + }) + .disposed(by: disposeBag) + + return Output() + } + +} diff --git a/CMC/Sources/Presenter/Auth/SignUp/SignUpViewModel.swift b/CMC/Sources/Presenter/Auth/SignUp/SignUpViewModel.swift index 255d627..d64f8a9 100644 --- a/CMC/Sources/Presenter/Auth/SignUp/SignUpViewModel.swift +++ b/CMC/Sources/Presenter/Auth/SignUp/SignUpViewModel.swift @@ -107,16 +107,23 @@ class SignUpViewModel: ViewModelType{ .asObservable() } .observe(on: MainScheduler.instance) - .subscribe(onNext: { [weak self] result in + .withUnretained(self) + .subscribe(onNext: { owner, result in switch result { case .success(let model): + //MARK: - 흠,,, 회원 수락을 직접 해주는거면, 이 친구들 저장 할 필요가 없지않나,,,? + /* UserDefaultManager.shared.save(model.accessToken, for: .accessToken) UserDefaultManager.shared.save(model.refreshToken, for: .refreshToken) - print("🍎 발급받은 악세스토큰: \(model.accessToken) 🍎") - self?.coordinator?.finish() + */ + let signUpCompletedViewController = SignUpCompletedViewController( + viewModel: SignUpCompletedViewModel( + coordinator: owner.coordinator + ) + ) + owner.coordinator?.presentViewController(viewController: signUpCompletedViewController, style: .overFullScreen) case .failure(let error): - print("🍎 발생한 에러: \(error) 🍎") - CMCToastManager.shared.addToast(message: "😵‍💫 로그인에 실패했습니다 ㅜ..ㅜ 😵‍💫") + CMCToastManager.shared.addToast(message: "회원가입에 실패했습니다: \(error.localizedDescription)") } }) .disposed(by: disposeBag) diff --git a/CMC/Sources/Presenter/Commons/Protocol/CoordinatorType.swift b/CMC/Sources/Presenter/Commons/Protocol/CoordinatorType.swift index fdbc128..685190e 100644 --- a/CMC/Sources/Presenter/Commons/Protocol/CoordinatorType.swift +++ b/CMC/Sources/Presenter/Commons/Protocol/CoordinatorType.swift @@ -31,8 +31,8 @@ protocol CoordinatorType: AnyObject{ func popViewController() // MARK: Modal 동작 - func presentViewController(viewController vc: UIViewController ) - func dismissViewController() + func presentViewController(viewController vc: UIViewController, style: UIModalPresentationStyle ) + func dismissViewController(completion: (() -> Void)?) } @@ -53,12 +53,13 @@ extension CoordinatorType{ self.navigationController.popViewController(animated: true) } - func presentViewController(viewController vc: UIViewController){ + func presentViewController(viewController vc: UIViewController, style: UIModalPresentationStyle){ + vc.modalPresentationStyle = style self.navigationController.present(vc, animated: true) } - func dismissViewController() { - navigationController.dismiss(animated: true) + func dismissViewController(completion: (() -> Void)?) { + navigationController.dismiss(animated: true, completion: completion) } }