From 7183b853bd3eec3d1098d1bc1ccf318d221320de Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Mon, 13 Jul 2020 14:24:57 +0800 Subject: [PATCH 1/4] #2256 Fixes #2256 --- Shared/Extensions/URL-Extensions.swift | 9 +++++++++ iOS/Article/WebViewController.swift | 1 + 2 files changed, 10 insertions(+) diff --git a/Shared/Extensions/URL-Extensions.swift b/Shared/Extensions/URL-Extensions.swift index 4fb9b8d7f..5cafe888a 100644 --- a/Shared/Extensions/URL-Extensions.swift +++ b/Shared/Extensions/URL-Extensions.swift @@ -15,4 +15,13 @@ extension URL { scheme == "mailto" ? URLComponents(url: self, resolvingAgainstBaseURL: false)?.path : nil } + func valueFor(_ parameter: String) -> String? { + guard let components = URLComponents(url: self, resolvingAgainstBaseURL: false), + let queryItems = components.queryItems, + let value = queryItems.first(where: { $0.name == parameter })?.value else { + return nil + } + return value + } + } diff --git a/iOS/Article/WebViewController.swift b/iOS/Article/WebViewController.swift index d702b0b87..6ce48e551 100644 --- a/iOS/Article/WebViewController.swift +++ b/iOS/Article/WebViewController.swift @@ -338,6 +338,7 @@ extension WebViewController: WKNavigationDelegate { if MFMailComposeViewController.canSendMail() { let mailComposeViewController = MFMailComposeViewController() mailComposeViewController.setToRecipients([emailAddress]) + mailComposeViewController.setSubject(url.valueFor("subject") ?? "") mailComposeViewController.mailComposeDelegate = self self.present(mailComposeViewController, animated: true, completion: {}) } else { From 1427e1d8c67958ca449fe3a8ec4bdb226bcdb6f7 Mon Sep 17 00:00:00 2001 From: Rizwan Mohamed Ibrahim Date: Tue, 14 Jul 2020 18:07:29 +0530 Subject: [PATCH 2/4] Add a11y label for expanded/collapsed status for Master Feed --- .../Cell/MasterFeedTableViewSectionHeader.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift index 3fcf7506f..0742fcb47 100644 --- a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift +++ b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift @@ -21,12 +21,22 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView { get { if unreadCount > 0 { let unreadLabel = NSLocalizedString("unread", comment: "Unread label for accessiblity") - return "\(name) \(unreadCount) \(unreadLabel)" + return "\(name) \(unreadCount) \(unreadLabel) \(expandedStateMessage) " } else { - return name + return "\(name) \(expandedStateMessage) " } } } + + private var expandedStateMessage: String { + set {} + get { + if disclosureExpanded { + return NSLocalizedString("Expanded", comment: "Disclosure button expanded state for accessibility") + } + return NSLocalizedString("Collapsed", comment: "Disclosure button expanded state for accessibility") + } + } var unreadCount: Int { get { From 1a3bbf7dbf105bd9c50ce35b83ced8f652da455e Mon Sep 17 00:00:00 2001 From: Rizwan Mohamed Ibrahim Date: Tue, 14 Jul 2020 18:08:07 +0530 Subject: [PATCH 3/4] Add a11y label for starred status on master timeline --- iOS/MasterTimeline/Cell/MasterTimelineTableViewCell.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/iOS/MasterTimeline/Cell/MasterTimelineTableViewCell.swift b/iOS/MasterTimeline/Cell/MasterTimelineTableViewCell.swift index 813420cf6..76684e7f5 100644 --- a/iOS/MasterTimeline/Cell/MasterTimelineTableViewCell.swift +++ b/iOS/MasterTimeline/Cell/MasterTimelineTableViewCell.swift @@ -237,8 +237,9 @@ private extension MasterTimelineTableViewCell { } func updateAccessiblityLabel() { - var label = cellData.read ? "" : "\(NSLocalizedString("Unread", comment: "Unread")), " - label += "\(cellData.feedName), \(cellData.title), \(cellData.summary), \(cellData.dateString)" + let starredStatus = cellData.starred ? "\(NSLocalizedString("Starred", comment: "Favourites article for accessibility")), " : "" + let unreadStatus = cellData.read ? "" : "\(NSLocalizedString("Unread", comment: "Unread")), " + let label = starredStatus + unreadStatus + "\(cellData.feedName), \(cellData.title), \(cellData.summary), \(cellData.dateString)" accessibilityLabel = label } From 64a4d9bbe5c1d1d3761b47a9ffdfd4d62bafd6f5 Mon Sep 17 00:00:00 2001 From: Rizwan Mohamed Ibrahim Date: Tue, 14 Jul 2020 22:04:20 +0530 Subject: [PATCH 4/4] Fix localised comments --- iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift | 2 +- iOS/MasterTimeline/Cell/MasterTimelineTableViewCell.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift index 0742fcb47..dc5b21ed6 100644 --- a/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift +++ b/iOS/MasterFeed/Cell/MasterFeedTableViewSectionHeader.swift @@ -34,7 +34,7 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView { if disclosureExpanded { return NSLocalizedString("Expanded", comment: "Disclosure button expanded state for accessibility") } - return NSLocalizedString("Collapsed", comment: "Disclosure button expanded state for accessibility") + return NSLocalizedString("Collapsed", comment: "Disclosure button collapsed state for accessibility") } } diff --git a/iOS/MasterTimeline/Cell/MasterTimelineTableViewCell.swift b/iOS/MasterTimeline/Cell/MasterTimelineTableViewCell.swift index 76684e7f5..7d3a1b936 100644 --- a/iOS/MasterTimeline/Cell/MasterTimelineTableViewCell.swift +++ b/iOS/MasterTimeline/Cell/MasterTimelineTableViewCell.swift @@ -237,7 +237,7 @@ private extension MasterTimelineTableViewCell { } func updateAccessiblityLabel() { - let starredStatus = cellData.starred ? "\(NSLocalizedString("Starred", comment: "Favourites article for accessibility")), " : "" + let starredStatus = cellData.starred ? "\(NSLocalizedString("Starred", comment: "Starred article for accessibility")), " : "" let unreadStatus = cellData.read ? "" : "\(NSLocalizedString("Unread", comment: "Unread")), " let label = starredStatus + unreadStatus + "\(cellData.feedName), \(cellData.title), \(cellData.summary), \(cellData.dateString)" accessibilityLabel = label