Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ class InsightsManagementViewController: UITableViewController {
}
}

private var insightsInactive: [StatSection] {
InsightsManagementViewController.allInsights.filter({ !self.insightsShown.contains($0) })
}

private var hasChanges: Bool {
return insightsShown != originalInsightsShown
}
Expand Down Expand Up @@ -250,7 +254,7 @@ private extension InsightsManagementViewController {
}

func inactiveCardsSection() -> ImmuTableSection {
let rows = InsightsManagementViewController.allInsights.filter({ !self.insightsShown.contains($0) })
let rows = insightsInactive

guard rows.count > 0 else {
return ImmuTableSection(headerText: TextContent.inactiveCardsHeader, rows: [inactivePlaceholderRow])
Expand All @@ -259,7 +263,7 @@ private extension InsightsManagementViewController {
return ImmuTableSection(headerText: TextContent.inactiveCardsHeader,
rows: rows.map {
return AddInsightStatRow(title: $0.insightManagementTitle,
enabled: true,
enabled: false,
action: rowActionFor($0)) }
)
}
Expand Down Expand Up @@ -310,6 +314,7 @@ private extension InsightsManagementViewController {
}

reloadViewModel()
selectToggledRowForAccessibility(for: statSection)
}

var placeholderRow: ImmuTableRow {
Expand Down Expand Up @@ -375,3 +380,13 @@ private extension InsightsManagementViewController {
}

}

private extension InsightsManagementViewController {
func selectToggledRowForAccessibility(for statSection: StatSection) {
if let shownIndex = insightsShown.firstIndex(of: statSection) {
UIAccessibility.post(notification: .screenChanged, argument: tableView.cellForRow(at: .init(item: shownIndex, section: 0)))
} else if let inactiveIndex = insightsInactive.firstIndex(of: statSection) {
UIAccessibility.post(notification: .screenChanged, argument: tableView.cellForRow(at: .init(item: inactiveIndex, section: 1)))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -588,11 +588,11 @@ private extension NoResultsViewController {
view.accessibilityLabel = titleLabel.text
view.accessibilityTraits = .staticText
} else {
view.accessibilityElements = [noResultsView!, actionButton!]
view.accessibilityElements = [labelStackView!, actionButton!]

noResultsView.isAccessibilityElement = true
noResultsView.accessibilityTraits = .staticText
noResultsView.accessibilityLabel = [
labelStackView.accessibilityTraits = .staticText
labelStackView.isAccessibilityElement = true
labelStackView.accessibilityLabel = [
titleLabel.text,
subtitleTextView.isHidden ? nil : subtitleTextView.attributedText.string
].compactMap { $0 }.joined(separator: ". ")
Expand Down