Improve UserView button behavior (IOS-140)
This commit is contained in:
parent
096b1200b0
commit
9d2e8eca16
|
@ -56,14 +56,13 @@ extension UserTableViewCell {
|
|||
viewModel.followedUsers,
|
||||
viewModel.blockedUsers
|
||||
)
|
||||
.debounce(for: 0.1, scheduler: DispatchQueue.main)
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] followed, blocked in
|
||||
if blocked.contains(user.id) {
|
||||
self?.userView.setButtonState(.blocked)
|
||||
} else if followed.contains(user.id) {
|
||||
self?.userView.setButtonState(.unfollow)
|
||||
} else {
|
||||
} else if user != me {
|
||||
self?.userView.setButtonState(.follow)
|
||||
}
|
||||
|
||||
|
|
|
@ -270,7 +270,9 @@ public extension UserView {
|
|||
|
||||
switch state {
|
||||
case .loading:
|
||||
followButton.isHidden = true
|
||||
followButton.isHidden = false
|
||||
followButton.setTitle(nil, for: .normal)
|
||||
followButton.setBackgroundColor(Asset.Colors.Button.disabled.color, for: .normal)
|
||||
|
||||
case .follow:
|
||||
followButton.isHidden = false
|
||||
|
@ -292,6 +294,8 @@ public extension UserView {
|
|||
|
||||
case .none:
|
||||
followButton.isHidden = true
|
||||
followButton.setTitle(nil, for: .normal)
|
||||
followButton.setBackgroundColor(.clear, for: .normal)
|
||||
}
|
||||
|
||||
followButton.addTarget(self, action: #selector(didTapButton), for: .touchUpInside)
|
||||
|
|
Loading…
Reference in New Issue