Skip to content

Commit d22d5cb

Browse files
committed
๐Ÿงฉ :: ํ™ˆ
1 parent 7d89709 commit d22d5cb

File tree

3 files changed

+30
-20
lines changed

3 files changed

+30
-20
lines changed

โ€ŽProjects/Presentation/Sources/DI/PresentationAssembly.swiftโ€Ž

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,18 @@ public final class PresentationAssembly: Assembly {
340340
)
341341
}
342342

343+
container.register(WinterInternDetailViewController.self) { resolver in
344+
WinterInternDetailViewController(
345+
resolver.resolve(WinterInternDetailViewModel.self)!
346+
)
347+
}
348+
container.register(WinterInternDetailViewModel.self) { resolver in
349+
WinterInternDetailViewModel(
350+
fetchRecruitmentDetailUseCase: resolver.resolve(FetchRecruitmentDetailUseCase.self)!,
351+
bookmarkUseCase: resolver.resolve(BookmarkUseCase.self)!
352+
)
353+
}
354+
343355
container.register(EasterEggViewController.self) { resolver in
344356
EasterEggViewController()
345357
}

โ€ŽProjects/Presentation/Sources/Home/HomeViewController.swiftโ€Ž

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import Domain
88
import DesignSystem
99

1010
public final class HomeViewController: BaseViewController<HomeViewModel> {
11-
private let isWinterSeason = BehaviorRelay(value: true)
1211
private let rejectButtonDidTap = PublishRelay<ApplicationEntity>()
1312
private let reApplyButtonDidTap = PublishRelay<ApplicationEntity>()
1413
private let navigateToAlarmButton = UIButton().then {
@@ -180,19 +179,17 @@ public final class HomeViewController: BaseViewController<HomeViewModel> {
180179
cell.adapt(model: element)
181180
}
182181
.disposed(by: disposeBag)
183-
}
184-
185-
public override func configureViewController() {
186-
checkWinterSeason()
187182

188-
isWinterSeason.asObservable()
183+
output.isWinterInternSeason
189184
.bind { [weak self] in
190185
self?.findCompanysCard.setCard(style: $0 ? .small(type: .findCompanys) : .large)
191186
self?.findWinterRecruitmentsCard.setCard(style: .small(type: .findWinterRecruitments))
192187
self?.findWinterRecruitmentsCard.isHidden = !$0
193188
}
194189
.disposed(by: disposeBag)
190+
}
195191

192+
public override func configureViewController() {
196193
viewWillAppearPublisher
197194
.bind {
198195
self.showTabbar()
@@ -203,18 +200,6 @@ public final class HomeViewController: BaseViewController<HomeViewModel> {
203200
self.navigationItem.rightBarButtonItem = .init(customView: navigateToAlarmButton)
204201
self.navigationItem.leftBarButtonItem = .init(customView: titleImageView)
205202
}
206-
207-
private func checkWinterSeason() {
208-
let now = Date()
209-
let dateFormatter = DateFormatter()
210-
dateFormatter.dateFormat = "M"
211-
dateFormatter.timeZone = NSTimeZone(name: "ko_KR") as? TimeZone
212-
if "12" == dateFormatter.string(from: now) {
213-
isWinterSeason.accept(true)
214-
} else {
215-
isWinterSeason.accept(false)
216-
}
217-
}
218203
}
219204

220205
extension UITableView {

โ€ŽProjects/Presentation/Sources/Home/HomeViewModel.swiftโ€Ž

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,20 @@ public final class HomeViewModel: BaseViewModel, Stepper {
1111
private let fetchStudentInfoUseCase: FetchStudentInfoUseCase
1212
private let fetchApplicationUseCase: FetchApplicationUseCase
1313
private let fetchBannerListUseCase: FetchBannerListUseCase
14+
private let fetchWinterInternUseCase: FetchWinterInternSeasonUseCase
1415

1516
private var touchedPopcatCount = 0
1617

1718
init(
1819
fetchStudentInfoUseCase: FetchStudentInfoUseCase,
1920
fetchApplicationUseCase: FetchApplicationUseCase,
20-
fetchBannerListUseCase: FetchBannerListUseCase
21+
fetchBannerListUseCase: FetchBannerListUseCase,
22+
fetchWinterInternUseCase: FetchWinterInternSeasonUseCase
2123
) {
2224
self.fetchStudentInfoUseCase = fetchStudentInfoUseCase
2325
self.fetchApplicationUseCase = fetchApplicationUseCase
2426
self.fetchBannerListUseCase = fetchBannerListUseCase
27+
self.fetchWinterInternUseCase = fetchWinterInternUseCase
2528
}
2629

2730
public struct Input {
@@ -40,12 +43,14 @@ public final class HomeViewModel: BaseViewModel, Stepper {
4043
let studentInfo: PublishRelay<StudentInfoEntity>
4144
let applicationList: PublishRelay<[ApplicationEntity]>
4245
let bannerList: BehaviorRelay<[FetchBannerEntity]>
46+
let isWinterInternSeason: BehaviorRelay<Bool>
4347
}
4448

4549
public func transform(_ input: Input) -> Output {
4650
let studentInfo = PublishRelay<StudentInfoEntity>()
4751
let applicationList = PublishRelay<[ApplicationEntity]>()
4852
let bannerList = BehaviorRelay<[FetchBannerEntity]>(value: [])
53+
let isWinterInternSeason = BehaviorRelay<Bool>(value: true)
4954

5055
input.viewAppear.asObservable()
5156
.flatMap { [self] in
@@ -108,6 +113,13 @@ public final class HomeViewModel: BaseViewModel, Stepper {
108113
.bind(to: applicationList)
109114
.disposed(by: disposeBag)
110115

116+
input.viewAppear.asObservable()
117+
.flatMap { [self] in
118+
fetchWinterInternUseCase.execute()
119+
}
120+
.bind(to: isWinterInternSeason)
121+
.disposed(by: disposeBag)
122+
111123
input.rejectButtonDidTap.asObservable()
112124
.map {
113125
HomeStep.rejectReasonIsRequired(
@@ -146,7 +158,8 @@ public final class HomeViewModel: BaseViewModel, Stepper {
146158
return Output(
147159
studentInfo: studentInfo,
148160
applicationList: applicationList,
149-
bannerList: bannerList
161+
bannerList: bannerList,
162+
isWinterInternSeason: isWinterInternSeason
150163
)
151164
}
152165
}

0 commit comments

Comments
ย (0)