Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a couple of tags management issues in Reader #24130

Merged
merged 4 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
* [*] Remove Submit Feedback form from the Me menu [#24020]
* [*] Fix unselectable group blocks in the experimental editor [https://github.com/wordpress-mobile/GutenbergKit/pull/68]
* [*] Prevent a intermittent crash when opening the experimental editor's "more" menu [#24065]
* [*] Fix an issue with follow/unfollow buttons not working for tags [#24130]
* [*] Fix an issue with tag header using incorrect copy for follow/unfollow button [#24130]
* [*] Add a context menu for tags in the Reader menu [#24130]
* [*] Fix incorrect background color for draft post cells on dashboard [#24080]
* [*] Fix an issue with comments sometimes displaying black text on black background in dark mode [#23536]
* [*] Fix incorrect sizing of images and other attachments in comments [#19943]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ final class ReaderTagStreamHeader: ReaderBaseHeaderView, ReaderStreamHeader {
stackView.pinEdges()

applyStyles()

followButton.addTarget(self, action: #selector(didTapFollowButton), for: .primaryActionTriggered)
followButton.alpha = 0 // don't know the state before topic is loaded
}

public required init?(coder: NSCoder) {
Expand All @@ -34,13 +37,14 @@ final class ReaderTagStreamHeader: ReaderBaseHeaderView, ReaderStreamHeader {
super.traitCollectionDidChange(previousTraitCollection)

if traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) {
WPStyleGuide.applyReaderFollowButtonStyle(followButton)
WPStyleGuide.applyTagsReaderButtonStyle(followButton)
}
}

// MARK: - Configuration

public func configureHeader(_ topic: ReaderAbstractTopic) {
followButton.alpha = 1
if let tag = topic as? ReaderTagTopic {
titleLabel.text = tag.formattedTitle
} else {
Expand All @@ -52,7 +56,7 @@ final class ReaderTagStreamHeader: ReaderBaseHeaderView, ReaderStreamHeader {

// MARK: - Actions

@IBAction func didTapFollowButton(_ sender: UIButton) {
@objc private func didTapFollowButton(_ sender: UIButton) {
followButton.isUserInteractionEnabled = false

delegate?.handleFollowActionForHeader(self, completion: { [weak self] in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ struct ReaderTopicPreviewView: UIViewControllerRepresentable {
let topic: ReaderAbstractTopic

func makeUIViewController(context: Context) -> ReaderStreamViewController {
ReaderStreamViewController.controllerWithTopic(topic)
let vc = ReaderStreamViewController.controllerWithTopic(topic)
vc.additionalSafeAreaInsets.top = 12
return vc
}

func updateUIViewController(_ vc: ReaderStreamViewController, context: Context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ struct ReaderSidebarTagsSection: View {
ReaderTagsHelper().unfollow(tag)
}.tint(.red)
}
.contextMenu(menuItems: {
Button(SharedStrings.Reader.unfollow, systemImage: "trash", role: .destructive) {
ReaderTagsHelper().unfollow(tag)
}
}, preview: {
ReaderTopicPreviewView(topic: tag)
})
}
.onDelete(perform: delete)

Expand Down