Skip to content

Commit

Permalink
[D-3] 회원가입 플로우 변경 (521) (#84)
Browse files Browse the repository at this point in the history
* chore: import 누락

* chore: Module Template 수정

* feat: CreateAgency Feature 생성

* refactor: 소속생성 및 대학 검색 화면 CreateAgency 모듈로 이동

* chore: 의존성 그래프 이그노어 처리

* feat: 키보드 여부에 따라 createButton 레이아웃으 변경되도록 구현

* feat: InputAgencyInfoVC Reactor 주입

* feat: CreateCompleteVC Reactor 주입

* chore: assertionFailure 제거

* feat: 대학 정보 입력 유무에 따른 소속 생성 분기 처리

* feat: 소속 생성에서 대학 정보 입력 화면으로 전환 구현

* chore: 폴더 구조 변경

* feat: 대학 정보 입력 화면에서 소속 생성 완료 화면 전환 구현

* chore: BaseFeatureInterface target 생성

* feat: 회원가입 플로우 변경

* fix: dismiss 동시에 화면이 나타나도록 수정

* fix: 잘못된 파라미터 값 수정

* fix: 대학교 등록화면 UI 수정

* chore: button 네이밍 변경

* chore: factory coordinator 옵셔널 타입으로 변경

* fix: 대학 정보 입력화면 레이아웃 및 UI 수정

* fix: 마이페이지 학교 정보 수정

* feat: 소속 생성을 하지 않는 경우 화면전환 구현

* feat: 소속 생성 완료화면에서 X 버튼 클릭 시 메인화면으로 이동되도록 구현

* feat: 대학 정보 입력 유무에 따른 notRegisterButton Hidden 처리
  • Loading branch information
Siwon-L committed Dec 17, 2024
1 parent cdcbdec commit acf2129
Show file tree
Hide file tree
Showing 58 changed files with 1,233 additions and 705 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,4 @@ Moneymong.app.dSYM.zip
fastlane/report.xml
fastlane/README.md
Projects/App/Resources/APIKey.xcconfig
graph.png
3 changes: 2 additions & 1 deletion Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let project = Project(
),
settings: .settings(
base: .init()
.marketingVersion("1.3.2")
.marketingVersion("1.4.0")
.swiftVersion("5.7")
.currentProjectVersion("1")
.appleGenericVersioningSystem(),
Expand Down Expand Up @@ -99,6 +99,7 @@ let project = Project(
dependencies: [
.project(target: "SignFeature", path: .relativeToRoot("Projects/Feature/Sign")),
.project(target: "MainFeature", path: .relativeToRoot("Projects/Feature/Main")),
.project(target: "CreateAgency", path: .relativeToRoot("Projects/Feature/CreateAgency")),
.target(name: "WidgetExtension")
],
settings: .settings(
Expand Down
10 changes: 9 additions & 1 deletion Projects/App/Sources/AppCoordinator.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UIKit

import BaseFeature
import BaseFeatureInterface
import MainFeature
import SignFeature
import DesignSystem
Expand All @@ -26,6 +26,14 @@ final class AppCoordinator: Coordinator {
main(animated: true)
case .login:
sign(animated: true)
case .ledger:
main(animated: true)
let mainCoordinator = childCoordinators.first { $0 is MainTabBarCoordinator }
mainCoordinator?.move(to: .ledger)
case let .createManualLedger(id):
main(animated: true)
let mainCoordinator = childCoordinators.first { $0 is MainTabBarCoordinator }
mainCoordinator?.move(to: .createManualLedger(id))
default: break
}
}
Expand Down
7 changes: 5 additions & 2 deletions Projects/App/Sources/DIContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import SignFeature
import AgencyFeature
import LedgerFeature
import MyPageFeature
import CreateAgency

import Core

Expand All @@ -25,12 +26,14 @@ final class AppDIContainer {

self.signDIContainer = SignDIContainer(
localStorage: localStorage,
networkManager: networkManager
networkManager: networkManager,
inputAgencyInfoFactory: InputAgencyInfoFactory(networkManager: networkManager, localStorage: localStorage)
)

self.mainDIContainer = MainDIContainer(
localStorage: localStorage,
networkManager: networkManager
networkManager: networkManager,
inputAgencyInfoFactory: InputAgencyInfoFactory(networkManager: networkManager, localStorage: localStorage)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ public final class NetworkManager: NetworkManagerInterfacae {

throw MoneyMongError.appError(.default, errorMessage: "디코딩 실패")
case let .failure(error):
assertionFailure("서버동작 에러! 적절한 처리 필요 \(error.localizedDescription)")
throw error
}
}
Expand Down
3 changes: 2 additions & 1 deletion Projects/Feature/Agency/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ let project = Project(
deploymentTarget: .iOS(targetVersion: "15.0", devices: .iphone),
sources: ["Sources/**"],
dependencies: [
.project(target: "BaseFeature", path: .relativeToRoot("Projects/Feature/Base"))
.project(target: "BaseFeature", path: .relativeToRoot("Projects/Feature/Base")),
.project(target: "CreateAgencyInterface", path: .relativeToRoot("Projects/Feature/CreateAgency"))
],
settings: .settings(base: [
"SWIFT_VERSION": "5.7"
Expand Down
42 changes: 20 additions & 22 deletions Projects/Feature/Agency/Sources/AgencyCoordinator.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import UIKit

import BaseFeature
import BaseFeatureInterface
import DesignSystem
import CreateAgencyInterface

public final class AgencyCoordinator: Coordinator {
public var navigationController: UINavigationController
Expand All @@ -10,7 +11,7 @@ public final class AgencyCoordinator: Coordinator {
public var childCoordinators: [Coordinator] = []

weak var secondFlowNavigationController: UINavigationController?

public init(navigationController: UINavigationController, diContainer: AgencyDIContainer) {
self.navigationController = navigationController
self.diContainer = diContainer
Expand All @@ -20,15 +21,24 @@ public final class AgencyCoordinator: Coordinator {
case alert(title: String, subTitle: String?, okAction: () -> Void, cancelAction: (() -> Void)? = nil)
case joinAgency(id: Int, name: String)
case joinComplete
case createAgency
case createComplete(id: Int)
case createAgency(UniversityType)
case web(String)
}

public func start(animated: Bool) {
agency(animated: animated)
}

public func move(to scene: BaseFeatureInterface.Scene) {
switch scene {
case .ledger:
parentCoordinator?.move(to: .ledger)
case .createManualLedger(let int):
parentCoordinator?.move(to: .createManualLedger(int))
default: break
}
}

func present(_ scene: Scene, animated: Bool = true) {
switch scene {
case let .alert(title, subTitle, okAction, cancelAction):
Expand All @@ -41,10 +51,8 @@ public final class AgencyCoordinator: Coordinator {
joinAgency(id: id, name: name, animated: animated)
case .joinComplete:
joinComplete(animated: animated)
case .createAgency:
createAgency(animated: animated)
case let .createComplete(id):
createComplete(agencyID: id, animated: animated)
case let .createAgency(universityType):
createAgency(universityType: universityType, animated: animated)
case let .web(url):
web(urlString: url)
}
Expand All @@ -54,13 +62,9 @@ public final class AgencyCoordinator: Coordinator {
navigationController.topViewController?.dismiss(animated: animated)
}

func goLedger() {
public func goLedger() {
parentCoordinator?.move(to: .ledger)
}

func goManualInput(agencyID: Int) {
parentCoordinator?.move(to: .createManualLedger(agencyID))
}
}

extension AgencyCoordinator {
Expand All @@ -69,16 +73,10 @@ extension AgencyCoordinator {
navigationController.viewControllers = [vc]
}

private func createAgency(animated: Bool) {
let vc = diContainer.createAgency(with: self)
secondFlowNavigationController = vc as? UINavigationController
private func createAgency(universityType: UniversityType, animated: Bool) {
let vc = diContainer.createAgency(with: self, universityType: universityType)
vc.modalPresentationStyle = .fullScreen
navigationController.topViewController?.present(vc, animated: animated)
}

private func createComplete(agencyID: Int, animated: Bool) {
let vc = diContainer.createComplete(with: self, id: agencyID)
secondFlowNavigationController?.pushViewController(vc, animated: animated)
navigationController.present(vc, animated: animated)
}

private func joinAgency(id: Int, name: String, animated: Bool) {
Expand Down
28 changes: 13 additions & 15 deletions Projects/Feature/Agency/Sources/AgencyDIContainer.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import UIKit

import Core
import CreateAgencyInterface

public final class AgencyDIContainer {

Expand All @@ -10,36 +11,33 @@ public final class AgencyDIContainer {
private let agencyRepo: AgencyRepositoryInterface
private let userRepo: UserRepositoryInterface

private let inputAgencyInfoFactory: InputAgencyInfoFactoryInterface

public init(
localStorage: LocalStorageInterface,
networkManager: NetworkManagerInterfacae
networkManager: NetworkManagerInterfacae,
inputAgencyInfoFactory: InputAgencyInfoFactoryInterface
) {
self.localStorage = localStorage
self.networkManager = networkManager
self.agencyRepo = AgencyRepository(networkManager: networkManager)
self.userRepo = UserRepository(networkManager: networkManager, localStorage: localStorage)
self.inputAgencyInfoFactory = inputAgencyInfoFactory
}

func agency(with coordinator: AgencyCoordinator) -> AgencyListVC {
let vc = AgencyListVC()
vc.reactor = AgencyListReactor(agencyRepo: agencyRepo)
vc.reactor = AgencyListReactor(agencyRepo: agencyRepo, userRepo: userRepo)
vc.coordinator = coordinator
return vc
}

func createAgency(with coordinator: AgencyCoordinator) -> UIViewController {
let vc = CreateAgencyVC()
let rootVC = UINavigationController(rootViewController: vc)
vc.reactor = CreateAgencyReactor(agencyRepo: agencyRepo, userRepo: userRepo)
vc.coordinator = coordinator
return rootVC
}

func createComplete(with coordinator: AgencyCoordinator, id: Int) -> CreateCompleteVC {
let vc = CreateCompleteVC()
vc.reactor = CreateCompleteReactor(userRepo: userRepo, id: id)
vc.coordinator = coordinator
return vc
func createAgency(with coordinator: AgencyCoordinator, universityType: UniversityType) -> UIViewController {
let navigationController = UINavigationController()
let createAgencyCoordinator = CreateAgencyCoordinator(navigationController: navigationController, inputAgencyFactory: inputAgencyInfoFactory)
createAgencyCoordinator.parentCoordinator = coordinator
createAgencyCoordinator.start(animated: true, universityType: universityType)
return navigationController
}

func joinAgency(id: Int, name: String, with coordinator: AgencyCoordinator) -> UIViewController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public final class AgencyListReactor: Reactor {
case tapSearchButton // 키보드의 검색 버튼을 눌렀을떄
case tapCancelButton
case searchTextChanged(String?)
case viewDidLoad
}

public enum Mutation {
Expand All @@ -32,6 +33,7 @@ public final class AgencyListReactor: Reactor {
case setAlert(title: String, subTitle: String)
case setPage(Int)
case setQuery(String?)
case setUserInfo(Result<UserInfo, MoneyMongError>)
}

public struct State {
Expand All @@ -40,6 +42,7 @@ public final class AgencyListReactor: Reactor {
var page: Int = 0
@Pulse var myAgency: [Agency] = []
@Pulse var items: [Item] = [.feedback]
@Pulse var userInfo: UserInfo?

@Pulse var error: MoneyMongError?
@Pulse var isLoading = false
Expand All @@ -53,11 +56,18 @@ public final class AgencyListReactor: Reactor {
}

public let initialState: State = State()

private let agencyRepo: AgencyRepositoryInterface
private let userRepo: UserRepositoryInterface

private let listLimit = 20

init(agencyRepo: AgencyRepositoryInterface) {
init(
agencyRepo: AgencyRepositoryInterface,
userRepo: UserRepositoryInterface
) {
self.agencyRepo = agencyRepo
self.userRepo = userRepo
}

public func mutate(action: Action) -> Observable<Mutation> {
Expand Down Expand Up @@ -132,6 +142,12 @@ public final class AgencyListReactor: Reactor {

case let .searchTextChanged(query):
return .just(.setQuery(query))
case .viewDidLoad:
return .task {
try await userRepo.user()
}
.map { .setUserInfo(.success($0)) }
.catch { return .just(.setUserInfo(.failure($0.toMMError))) }
}
}

Expand Down Expand Up @@ -168,6 +184,12 @@ public final class AgencyListReactor: Reactor {

case let .setQuery(query):
newState.query = query

case let .setUserInfo(.success(userInfo)):
newState.userInfo = userInfo

case let .setUserInfo(.failure(error)):
newState.error = error
}

return newState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import DesignSystem
import BaseFeature
import Utility
import Core
import CreateAgencyInterface

import ReactorKit
import RxDataSources
Expand Down Expand Up @@ -66,6 +67,10 @@ public final class AgencyListVC: BaseVC, View {
public func bind(reactor: AgencyListReactor) {
setRightItem(.search)
// Action Binding
rx.viewDidLoad
.map { Reactor.Action.viewDidLoad }
.bind(to: reactor.action)
.disposed(by: disposeBag)

navigationItem.rightBarButtonItem?.rx.tap
.observe(on: MainScheduler.instance)
Expand Down Expand Up @@ -123,8 +128,10 @@ public final class AgencyListVC: BaseVC, View {

createAgencyButton.rx.tap
.throttle(.seconds(1), latest: false, scheduler: MainScheduler.instance)
.bind(with: self) { owner, _ in
owner.coordinator?.present(.createAgency)
.compactMap { reactor.currentState.userInfo?.universityName }
.map { universityName -> UniversityType in universityName == "정보없음" ? .none : .exists }
.bind(with: self) { owner, universityType in
owner.coordinator?.present(.createAgency(universityType))
}
.disposed(by: disposeBag)

Expand All @@ -142,7 +149,6 @@ public final class AgencyListVC: BaseVC, View {
reactor.pulse(\.$query)
.observe(on: MainScheduler.instance)
.bind(with: self) { owner, query in

owner.navigationItem.rightBarButtonItem?.setValue(query != nil, forKey: "hidden")
owner.searchHeaderView.flex.height(query == nil ? 0 : 60)
owner.searchHeaderView.flex.markDirty()
Expand Down
Loading

0 comments on commit acf2129

Please sign in to comment.