Skip to content

Commit 98bd120

Browse files
authored
Merge branch 'develop' into feature/(#262)-bug_fix_and_feature
2 parents 72dd2f2 + 15421ed commit 98bd120

File tree

7 files changed

+158
-10
lines changed

7 files changed

+158
-10
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "Pie Chart.png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"author" : "xcode",
19+
"version" : 1
20+
}
21+
}
115 KB
Loading

Projects/Modules/DesignSystem/Sources/Image/JobisIcon.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public enum JobisIcon {
4343
case link
4444
case close
4545
case addPhoto
46+
case fileImage
4647

4748
func uiImage() -> UIImage {
4849
let dsIcons = DesignSystemAsset.Icons.self
@@ -152,6 +153,9 @@ public enum JobisIcon {
152153

153154
case .addPhoto:
154155
return dsIcons.addPhoto.image
156+
157+
case .fileImage:
158+
return dsIcons.fileImage.image
155159
}
156160
}
157161
}

Projects/Presentation/Sources/DI/PresentationAssembly.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public final class PresentationAssembly: Assembly {
1515
fetchStudentInfoUseCase: resolver.resolve(FetchStudentInfoUseCase.self)!,
1616
fetchApplicationUseCase: resolver.resolve(FetchApplicationUseCase.self)!,
1717
fetchBannerListUseCase: resolver.resolve(FetchBannerListUseCase.self)!,
18-
fetchWinterInternUseCase: resolver.resolve(FetchWinterInternSeasonUseCase.self)!
18+
fetchWinterInternUseCase: resolver.resolve(FetchWinterInternSeasonUseCase.self)!,
19+
fetchTotalPassStudentUseCase: resolver.resolve(FetchTotalPassStudentUseCase.self)!
1920
)
2021
}
2122

Projects/Presentation/Sources/Home/Components/Cell/BannerCollectionViewCell.swift

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,57 @@ final class BannerCollectionViewCell: BaseCollectionViewCell<FetchBannerEntity>
1111
$0.layer.cornerRadius = 16
1212
$0.clipsToBounds = true
1313
}
14+
private let passTitleLabel = UILabel().then {
15+
$0.numberOfLines = 0
16+
$0.setJobisText(
17+
"9기 대마고\n학생들의 취업률",
18+
font: .headLine,
19+
color: .GrayScale.gray90
20+
)
21+
}
22+
private let passLabel = UILabel().then {
23+
$0.setJobisText(
24+
" - ",
25+
font: .headLine,
26+
color: .Primary.blue20
27+
)
28+
}
29+
private let prePassCountTitleLabel = UILabel().then {
30+
$0.setJobisText(
31+
"현재",
32+
font: .subHeadLine,
33+
color: .GrayScale.gray60
34+
)
35+
}
36+
private let sufPassCountTitleLabel = UILabel().then {
37+
$0.setJobisText(
38+
"명이 취업했어요",
39+
font: .subHeadLine,
40+
color: .GrayScale.gray60
41+
)
42+
}
43+
private let passCountLabel = UILabel().then {
44+
$0.setJobisText(
45+
" - ",
46+
font: .subHeadLine,
47+
color: .GrayScale.gray70
48+
)
49+
}
50+
private let fileImageView = UIImageView().then {
51+
$0.contentMode = .scaleAspectFill
52+
$0.clipsToBounds = true
53+
$0.image = UIImage.jobisIcon(.fileImage)
54+
}
1455

1556
override func addView() {
1657
[
17-
imageView
58+
imageView,
59+
passTitleLabel,
60+
passLabel,
61+
prePassCountTitleLabel,
62+
sufPassCountTitleLabel,
63+
passCountLabel,
64+
fileImageView
1865
].forEach(contentView.addSubview(_:))
1966
}
2067

@@ -24,12 +71,58 @@ final class BannerCollectionViewCell: BaseCollectionViewCell<FetchBannerEntity>
2471
}
2572
}
2673

74+
func totalPassSetLayout() {
75+
passTitleLabel.snp.makeConstraints {
76+
$0.top.leading.equalToSuperview().inset(24)
77+
}
78+
79+
passLabel.snp.makeConstraints {
80+
$0.top.equalTo(passTitleLabel.snp.bottom)
81+
$0.leading.equalToSuperview().inset(24)
82+
}
83+
84+
prePassCountTitleLabel.snp.makeConstraints {
85+
$0.bottom.leading.equalToSuperview().inset(24)
86+
}
87+
88+
passCountLabel.snp.makeConstraints {
89+
$0.top.equalTo(prePassCountTitleLabel.snp.top)
90+
$0.leading.equalTo(prePassCountTitleLabel.snp.trailing).offset(4)
91+
}
92+
93+
sufPassCountTitleLabel.snp.makeConstraints {
94+
$0.bottom.equalToSuperview().inset(24)
95+
$0.leading.equalTo(passCountLabel.snp.trailing).offset(4)
96+
}
97+
98+
fileImageView.snp.makeConstraints {
99+
$0.width.height.equalTo(180)
100+
$0.top.trailing.equalToSuperview()
101+
}
102+
}
103+
27104
override func configureView() {
28105
self.layer.cornerRadius = 12
29106
self.backgroundColor = .GrayScale.gray30
30107
}
31108

32109
override func adapt(model: FetchBannerEntity) {
110+
setLayout()
33111
self.imageView.setJobisImage(urlString: model.bannerURL)
34112
}
113+
114+
func totalPassAdapt(model: TotalPassStudentEntity) {
115+
totalPassSetLayout()
116+
passLabel.setJobisText(
117+
"\(Int(Double(model.passedCount) / Double(model.totalStudentCount) * 100.0))%",
118+
font: .headLine,
119+
color: .Primary.blue20
120+
)
121+
122+
passCountLabel.setJobisText(
123+
"\(model.passedCount)/\(model.totalStudentCount)",
124+
font: .subHeadLine,
125+
color: .GrayScale.gray70
126+
)
127+
}
35128
}

Projects/Presentation/Sources/Home/HomeViewController.swift

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,28 @@ public final class HomeViewController: BaseViewController<HomeViewModel> {
167167
}
168168
.disposed(by: disposeBag)
169169

170-
output.bannerList
171-
.filter { !$0.isEmpty }
172-
.do(onNext: {
173-
self.bannerView.setPageControl(count: $0.count)
170+
let totalPassBannerModel = output.totalPassStudentInfo.value
171+
172+
let combinedBanners = output.bannerList
173+
.map { banners in
174+
return [totalPassBannerModel] + banners
175+
}
176+
177+
combinedBanners
178+
.do(onNext: { banners in
179+
self.bannerView.setPageControl(count: banners.count)
174180
})
175181
.bind(to: bannerView.collectionView.rx.items(
176182
cellIdentifier: BannerCollectionViewCell.identifier,
177183
cellType: BannerCollectionViewCell.self
178-
)) { _, element, cell in
179-
cell.adapt(model: element)
184+
)) { index, element, cell in
185+
if index == 0 {
186+
cell.totalPassAdapt(model: output.totalPassStudentInfo.value)
187+
} else {
188+
if let fetchBanner = element as? FetchBannerEntity {
189+
cell.adapt(model: fetchBanner)
190+
}
191+
}
180192
}
181193
.disposed(by: disposeBag)
182194

Projects/Presentation/Sources/Home/HomeViewModel.swift

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,22 @@ public final class HomeViewModel: BaseViewModel, Stepper {
1212
private let fetchApplicationUseCase: FetchApplicationUseCase
1313
private let fetchBannerListUseCase: FetchBannerListUseCase
1414
private let fetchWinterInternUseCase: FetchWinterInternSeasonUseCase
15+
private let fetchTotalPassStudentUseCase: FetchTotalPassStudentUseCase
1516

1617
private var touchedPopcatCount = 0
1718

1819
init(
1920
fetchStudentInfoUseCase: FetchStudentInfoUseCase,
2021
fetchApplicationUseCase: FetchApplicationUseCase,
2122
fetchBannerListUseCase: FetchBannerListUseCase,
22-
fetchWinterInternUseCase: FetchWinterInternSeasonUseCase
23+
fetchWinterInternUseCase: FetchWinterInternSeasonUseCase,
24+
fetchTotalPassStudentUseCase: FetchTotalPassStudentUseCase
2325
) {
2426
self.fetchStudentInfoUseCase = fetchStudentInfoUseCase
2527
self.fetchApplicationUseCase = fetchApplicationUseCase
2628
self.fetchBannerListUseCase = fetchBannerListUseCase
2729
self.fetchWinterInternUseCase = fetchWinterInternUseCase
30+
self.fetchTotalPassStudentUseCase = fetchTotalPassStudentUseCase
2831
}
2932

3033
public struct Input {
@@ -44,13 +47,19 @@ public final class HomeViewModel: BaseViewModel, Stepper {
4447
let applicationList: PublishRelay<[ApplicationEntity]>
4548
let bannerList: BehaviorRelay<[FetchBannerEntity]>
4649
let isWinterInternSeason: BehaviorRelay<Bool>
50+
let totalPassStudentInfo: BehaviorRelay<TotalPassStudentEntity>
4751
}
4852

4953
public func transform(_ input: Input) -> Output {
5054
let studentInfo = PublishRelay<StudentInfoEntity>()
5155
let applicationList = PublishRelay<[ApplicationEntity]>()
5256
let bannerList = BehaviorRelay<[FetchBannerEntity]>(value: [])
5357
let isWinterInternSeason = BehaviorRelay<Bool>(value: true)
58+
let totalPassStudentInfo = BehaviorRelay<TotalPassStudentEntity>(value: TotalPassStudentEntity.init(
59+
totalStudentCount: 0,
60+
passedCount: 0,
61+
approvedCount: 0
62+
))
5463

5564
input.viewAppear.asObservable()
5665
.flatMap { [self] in
@@ -99,6 +108,13 @@ public final class HomeViewModel: BaseViewModel, Stepper {
99108
.bind(to: steps)
100109
.disposed(by: disposeBag)
101110

111+
input.viewAppear.asObservable()
112+
.flatMap { [self] in
113+
fetchTotalPassStudentUseCase.execute()
114+
}
115+
.bind(to: totalPassStudentInfo)
116+
.disposed(by: disposeBag)
117+
102118
input.viewAppear.asObservable()
103119
.flatMap { [self] in
104120
fetchBannerListUseCase.execute()
@@ -159,7 +175,8 @@ public final class HomeViewModel: BaseViewModel, Stepper {
159175
studentInfo: studentInfo,
160176
applicationList: applicationList,
161177
bannerList: bannerList,
162-
isWinterInternSeason: isWinterInternSeason
178+
isWinterInternSeason: isWinterInternSeason,
179+
totalPassStudentInfo: totalPassStudentInfo
163180
)
164181
}
165182
}

0 commit comments

Comments
 (0)