diff --git a/Account/Sources/Account/WebFeed.swift b/Account/Sources/Account/WebFeed.swift index a705736e9..d3a2604fe 100644 --- a/Account/Sources/Account/WebFeed.swift +++ b/Account/Sources/Account/WebFeed.swift @@ -240,6 +240,27 @@ public final class WebFeed: Feed, Renamable, Hashable { return true } } + + // 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 diff --git a/Mac/Inspector/WebFeedInspectorViewController.swift b/Mac/Inspector/WebFeedInspectorViewController.swift index b04991916..cd28699b8 100644 --- a/Mac/Inspector/WebFeedInspectorViewController.swift +++ b/Mac/Inspector/WebFeedInspectorViewController.swift @@ -183,6 +183,7 @@ private extension WebFeedInspectorViewController { } 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 } diff --git a/Mac/MainWindow/Sidebar/SidebarViewController+ContextualMenus.swift b/Mac/MainWindow/Sidebar/SidebarViewController+ContextualMenus.swift index 2ebe3ea22..46286cd64 100644 --- a/Mac/MainWindow/Sidebar/SidebarViewController+ContextualMenus.swift +++ b/Mac/MainWindow/Sidebar/SidebarViewController+ContextualMenus.swift @@ -230,7 +230,7 @@ private extension SidebarViewController { } 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) if webFeed.isNotifyAboutNewArticles == nil || webFeed.isNotifyAboutNewArticles! == false { diff --git a/iOS/Inspector/WebFeedInspectorViewController.swift b/iOS/Inspector/WebFeedInspectorViewController.swift index d8b8120c6..048514ab1 100644 --- a/iOS/Inspector/WebFeedInspectorViewController.swift +++ b/iOS/Inspector/WebFeedInspectorViewController.swift @@ -156,7 +156,15 @@ extension WebFeedInspectorViewController { } 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? {