Skip to content

Commit

Permalink
Fix display of certain topics in Discover recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jan 10, 2025
1 parent daaa5ad commit 7599361
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions WordPress/Classes/Models/ReaderTagTopic.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ import Foundation
return topic
}

var formattedTitle: String {
title.split(separator: "-").map(\.capitalized).joined(separator: " ")
}

/// Convenience method to update the tag's `following` state and also updates `showInMenu`.
@objc func toggleFollowing(_ isFollowing: Bool) {
following = isFollowing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ enum ReaderDiscoverChannel: Hashable {
case .dailyPrompts:
NSLocalizedString("reader.discover.channel.dailyPrompts", value: "Daily Prompts", comment: "Header view channel (filter)")
case .tag(let tag):
tag.title.localizedCapitalized
tag.formattedTitle
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ final class ReaderTagStreamHeader: ReaderBaseHeaderView, ReaderStreamHeader {
// MARK: - Configuration

public func configureHeader(_ topic: ReaderAbstractTopic) {
titleLabel.text = topic.title.split(separator: "-").map { $0.capitalized }.joined(separator: " ")
if let tag = topic as? ReaderTagTopic {
titleLabel.text = tag.formattedTitle
} else {
titleLabel.text = topic.title
}
followButton.isSelected = topic.following
WPStyleGuide.applyTagsReaderButtonStyle(followButton)
}
Expand Down

0 comments on commit 7599361

Please sign in to comment.