Skip to content

Commit

Permalink
Merge pull request #4988 from wikimedia/T374167
Browse files Browse the repository at this point in the history
Update profile nav button accessibility labels
  • Loading branch information
l-olson1214 authored Sep 24, 2024
2 parents 3bc933d + aec660f commit f196e60
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions WMF Framework/CommonStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ public class CommonStrings: NSObject {

@objc public static let notificationsCenterTitle = WMFLocalizedString("notifications-center-title", value: "Notifications", comment: "Title for Notifications Center interface, as well as the accessibility label for the button that navigates to Notifications Center.")
@objc public static let notificationsCenterBadgeTitle = WMFLocalizedString("notifications-center-badge-button-accessibility-label", value: "Notifications with unread badge", comment: "Accessibility label for a button that navigates to Notifications Center. This button has a badge indicating there are unread notifications.")

@objc public static let profileButtonTitle = WMFLocalizedString("profile-button-accessibility-label", value: "Profile", comment: "Accessibility label for the profile navigation bar button. Tapping it navigates to the user profile view.")
@objc public static let profileButtonAccessibilityHint = WMFLocalizedString("profile-button-accessibility-hint", value: "Navigates to the profile view.", comment: "Accessibility hint for the profile navigation bar button. Explains to the user what will happen upon button tap.")
@objc public static let profileButtonBadgeTitle = WMFLocalizedString("profile-button-badge-accessibility-label", value: "Profile with unread badge", comment: "Accessibility label for the profile navigation bar badge button. This button has a badge indicating there are unread notifications. Tapping it navigates to the user profile view.")

public static let notificationsCenterMarkAsRead = WMFLocalizedString("notifications-center-mark-as-read", value: "Mark as Read", comment: "Button text in Notifications Center to mark a notification as read.")
public static let notificationsCenterMarkAsReadSwipe = WMFLocalizedString("notifications-center-swipe-mark-as-read", value: "Mark as read", comment: "Button text in Notifications Center swipe actions to mark a notification as read.")
public static let notificationsCenterMarkAsUnread = WMFLocalizedString("notifications-center-mark-as-unread", value: "Mark as Unread", comment: "Button text in Notifications Center to mark a notification as unread.")
Expand Down
1 change: 1 addition & 0 deletions WMF Framework/NavigationBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ public class NavigationBar: SetupView, FakeProgressReceiving, FakeProgressDelega
barButtonItem.isEnabled = item.isEnabled
barButtonItem.isAccessibilityElement = item.isAccessibilityElement
barButtonItem.accessibilityLabel = item.accessibilityLabel
barButtonItem.accessibilityHint = item.accessibilityHint
return barButtonItem
}

Expand Down
2 changes: 2 additions & 0 deletions Wikipedia/Code/ArticleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,8 @@ private extension ArticleViewController {

let profileImage = BarButtonImageStyle.profileButtonImage(theme: theme, indicated: hasUnreadNotifications, isExplore: false)
let profileViewButtonItem = UIBarButtonItem(image: profileImage, style: .plain, target: self, action: #selector(userDidTapProfile))
profileViewButtonItem.accessibilityLabel = hasUnreadNotifications ? CommonStrings.profileButtonBadgeTitle : CommonStrings.profileButtonTitle
profileViewButtonItem.accessibilityHint = CommonStrings.profileButtonAccessibilityHint

navigationItem.rightBarButtonItems = [AppSearchBarButtonItem.newAppSearchBarButtonItem, profileViewButtonItem]
navigationBar.updateNavigationItems()
Expand Down
2 changes: 2 additions & 0 deletions Wikipedia/Code/ExploreViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ class ExploreViewController: ColumnarCollectionViewController, ExploreCardViewCo

let profileImage = BarButtonImageStyle.profileButtonImage(theme: theme, indicated: hasUnreadNotifications)
let profileViewButtonItem = UIBarButtonItem(image: profileImage, style: .plain, target: self, action: #selector(userDidTapProfile))
profileViewButtonItem.accessibilityLabel = hasUnreadNotifications ? CommonStrings.profileButtonBadgeTitle : CommonStrings.profileButtonTitle
profileViewButtonItem.accessibilityHint = CommonStrings.profileButtonAccessibilityHint
navigationItem.rightBarButtonItem = profileViewButtonItem
navigationBar.updateNavigationItems()
}
Expand Down
2 changes: 2 additions & 0 deletions Wikipedia/Code/WMFSettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ - (void)updateProfileViewButton {
BOOL hasUnreadNotifications = numUnreadNotifications != 0;
UIImage *image = [BarButtonImageStyle profileButtonImageForTheme:self.theme indicated:hasUnreadNotifications isExplore:true];
UIBarButtonItem *profileViewButtonItem = [[UIBarButtonItem alloc] initWithImage:image style:UIBarButtonItemStylePlain target:self action:@selector(userDidTapProfile)];
profileViewButtonItem.accessibilityLabel = hasUnreadNotifications ? WMFCommonStrings.profileButtonBadgeTitle : WMFCommonStrings.profileButtonTitle;
profileViewButtonItem.accessibilityHint = WMFCommonStrings.profileButtonAccessibilityHint;
self.navigationItem.leftBarButtonItem = profileViewButtonItem;
}

Expand Down
3 changes: 3 additions & 0 deletions Wikipedia/Localizations/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,9 @@
"preference-summary-eventlogging-opt-in" = "Allow Wikimedia Foundation to collect information about how you use the app to make the app better";
"privacy-policy-title" = "Privacy policy";
"problem-with-feature-title" = "Problem with feature";
"profile-button-accessibility-hint" = "Navigates to the profile view.";
"profile-button-accessibility-label" = "Profile";
"profile-button-badge-accessibility-label" = "Profile with unread badge";
"profile-page-donate" = "Donate";
"profile-page-donate-subtext" = "Or support Wikipedia with a donation to keep it free and accessible for everyone around the world.";
"profile-page-join-subtext" = "Sign up for a Wikipedia account to track your contributions, save articles offline, and sync across devices.";
Expand Down
3 changes: 3 additions & 0 deletions Wikipedia/Localizations/qqq.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,9 @@
"preference-summary-eventlogging-opt-in" = "Description of preference that when checked enables data collection of user behavior.";
"privacy-policy-title" = "Title for the privacy Policy";
"problem-with-feature-title" = "Button title text that allows user to send feedback to the iOS support email about a particular feature.";
"profile-button-accessibility-hint" = "Accessibility hint for the profile navigation bar button. Explains to the user what will happen upon button tap.";
"profile-button-accessibility-label" = "Accessibility label for the profile navigation bar button. Tapping it navigates to the user profile view.";
"profile-button-badge-accessibility-label" = "Accessibility label for the profile navigation bar badge button. This button has a badge indicating there are unread notifications. Tapping it navigates to the user profile view.";
"profile-page-donate" = "Link to donate";
"profile-page-donate-subtext" = "Information about supporting Wikipedia through donations";
"profile-page-join-subtext" = "Information about signing in or up";
Expand Down
Binary file modified Wikipedia/iOS Native Localizations/en.lproj/Localizable.strings
Binary file not shown.

0 comments on commit f196e60

Please sign in to comment.