fix: wrong loader appear animation in hashtag scene issue

This commit is contained in:
CMK 2021-06-22 20:03:40 +08:00
parent f36bcf25ec
commit 19d4a2ffc5
2 changed files with 11 additions and 4 deletions

View File

@ -117,10 +117,9 @@ extension HashtagTimelineViewController {
aspectViewWillAppear(animated)
viewModel.fetchTag()
guard viewModel.loadLatestStateMachine.currentState is HashtagTimelineViewModel.LoadLatestState.Initial else { return }
refreshControl.beginRefreshing()
refreshControl.sendActions(for: .valueChanged)
if viewModel.loadLatestStateMachine.currentState is HashtagTimelineViewModel.LoadLatestState.Initial {
viewModel.loadLatestStateMachine.enter(HashtagTimelineViewModel.LoadLatestState.Loading.self)
}
}
override func viewDidDisappear(_ animated: Bool) {

View File

@ -31,6 +31,14 @@ extension HashtagTimelineViewModel {
timelineMiddleLoaderTableViewCellDelegate: timelineMiddleLoaderTableViewCellDelegate,
threadReplyLoaderTableViewCellDelegate: nil
)
var snapshot = NSDiffableDataSourceSnapshot<StatusSection, Item>()
snapshot.appendSections([.main])
diffableDataSource?.apply(snapshot)
// workaround to append loader wrong animation issue
snapshot.appendItems([.bottomLoader], toSection: .main)
diffableDataSource?.apply(snapshot)
}
}