2022-12-17 12:37:46 +00:00
|
|
|
import Foundation
|
|
|
|
|
2023-01-22 15:55:03 +00:00
|
|
|
public struct MediaAttachment: Codable, Identifiable, Hashable, Equatable {
|
2022-12-27 05:44:40 +00:00
|
|
|
public struct MetaContainer: Codable, Equatable {
|
|
|
|
public struct Meta: Codable, Equatable {
|
|
|
|
public let width: Int?
|
|
|
|
public let height: Int?
|
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2023-01-05 12:27:04 +00:00
|
|
|
public let original: Meta?
|
2022-12-27 05:44:40 +00:00
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2022-12-19 15:01:23 +00:00
|
|
|
public enum SupportedType: String {
|
2023-01-08 15:18:38 +00:00
|
|
|
case image, gifv, video, audio
|
2022-12-19 15:01:23 +00:00
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2022-12-19 18:04:07 +00:00
|
|
|
public func hash(into hasher: inout Hasher) {
|
|
|
|
hasher.combine(id)
|
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2022-12-17 12:37:46 +00:00
|
|
|
public let id: String
|
|
|
|
public let type: String
|
2022-12-19 15:01:23 +00:00
|
|
|
public var supportedType: SupportedType? {
|
|
|
|
SupportedType(rawValue: type)
|
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
Timeline & Timeline detail accessibility uplift (#1323)
* Improve accessibility of StatusPollView
Previously, this view did not provide the proper context to indicate that it represented a poll.
Now, we’ve added
- A container that will stay “Active poll” or “Poll results” when the cursor first hits one of the options;
- A prefix to say “Option X of Y” before each option;
- A Selected trait on the selected option(s), if present
- Consolidating and adding an `.updatesFrequently` trait to the footer view with the countdown.
* Add poll description in StatusRowView combinedAccessibilityLabel
This largely duplicates the logic in `StatusPollView`.
* Improve accessibility of media attachments
Previously, the media attachments without alt text would not show up in the consolidated `StatusRowView`, nor would they be meaningfully explained on the status detail screen.
Now, they are presented with their attachment type.
* Change accessibilityRepresentation of AppAcountsSelectorView
* Change Notifications tab title view accessibility representation to Menu
Previously it would present as a button
* Hide layout `Rectangle`s from accessibility
* Consolidate `StatusRowDetailView` accessibility representation
* Improve readability of Poll accessibility label
* Ensure poll options don’t present as interactive when the poll is finished
* Improve accessibility of StatusRowCardView
Previously, it would present as four separate elements, including an image without a description, all interactive, none with an interactive trait.
Now, it presents as a single element with the `.link` trait
* Improve accessibility of StatusRowHeaderView
Previously, it had no traits and no actions except inherited ones.
Now it presents as a button, triggering its primary action.
It also has custom actions corresponding to its context menu
* Avoid applying the StatusRowView custom actions to every view when contained
* Provide context for the application name
* Add pauses to StatusRowView combinedAccessibilityLabel
* Hide `TimelineView.scrollToTopView` from accessibility
* Set appropriate font style on Notification header
After the change the Text needed a `.headline` style to match the prior appearance.
* Fix bug in accessibilityRepresentation of TimelineView nav bar title
Previously, it would not display the proper label for .remoteLocal filter options.
* Ensure that pop-up button nav bar titles are interactive
* Ensure TextView responds to Environment.sizeCategory
This resolves #1309
* Fix button
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-28 16:48:58 +00:00
|
|
|
public var localizedTypeDescription: String? {
|
|
|
|
if let supportedType {
|
|
|
|
switch supportedType {
|
2023-07-19 05:46:25 +00:00
|
|
|
case .image:
|
|
|
|
return NSLocalizedString("accessibility.media.supported-type.image.label", bundle: .main, comment: "A localized description of SupportedType.image")
|
|
|
|
case .gifv:
|
|
|
|
return NSLocalizedString("accessibility.media.supported-type.gifv.label", bundle: .main, comment: "A localized description of SupportedType.gifv")
|
|
|
|
case .video:
|
|
|
|
return NSLocalizedString("accessibility.media.supported-type.video.label", bundle: .main, comment: "A localized description of SupportedType.video")
|
|
|
|
case .audio:
|
|
|
|
return NSLocalizedString("accessibility.media.supported-type.audio.label", bundle: .main, comment: "A localized description of SupportedType.audio")
|
Timeline & Timeline detail accessibility uplift (#1323)
* Improve accessibility of StatusPollView
Previously, this view did not provide the proper context to indicate that it represented a poll.
Now, we’ve added
- A container that will stay “Active poll” or “Poll results” when the cursor first hits one of the options;
- A prefix to say “Option X of Y” before each option;
- A Selected trait on the selected option(s), if present
- Consolidating and adding an `.updatesFrequently` trait to the footer view with the countdown.
* Add poll description in StatusRowView combinedAccessibilityLabel
This largely duplicates the logic in `StatusPollView`.
* Improve accessibility of media attachments
Previously, the media attachments without alt text would not show up in the consolidated `StatusRowView`, nor would they be meaningfully explained on the status detail screen.
Now, they are presented with their attachment type.
* Change accessibilityRepresentation of AppAcountsSelectorView
* Change Notifications tab title view accessibility representation to Menu
Previously it would present as a button
* Hide layout `Rectangle`s from accessibility
* Consolidate `StatusRowDetailView` accessibility representation
* Improve readability of Poll accessibility label
* Ensure poll options don’t present as interactive when the poll is finished
* Improve accessibility of StatusRowCardView
Previously, it would present as four separate elements, including an image without a description, all interactive, none with an interactive trait.
Now, it presents as a single element with the `.link` trait
* Improve accessibility of StatusRowHeaderView
Previously, it had no traits and no actions except inherited ones.
Now it presents as a button, triggering its primary action.
It also has custom actions corresponding to its context menu
* Avoid applying the StatusRowView custom actions to every view when contained
* Provide context for the application name
* Add pauses to StatusRowView combinedAccessibilityLabel
* Hide `TimelineView.scrollToTopView` from accessibility
* Set appropriate font style on Notification header
After the change the Text needed a `.headline` style to match the prior appearance.
* Fix bug in accessibilityRepresentation of TimelineView nav bar title
Previously, it would not display the proper label for .remoteLocal filter options.
* Ensure that pop-up button nav bar titles are interactive
* Ensure TextView responds to Environment.sizeCategory
This resolves #1309
* Fix button
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-28 16:48:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2022-12-27 15:16:25 +00:00
|
|
|
public let url: URL?
|
2022-12-21 11:39:29 +00:00
|
|
|
public let previewUrl: URL?
|
2022-12-17 12:37:46 +00:00
|
|
|
public let description: String?
|
2022-12-27 05:44:40 +00:00
|
|
|
public let meta: MetaContainer?
|
2022-12-17 12:37:46 +00:00
|
|
|
}
|
2023-02-27 05:39:07 +00:00
|
|
|
|
|
|
|
extension MediaAttachment: Sendable {}
|
|
|
|
extension MediaAttachment.MetaContainer: Sendable {}
|
|
|
|
extension MediaAttachment.MetaContainer.Meta: Sendable {}
|
|
|
|
extension MediaAttachment.SupportedType: Sendable {}
|