Add spinner to loading-state (and fix some colors)
This commit is contained in:
parent
7432b6f22b
commit
c26467c904
|
@ -104,7 +104,7 @@ public final class UserView: UIView {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
public let followButtonWrapper = UIView()
|
public let followButtonWrapper = UIView()
|
||||||
private let followButton: UIButton = {
|
public let followButton: UIButton = {
|
||||||
var buttonConfiguration = UIButton.Configuration.filled()
|
var buttonConfiguration = UIButton.Configuration.filled()
|
||||||
buttonConfiguration.background.cornerRadius = 10
|
buttonConfiguration.background.cornerRadius = 10
|
||||||
|
|
||||||
|
@ -272,48 +272,63 @@ public extension UserView {
|
||||||
followButtonWrapper.isHidden = false
|
followButtonWrapper.isHidden = false
|
||||||
followButton.isHidden = false
|
followButton.isHidden = false
|
||||||
followButton.configuration?.title = nil
|
followButton.configuration?.title = nil
|
||||||
followButton.setBackgroundColor(Asset.Colors.Button.disabled.color, for: .normal)
|
followButton.configuration?.showsActivityIndicator = true
|
||||||
|
followButton.configuration?.background.backgroundColor = Asset.Colors.Button.userFollowing.color
|
||||||
|
followButton.configuration?.baseForegroundColor = Asset.Colors.Brand.blurple.color
|
||||||
|
followButton.isEnabled = false
|
||||||
|
|
||||||
case .follow:
|
case .follow:
|
||||||
followButtonWrapper.isHidden = false
|
followButtonWrapper.isHidden = false
|
||||||
followButton.isHidden = false
|
followButton.isHidden = false
|
||||||
followButton.configuration?.title = L10n.Common.Controls.Friendship.follow
|
followButton.configuration?.title = L10n.Common.Controls.Friendship.follow
|
||||||
followButton.configuration?.baseBackgroundColor = Asset.Colors.Button.userFollow.color
|
followButton.configuration?.showsActivityIndicator = false
|
||||||
|
followButton.configuration?.background.backgroundColor = Asset.Colors.Button.userFollow.color
|
||||||
followButton.configuration?.baseForegroundColor = .white
|
followButton.configuration?.baseForegroundColor = .white
|
||||||
|
followButton.isEnabled = true
|
||||||
|
|
||||||
case .request:
|
case .request:
|
||||||
followButtonWrapper.isHidden = false
|
followButtonWrapper.isHidden = false
|
||||||
followButton.isHidden = false
|
followButton.isHidden = false
|
||||||
followButton.configuration?.title = L10n.Common.Controls.Friendship.request
|
followButton.configuration?.title = L10n.Common.Controls.Friendship.request
|
||||||
followButton.configuration?.baseBackgroundColor = Asset.Colors.Button.userFollow.color
|
followButton.configuration?.showsActivityIndicator = false
|
||||||
|
followButton.configuration?.background.backgroundColor = Asset.Colors.Button.userFollow.color
|
||||||
followButton.configuration?.baseForegroundColor = .white
|
followButton.configuration?.baseForegroundColor = .white
|
||||||
|
followButton.isEnabled = true
|
||||||
|
|
||||||
case .pending:
|
case .pending:
|
||||||
followButtonWrapper.isHidden = false
|
followButtonWrapper.isHidden = false
|
||||||
followButton.isHidden = false
|
followButton.isHidden = false
|
||||||
followButton.configuration?.title = L10n.Common.Controls.Friendship.pending
|
followButton.configuration?.title = L10n.Common.Controls.Friendship.pending
|
||||||
followButton.configuration?.baseForegroundColor = Asset.Colors.Button.userFollowingTitle.color
|
followButton.configuration?.baseForegroundColor = Asset.Colors.Button.userFollowingTitle.color
|
||||||
followButton.configuration?.baseBackgroundColor = Asset.Colors.Button.userFollowing.color
|
followButton.configuration?.showsActivityIndicator = false
|
||||||
|
followButton.configuration?.background.backgroundColor = Asset.Colors.Button.userFollowing.color
|
||||||
|
followButton.isEnabled = true
|
||||||
|
|
||||||
case .unfollow:
|
case .unfollow:
|
||||||
followButtonWrapper.isHidden = false
|
followButtonWrapper.isHidden = false
|
||||||
followButton.isHidden = false
|
followButton.isHidden = false
|
||||||
followButton.configuration?.title = L10n.Common.Controls.Friendship.following
|
followButton.configuration?.title = L10n.Common.Controls.Friendship.following
|
||||||
followButton.configuration?.baseBackgroundColor = Asset.Colors.Button.userFollowing.color
|
followButton.configuration?.showsActivityIndicator = false
|
||||||
|
followButton.configuration?.background.backgroundColor = Asset.Colors.Button.userFollowing.color
|
||||||
followButton.configuration?.baseForegroundColor = Asset.Colors.Button.userFollowingTitle.color
|
followButton.configuration?.baseForegroundColor = Asset.Colors.Button.userFollowingTitle.color
|
||||||
|
followButton.isEnabled = true
|
||||||
|
|
||||||
case .blocked:
|
case .blocked:
|
||||||
followButtonWrapper.isHidden = false
|
followButtonWrapper.isHidden = false
|
||||||
followButton.isHidden = false
|
followButton.isHidden = false
|
||||||
followButton.configuration?.title = L10n.Common.Controls.Friendship.blocked
|
followButton.configuration?.title = L10n.Common.Controls.Friendship.blocked
|
||||||
followButton.configuration?.baseBackgroundColor = Asset.Colors.Button.userBlocked.color
|
followButton.configuration?.showsActivityIndicator = false
|
||||||
|
followButton.configuration?.background.backgroundColor = Asset.Colors.Button.userBlocked.color
|
||||||
followButton.configuration?.baseForegroundColor = .systemRed
|
followButton.configuration?.baseForegroundColor = .systemRed
|
||||||
|
followButton.isEnabled = true
|
||||||
|
|
||||||
case .none:
|
case .none:
|
||||||
followButtonWrapper.isHidden = true
|
followButtonWrapper.isHidden = true
|
||||||
followButton.isHidden = true
|
followButton.isHidden = true
|
||||||
followButton.configuration?.title = nil
|
followButton.configuration?.title = nil
|
||||||
followButton.configuration?.baseBackgroundColor = .clear
|
followButton.configuration?.showsActivityIndicator = false
|
||||||
|
followButton.configuration?.background.backgroundColor = .clear
|
||||||
|
followButton.isEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
followButton.addTarget(self, action: #selector(didTapFollowButton), for: .touchUpInside)
|
followButton.addTarget(self, action: #selector(didTapFollowButton), for: .touchUpInside)
|
||||||
|
|
Loading…
Reference in New Issue