From 0188a65dc4f02669f3bbbd690929376b3fca4336 Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Sun, 31 Jan 2021 05:38:59 -0800 Subject: [PATCH] Disable status buttons when browsing --- Views/UIKit/Content Views/StatusView.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Views/UIKit/Content Views/StatusView.swift b/Views/UIKit/Content Views/StatusView.swift index 7c85679..09ee40c 100644 --- a/Views/UIKit/Content Views/StatusView.swift +++ b/Views/UIKit/Content Views/StatusView.swift @@ -317,6 +317,8 @@ private extension StatusView { let viewModel = statusConfiguration.viewModel let isContextParent = viewModel.configuration.isContextParent let mutableDisplayName = NSMutableAttributedString(string: viewModel.displayName) + let isAuthenticated = viewModel.identityContext.identity.authenticated + && !viewModel.identityContext.identity.pending menuButton.menu = menu(viewModel: viewModel) @@ -437,6 +439,7 @@ private extension StatusView { setButtonImages(scale: isContextParent ? .medium : .small) replyButton.setCountTitle(count: viewModel.repliesCount, isContextParent: isContextParent) + replyButton.isEnabled = isAuthenticated if viewModel.identityContext.appPreferences.showReblogAndFavoriteCounts || isContextParent { reblogButton.setCountTitle(count: viewModel.reblogsCount, isContextParent: isContextParent) @@ -450,14 +453,17 @@ private extension StatusView { reblogButton.tintColor = reblogColor reblogButton.setTitleColor(reblogColor, for: .normal) - reblogButton.isEnabled = viewModel.canBeReblogged + reblogButton.isEnabled = viewModel.canBeReblogged && isAuthenticated let favoriteColor: UIColor = viewModel.favorited ? .systemYellow : .secondaryLabel favoriteButton.tintColor = favoriteColor favoriteButton.setTitleColor(favoriteColor, for: .normal) + favoriteButton.isEnabled = isAuthenticated shareButton.tag = viewModel.sharingURL?.hashValue ?? 0 + + menuButton.isEnabled = isAuthenticated } // swiftlint:enable function_body_length