Skip to content

Commit

Permalink
✨ Feat: #29 - 회원가입 완료 페이지 이동 및, 화면전환
Browse files Browse the repository at this point in the history
  • Loading branch information
usa4060 committed Nov 15, 2023
1 parent f29d7c5 commit 4e261dc
Show file tree
Hide file tree
Showing 10 changed files with 228 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "24x24dropDown.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Group 1171275642.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group [email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions CMC/Sources/App/AppCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
109 changes: 109 additions & 0 deletions CMC/Sources/Presenter/Auth/SignUp/SignUpCompletedViewController.swift
Original file line number Diff line number Diff line change
@@ -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)
}

}
49 changes: 49 additions & 0 deletions CMC/Sources/Presenter/Auth/SignUp/SignUpCompletedViewModel.swift
Original file line number Diff line number Diff line change
@@ -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<Void>
}

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()
}

}
17 changes: 12 additions & 5 deletions CMC/Sources/Presenter/Auth/SignUp/SignUpViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 6 additions & 5 deletions CMC/Sources/Presenter/Commons/Protocol/CoordinatorType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)?)

}

Expand All @@ -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)
}

}

0 comments on commit 4e261dc

Please sign in to comment.