Skip to content

Commit

Permalink
chore #384: loading 완료 후 엠티 뷰 뜨도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
otoolz committed Jan 15, 2024
1 parent 8c4bfc5 commit afec520
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ private extension TimelineVC {
func setupAttributes() {
view.backgroundColor = TLColor.black
timelineCollectionView.backgroundView = emptyView
timelineCollectionView.backgroundView?.isHidden = true
}

func setupLayout() {
Expand Down Expand Up @@ -202,7 +203,6 @@ private extension TimelineVC {
.withUnretained(self)
.sink { owner, cardlist in
owner.setupData(list: cardlist)
owner.timelineCollectionView.backgroundView?.isHidden = !cardlist.isEmpty
}
.store(in: &cancellables)

Expand Down Expand Up @@ -249,6 +249,14 @@ private extension TimelineVC {
owner.navigationController?.popViewController(animated: true)
}
.store(in: &cancellables)

viewModel.state
.map(\.isEmptyList)
.withUnretained(self)
.sink { owner, isEmptyList in
owner.timelineCollectionView.backgroundView?.isHidden = !isEmptyList
}
.store(in: &cancellables)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ struct TimelineState: BaseState {
var isEdit: Bool = false
var deleteCompleted: Bool = false
var errorMsg: String?
var isEmptyList: Bool = false
}

final class TimelineViewModel: BaseViewModel<TimelineAction, TimelineSideEffect, TimelineState> {
Expand Down Expand Up @@ -141,6 +142,7 @@ final class TimelineViewModel: BaseViewModel<TimelineAction, TimelineSideEffect,

case let .loadTimelineCardList(timelineCardList):
newState.timelineCardList = timelineCardList
newState.isEmptyList = timelineCardList.isEmpty

case let .removeRegacyCards(day):
newState.day = day
Expand Down

0 comments on commit afec520

Please sign in to comment.