Skip to content

Commit 41b3d53

Browse files
authored
[Merge] #596 - 서재소소 QA 사항 반영
[Fix] #596 - 서재소소 QA 사항 반영
2 parents f7700ae + 509934b commit 41b3d53

File tree

10 files changed

+143
-23
lines changed

10 files changed

+143
-23
lines changed

WSSiOS/WSSiOS/Resource/Constants/Strings/StringLiterals+MyLibrary.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,11 @@ extension StringLiterals {
2424
static let attractivePoint = "매력포인트"
2525
static let rating = "별점"
2626
}
27+
28+
enum Empty {
29+
static let libraryEmpty = "서재가 비어있어요"
30+
static let searchButton = "웹소설 찾으러 가기"
31+
static let filterResultEmpty = "해당하는 작품이 없어요\n검색의 범위를 더 넓혀보세요"
32+
}
2733
}
2834
}

WSSiOS/WSSiOS/Source/Data/Base/ReadStatus.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,6 @@ enum ReadStatus: String, CaseIterable {
5252
}
5353
}
5454

55-
var tagText: String {
56-
switch self {
57-
case .watching: return "보는중"
58-
case .watched: return "봤어요"
59-
case .quit: return "하차"
60-
}
61-
}
62-
6355
var tagBackgroundColor: UIColor {
6456
switch self {
6557
case .watching: return .wssPrimary100

WSSiOS/WSSiOS/Source/Presentation/Library/LibraryFilter/LibraryFilterViewController/LibraryFilterViewController.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ final class LibraryFilterViewController: UIViewController {
102102
.flatMap { button in
103103
button.rx.tap.map { button.status }
104104
}
105+
.withLatestFrom(ratingOption) { tappedButton, currentOption in
106+
if tappedButton == currentOption {
107+
return nil
108+
} else {
109+
return tappedButton
110+
}
111+
}
105112
.bind(to: ratingOption)
106113
.disposed(by: disposeBag)
107114

WSSiOS/WSSiOS/Source/Presentation/Library/MyLibrary/MyLibraryView/MyLibraryAssistantView/MyLibraryEmptyView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ final class MyLibraryEmptyView: UIView {
4949
}
5050

5151
descriptionLabel.do {
52-
$0.applyWSSFont(.body1, with: StringLiterals.Library.empty)
52+
$0.applyWSSFont(.body1, with: StringLiterals.MyLibrary.Empty.libraryEmpty)
5353
$0.textColor = .wssGray200
5454
}
5555

@@ -59,7 +59,7 @@ final class MyLibraryEmptyView: UIView {
5959
}
6060

6161
searchNovelButtonLabel.do {
62-
$0.applyWSSFont(.title1, with: StringLiterals.Library.lookForNovel)
62+
$0.applyWSSFont(.title1, with: StringLiterals.MyLibrary.Empty.searchButton)
6363
$0.textColor = .wssPrimary100
6464
$0.isUserInteractionEnabled = false
6565
}

WSSiOS/WSSiOS/Source/Presentation/Library/MyLibrary/MyLibraryView/MyLibraryAssistantView/MyLibraryFilterHeaderView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ final class MyLibraryFilterHeaderView: UIView {
126126
let overCount = selectedOption.count - 1
127127

128128
let text = switch (isSelected, isMoreThanOne) {
129-
case (true, false): selectedOption.first?.tagText
130-
case (true, true): "\(selectedOption.first?.tagText ?? "")\(overCount)"
129+
case (true, false): selectedOption.first?.statusName
130+
case (true, true): "\(selectedOption.first?.statusName ?? "")\(overCount)"
131131
case (false, _): StringLiterals.MyLibrary.FilterButton.readStatus
132132
}
133133

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
//
2+
// MyLibraryFilterResultEmptyView.swift
3+
// WSSiOS
4+
//
5+
// Created by YunhakLee on 6/25/25.
6+
//
7+
8+
import UIKit
9+
10+
import SnapKit
11+
import Then
12+
13+
final class MyLibraryFilterResultEmptyView: UIView {
14+
15+
//MARK: - Components
16+
17+
private let stackView = UIStackView()
18+
private let imageView = UIImageView()
19+
private let descriptionLabel = UILabel()
20+
21+
// MARK: - Life Cycle
22+
23+
override init(frame: CGRect) {
24+
super.init(frame: frame)
25+
26+
setUI()
27+
setHierarchy()
28+
setLayout()
29+
}
30+
31+
required init?(coder: NSCoder) {
32+
fatalError("init(coder:) has not been implemented")
33+
}
34+
35+
//MARK: - UI
36+
37+
private func setUI() {
38+
self.backgroundColor = .wssWhite
39+
40+
stackView.do {
41+
$0.axis = .vertical
42+
$0.alignment = .center
43+
}
44+
45+
imageView.do {
46+
$0.image = .imgEmpty
47+
}
48+
49+
descriptionLabel.do {
50+
$0.applyWSSFont(.body1, with: StringLiterals.MyLibrary.Empty.filterResultEmpty)
51+
$0.textColor = .wssGray200
52+
$0.textAlignment = .center
53+
$0.numberOfLines = 2
54+
}
55+
}
56+
57+
private func setHierarchy() {
58+
self.addSubviews(stackView)
59+
stackView.addArrangedSubviews(imageView,
60+
descriptionLabel)
61+
}
62+
63+
private func setLayout() {
64+
stackView.snp.makeConstraints() {
65+
$0.centerY.equalToSuperview().offset(-47)
66+
$0.horizontalEdges.equalToSuperview()
67+
}
68+
69+
stackView.do {
70+
$0.spacing = 8
71+
}
72+
73+
imageView.snp.makeConstraints() {
74+
$0.height.equalTo(48)
75+
}
76+
}
77+
}

WSSiOS/WSSiOS/Source/Presentation/Library/MyLibrary/MyLibraryView/MyLibraryAssistantView/MyLibraryReadStatusTagView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ final class MyLibraryReadStatusTagView: UIView {
5252
self.backgroundColor = readStatus.tagBackgroundColor
5353

5454
statusLabel.do {
55-
$0.applyWSSFont(.label2, with: readStatus.tagText)
55+
$0.applyWSSFont(.label2, with: readStatus.statusName)
5656
}
5757
}
5858
}

WSSiOS/WSSiOS/Source/Presentation/Library/MyLibrary/MyLibraryView/MyLibraryView.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ final class MyLibraryView: UIView {
1919
let libraryCollectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewLayout())
2020
let libraryTableView = UITableView(frame: .zero, style: .plain)
2121
let libraryEmptyView = MyLibraryEmptyView()
22+
let libraryFilterResultEmptyView = MyLibraryFilterResultEmptyView()
2223
let loadingView = WSSLoadingView()
2324
let networkErrorView = WSSNetworkErrorView()
2425

@@ -68,6 +69,7 @@ final class MyLibraryView: UIView {
6869
libraryCollectionView,
6970
libraryTableView,
7071
libraryEmptyView,
72+
libraryFilterResultEmptyView,
7173
loadingView,
7274
networkErrorView)
7375
}
@@ -101,6 +103,12 @@ final class MyLibraryView: UIView {
101103
$0.bottom.equalToSuperview()
102104
}
103105

106+
libraryFilterResultEmptyView.snp.makeConstraints {
107+
$0.top.equalTo(headerView.snp.bottom)
108+
$0.horizontalEdges.equalToSuperview()
109+
$0.bottom.equalToSuperview()
110+
}
111+
104112
loadingView.snp.makeConstraints {
105113
$0.top.equalTo(headerView.snp.bottom)
106114
$0.horizontalEdges.equalToSuperview()
@@ -114,10 +122,14 @@ final class MyLibraryView: UIView {
114122
}
115123
}
116124

117-
func showEmptyLibraryView(isShowing: Bool) {
125+
func showLibraryEmptyView(isShowing: Bool) {
118126
libraryEmptyView.isHidden = !isShowing
119127
}
120128

129+
func showFilterResultEmptyView(isShowing: Bool) {
130+
libraryFilterResultEmptyView.isHidden = !isShowing
131+
}
132+
121133
func showLibraryListView(selectedType: LayoutType) {
122134
libraryCollectionView.isHidden = selectedType == .list
123135
libraryTableView.isHidden = selectedType == .grid

WSSiOS/WSSiOS/Source/Presentation/Library/MyLibrary/MyLibraryViewController/MyLibraryViewController.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,15 @@ final class MyLibraryViewController: UIViewController {
129129
}
130130
.disposed(by: disposeBag)
131131

132-
output.showEmptyLibraryView
133-
.observe(on: MainScheduler.instance)
134-
.bind(with: self, onNext: { owner, isShowing in
135-
owner.rootView.showEmptyLibraryView(isShowing: isShowing)
132+
output.showLibraryEmptyView
133+
.drive(with: self, onNext: { owner, isShowing in
134+
owner.rootView.showLibraryEmptyView(isShowing: isShowing)
135+
})
136+
.disposed(by: disposeBag)
137+
138+
output.showFilterResultEmptyView
139+
.drive(with: self, onNext: { owner, isShowing in
140+
owner.rootView.showFilterResultEmptyView(isShowing: isShowing)
136141
})
137142
.disposed(by: disposeBag)
138143

WSSiOS/WSSiOS/Source/Presentation/Library/MyLibrary/MyLibraryViewModel/MyLibraryViewModel.swift

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ final class MyLibraryViewModel: ViewModelType {
3131
private let reloadNovelList = PublishRelay<Void>()
3232
private let refreshNovelList = PublishRelay<Void>()
3333

34-
private let showEmptyLibraryView = BehaviorRelay<Bool>(value: false)
34+
private let isLibraryEmpty = BehaviorRelay<Bool>(value: false)
35+
private let showLibraryEmptyView = BehaviorRelay<Bool>(value: false)
36+
private let showFilterResultEmptyView = BehaviorRelay<Bool>(value: false)
3537
private let pushToNovelDetailViewController = PublishRelay<Int>()
3638
private let showLoadingView = BehaviorRelay<Bool>(value: false)
3739
private let showNetworkErrorView = BehaviorRelay<Bool>(value: false)
@@ -61,7 +63,8 @@ final class MyLibraryViewModel: ViewModelType {
6163
let selectedLayoutType: Driver<LayoutType>
6264
let novelCount: Driver<Int>
6365
let libraryNovelList: Observable<[MyLibraryNovel]>
64-
let showEmptyLibraryView: Observable<Bool>
66+
let showLibraryEmptyView: Driver<Bool>
67+
let showFilterResultEmptyView: Driver<Bool>
6568
let pushToNovelDetailViewController: Observable<Int>
6669
let showLoadingView: Observable<Bool>
6770
let showNetworkErrorView: Observable<Bool>
@@ -164,13 +167,31 @@ final class MyLibraryViewModel: ViewModelType {
164167
.bind(to: pushToNovelDetailViewController)
165168
.disposed(by: disposeBag)
166169

170+
isLibraryEmpty
171+
.withLatestFrom(filterOption) { isEmpty, filterOption in
172+
return (isEmpty, filterOption != LibraryFilterOption())
173+
}
174+
.bind(with: self, onNext: { owner, data in
175+
let (isLibraryEmpty, isFilterResult) = data
176+
if isLibraryEmpty {
177+
owner.showFilterResultEmptyView.accept(isFilterResult)
178+
owner.showLibraryEmptyView.accept(!isFilterResult)
179+
} else {
180+
owner.showFilterResultEmptyView.accept(false)
181+
owner.showLibraryEmptyView.accept(false)
182+
}
183+
184+
})
185+
.disposed(by: disposeBag)
186+
167187
return Output(
168188
selectedFilterOption: filterOption.asDriver(),
169189
selectedSortType: sortType.asDriver(),
170190
selectedLayoutType: layoutType.asDriver(),
171191
novelCount: novelCount.asDriver(),
172192
libraryNovelList: libraryNovelList.asObservable(),
173-
showEmptyLibraryView: showEmptyLibraryView.asObservable(),
193+
showLibraryEmptyView: showLibraryEmptyView.asDriver(),
194+
showFilterResultEmptyView: showFilterResultEmptyView.asDriver(),
174195
pushToNovelDetailViewController: pushToNovelDetailViewController.asObservable(),
175196
showLoadingView: showLoadingView.asObservable(),
176197
showNetworkErrorView: showNetworkErrorView.asObservable()
@@ -201,15 +222,15 @@ final class MyLibraryViewModel: ViewModelType {
201222
isLoadable.accept(true)
202223
novelCount.accept(0)
203224
lastUserNovelId.accept(0)
204-
showEmptyLibraryView.accept(false)
225+
isLibraryEmpty.accept(false)
205226
}
206227

207228
private func updateLibraryState(with entity: MyLibraryEntity) {
208229
libraryNovelList.accept(entity.userNovels)
209230
isLoadable.accept(entity.isLoadable)
210231
novelCount.accept(entity.userNovelCount)
211232
lastUserNovelId.accept(entity.userNovels.last?.userNovelId ?? 0)
212-
showEmptyLibraryView.accept(entity.userNovels.isEmpty)
233+
isLibraryEmpty.accept(entity.userNovels.isEmpty)
213234
}
214235

215236
private func updateRequestState(isStarting: Bool, isReloading: Bool = false, isError: Bool = false) {

0 commit comments

Comments
 (0)