1
0
mirror of https://github.com/mastodon/mastodon-ios.git synced 2024-12-23 07:26:34 +01:00

chore: update following/follower list footer display logic

This commit is contained in:
CMK 2021-11-02 16:00:42 +08:00
parent dfb84fdb5b
commit 206beb6d19
4 changed files with 12 additions and 15 deletions

View File

@ -48,7 +48,11 @@ extension FollowerListViewModel {
case is State.Idle, is State.Loading, is State.Fail: case is State.Idle, is State.Loading, is State.Fail:
snapshot.appendItems([.bottomLoader], toSection: .main) snapshot.appendItems([.bottomLoader], toSection: .main)
case is State.NoMore: case is State.NoMore:
let text = "Followers from other servers are not displayed." guard let activeMastodonAuthenticationBox = self.context.authenticationService.activeMastodonAuthenticationBox.value,
let userID = self.userID.value,
userID != activeMastodonAuthenticationBox.userID
else { break }
let text = L10n.Scene.Follower.footer
snapshot.appendItems([.bottomHeader(text: text)], toSection: .main) snapshot.appendItems([.bottomHeader(text: text)], toSection: .main)
default: default:
break break

View File

@ -155,7 +155,7 @@ extension FollowerListViewModel.State {
let maxID = response.link?.maxID let maxID = response.link?.maxID
if hasNewAppend, maxID != nil { if maxID != nil {
stateMachine.enter(Idle.self) stateMachine.enter(Idle.self)
} else { } else {
stateMachine.enter(NoMore.self) stateMachine.enter(NoMore.self)

View File

@ -48,7 +48,12 @@ extension FollowingListViewModel {
case is State.Idle, is State.Loading, is State.Fail: case is State.Idle, is State.Loading, is State.Fail:
snapshot.appendItems([.bottomLoader], toSection: .main) snapshot.appendItems([.bottomLoader], toSection: .main)
case is State.NoMore: case is State.NoMore:
break guard let activeMastodonAuthenticationBox = self.context.authenticationService.activeMastodonAuthenticationBox.value,
let userID = self.userID.value,
userID != activeMastodonAuthenticationBox.userID
else { break }
let text = L10n.Scene.Following.footer
snapshot.appendItems([.bottomHeader(text: text)], toSection: .main)
default: default:
break break
} }

View File

@ -179,18 +179,6 @@ extension FollowingListViewModel.State {
override func didEnter(from previousState: GKState?) { override func didEnter(from previousState: GKState?) {
super.didEnter(from: previousState) super.didEnter(from: previousState)
guard let viewModel = viewModel, let _ = stateMachine else { return }
guard let diffableDataSource = viewModel.diffableDataSource else {
assertionFailure()
return
}
DispatchQueue.main.async {
var snapshot = diffableDataSource.snapshot()
snapshot.deleteItems([.bottomLoader])
let header = UserItem.bottomHeader(text: "Followers from other servers are not displayed")
snapshot.appendItems([header], toSection: .main)
diffableDataSource.apply(snapshot, animatingDifferences: false)
}
} }
} }
} }