mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2025-01-27 07:46:15 +01:00
Disable "Follow all"-button if there are no suggestions (#1124)
This commit is contained in:
parent
32564ff871
commit
be11f632cc
@ -104,6 +104,8 @@ extension SuggestionAccountViewController: UITableViewDelegate {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
footerView.followAllButton.isEnabled = viewModel.userFetchedResultsController.records.isNotEmpty
|
||||||
|
|
||||||
footerView.delegate = self
|
footerView.delegate = self
|
||||||
return footerView
|
return footerView
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ final class SuggestionAccountViewModel: NSObject {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
guard !userIDs.isEmpty else { return }
|
guard userIDs.isNotEmpty else { return }
|
||||||
userFetchedResultsController.userIDs = userIDs
|
userFetchedResultsController.userIDs = userIDs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,20 +14,20 @@ class SuggestionAccountTableViewFooter: UITableViewHeaderFooterView {
|
|||||||
|
|
||||||
weak var delegate: SuggestionAccountTableViewFooterDelegate?
|
weak var delegate: SuggestionAccountTableViewFooterDelegate?
|
||||||
|
|
||||||
let followAllButton: FollowButton
|
let followAllButton: UIButton
|
||||||
|
|
||||||
override init(reuseIdentifier: String?) {
|
override init(reuseIdentifier: String?) {
|
||||||
|
|
||||||
//TODO: Check if we can use UIButton.configuration here instead?
|
var buttonConfiguration = UIButton.Configuration.filled()
|
||||||
followAllButton = FollowButton()
|
buttonConfiguration.baseForegroundColor = .white
|
||||||
followAllButton.translatesAutoresizingMaskIntoConstraints = false
|
buttonConfiguration.baseBackgroundColor = Asset.Colors.Button.userFollow.color
|
||||||
followAllButton.setTitle(L10n.Scene.SuggestionAccount.followAll, for: .normal)
|
buttonConfiguration.background.cornerRadius = 10
|
||||||
followAllButton.setBackgroundColor(Asset.Colors.Button.userFollow.color, for: .normal)
|
buttonConfiguration.attributedTitle = AttributedString(L10n.Scene.SuggestionAccount.followAll, attributes: AttributeContainer([.font: UIFontMetrics(forTextStyle: .subheadline).scaledFont(for: .boldSystemFont(ofSize: 15))]))
|
||||||
followAllButton.setTitleColor(.white, for: .normal)
|
buttonConfiguration.contentInsets = NSDirectionalEdgeInsets(top: 12, leading: 20, bottom: 12, trailing: 20)
|
||||||
followAllButton.contentEdgeInsets = .init(horizontal: 20, vertical: 12)
|
|
||||||
followAllButton.cornerRadius = 10
|
|
||||||
followAllButton.titleLabel?.font = UIFontMetrics(forTextStyle: .subheadline).scaledFont(for: .boldSystemFont(ofSize: 15))
|
|
||||||
|
|
||||||
|
followAllButton = UIButton(configuration: buttonConfiguration)
|
||||||
|
followAllButton.isEnabled = false
|
||||||
|
followAllButton.translatesAutoresizingMaskIntoConstraints = false
|
||||||
followAllButton.setContentCompressionResistancePriority(.required, for: .horizontal)
|
followAllButton.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||||
followAllButton.setContentHuggingPriority(.required, for: .horizontal)
|
followAllButton.setContentHuggingPriority(.required, for: .horizontal)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user