diff --git a/Account/Sources/Account/WebFeed.swift b/Account/Sources/Account/WebFeed.swift index a705736e9..1d173c139 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 notifyNameDisplay: 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..4ad0b1779 100644 --- a/Mac/Inspector/WebFeedInspectorViewController.swift +++ b/Mac/Inspector/WebFeedInspectorViewController.swift @@ -183,6 +183,7 @@ private extension WebFeedInspectorViewController { } func updateNotifyAboutNewArticles() { + isNotifyAboutNewArticlesCheckBox?.title = feed?.notifyNameDisplay ?? 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..998154875 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.notifyNameDisplay.capitalized let notificationMenuItem = menuItem(notificationText, #selector(toggleNotificationsFromContextMenu(_:)), webFeed) if webFeed.isNotifyAboutNewArticles == nil || webFeed.isNotifyAboutNewArticles! == false { diff --git a/iOS/Inspector/Inspector.storyboard b/iOS/Inspector/Inspector.storyboard index 384157ff9..fc6effa99 100644 --- a/iOS/Inspector/Inspector.storyboard +++ b/iOS/Inspector/Inspector.storyboard @@ -199,13 +199,16 @@ + + + @@ -214,10 +217,11 @@ - - - + + + + @@ -229,7 +233,7 @@ + + - - - + + @@ -346,7 +351,7 @@ - + diff --git a/iOS/Inspector/WebFeedInspectorViewController.swift b/iOS/Inspector/WebFeedInspectorViewController.swift index d8b8120c6..8265bb1d2 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.notifyNameDisplay.capitalized + } + return cell } override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {