Re-enable A11y (IOS-194)

This commit is contained in:
Nathan Mattes 2023-11-20 13:00:37 +01:00
parent 32520be6c9
commit 873c5befe2
2 changed files with 66 additions and 70 deletions

View File

@ -54,7 +54,7 @@ extension ProfileCardView.ViewModel {
bindRelationship(view: view)
bindDashboard(view: view)
bindFamiliarFollowers(view: view)
// bindAccessibility(view: view)
bindAccessibility(view: view)
}
private func bindHeader(view: ProfileCardView) {
@ -177,73 +177,69 @@ extension ProfileCardView.ViewModel {
view.familiarFollowersDashboardView.configure(familiarFollowers: familiarFollowers)
}
.store(in: &disposeBag)
// $backgroundColor
// .assign(to: \.backgroundColor, on: view.familiarFollowersDashboardView.viewModel)
// .store(in: &disposeBag)
}
// private func bindAccessibility(view: ProfileCardView) {
// let authorAccessibilityLabel = Publishers.CombineLatest(
// $authorName,
// $bioContent
// )
// .map { authorName, bioContent -> String? in
// var strings: [String?] = []
// strings.append(authorName?.string)
// strings.append(bioContent?.string)
// return strings.compactMap { $0 }.joined(separator: ", ")
// }
//
// authorAccessibilityLabel
// .map { $0 ?? "" }
// .assign(to: &$groupedAccessibilityLabel)
//
// $groupedAccessibilityLabel
// .sink { accessibilityLabel in
// view.accessibilityLabel = accessibilityLabel
// }
// .store(in: &disposeBag)
//
// let statusesContent = $statusesCount
// .removeDuplicates()
// .map {
// AXCustomContent(
// label: L10n.Scene.Profile.Dashboard.otherPosts,
// value: "\($0.)"
// )
// }
// let followingContent = $followingCount
// .removeDuplicates()
// .map {
// AXCustomContent(
// label: L10n.Scene.Profile.Dashboard.otherFollowing,
// value: $0
// )
// }
// let followersContent = $followersCount
// .removeDuplicates()
// .map {
// AXCustomContent(
// label: L10n.Scene.Profile.Dashboard.otherFollowers,
// value: $0
// )
// }
// let familiarContent = view.familiarFollowersDashboardView.viewModel.$label
// .map { $0?.accessibilityLabel }
// .removeDuplicates()
// .map {
// AXCustomContent(
// label: L10n.Scene.Profile.Dashboard.familiarFollowers,
// value: $0
// )
// }
// Publishers.CombineLatest4(
// statusesContent,
// followingContent,
// followersContent,
// familiarContent
// ).sink { statuses, following, followers, familiar in
// view.accessibilityCustomContent = [statuses, following, followers, familiar].compactMap { $0 }
// }.store(in: &disposeBag)
// }
private func bindAccessibility(view: ProfileCardView) {
let authorAccessibilityLabel = Publishers.CombineLatest(
$authorName,
$bioContent
)
.map { authorName, bioContent -> String? in
var strings: [String?] = []
strings.append(authorName?.string)
strings.append(bioContent?.string)
return strings.compactMap { $0 }.joined(separator: ", ")
}
authorAccessibilityLabel
.map { $0 ?? "" }
.assign(to: &$groupedAccessibilityLabel)
$groupedAccessibilityLabel
.sink { accessibilityLabel in
view.accessibilityLabel = accessibilityLabel
}
.store(in: &disposeBag)
let statusesContent = $statusesCount
.removeDuplicates()
.map {
AXCustomContent(
label: L10n.Scene.Profile.Dashboard.otherPosts,
value: String(describing: $0)
)
}
let followingContent = $followingCount
.removeDuplicates()
.map {
AXCustomContent(
label: L10n.Scene.Profile.Dashboard.otherFollowing,
value: String(describing: $0)
)
}
let followersContent = $followersCount
.removeDuplicates()
.map {
AXCustomContent(
label: L10n.Scene.Profile.Dashboard.otherFollowers,
value: String(describing: $0)
)
}
let familiarContent = view.familiarFollowersDashboardView.viewModel.$label
.map { $0?.accessibilityLabel ?? ""}
.removeDuplicates()
.map {
AXCustomContent(
label: L10n.Scene.Profile.Dashboard.familiarFollowers,
value: $0
)
}
Publishers.CombineLatest4(
statusesContent,
followingContent,
followersContent,
familiarContent
).sink { statuses, following, followers, familiar in
view.accessibilityCustomContent = [statuses, following, followers, familiar].compactMap { $0 }
}.store(in: &disposeBag)
}
}

View File

@ -22,7 +22,7 @@ extension FamiliarFollowersDashboardView {
@Published var emojis: MastodonContent.Emojis = [:]
@Published var backgroundColor: UIColor?
@Published var label: MetaContent?
@Published public var label: MetaContent?
}
}