From 533e86caabad5293dcc3969e343e646c73e459ef Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Mon, 1 Feb 2021 14:00:40 -0800 Subject: [PATCH] Accessibility labels wip --- Localizations/Localizable.strings | 1 + Views/UIKit/CompositionView.swift | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Localizations/Localizable.strings b/Localizations/Localizable.strings index 0e01f9f..865967d 100644 --- a/Localizations/Localizable.strings +++ b/Localizations/Localizable.strings @@ -62,6 +62,7 @@ "compose.attachments-will-be-discarded" = "Attachments will be discarded when changing accounts"; "compose.browse" = "Browse"; "compose.characters-remaining-accessibility-label-%ld" = "%ld characters remaining"; +"compose.change-identity-button.accessibility-hint" = "Tap to post with a different account"; "compose.content-warning-button.add" = "Add content warning"; "compose.content-warning-button.remove" = "Remove content warning"; "compose.emoji-button" = "Emoji picker"; diff --git a/Views/UIKit/CompositionView.swift b/Views/UIKit/CompositionView.swift index 5c350de..554b4f8 100644 --- a/Views/UIKit/CompositionView.swift +++ b/Views/UIKit/CompositionView.swift @@ -184,8 +184,15 @@ private extension CompositionView { } .store(in: &cancellables) - parentViewModel.$identityContext.map(\.identity.image) - .sink { [weak self] in self?.avatarImageView.kf.setImage(with: $0) } + parentViewModel.$identityContext.map(\.identity) + .sink { [weak self] in + guard let self = self else { return } + + self.avatarImageView.kf.setImage(with: $0.image) + self.changeIdentityButton.accessibilityLabel = $0.handle + self.changeIdentityButton.accessibilityHint = + NSLocalizedString("compose.change-identity-button.accessibility-hint", comment: "") + } .store(in: &cancellables) parentViewModel.$authenticatedIdentities