2021-07-23 13:10:27 +02:00
|
|
|
//extension ActiveEntity {
|
2021-01-29 09:47:32 +01:00
|
|
|
//
|
2021-07-23 13:10:27 +02:00
|
|
|
// var accessibilityLabelDescription: String {
|
|
|
|
// switch self.type {
|
|
|
|
// case .email: return L10n.Common.Controls.Status.Tag.email
|
|
|
|
// case .hashtag: return L10n.Common.Controls.Status.Tag.hashtag
|
|
|
|
// case .mention: return L10n.Common.Controls.Status.Tag.mention
|
|
|
|
// case .url: return L10n.Common.Controls.Status.Tag.url
|
|
|
|
// case .emoji: return L10n.Common.Controls.Status.Tag.emoji
|
|
|
|
// }
|
|
|
|
// }
|
2021-01-29 09:47:32 +01:00
|
|
|
//
|
2021-07-23 13:10:27 +02:00
|
|
|
// var accessibilityValueDescription: String {
|
|
|
|
// switch self.type {
|
|
|
|
// case .email(let text, _): return text
|
|
|
|
// case .hashtag(let text, _): return text
|
|
|
|
// case .mention(let text, _): return text
|
|
|
|
// case .url(_, let trimmed, _, _): return trimmed
|
|
|
|
// case .emoji(let text, _, _): return text
|
|
|
|
// }
|
|
|
|
// }
|
2021-01-29 09:47:32 +01:00
|
|
|
//
|
2021-07-23 13:10:27 +02:00
|
|
|
// func accessibilityElement(in accessibilityContainer: Any) -> ActiveLabelAccessibilityElement? {
|
|
|
|
// if case .emoji = self.type {
|
|
|
|
// return nil
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// let element = ActiveLabelAccessibilityElement(accessibilityContainer: accessibilityContainer)
|
|
|
|
// element.accessibilityTraits = .button
|
|
|
|
// element.accessibilityLabel = accessibilityLabelDescription
|
|
|
|
// element.accessibilityValue = accessibilityValueDescription
|
|
|
|
// return element
|
|
|
|
// }
|
|
|
|
//}
|
2021-01-29 09:47:32 +01:00
|
|
|
|
2021-07-23 13:10:27 +02:00
|
|
|
//final class ActiveLabelAccessibilityElement: UIAccessibilityElement {
|
|
|
|
// var index: Int!
|
|
|
|
//}
|
|
|
|
//
|
2021-05-12 12:26:53 +02:00
|
|
|
// MARK: - UIAccessibilityContainer
|
2021-07-23 13:10:27 +02:00
|
|
|
//extension ActiveLabel {
|
|
|
|
//
|
|
|
|
// func createAccessibilityElements() -> [UIAccessibilityElement] {
|
|
|
|
// var elements: [UIAccessibilityElement] = []
|
|
|
|
//
|
|
|
|
// let element = ActiveLabelAccessibilityElement(accessibilityContainer: self)
|
|
|
|
// element.accessibilityTraits = .staticText
|
|
|
|
// element.accessibilityLabel = accessibilityLabel
|
|
|
|
// element.accessibilityFrame = superview!.convert(frame, to: nil)
|
|
|
|
// element.accessibilityLanguage = accessibilityLanguage
|
|
|
|
// elements.append(element)
|
|
|
|
//
|
|
|
|
// for entity in activeEntities {
|
|
|
|
// guard let element = entity.accessibilityElement(in: self) else { continue }
|
|
|
|
// var glyphRange = NSRange()
|
|
|
|
// layoutManager.characterRange(forGlyphRange: entity.range, actualGlyphRange: &glyphRange)
|
|
|
|
// let rect = layoutManager.boundingRect(forGlyphRange: glyphRange, in: textContainer)
|
|
|
|
// element.accessibilityFrame = self.convert(rect, to: nil)
|
|
|
|
// element.accessibilityContainer = self
|
|
|
|
// elements.append(element)
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// return elements
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//}
|