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:
parent
dfb84fdb5b
commit
206beb6d19
@ -48,7 +48,11 @@ extension FollowerListViewModel {
|
||||
case is State.Idle, is State.Loading, is State.Fail:
|
||||
snapshot.appendItems([.bottomLoader], toSection: .main)
|
||||
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)
|
||||
default:
|
||||
break
|
||||
|
@ -155,7 +155,7 @@ extension FollowerListViewModel.State {
|
||||
|
||||
let maxID = response.link?.maxID
|
||||
|
||||
if hasNewAppend, maxID != nil {
|
||||
if maxID != nil {
|
||||
stateMachine.enter(Idle.self)
|
||||
} else {
|
||||
stateMachine.enter(NoMore.self)
|
||||
|
@ -48,7 +48,12 @@ extension FollowingListViewModel {
|
||||
case is State.Idle, is State.Loading, is State.Fail:
|
||||
snapshot.appendItems([.bottomLoader], toSection: .main)
|
||||
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:
|
||||
break
|
||||
}
|
||||
|
@ -179,18 +179,6 @@ extension FollowingListViewModel.State {
|
||||
|
||||
override func didEnter(from previousState: GKState?) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user