mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-22 08:10:59 +00:00
VoiceOver
This commit is contained in:
parent
3bdffb8b12
commit
b0a11b9191
1 changed files with 49 additions and 1 deletions
|
@ -146,6 +146,7 @@ private extension AccountView {
|
||||||
muteButton.addAction(
|
muteButton.addAction(
|
||||||
UIAction { [weak self] _ in self?.accountConfiguration.viewModel.confirmMute() },
|
UIAction { [weak self] _ in self?.accountConfiguration.viewModel.confirmMute() },
|
||||||
for: .touchUpInside)
|
for: .touchUpInside)
|
||||||
|
muteButton.isHidden = true
|
||||||
|
|
||||||
stackView.addArrangedSubview(unmuteButton)
|
stackView.addArrangedSubview(unmuteButton)
|
||||||
unmuteButton.setTitle(NSLocalizedString("account.unmute", comment: ""), for: .normal)
|
unmuteButton.setTitle(NSLocalizedString("account.unmute", comment: ""), for: .normal)
|
||||||
|
@ -154,6 +155,7 @@ private extension AccountView {
|
||||||
unmuteButton.addAction(
|
unmuteButton.addAction(
|
||||||
UIAction { [weak self] _ in self?.accountConfiguration.viewModel.confirmUnmute() },
|
UIAction { [weak self] _ in self?.accountConfiguration.viewModel.confirmUnmute() },
|
||||||
for: .touchUpInside)
|
for: .touchUpInside)
|
||||||
|
unmuteButton.isHidden = true
|
||||||
|
|
||||||
stackView.addArrangedSubview(blockButton)
|
stackView.addArrangedSubview(blockButton)
|
||||||
blockButton.setTitle(NSLocalizedString("account.block", comment: ""), for: .normal)
|
blockButton.setTitle(NSLocalizedString("account.block", comment: ""), for: .normal)
|
||||||
|
@ -162,6 +164,7 @@ private extension AccountView {
|
||||||
blockButton.addAction(
|
blockButton.addAction(
|
||||||
UIAction { [weak self] _ in self?.accountConfiguration.viewModel.confirmBlock() },
|
UIAction { [weak self] _ in self?.accountConfiguration.viewModel.confirmBlock() },
|
||||||
for: .touchUpInside)
|
for: .touchUpInside)
|
||||||
|
blockButton.isHidden = true
|
||||||
|
|
||||||
stackView.addArrangedSubview(unblockButton)
|
stackView.addArrangedSubview(unblockButton)
|
||||||
unblockButton.setTitle(NSLocalizedString("account.unblock", comment: ""), for: .normal)
|
unblockButton.setTitle(NSLocalizedString("account.unblock", comment: ""), for: .normal)
|
||||||
|
@ -170,6 +173,7 @@ private extension AccountView {
|
||||||
unblockButton.addAction(
|
unblockButton.addAction(
|
||||||
UIAction { [weak self] _ in self?.accountConfiguration.viewModel.confirmUnblock() },
|
UIAction { [weak self] _ in self?.accountConfiguration.viewModel.confirmUnblock() },
|
||||||
for: .touchUpInside)
|
for: .touchUpInside)
|
||||||
|
unblockButton.isHidden = true
|
||||||
|
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
avatarImageView.widthAnchor.constraint(equalToConstant: .avatarDimension),
|
avatarImageView.widthAnchor.constraint(equalToConstant: .avatarDimension),
|
||||||
|
@ -191,7 +195,7 @@ private extension AccountView {
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next function_body_length
|
// swiftlint:disable:next function_body_length cyclomatic_complexity
|
||||||
func applyAccountConfiguration() {
|
func applyAccountConfiguration() {
|
||||||
let viewModel = accountConfiguration.viewModel
|
let viewModel = accountConfiguration.viewModel
|
||||||
|
|
||||||
|
@ -283,6 +287,50 @@ private extension AccountView {
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}]
|
}]
|
||||||
|
} else if viewModel.configuration == .mute, let relationship = viewModel.relationship {
|
||||||
|
if relationship.muting {
|
||||||
|
accessibilityCustomActions = [
|
||||||
|
UIAccessibilityCustomAction(
|
||||||
|
name: NSLocalizedString(
|
||||||
|
"account.unmute",
|
||||||
|
comment: "")) { [weak self] _ in
|
||||||
|
self?.accountConfiguration.viewModel.confirmUnmute()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}]
|
||||||
|
} else {
|
||||||
|
accessibilityCustomActions = [
|
||||||
|
UIAccessibilityCustomAction(
|
||||||
|
name: NSLocalizedString(
|
||||||
|
"account.mute",
|
||||||
|
comment: "")) { [weak self] _ in
|
||||||
|
self?.accountConfiguration.viewModel.confirmMute()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
} else if viewModel.configuration == .block, let relationship = viewModel.relationship {
|
||||||
|
if relationship.blocking {
|
||||||
|
accessibilityCustomActions = [
|
||||||
|
UIAccessibilityCustomAction(
|
||||||
|
name: NSLocalizedString(
|
||||||
|
"account.unblock",
|
||||||
|
comment: "")) { [weak self] _ in
|
||||||
|
self?.accountConfiguration.viewModel.confirmUnblock()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}]
|
||||||
|
} else {
|
||||||
|
accessibilityCustomActions = [
|
||||||
|
UIAccessibilityCustomAction(
|
||||||
|
name: NSLocalizedString(
|
||||||
|
"account.block",
|
||||||
|
comment: "")) { [weak self] _ in
|
||||||
|
self?.accountConfiguration.viewModel.confirmBlock()
|
||||||
|
|
||||||
|
return true
|
||||||
|
}]
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
accessibilityCustomActions = []
|
accessibilityCustomActions = []
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue