Skip to content

Commit

Permalink
Merge pull request #11992 from wordpress-mobile/merge/12.7-beta-2-int…
Browse files Browse the repository at this point in the history
…o-develop

Merge 12.7 beta 2 into develop
  • Loading branch information
jkmassel authored Jun 26, 2019
2 parents c504303 + b7f2263 commit ff94001
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct StatsTotalRowData {
@objc optional func showPostStats(postID: Int, postTitle: String?, postURL: URL?)
}

class StatsTotalRow: UIView, NibLoadable {
class StatsTotalRow: UIView, NibLoadable, Accessible {

// MARK: - Properties

Expand Down Expand Up @@ -167,13 +167,26 @@ class StatsTotalRow: UIView, NibLoadable {
dataLabel.isHidden = rowData.data.isEmpty

applyStyles()
prepareForVoiceOver()
}

override func layoutSubviews() {
super.layoutSubviews()
configureDataBar()
}

// MARK: - Accessibility
func prepareForVoiceOver() {
isAccessibilityElement = true

let itemTitle = itemLabel.text ?? ""
let dataTitle = dataLabel.text ?? ""
accessibilityLabel = [itemTitle, dataTitle].joined(separator: ", ")

let showDisclosure = rowData?.showDisclosure ?? false
accessibilityTraits = (showDisclosure) ? .button : .staticText
accessibilityHint = (showDisclosure) ? NSLocalizedString("Tap for more detail.", comment: "Accessibility hint") : ""
}
}

private extension StatsTotalRow {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class TopTotalsCell: UITableViewCell, NibLoadable {
private var forDetails = false
private var limitRowsDisplayed = true
private let maxChildRowsToDisplay = 10
private var dataRows = [StatsTotalRowData]()
fileprivate var dataRows = [StatsTotalRowData]()
private var subtitlesProvided = true
private weak var siteStatsInsightsDelegate: SiteStatsInsightsDelegate?
private weak var siteStatsPeriodDelegate: SiteStatsPeriodDelegate?
Expand Down Expand Up @@ -66,6 +66,7 @@ class TopTotalsCell: UITableViewCell, NibLoadable {

setSubtitleVisibility()
applyStyles()
prepareForVoiceOver()
}

override func prepareForReuse() {
Expand All @@ -86,7 +87,6 @@ class TopTotalsCell: UITableViewCell, NibLoadable {

removeRowsFromStackView(rowsStackView)
}

}

// MARK: - Private Extension
Expand Down Expand Up @@ -317,3 +317,28 @@ extension TopTotalsCell: ViewMoreRowDelegate {
}

}

// MARK: - Accessibility

extension TopTotalsCell: Accessible {
func prepareForVoiceOver() {
accessibilityTraits = .summaryElement

guard dataRows.count > 0 else {
return
}

let itemTitle = itemSubtitleLabel.text
let dataTitle = dataSubtitleLabel.text

if let itemTitle = itemTitle, let dataTitle = dataTitle {
let description = String(format: "Table showing %@ and %@", itemTitle, dataTitle)
accessibilityLabel = NSLocalizedString(description, comment: "Accessibility of stats table. Placeholders will be populated with names of data shown in table.")
} else {
if let title = (itemTitle ?? dataTitle) {
let description = String(format: "Table showing %@", title)
accessibilityLabel = NSLocalizedString(description, comment: "Accessibility of stats table. Placeholder will be populated with name of data shown in table.")
}
}
}
}
2 changes: 1 addition & 1 deletion config/Version.internal.xcconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_SHORT=12.7

// Internal long version example: VERSION_LONG=9.9.0.20180423
VERSION_LONG=12.7.0.20190620
VERSION_LONG=12.7.0.20190622
2 changes: 1 addition & 1 deletion config/Version.public.xcconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_SHORT=12.7

// Public long version example: VERSION_LONG=9.9.0.0
VERSION_LONG=12.7.0.1
VERSION_LONG=12.7.0.2

0 comments on commit ff94001

Please sign in to comment.