mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-25 09:41:00 +00:00
Disable status buttons when browsing
This commit is contained in:
parent
4634230563
commit
0188a65dc4
1 changed files with 7 additions and 1 deletions
|
@ -317,6 +317,8 @@ private extension StatusView {
|
||||||
let viewModel = statusConfiguration.viewModel
|
let viewModel = statusConfiguration.viewModel
|
||||||
let isContextParent = viewModel.configuration.isContextParent
|
let isContextParent = viewModel.configuration.isContextParent
|
||||||
let mutableDisplayName = NSMutableAttributedString(string: viewModel.displayName)
|
let mutableDisplayName = NSMutableAttributedString(string: viewModel.displayName)
|
||||||
|
let isAuthenticated = viewModel.identityContext.identity.authenticated
|
||||||
|
&& !viewModel.identityContext.identity.pending
|
||||||
|
|
||||||
menuButton.menu = menu(viewModel: viewModel)
|
menuButton.menu = menu(viewModel: viewModel)
|
||||||
|
|
||||||
|
@ -437,6 +439,7 @@ private extension StatusView {
|
||||||
setButtonImages(scale: isContextParent ? .medium : .small)
|
setButtonImages(scale: isContextParent ? .medium : .small)
|
||||||
|
|
||||||
replyButton.setCountTitle(count: viewModel.repliesCount, isContextParent: isContextParent)
|
replyButton.setCountTitle(count: viewModel.repliesCount, isContextParent: isContextParent)
|
||||||
|
replyButton.isEnabled = isAuthenticated
|
||||||
|
|
||||||
if viewModel.identityContext.appPreferences.showReblogAndFavoriteCounts || isContextParent {
|
if viewModel.identityContext.appPreferences.showReblogAndFavoriteCounts || isContextParent {
|
||||||
reblogButton.setCountTitle(count: viewModel.reblogsCount, isContextParent: isContextParent)
|
reblogButton.setCountTitle(count: viewModel.reblogsCount, isContextParent: isContextParent)
|
||||||
|
@ -450,14 +453,17 @@ private extension StatusView {
|
||||||
|
|
||||||
reblogButton.tintColor = reblogColor
|
reblogButton.tintColor = reblogColor
|
||||||
reblogButton.setTitleColor(reblogColor, for: .normal)
|
reblogButton.setTitleColor(reblogColor, for: .normal)
|
||||||
reblogButton.isEnabled = viewModel.canBeReblogged
|
reblogButton.isEnabled = viewModel.canBeReblogged && isAuthenticated
|
||||||
|
|
||||||
let favoriteColor: UIColor = viewModel.favorited ? .systemYellow : .secondaryLabel
|
let favoriteColor: UIColor = viewModel.favorited ? .systemYellow : .secondaryLabel
|
||||||
|
|
||||||
favoriteButton.tintColor = favoriteColor
|
favoriteButton.tintColor = favoriteColor
|
||||||
favoriteButton.setTitleColor(favoriteColor, for: .normal)
|
favoriteButton.setTitleColor(favoriteColor, for: .normal)
|
||||||
|
favoriteButton.isEnabled = isAuthenticated
|
||||||
|
|
||||||
shareButton.tag = viewModel.sharingURL?.hashValue ?? 0
|
shareButton.tag = viewModel.sharingURL?.hashValue ?? 0
|
||||||
|
|
||||||
|
menuButton.isEnabled = isAuthenticated
|
||||||
}
|
}
|
||||||
// swiftlint:enable function_body_length
|
// swiftlint:enable function_body_length
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue