Merge pull request #3021 from stuartbreckenridge/fix/3014
Naming convention for notification options
This commit is contained in:
commit
77cd189c75
@ -241,6 +241,27 @@ public final class WebFeed: Feed, Renamable, Hashable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - NotificationDisplayName
|
||||||
|
public var notificationDisplayName: String {
|
||||||
|
#if os(macOS)
|
||||||
|
if self.url.contains("twitter.com") {
|
||||||
|
return NSLocalizedString("Show notifications for new tweets", comment: "notifyNameDisplay / Twitter")
|
||||||
|
} else if self.url.contains("www.reddit.com") {
|
||||||
|
return NSLocalizedString("Show notifications for new posts", comment: "notifyNameDisplay / Reddit")
|
||||||
|
} else {
|
||||||
|
return NSLocalizedString("Show notifications for new articles", comment: "notifyNameDisplay / Default")
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if self.url.contains("twitter.com") {
|
||||||
|
return NSLocalizedString("Notify about new tweets", comment: "notifyNameDisplay / Twitter")
|
||||||
|
} else if self.url.contains("www.reddit.com") {
|
||||||
|
return NSLocalizedString("Notify about new posts", comment: "notifyNameDisplay / Reddit")
|
||||||
|
} else {
|
||||||
|
return NSLocalizedString("Notify about new articles", comment: "notifyNameDisplay / Default")
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
var metadata: WebFeedMetadata
|
var metadata: WebFeedMetadata
|
||||||
|
|
||||||
// MARK: - Private
|
// MARK: - Private
|
||||||
|
@ -183,6 +183,7 @@ private extension WebFeedInspectorViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateNotifyAboutNewArticles() {
|
func updateNotifyAboutNewArticles() {
|
||||||
|
isNotifyAboutNewArticlesCheckBox?.title = feed?.notificationDisplayName ?? NSLocalizedString("Show notifications for new articles", comment: "Show notifications for new articles")
|
||||||
isNotifyAboutNewArticlesCheckBox?.state = (feed?.isNotifyAboutNewArticles ?? false) ? .on : .off
|
isNotifyAboutNewArticlesCheckBox?.state = (feed?.isNotifyAboutNewArticles ?? false) ? .on : .off
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ private extension SidebarViewController {
|
|||||||
}
|
}
|
||||||
menu.addItem(NSMenuItem.separator())
|
menu.addItem(NSMenuItem.separator())
|
||||||
|
|
||||||
let notificationText = NSLocalizedString("Show Notifications for New Articles", comment: "Show Notifications for New Articles")
|
let notificationText = webFeed.notificationDisplayName.capitalized
|
||||||
|
|
||||||
let notificationMenuItem = menuItem(notificationText, #selector(toggleNotificationsFromContextMenu(_:)), webFeed)
|
let notificationMenuItem = menuItem(notificationText, #selector(toggleNotificationsFromContextMenu(_:)), webFeed)
|
||||||
if webFeed.isNotifyAboutNewArticles == nil || webFeed.isNotifyAboutNewArticles! == false {
|
if webFeed.isNotifyAboutNewArticles == nil || webFeed.isNotifyAboutNewArticles! == false {
|
||||||
|
@ -156,7 +156,15 @@ extension WebFeedInspectorViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||||
super.tableView(tableView, cellForRowAt: shift(indexPath))
|
let cell = super.tableView(tableView, cellForRowAt: shift(indexPath))
|
||||||
|
if indexPath.section == 0 && indexPath.row == 1 {
|
||||||
|
guard let label = cell.contentView.subviews.filter({ $0.isKind(of: UILabel.self) })[0] as? UILabel else {
|
||||||
|
return cell
|
||||||
|
}
|
||||||
|
label.numberOfLines = 2
|
||||||
|
label.text = webFeed.notificationDisplayName.capitalized
|
||||||
|
}
|
||||||
|
return cell
|
||||||
}
|
}
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user