Skip to content

Commit

Permalink
Merge pull request #259 from Team-return/feature/(#258)-winter_season
Browse files Browse the repository at this point in the history
🔗 :: (#258) 겨울인턴 개발
  • Loading branch information
cyj513 authored Sep 25, 2024
2 parents 3e407a1 + 02c61a6 commit c316de1
Show file tree
Hide file tree
Showing 13 changed files with 408 additions and 18 deletions.
1 change: 1 addition & 0 deletions Projects/Core/Sources/Steps/HomeStep.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public enum HomeStep: Step {
case homeIsRequired
case alarmIsRequired
case companyIsRequired
case winterInternIsRequired
case easterEggIsRequired
case rejectReasonIsRequired(
recruitmentID: Int,
Expand Down
6 changes: 3 additions & 3 deletions Projects/Data/Sources/DataSource/API/RecruitmentsAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import AppNetwork

enum RecruitmentsAPI {
case fetchRecruitmentDetail(id: Int)
case fetchRecruitmentList(page: Int, jobCode: String?, techCode: [String]?, name: String?)
case fetchRecruitmentList(page: Int, jobCode: String?, techCode: [String]?, name: String?, winterIntern: Bool?)
}

extension RecruitmentsAPI: JobisAPI {
Expand Down Expand Up @@ -33,13 +33,13 @@ extension RecruitmentsAPI: JobisAPI {

var task: Moya.Task {
switch self {
case let .fetchRecruitmentList(page, jobCode, techCode, name):
case let .fetchRecruitmentList(page, jobCode, techCode, name, winterIntern):
return .requestParameters(parameters: [
"page": page,
"job_code": jobCode ?? "",
"tech_code": techCode?.joined(separator: ",") ?? "",
"name": name ?? "",
"winter_intern": false
"winter_intern": winterIntern ?? false
], encoding: URLEncoding.queryString)

default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Domain
protocol RemoteRecruitmentsDataSource {
func fetchRecruitmentDetail(id: Int) -> Single<RecruitmentDetailEntity>
func fetchRecruitmentList(
page: Int, jobCode: String?, techCode: [String]?, name: String?
page: Int, jobCode: String?, techCode: [String]?, name: String?, winterIntern: Bool?
) -> Single<[RecruitmentEntity]>
}

Expand All @@ -16,10 +16,20 @@ final class RemoteRecruitmentsDataSourceImpl: RemoteBaseDataSource<RecruitmentsA
}

func fetchRecruitmentList(
page: Int, jobCode: String?, techCode: [String]?, name: String?
page: Int,
jobCode: String?,
techCode: [String]?,
name: String?,
winterIntern: Bool?
) -> Single<[RecruitmentEntity]> {
request(.fetchRecruitmentList(page: page, jobCode: jobCode, techCode: techCode, name: name))
.map(RecruitmentListResponseDTO.self)
.map { $0.toDomain() }
request(.fetchRecruitmentList(
page: page,
jobCode: jobCode,
techCode: techCode,
name: name,
winterIntern: winterIntern
))
.map(RecruitmentListResponseDTO.self)
.map { $0.toDomain() }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@ struct RecruitmentsRepositoryImpl: RecruitmentsRepository {
}

func fetchRecruitmentList(
page: Int, jobCode: String?, techCode: [String]?, name: String?
page: Int,
jobCode: String?,
techCode: [String]?,
name: String?, winterIntern: Bool?
) -> Single<[RecruitmentEntity]> {
remoteRecruitmentsDataSource.fetchRecruitmentList(page: page, jobCode: jobCode, techCode: techCode, name: name)
remoteRecruitmentsDataSource.fetchRecruitmentList(
page: page,
jobCode: jobCode,
techCode: techCode,
name: name,
winterIntern: winterIntern
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import RxSwift
public protocol RecruitmentsRepository {
func fetchRecruitmentDetail(id: Int) -> Single<RecruitmentDetailEntity>
func fetchRecruitmentList(
page: Int, jobCode: String?, techCode: [String]?, name: String?
page: Int, jobCode: String?, techCode: [String]?, name: String?, winterIntern: Bool?
) -> Single<[RecruitmentEntity]>
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,18 @@ public struct FetchRecruitmentListUseCase {
private let recruitmentsRepository: RecruitmentsRepository

public func execute(
page: Int, jobCode: String? = nil, techCode: [String]? = nil, name: String? = nil
page: Int,
jobCode: String? = nil,
techCode: [String]? = nil,
name: String? = nil,
winterIntern: Bool? = nil
) -> Single<[RecruitmentEntity]> {
recruitmentsRepository.fetchRecruitmentList(page: page, jobCode: jobCode, techCode: techCode, name: name)
recruitmentsRepository.fetchRecruitmentList(
page: page,
jobCode: jobCode,
techCode: techCode,
name: name,
winterIntern: winterIntern
)
}
}
20 changes: 20 additions & 0 deletions Projects/Flow/Sources/Home/HomeFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public final class HomeFlow: Flow {
case .companyIsRequired:
return navigateToCompany()

case .winterInternIsRequired:
return navigateToWinterIntern()

case .easterEggIsRequired:
return navigateToEasterEgg()

Expand Down Expand Up @@ -108,6 +111,23 @@ private extension HomeFlow {
))
}

func navigateToWinterIntern() -> FlowContributors {
let winterInternFlow = WinterInternFlow(container: container)
Flows.use(winterInternFlow, when: .created) { root in
self.rootViewController.pushViewController(
root,
animated: true
)
}

return .one(flowContributor: .contribute(
withNextPresentable: winterInternFlow,
withNextStepper: OneStepper(
withSingleStep: RecruitmentStep.recruitmentIsRequired
)
))
}

func navigateToRejectReason(
_ recruitmentID: Int,
_ applicationID: Int,
Expand Down
104 changes: 104 additions & 0 deletions Projects/Flow/Sources/WinterIntern/WinterInternFlow.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import UIKit
import Presentation
import Swinject
import RxFlow
import Core

public final class WinterInternFlow: Flow {
public let container: Container
private let rootViewController: WinterInternViewController
public var root: Presentable {
return rootViewController
}

public init(container: Container) {
self.container = container
self.rootViewController = container.resolve(WinterInternViewController.self)!
}

public func navigate(to step: Step) -> FlowContributors {
guard let step = step as? RecruitmentStep else { return .none }

switch step {
case .recruitmentIsRequired:
return navigateToRecruitment()

case let .recruitmentDetailIsRequired(id):
return navigateToRecruitmentDetail(recruitmentID: id)

case .recruitmentFilterIsRequired:
return navigateToRecruitmentFilter()

case .searchRecruitmentIsRequired:
return navigateToSearchRecruitment()
}
}
}

private extension WinterInternFlow {
func navigateToRecruitment() -> FlowContributors {
return .one(flowContributor: .contribute(
withNextPresentable: rootViewController,
withNextStepper: rootViewController.viewModel
))
}

func navigateToRecruitmentDetail(recruitmentID: Int) -> FlowContributors {
let recruitmentDetailFlow = RecruitmentDetailFlow(container: container)

Flows.use(recruitmentDetailFlow, when: .created) { (root) in
let view = root as? RecruitmentDetailViewController
view?.viewModel.recruitmentID = recruitmentID
view?.isPopViewController = { id, bookmark in
let popView = self.rootViewController
var oldData = popView.viewModel.recruitmentData.value
oldData.enumerated().forEach {
if $0.element.recruitID == id {
oldData[$0.offset].bookmarked = bookmark
}
}
popView.viewModel.recruitmentData.accept(oldData)
popView.isTabNavigation = false
}
self.rootViewController.navigationController?.pushViewController(
view!, animated: true
)
}

return .one(flowContributor: .contribute(
withNextPresentable: recruitmentDetailFlow,
withNextStepper: OneStepper(withSingleStep: RecruitmentDetailStep.recruitmentDetailIsRequired)
))
}

func navigateToSearchRecruitment() -> FlowContributors {
let searchRecruitmentFlow = SearchRecruitmentFlow(container: container)

Flows.use(searchRecruitmentFlow, when: .created) { (root) in
let view = root as? SearchRecruitmentViewController
self.rootViewController.navigationController?.pushViewController(
view!, animated: true
)
}

return .one(flowContributor: .contribute(
withNextPresentable: searchRecruitmentFlow,
withNextStepper: OneStepper(withSingleStep: SearchRecruitmentStep.searchRecruitmentIsRequired)
))
}

func navigateToRecruitmentFilter() -> FlowContributors {
let recruitmentFilterFlow = RecruitmentFilterFlow(container: container)

Flows.use(recruitmentFilterFlow, when: .created) { (root) in
self.rootViewController.navigationController?.pushViewController(
root, animated: true
)
}

return .one(flowContributor: .contribute(
withNextPresentable: recruitmentFilterFlow,
withNextStepper: OneStepper(withSingleStep: RecruitmentFilterStep.recruitmentFilterIsRequired)
))
}
}
12 changes: 12 additions & 0 deletions Projects/Presentation/Sources/DI/PresentationAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,18 @@ public final class PresentationAssembly: Assembly {
MajorBottomSheetViewModel()
}

container.register(WinterInternViewController.self) { resolver in
WinterInternViewController(
resolver.resolve(WinterInternVieModel.self)!
)
}
container.register(WinterInternVieModel.self) { resolver in
WinterInternVieModel(
fetchRecruitmentListUseCase: resolver.resolve(FetchRecruitmentListUseCase.self)!,
bookmarkUseCase: resolver.resolve(BookmarkUseCase.self)!
)
}

container.register(EasterEggViewController.self) { resolver in
EasterEggViewController()
}
Expand Down
6 changes: 1 addition & 5 deletions Projects/Presentation/Sources/Home/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public final class HomeViewController: BaseViewController<HomeViewModel> {
navigateToAlarmButtonDidTap: navigateToAlarmButton.rx.tap.asSignal(),
navigateToEasterEggDidTap: navigateToEasterEggDidTap,
navigateToCompanyButtonDidTap: findCompanysCard.rx.tap.asSignal(),
navigateToWinterInternButtonDidTap: findWinterRecruitmentsCard.rx.tap.asSignal(),
rejectButtonDidTap: rejectButtonDidTap,
reApplyButtonDidTap: reApplyButtonDidTap,
applicationStatusTableViewDidTap: applicationStatusTableView.rx
Expand Down Expand Up @@ -196,11 +197,6 @@ public final class HomeViewController: BaseViewController<HomeViewModel> {
.bind {
self.showTabbar()
}.disposed(by: disposeBag)

findWinterRecruitmentsCard.rx.tap.subscribe(onNext: {
print("findWinterRecruitment!!")
})
.disposed(by: disposeBag)
}

public override func configureNavigation() {
Expand Down
6 changes: 6 additions & 0 deletions Projects/Presentation/Sources/Home/HomeViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public final class HomeViewModel: BaseViewModel, Stepper {
let navigateToAlarmButtonDidTap: Signal<Void>
let navigateToEasterEggDidTap: PublishRelay<Void>
let navigateToCompanyButtonDidTap: Signal<Void>
let navigateToWinterInternButtonDidTap: Signal<Void>
let rejectButtonDidTap: PublishRelay<ApplicationEntity>
let reApplyButtonDidTap: PublishRelay<ApplicationEntity>
let applicationStatusTableViewDidTap: Observable<(Int, ApplicationStatusType)>
Expand Down Expand Up @@ -88,6 +89,11 @@ public final class HomeViewModel: BaseViewModel, Stepper {
.bind(to: steps)
.disposed(by: disposeBag)

input.navigateToWinterInternButtonDidTap.asObservable()
.map { _ in HomeStep.winterInternIsRequired }
.bind(to: steps)
.disposed(by: disposeBag)

input.viewAppear.asObservable()
.flatMap { [self] in
fetchBannerListUseCase.execute()
Expand Down
Loading

0 comments on commit c316de1

Please sign in to comment.