shim accessibility for testers.

This commit is contained in:
Kyle Matthew Hedden 2020-08-06 18:25:12 -04:00
parent af2425e296
commit 4cc2a1cda0

View File

@ -63,8 +63,13 @@
- (void)amendAccesibilityLabel {
NSString *amendment = [MVMCoreUIUtility hardcodedStringWithKey:@"top_alert_notification"];
if (![self.buttonView.label.accessibilityLabel hasPrefix:amendment]) {
self.buttonView.label.accessibilityLabel = [NSString stringWithFormat:@"%@ - %@", amendment, self.buttonView.label.accessibilityLabel];
NSString *accessibilityLabel = self.buttonView.label.accessibilityLabel;
if (!accessibilityLabel) {
// The accessibility label is nil when in non-voice over mode. Therefore assign the label text for the voice over is turned on mid-session (i.e. testers 🤦).
accessibilityLabel = self.buttonView.label.text;
}
if (accessibilityLabel && ![accessibilityLabel hasPrefix:amendment]) {
self.buttonView.label.accessibilityLabel = [NSString stringWithFormat:@"%@ - %@", amendment, accessibilityLabel];
}
}