Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IDLE-000] 센터 인증후 프로필 입력 플로우 구현및 변경된 UI 적용 #59

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,25 @@ class CenterProfileRegisterCoordinator: CenterProfileRegisterCoordinatable {

extension CenterProfileRegisterCoordinator {

func showCompleteScreen(cardVO: Entity.CenterProfileCardVO) {
let coordinator = ProfileRegisterCompleteCoordinator(
cardVO: cardVO,
navigationController: navigationController
func showCompleteScreen() {
let vc = CenterProfileRegisterCompleteVC(coordinator: self)
let coordinator = CoordinatorWrapper(
parent: self,
nav: navigationController,
vc: vc
)
addChildCoordinator(coordinator)
coordinator.parent = self
coordinator.start()
}

func showPreviewScreen(stateObject: CenterProfileRegisterState) {
let coordinator = CenterProfileRegisterOverviewCO(
dependency: .init(
navigationController: navigationController,
stateObject: stateObject,
profileUseCase: injector.resolve(CenterProfileUseCase.self)
)
)
addChildCoordinator(coordinator)
coordinator.parent = self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ extension RootCoordinator: RootCoorinatable {
addChildCoordinator(coordinator)

coordinator.start()
}

/// 요양보호사 메인화면을 실행합니다.
func workerMain() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ public protocol AuthRepository: RepositoryBase {
func requestWorkerLogin(phoneNumber: String, authNumber: String) -> Single<Void>
func signoutWorkerAccount() -> Single<Void>
func deregisterWorkerAccount(reasons: [DeregisterReasonVO]) -> Single<Void>
func getCenterJoinStatus() -> RxSwift.Single<CenterJoinStatusInfoVO>
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?

var coordinator: RegisterCenterInfoCoordinator!

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {

guard let windowScene = scene as? UIWindowScene else { return }
Expand All @@ -23,9 +25,9 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {

window = UIWindow(windowScene: windowScene)

window?.rootViewController = AuthStateDisplayVC(state: .requestCenterInfo)
window?.rootViewController = navigationController
window?.makeKeyAndVisible()


coordinator.start()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//
// CenterProfileRegisterOverviewCO.swift
// CenterFeature
//
// Created by choijunios on 9/12/24.
//

import UIKit
import Entity
import PresentationCore
import UseCaseInterface

public class CenterProfileRegisterOverviewCO: ChildCoordinator {

public struct Dependency {
let navigationController: UINavigationController
let stateObject: CenterProfileRegisterState
let profileUseCase: CenterProfileUseCase

public init(navigationController: UINavigationController, stateObject: CenterProfileRegisterState, profileUseCase: CenterProfileUseCase) {
self.navigationController = navigationController
self.stateObject = stateObject
self.profileUseCase = profileUseCase
}
}

public weak var viewControllerRef: UIViewController?
public weak var parent: CenterProfileRegisterCoordinatable?

public let navigationController: UINavigationController
let stateObject: CenterProfileRegisterState
let profileUseCase: CenterProfileUseCase

public init(dependency: Dependency) {
self.navigationController = dependency.navigationController
self.stateObject = dependency.stateObject
self.profileUseCase = dependency.profileUseCase
}

deinit {
printIfDebug("\(String(describing: RegisterRecruitmentCoordinator.self))")
}

public func start() {
let vc = CenterProfileRegisterOverviewVC()
let vm = RegisterProfileOverviewVM(
coordinator: self,
stateObject: stateObject,
profileUseCase: profileUseCase
)
vc.bind(viewModel: vm)

viewControllerRef = vc
navigationController.pushViewController(vc, animated: true)
}

public func coordinatorDidFinish() {
parent?.removeChildCoordinator(self)
popViewController()
}

func showCompleteScreen() {
parent?.showCompleteScreen()
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ public class RegisterCenterInfoCoordinator: ChildCoordinator {
public weak var parent: CenterProfileRegisterCoordinatable?

public let navigationController: UINavigationController

public let viewModel: RegisterCenterInfoViewModelable
let profileUseCase: CenterProfileUseCase

public init(
profileUseCase: CenterProfileUseCase,
navigationController: UINavigationController
) {
self.viewModel = RegisterCenterInfoVM(profileUseCase: profileUseCase)
self.profileUseCase = profileUseCase
self.navigationController = navigationController
}

Expand All @@ -33,7 +32,8 @@ public class RegisterCenterInfoCoordinator: ChildCoordinator {

public func start() {
let vc = RegisterCenterInfoVC(coordinator: self)
vc.bind(viewModel: viewModel)
let vm = RegisterCenterInfoVM(coordinator: self)
vc.bind(viewModel: vm)

viewControllerRef = vc

Expand All @@ -47,8 +47,8 @@ public class RegisterCenterInfoCoordinator: ChildCoordinator {

extension RegisterCenterInfoCoordinator {

func showCompleteScreen(cardVO: CenterProfileCardVO) {
parent?.showCompleteScreen(cardVO: cardVO)
func showPreviewScreen(stateObject: CenterProfileRegisterState) {
parent?.showPreviewScreen(stateObject: stateObject)
}

func registerFinished() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,4 @@ class PageControllerDotView: HStack {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -220,47 +220,3 @@ extension CenterCertificateIntroductionVC: UIPageViewControllerDelegate, UIPageV
dotView.activateView(index)
}
}

class PageControllerDotView: HStack {

let accentColor = DSColor.orange500.color
let normalColor = DSColor.gray100.color

// Init
let pageCnt: Int

// View
private var dotViews: [Int: UIView] = [:]

init(pageCnt: Int) {
self.pageCnt = pageCnt
super.init([], spacing: 12)
setLayout()
}
required init(coder: NSCoder) { fatalError() }

func setLayout() {

let viewList = (0..<pageCnt).map { index in
let view = Spacer(width: 8, height: 8)
view.backgroundColor = normalColor
view.layer.cornerRadius = 4

dotViews[index] = view

return view
}

viewList.forEach {
self.addArrangedSubview($0)
}
}

func activateView(_ index: Int) {

dotViews.forEach { (key, view) in

view.backgroundColor = key == index ? accentColor : normalColor
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
//
// CenterProfileRegisterCompleteVC.swift
// CenterFeature
//
// Created by choijunios on 9/12/24.
//

import UIKit
import BaseFeature
import PresentationCore
import RxCocoa
import RxSwift
import Entity
import DSKit

public class CenterProfileRegisterCompleteVC: BaseViewController {

// Init

// Not init
weak var coordinator: CenterProfileRegisterCoordinatable?

// View
private let ctaButton: CTAButtonType1 = {

let button = CTAButtonType1(labelText: "확인")

return button
}()

public init(coordinator: CenterProfileRegisterCoordinatable) {
self.coordinator = coordinator
super.init(nibName: nil, bundle: nil)
}

public required init?(coder: NSCoder) { fatalError() }

public override func viewDidLoad() {
setAppearance()
setLayout()
setObservable()
}

private func setAppearance() {
view.backgroundColor = .white
}

private func setLayout() {

let markImageView = DSKitAsset.Icons.completeMark.image.toView()
let completeLabel = IdleLabel(typography: .Heading1)
completeLabel.numberOfLines = 2
completeLabel.textString = "센터 정보를 등록했어요!"
completeLabel.textAlignment = .center

let imageLabelStack = VStack(
[
markImageView,
completeLabel
],
spacing: 36,
alignment: .center
)

let imageLabelStackBackView = UIView()
[
imageLabelStack
].forEach {
$0.translatesAutoresizingMaskIntoConstraints = false
imageLabelStackBackView.addSubview($0)
}


[
imageLabelStackBackView,
ctaButton
].forEach {
$0.translatesAutoresizingMaskIntoConstraints = false
view.addSubview($0)
}

NSLayoutConstraint.activate([

imageLabelStack.centerXAnchor.constraint(equalTo: imageLabelStackBackView.centerXAnchor),
imageLabelStack.centerYAnchor.constraint(equalTo: imageLabelStackBackView.centerYAnchor),

imageLabelStackBackView.topAnchor.constraint(equalTo: view.topAnchor),
imageLabelStackBackView.leftAnchor.constraint(equalTo: view.leftAnchor),
imageLabelStackBackView.rightAnchor.constraint(equalTo: view.rightAnchor),
imageLabelStackBackView.bottomAnchor.constraint(equalTo: ctaButton.topAnchor),

ctaButton.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -16),
ctaButton.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 20),
ctaButton.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -20),
])
}

private func setObservable() {

ctaButton.eventPublisher
.subscribe { [coordinator] _ in
coordinator?.registerFinished()
}
.disposed(by: disposeBag)
}
}
Loading