Skip to content

Commit

Permalink
fix accessibilityLabel recursion :)
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Feb 26, 2025
1 parent 90d8e0a commit 14c6b73
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions deltachat-ios/Chat/Views/Cells/AudioMessageCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public class AudioMessageCell: BaseMessageCell, ReusableCell {
mainContentView.spacing = 0
}
if msg.type == DC_MSG_VOICE {
accessibilityLabel = String.localized("voice_message")
a11yDcType = String.localized("voice_message")
} else {
accessibilityLabel = String.localized("audio")
a11yDcType = String.localized("audio")
}

delegate?.getAudioDuration(messageId: messageId, successHandler: { [weak self] messageId, duration in
Expand Down
5 changes: 3 additions & 2 deletions deltachat-ios/Chat/Views/Cells/BaseMessageCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public class BaseMessageCell: UITableViewCell {

private var dcContextId: Int?
private var dcMsgId: Int?
var a11yDcType: String?

override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {

Expand Down Expand Up @@ -593,8 +594,8 @@ public class BaseMessageCell: UITableViewCell {
if let senderTitle = quoteView.senderTitle.text, let quote = quoteView.quote.text {
quoteAccessibilityString = "\(senderTitle), \(quote), \(String.localized("reply_noun")), "
}
if let additionalAccessibilityInfo = accessibilityLabel {
additionalAccessibilityString = "\(additionalAccessibilityInfo), "
if let a11yDcType {
additionalAccessibilityString = "\(a11yDcType), "
}

var reactionsString = ""
Expand Down
2 changes: 1 addition & 1 deletion deltachat-ios/Chat/Views/Cells/ContactCardCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class ContactCardCell: BaseMessageCell, ReusableCell {
}

contactView.configure(message: msg, dcContext: dcContext)
accessibilityLabel = "\(String.localized("document")), \(contactView.configureAccessibilityLabel())"
a11yDcType = "\(String.localized("document")), \(contactView.configureAccessibilityLabel())"
super.update(dcContext: dcContext,
msg: msg,
messageStyle: messageStyle,
Expand Down
2 changes: 1 addition & 1 deletion deltachat-ios/Chat/Views/Cells/FileTextCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class FileTextCell: BaseMessageCell, ReusableCell {
}

fileView.configure(message: msg)
accessibilityLabel = "\(String.localized("document")), \(fileView.configureAccessibilityLabel())"
a11yDcType = "\(String.localized("document")), \(fileView.configureAccessibilityLabel())"
super.update(dcContext: dcContext,
msg: msg,
messageStyle: messageStyle,
Expand Down
4 changes: 2 additions & 2 deletions deltachat-ios/Chat/Views/Cells/ImageTextCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ class ImageTextCell: BaseMessageCell, ReusableCell {
size: CGSize(width: 500, height: 500)))
contentImageIsPlaceholder = false
playButtonView.isHidden = true
accessibilityLabel = msg.type == DC_MSG_GIF ? String.localized("gif") : String.localized("image")
a11yDcType = msg.type == DC_MSG_GIF ? String.localized("gif") : String.localized("image")
setAspectRatioFor(message: msg)
} else if msg.type == DC_MSG_VIDEO, let url = msg.fileURL {
playButtonView.isHidden = false
accessibilityLabel = String.localized("video")
a11yDcType = String.localized("video")
let placeholderImage = UIImage(color: UIColor.init(alpha: 0, red: 255, green: 255, blue: 255), size: CGSize(width: 250, height: 250))
contentImageView.image = placeholderImage
DispatchQueue.global(qos: .userInteractive).async {
Expand Down
2 changes: 1 addition & 1 deletion deltachat-ios/Chat/Views/Cells/WebxdcCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ public class WebxdcCell: FileTextCell {
showName: showName,
searchText: searchText,
highlight: highlight)
accessibilityLabel = fileView.configureAccessibilityLabel()
a11yDcType = fileView.configureAccessibilityLabel()
}
}

0 comments on commit 14c6b73

Please sign in to comment.