mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-22 08:10:59 +00:00
VoiceOver wip
This commit is contained in:
parent
5bfe75c778
commit
45517c0df6
3 changed files with 49 additions and 8 deletions
|
@ -3,6 +3,7 @@
|
||||||
"about" = "About";
|
"about" = "About";
|
||||||
"about.acknowledgments" = "Acknowledgments";
|
"about.acknowledgments" = "Acknowledgments";
|
||||||
"account.%@-followers" = "%@'s Followers";
|
"account.%@-followers" = "%@'s Followers";
|
||||||
|
"account.accept-follow-request-button.accessibility-label" = "Accept follow request";
|
||||||
"account.avatar.accessibility-label-%@" = "Avatar: %@";
|
"account.avatar.accessibility-label-%@" = "Avatar: %@";
|
||||||
"account.block" = "Block";
|
"account.block" = "Block";
|
||||||
"account.block.confirm-%@" = "Block %@?";
|
"account.block.confirm-%@" = "Block %@?";
|
||||||
|
@ -19,6 +20,7 @@
|
||||||
"account.header.accessibility-label-%@" = "Header image: %@";
|
"account.header.accessibility-label-%@" = "Header image: %@";
|
||||||
"account.hide-reblogs" = "Hide boosts";
|
"account.hide-reblogs" = "Hide boosts";
|
||||||
"account.mute" = "Mute";
|
"account.mute" = "Mute";
|
||||||
|
"account.reject-follow-request-button.accessibility-label" = "Reject follow request";
|
||||||
"account.request" = "Request";
|
"account.request" = "Request";
|
||||||
"account.statuses.post" = "Posts";
|
"account.statuses.post" = "Posts";
|
||||||
"account.statuses.toot" = "Toots";
|
"account.statuses.toot" = "Toots";
|
||||||
|
|
|
@ -147,22 +147,23 @@ private extension AccountView {
|
||||||
stackView.bottomAnchor.constraint(equalTo: readableContentGuide.bottomAnchor),
|
stackView.bottomAnchor.constraint(equalTo: readableContentGuide.bottomAnchor),
|
||||||
stackView.trailingAnchor.constraint(equalTo: readableContentGuide.trailingAnchor)
|
stackView.trailingAnchor.constraint(equalTo: readableContentGuide.trailingAnchor)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
isAccessibilityElement = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// swiftlint:disable:next function_body_length
|
||||||
func applyAccountConfiguration() {
|
func applyAccountConfiguration() {
|
||||||
let viewModel = accountConfiguration.viewModel
|
let viewModel = accountConfiguration.viewModel
|
||||||
|
|
||||||
avatarImageView.kf.setImage(with: viewModel.avatarURL(profile: false))
|
avatarImageView.kf.setImage(with: viewModel.avatarURL(profile: false))
|
||||||
|
|
||||||
if viewModel.displayName.isEmpty {
|
let mutableDisplayName = NSMutableAttributedString(string: viewModel.displayName)
|
||||||
displayNameLabel.isHidden = true
|
|
||||||
} else {
|
|
||||||
let mutableDisplayName = NSMutableAttributedString(string: viewModel.displayName)
|
|
||||||
|
|
||||||
mutableDisplayName.insert(emojis: viewModel.emojis, view: displayNameLabel)
|
mutableDisplayName.insert(emojis: viewModel.emojis, view: displayNameLabel)
|
||||||
mutableDisplayName.resizeAttachments(toLineHeight: displayNameLabel.font.lineHeight)
|
mutableDisplayName.resizeAttachments(toLineHeight: displayNameLabel.font.lineHeight)
|
||||||
displayNameLabel.attributedText = mutableDisplayName
|
displayNameLabel.attributedText = mutableDisplayName
|
||||||
}
|
|
||||||
|
displayNameLabel.isHidden = viewModel.displayName.isEmpty
|
||||||
|
|
||||||
accountLabel.text = viewModel.accountName
|
accountLabel.text = viewModel.accountName
|
||||||
|
|
||||||
|
@ -189,5 +190,42 @@ private extension AccountView {
|
||||||
|
|
||||||
acceptFollowRequestButton.isHidden = !isFollowRequest
|
acceptFollowRequestButton.isHidden = !isFollowRequest
|
||||||
rejectFollowRequestButton.isHidden = !isFollowRequest
|
rejectFollowRequestButton.isHidden = !isFollowRequest
|
||||||
|
|
||||||
|
let accessibilityAttributedLabel = NSMutableAttributedString(string: "")
|
||||||
|
|
||||||
|
if !displayNameLabel.isHidden, let displayName = displayNameLabel.attributedText {
|
||||||
|
accessibilityAttributedLabel.append(displayName)
|
||||||
|
accessibilityAttributedLabel.appendWithSeparator(viewModel.accountName)
|
||||||
|
} else {
|
||||||
|
accessibilityAttributedLabel.appendWithSeparator(viewModel.accountName)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !noteTextView.isHidden, let note = noteTextView.attributedText {
|
||||||
|
accessibilityAttributedLabel.appendWithSeparator(note)
|
||||||
|
}
|
||||||
|
|
||||||
|
self.accessibilityAttributedLabel = accessibilityAttributedLabel
|
||||||
|
|
||||||
|
if isFollowRequest {
|
||||||
|
accessibilityCustomActions = [
|
||||||
|
UIAccessibilityCustomAction(
|
||||||
|
name: NSLocalizedString(
|
||||||
|
"account.accept-follow-request-button.accessibility-label",
|
||||||
|
comment: "")) { [weak self] _ in
|
||||||
|
self?.accountConfiguration.viewModel.acceptFollowRequest()
|
||||||
|
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
UIAccessibilityCustomAction(
|
||||||
|
name: NSLocalizedString(
|
||||||
|
"account.reject-follow-request-button.accessibility-label",
|
||||||
|
comment: "")) { [weak self] _ in
|
||||||
|
self?.accountConfiguration.viewModel.rejectFollowRequest()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}]
|
||||||
|
} else {
|
||||||
|
accessibilityCustomActions = []
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ final class AccountTableViewCell: UITableViewCell {
|
||||||
guard let viewModel = viewModel else { return }
|
guard let viewModel = viewModel else { return }
|
||||||
|
|
||||||
contentConfiguration = AccountContentConfiguration(viewModel: viewModel).updated(for: state)
|
contentConfiguration = AccountContentConfiguration(viewModel: viewModel).updated(for: state)
|
||||||
|
accessibilityElements = [contentView]
|
||||||
}
|
}
|
||||||
|
|
||||||
override func layoutSubviews() {
|
override func layoutSubviews() {
|
||||||
|
|
Loading…
Reference in a new issue