IOS-88: Use post content as the primary user input label for posts in feeds/threads (#937)

This commit is contained in:
Jed Fox 2023-02-23 06:58:14 -05:00 committed by GitHub
parent c05ee88004
commit b70bab901a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View File

@ -86,7 +86,16 @@ extension StatusTableViewCell {
self.accessibilityLabel = accessibilityLabel
}
.store(in: &_disposeBag)
statusView.viewModel.$contentAccessibilityLabel
.combineLatest(statusView.viewModel.$groupedAccessibilityLabel)
.receive(on: DispatchQueue.main)
.sink { [weak self] contentLabel, accessibilityLabel in
guard let self = self else { return }
self.accessibilityUserInputLabels = [contentLabel, accessibilityLabel]
}
.store(in: &_disposeBag)
statusView.viewModel
.$translatedFromLanguage
.receive(on: DispatchQueue.main)

View File

@ -108,6 +108,7 @@ extension StatusView {
@Published public var isFiltered = false
@Published public var groupedAccessibilityLabel = ""
@Published public var contentAccessibilityLabel = ""
let timestampUpdatePublisher = Timer.publish(every: 1.0, on: .main, in: .common)
.autoconnect()
@ -746,12 +747,12 @@ extension StatusView.ViewModel {
.assign(to: \.accessibilityLabel, on: statusView.authorView)
.store(in: &disposeBag)
let contentAccessibilityLabel = Publishers.CombineLatest3(
Publishers.CombineLatest3(
$isContentReveal,
$spoilerContent,
$content
)
.map { isContentReveal, spoilerContent, content -> String? in
.map { isContentReveal, spoilerContent, content in
var strings: [String?] = []
if let spoilerContent = spoilerContent, !spoilerContent.string.isEmpty {
@ -768,6 +769,7 @@ extension StatusView.ViewModel {
return strings.compactMap { $0 }.joined(separator: ", ")
}
.assign(to: &$contentAccessibilityLabel)
$isContentReveal
.map { isContentReveal in
@ -778,7 +780,7 @@ extension StatusView.ViewModel {
}
.store(in: &disposeBag)
contentAccessibilityLabel
$contentAccessibilityLabel
.sink { contentAccessibilityLabel in
statusView.spoilerOverlayView.accessibilityLabel = contentAccessibilityLabel
}
@ -859,7 +861,7 @@ extension StatusView.ViewModel {
Publishers.CombineLatest4(
shortAuthorAccessibilityLabel,
contentAccessibilityLabel,
$contentAccessibilityLabel,
translatedFromLabel,
mediaAccessibilityLabel
)