Skip to content

Commit 18d3473

Browse files
committed
refactor: 코드리뷰 반영
1 parent 756fdb6 commit 18d3473

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

Projects/Presentation/Sources/Common/Component/NetworkErrorView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ final class NetworkErrorView: UIView {
1313
static let contentViewWidth: CGFloat = 204
1414
static let contentViewHeight: CGFloat = 215
1515
static let errorImageSize: CGFloat = 40
16-
static let boldtitleLabelTopSpacing: CGFloat = 21
16+
static let boldTitleLabelTopSpacing: CGFloat = 21
1717
static let boldTitleLabelHeight: CGFloat = 30
1818
static let mediumTitleLabelTopSpacing: CGFloat = 2
1919
static let mediumTitleLabelHeight: CGFloat = 24
@@ -95,7 +95,7 @@ final class NetworkErrorView: UIView {
9595
boldTitleLabel.snp.makeConstraints { make in
9696
make.top
9797
.equalTo(errorImageView.snp.bottom)
98-
.offset(Layout.boldtitleLabelTopSpacing)
98+
.offset(Layout.boldTitleLabelTopSpacing)
9999

100100
make.height.equalTo(Layout.boldTitleLabelHeight)
101101

Projects/Presentation/Sources/Common/Protocol/BaseViewController.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ public class BaseViewController<T: ViewModel>: UIViewController {
1313
let viewModel: T
1414
private var baseCancellables = Set<AnyCancellable>()
1515
private lazy var networkErrorView = NetworkErrorView()
16+
private var isShowingNetworkError = false
17+
1618

1719
init(viewModel: T) {
1820
self.viewModel = viewModel
1921
super.init(nibName: nil, bundle: nil)
2022
}
2123

2224
deinit {
25+
guard isShowingNetworkError else { return }
26+
2327
DispatchQueue.main.async { [weak tabBarController = self.tabBarController] in
2428
tabBarController?.tabBar.isHidden = false
2529
}
@@ -74,6 +78,8 @@ public class BaseViewController<T: ViewModel>: UIViewController {
7478

7579
/// 네트워크 에러 뷰 를 보이거나 숨깁니다.
7680
private func handleNetworkErrorView(show: Bool) {
81+
isShowingNetworkError = show
82+
7783
if show {
7884
view.bringSubviewToFront(networkErrorView)
7985
networkErrorView.isHidden = false

Projects/Presentation/Sources/ResultRecommendedRoutine/ViewModel/ResultRecommendedRoutineViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ final class ResultRecommendedRoutineViewModel: ViewModel {
168168
registerRoutineResultSubject.send(false)
169169

170170
networkRetryHandler.handleNetworkError(error) { [weak self] in
171-
self?.fetchResultRecommendedRoutines()
171+
self?.registerRecommendedRoutine()
172172
}
173173
}
174174
}

Projects/Presentation/Sources/RoutineList/ViewModel/RoutineListViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ final class RoutineListViewModel: ViewModel {
138138
deleteRoutineResultSubject.send(false)
139139

140140
networkRetryHandler.handleNetworkError(error) { [weak self] in
141-
self?.fetchRoutines()
141+
self?.deleteRoutine(isDeleteAllRoutines: isDeleteAllRoutines)
142142
}
143143
}
144144
}

0 commit comments

Comments
 (0)