Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feature/(#204)-rec…
Browse files Browse the repository at this point in the history
…ruitment_filter

# Conflicts:
#	Projects/Presentation/Sources/DI/PresentationAssembly.swift
  • Loading branch information
juyeong525 committed Apr 3, 2024
2 parents 436f160 + 1abc27f commit 074f3cb
Show file tree
Hide file tree
Showing 29 changed files with 542 additions and 15 deletions.
Empty file removed Projects/.swiftlint.yml
Empty file.
1 change: 1 addition & 0 deletions Projects/Core/Sources/Steps/CompanyStep.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import RxFlow
public enum CompanyStep: Step {
case companyIsRequired
case companyDetailIsRequired(id: Int)
case searchCompanyIsRequired
}
5 changes: 5 additions & 0 deletions Projects/Core/Sources/Steps/EasterEggStep.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import RxFlow

public enum EasterEggStep: Step {
case easterEggIsRequired
}
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 easterEggIsRequired
case rejectReasonIsRequired(
recruitmentID: Int,
applicationID: Int,
Expand Down
6 changes: 6 additions & 0 deletions Projects/Core/Sources/Steps/SearchCompanyStep.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import RxFlow

public enum SearchCompanyStep: Step {
case searchCompanyIsRequired
case companyDetailIsRequired(id: Int)
}
18 changes: 18 additions & 0 deletions Projects/Flow/Sources/Company/CompanyFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public final class CompanyFlow: Flow {
return navigateToCompany()
case let .companyDetailIsRequired(id):
return navigateToCompanyDetail(id)
case .searchCompanyIsRequired:
return navigateToSearchCompany()
}
}
}
Expand Down Expand Up @@ -53,4 +55,20 @@ private extension CompanyFlow {
withNextStepper: OneStepper(withSingleStep: CompanyDetailStep.companyDetailIsRequired)
))
}

func navigateToSearchCompany() -> FlowContributors {
let searchCompanyFlow = SearchCompanyFlow(container: container)

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

return .one(flowContributor: .contribute(
withNextPresentable: searchCompanyFlow,
withNextStepper: OneStepper(withSingleStep: SearchCompanyStep.searchCompanyIsRequired)
))
}
}
57 changes: 57 additions & 0 deletions Projects/Flow/Sources/Company/SearchCompanyFlow.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import UIKit
import Presentation
import Swinject
import RxFlow
import Core

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

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

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

switch step {
case .searchCompanyIsRequired:
return navigateToSearchCompany()

case let .companyDetailIsRequired(id):
return navigateToCompanyDetail(id)
}
}
}

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

func navigateToCompanyDetail(_ companyId: Int) -> FlowContributors {
let companyDetailFlow = CompanyDetailFlow(container: container)

Flows.use(companyDetailFlow, when: .created) { (root) in
let view = root as? CompanyDetailViewController
view?.viewModel.companyID = companyId
view?.viewModel.type = .searchCompany
self.rootViewController.navigationController?.pushViewController(
view!, animated: true
)
}

return .one(flowContributor: .contribute(
withNextPresentable: companyDetailFlow,
withNextStepper: OneStepper(withSingleStep: CompanyDetailStep.companyDetailIsRequired)
))
}
}
35 changes: 35 additions & 0 deletions Projects/Flow/Sources/Home/EasterEggFlow.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import UIKit
import SwiftUI
import Presentation
import Swinject
import RxFlow
import Core


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

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

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

switch step {
case .easterEggIsRequired:
return navigateToEasterEgg()
}
}
}

private extension EasterEggFlow {
func navigateToEasterEgg() -> FlowContributors {
return .one(flowContributor: .contribute(withNext: rootViewController))
}
}
18 changes: 18 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 .easterEggIsRequired:
return navigateToEasterEgg()

case let .rejectReasonIsRequired(recruitmentID, applicationID, companyName, companyImageUrl):
return navigateToRejectReason(recruitmentID, applicationID, companyName, companyImageUrl)

Expand Down Expand Up @@ -67,6 +70,21 @@ private extension HomeFlow {
))
}

func navigateToEasterEgg() -> FlowContributors {
let easterEggFlow = EasterEggFlow(container: container)

Flows.use(easterEggFlow, when: .created) { root in
self.rootViewController.present(
root, animated: true
)
}

return .one(flowContributor: .contribute(
withNextPresentable: easterEggFlow,
withNextStepper: OneStepper(withSingleStep: EasterEggStep.easterEggIsRequired)
))
}

func navigateToCompany() -> FlowContributors {
let companyFlow = CompanyFlow(container: container)
Flows.use(companyFlow, when: .created) { root in
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Jobis logo.png",
"filename" : "close.png",
"idiom" : "universal",
"scale" : "1x"
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Team return logo.png",
"filename" : "open.png",
"idiom" : "universal",
"scale" : "1x"
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ public final class StudentInfoView: UIView {
$0.alignment = .leading
}
private let userInfoLabel = UILabel().then {
$0.setJobisText("0000 가가가", font: .subHeadLine, color: .GrayScale.gray90)
$0.setJobisText("불러오는 중...", font: .subHeadLine, color: .GrayScale.gray90)
}
private let departmentLabel = UILabel().then {
$0.setJobisText("가가가가가가가가", font: .description, color: .GrayScale.gray70)
$0.setJobisText("", font: .description, color: .GrayScale.gray70)
}

public init() {
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Core
import DesignSystem

public class CompanyViewController: BaseViewController<CompanyViewModel> {
private let searchButtonDidTap = PublishRelay<Void>()
private let companyTableView = UITableView().then {
$0.register(
CompanyTableViewCell.self,
Expand Down Expand Up @@ -43,7 +44,8 @@ public class CompanyViewController: BaseViewController<CompanyViewModel> {
) - 1
},
companyTableViewCellDidTap: companyTableView.rx.modelSelected(CompanyEntity.self)
.map { $0.companyID }
.map { $0.companyID },
searchButtonDidTap: searchButtonDidTap
)

let output = viewModel.transform(input)
Expand All @@ -66,6 +68,12 @@ public class CompanyViewController: BaseViewController<CompanyViewModel> {
self.hideTabbar()
}
.disposed(by: disposeBag)

searchButton.rx.tap
.subscribe(onNext: { _ in
self.searchButtonDidTap.accept(())
})
.disposed(by: disposeBag)
}

public override func configureNavigation() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public final class CompanyViewModel: BaseViewModel, Stepper {
let viewAppear: PublishRelay<Void>
var pageChange: Observable<WillDisplayCellEvent>
let companyTableViewCellDidTap: Observable<Int>
let searchButtonDidTap: PublishRelay<Void>
}

public struct Output {
Expand Down Expand Up @@ -58,6 +59,11 @@ public final class CompanyViewModel: BaseViewModel, Stepper {
.bind(to: steps)
.disposed(by: disposeBag)

input.searchButtonDidTap.asObservable()
.map { CompanyStep.searchCompanyIsRequired }
.bind(to: steps)
.disposed(by: disposeBag)

return Output(companyList: companyList)
}
}
13 changes: 13 additions & 0 deletions Projects/Presentation/Sources/DI/PresentationAssembly.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,15 @@ public final class PresentationAssembly: Assembly {
)
}

container.register(SearchCompanyViewController.self) { resolver in
SearchCompanyViewController(
resolver.resolve(SearchCompanyViewModel.self)!
)
}
container.register(SearchCompanyViewModel.self) { resolver in
SearchCompanyViewModel(fetchCompanyListUseCase: resolver.resolve(FetchCompanyListUseCase.self)!)
}

container.register(RejectReasonViewModel.self) { resolver in
RejectReasonViewModel(
fetchRejectionReasonUseCase: resolver.resolve(FetchRejectionReasonUseCase.self)!
Expand All @@ -252,6 +261,10 @@ public final class PresentationAssembly: Assembly {
RecruitmentFilterViewModel(
fetchCodeListUseCase: resolver.resolve(FetchCodeListUseCase.self)!
)

container.register(EasterEggViewController.self) { resolver in
EasterEggViewController()
}

}
}
60 changes: 60 additions & 0 deletions Projects/Presentation/Sources/EasterEgg/EasterEggView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import SwiftUI
import DesignSystem

struct EasterEggView: View {
@State private var count = 0
@State private var angle = 0
@State private var index = 0
private var colors: [Color] = [
.yellow,
.red,
.blue,
.green,
.purple,
.orange,
.mint,
.white
]
var body: some View {
VStack {
Button("", action: addAction)
.buttonStyle(CatButtonStyle())
.rotationEffect(.degrees(Double(angle)))

Text("\(count)")
.padding(.top, 50)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.padding()
.background(colors[index])
}

private func addAction() {
count += 1
angle = (angle + 45) % 360
index = Int.random(in: 0..<colors.count)
HapticManager.instance.impact(style: .heavy)
}
}

private struct CatButtonStyle: ButtonStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.isPressed ? DesignSystemAsset.Images.EasterEgg.open.swiftUIImage:
DesignSystemAsset.Images.EasterEgg.close.swiftUIImage
}
}

final private class HapticManager {
static let instance = HapticManager()

func notification(type: UINotificationFeedbackGenerator.FeedbackType) {

let generator = UINotificationFeedbackGenerator()
generator.notificationOccurred(type)
}

func impact(style: UIImpactFeedbackGenerator.FeedbackStyle) {
let generator = UIImpactFeedbackGenerator(style: style)
generator.impactOccurred()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import UIKit
import SwiftUI
import RxFlow
import RxCocoa
import RxSwift
import DesignSystem

public final class EasterEggViewController: RxFlowViewController {
public init() {
super.init(nibName: nil, bundle: nil)
contentViewController = UIHostingController(rootView: EasterEggView())
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

public override func viewDidLoad() {
super.viewDidLoad()
}

public override func viewWillAppear(_ animated: Bool) {
self.hideTabbar()
}
}
Loading

0 comments on commit 074f3cb

Please sign in to comment.