IceCubesApp/Packages/StatusKit/Sources/StatusKit/Row/StatusRowView.swift

358 lines
12 KiB
Swift
Raw Normal View History

2022-12-19 11:28:55 +00:00
import DesignSystem
2023-01-17 10:36:01 +00:00
import EmojiText
import Env
import Foundation
2023-01-17 10:36:01 +00:00
import Models
2022-12-19 14:51:25 +00:00
import Network
2023-01-17 10:36:01 +00:00
import SwiftUI
2022-11-21 08:31:32 +00:00
2023-09-18 19:03:52 +00:00
@MainActor
2022-12-18 19:30:19 +00:00
public struct StatusRowView: View {
2023-10-23 17:12:25 +00:00
@Environment(\.openWindow) private var openWindow
@Environment(\.isInCaptureMode) private var isInCaptureMode: Bool
2022-12-17 12:37:46 +00:00
@Environment(\.redactionReasons) private var reasons
@Environment(\.isCompact) private var isCompact: Bool
@Environment(\.accessibilityVoiceOverEnabled) private var accessibilityVoiceOverEnabled
@Environment(\.isStatusFocused) private var isFocused
@Environment(\.indentationLevel) private var indentationLevel
2023-03-13 12:38:28 +00:00
@Environment(QuickLook.self) private var quickLook
2023-09-18 19:03:52 +00:00
@Environment(Theme.self) private var theme
2024-01-31 06:56:50 +00:00
@Environment(Client.self) private var client
2023-03-13 12:38:28 +00:00
@State private var viewModel: StatusRowViewModel
@State private var showSelectableText: Bool = false
2024-01-31 06:56:50 +00:00
@State private var isBlockConfirmationPresented = false
2023-03-13 12:38:28 +00:00
public enum Context { case timeline, detail }
private let context: Context
public init(viewModel: StatusRowViewModel, context: Context = .timeline) {
2024-02-14 11:48:14 +00:00
_viewModel = .init(initialValue: viewModel)
self.context = context
2022-12-18 19:30:19 +00:00
}
2023-03-13 12:38:28 +00:00
var contextMenu: some View {
2024-02-14 11:48:14 +00:00
StatusRowContextMenu(viewModel: viewModel,
2024-01-31 06:56:50 +00:00
showTextForSelection: $showSelectableText,
isBlockConfirmationPresented: $isBlockConfirmationPresented)
}
2023-03-13 12:38:28 +00:00
2022-12-18 19:30:19 +00:00
public var body: some View {
HStack(spacing: 0) {
2023-11-20 16:20:09 +00:00
if !isCompact {
HStack(spacing: 3) {
2023-12-18 07:22:59 +00:00
ForEach(0 ..< indentationLevel, id: \.self) { level in
2023-11-20 16:20:09 +00:00
Rectangle()
.fill(theme.tintColor)
.frame(width: 2)
.accessibilityHidden(true)
.opacity((indentationLevel == level + 1) ? 1 : 0.15)
2023-11-20 16:20:09 +00:00
}
}
if indentationLevel > 0 {
Spacer(minLength: 8)
}
}
2023-12-27 15:07:16 +00:00
VStack(alignment: .leading, spacing: .statusComponentSpacing) {
if viewModel.isFiltered, let filter = viewModel.filter {
switch filter.filter.filterAction {
case .warn:
makeFilterView(filter: filter.filter)
case .hide:
EmptyView()
2023-01-03 11:24:15 +00:00
}
} else {
if !isCompact && context != .detail {
Group {
2023-12-28 06:55:17 +00:00
StatusRowTagView(viewModel: viewModel)
StatusRowReblogView(viewModel: viewModel)
StatusRowReplyView(viewModel: viewModel)
}
2023-12-28 06:55:17 +00:00
.padding(.leading, theme.avatarPosition == .top ? 0 : AvatarView.FrameConfig.status.width + .statusColumnsSpacing)
}
HStack(alignment: .top, spacing: .statusColumnsSpacing) {
if !isCompact,
theme.avatarPosition == .leading
{
2024-02-14 09:48:17 +00:00
AvatarView(viewModel.finalStatus.account.avatar)
.accessibility(addTraits: .isButton)
.contentShape(Circle())
.hoverEffect()
.onTapGesture {
viewModel.navigateToAccountDetail(account: viewModel.finalStatus.account)
}
}
VStack(alignment: .leading, spacing: .statusComponentSpacing) {
if !isCompact {
StatusRowHeaderView(viewModel: viewModel)
2023-12-27 15:07:16 +00:00
}
StatusRowContentView(viewModel: viewModel)
.contentShape(Rectangle())
.onTapGesture {
guard !isFocused else { return }
viewModel.navigateToDetail()
}
.accessibilityActions {
if isFocused, viewModel.showActions {
accessibilityActions
}
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
}
if !reasons.contains(.placeholder),
viewModel.showActions, isFocused || theme.statusActionsDisplay != .none,
!isInCaptureMode
{
StatusRowActionsView(isBlockConfirmationPresented: $isBlockConfirmationPresented,
viewModel: viewModel)
.tint(isFocused ? theme.tintColor : .gray)
2023-12-27 15:07:16 +00:00
}
2023-09-18 19:03:52 +00:00
if isFocused, !isCompact {
StatusRowDetailView(viewModel: viewModel)
}
}
2023-01-03 11:24:15 +00:00
}
}
2022-12-23 16:50:51 +00:00
}
2024-01-22 08:05:22 +00:00
.padding(.init(top: isCompact ? 6 : 12, leading: 0, bottom: isFocused ? 12 : 6, trailing: 0))
}
.onAppear {
2023-12-27 16:12:48 +00:00
if !reasons.contains(.placeholder) {
if !isCompact, viewModel.embeddedStatus == nil {
Task {
await viewModel.loadEmbeddedStatus()
2023-01-22 08:51:43 +00:00
}
}
2022-12-27 06:51:44 +00:00
}
}
.contextMenu {
contextMenu
.onAppear {
Task {
await viewModel.loadAuthorRelationship()
}
}
}
.swipeActions(edge: .trailing) {
Profile tab accessibility uplift (#1274) * Combine `joinedAtView` into one accessibility element Previously, the calendar image was visible with a nonsensical label. We use the `.combine` operator here to maintain the proper string formatting of the date. * Improve the accessibility of the AccountDetailHeaderView Previously, this image had no description and no indication that it had an associated interaction. Now, we wrap it in a button that performs the tap gesture action, and remove the element altogether if there is no avatar image set. This commit also handles the checkmark for supporter users * Tweak accessibility of Profile CustomInfoLabels This commit: - Reverses the order of title and value - Sets the value as an `accessibilityValue` - Adds a hint indicating what the button does, as they perform slightly different actions * Make Profile tab header image into a Button This element has an action associated with it (quicklook), so it makes more sense to have it as a button, and hide it if the user does not have an image set. Without the action it would have been considered decorative and should be hidden. * Change accessibilityLabel of Profile tab nav bar item to ‘Options’ “More” is considered overly generic. This commit also adds two additional user input label options * Add accessibility labels for the Profile tab `Picker` Previously, these labels were the default accessibility label provided by the SF symbol, that almost, but not quite, made sense * Remove StatusRowView swipe actions if VoiceOver is running These swipe actions are automagically added to the accessibility element’s custom actions, in addition to the ones already there, which means that there is a significant (and confusing) amount of doubling up going on. * Fix typo in StatusRowView.accessibilityActions * Add accessibilityLabels to all StatusRowActionsView actions * Provide explicit combined accessibility label for unfocused StatusRowView Previously, this was a synthesized label, which read the elements in their traversal order, and didn’t provide any context for which of the three numbers corresponded to replies, boosts or favourites. Now, we create an explicit combined label when the post isn’t being viewed by itself. * Improve accessibility of StatusRow(Reblog|Reply)View They are now combined elements and don’t vend the icon as its own element. * Add missing punctuation to accessibility hints * Remove interaction from Profile tab @username and profile note elements These elements open the profile photo url, which is already provided explicitly through the profile photo * Prefer spoiler warning for StatusRowView accessibility label …but place the full, unredacted content in an `AccessibilityCustomContent` field for easy access. Additionally, if VoiceOver is running, an action to expand the warning is also available. * Represent `FollowButton` elements as Toggles to accessibility Since these buttons have two states (though arguable in the case of following, but handled here by not changing the representation if a request is pending), it makes sense to handle them as toggles, so they will be read as “Following, On, <Trait>” * Remove errant comment * Add “Verified” accessibilityValue to profile fields * Fix bug StatusRowView default action bug affecting VoiceOver users Previously, the default (‘Activate’) action for VoiceOver users would be to share a link to the toot, rather than navigate to its detail. It’s hard to say exactly what caused this, but the root was the inclusion of the `contextMenu` in the `accessibilityActions`. Now, double-tapping on a a non-focused `StatusRowView` will take you to the toot detail. * Add header trait to Profile tab display name and familiar followers These stand out as being header-like in presentation and represent the beginning of specific parts of the screen. * Add conditional accessibility modifier to Profile tab user-defined fields that opens the correct link * Add accessibility container that contextualises the user-defined fields When VoiceOver users first enter a user-defined field, the container label will be read out before the element’s spoken description. * Improve StatusRowView combined accessibility label It will now start with: “X boosted Y”, “X replied to @Y”, or “X…” depending on the context of the toot. * Change familiar follows thumbnail to a Button; add display name as accessibility label Previously, this button had no context, and would just be a series of images with nothing to allow users to disambiguate them. * Revert changes from ZStack with tap gesture to Button Using a Button for this purpose caused high weirdness in tap zones. Basically everything down to the familiar followers triggered both image buttons. * Add image alt text to StatusRowView and StatusRowMediaPreviewView Previously, there was no way for the intended audience for the alt text to find said text. There is a tap gesture on each image in the focused status row, but this is not advertised to the user. Now, the first image’s alt text is read as part of the non-focused, combined representation, and each image has its own alt text attributed in the focused representation. * Add Profile tab accessibility labels to indicate private/bot/muted/blocked accounts Previously, the icon did not have any accessible representation (an empty text string). * Add header trait to Profile “pinned post” * Use the Account.Field.name for the user input label * Replace spaces with commas in StatusRowView.combinedAccessibilityLabel
2023-03-19 15:27:18 +00:00
// The actions associated with the swipes are exposed as custom accessibility actions and there is no way to remove them.
if !isCompact, accessibilityVoiceOverEnabled == false {
StatusRowSwipeView(viewModel: viewModel, mode: .trailing)
2023-01-22 05:38:30 +00:00
}
}
.swipeActions(edge: .leading) {
Profile tab accessibility uplift (#1274) * Combine `joinedAtView` into one accessibility element Previously, the calendar image was visible with a nonsensical label. We use the `.combine` operator here to maintain the proper string formatting of the date. * Improve the accessibility of the AccountDetailHeaderView Previously, this image had no description and no indication that it had an associated interaction. Now, we wrap it in a button that performs the tap gesture action, and remove the element altogether if there is no avatar image set. This commit also handles the checkmark for supporter users * Tweak accessibility of Profile CustomInfoLabels This commit: - Reverses the order of title and value - Sets the value as an `accessibilityValue` - Adds a hint indicating what the button does, as they perform slightly different actions * Make Profile tab header image into a Button This element has an action associated with it (quicklook), so it makes more sense to have it as a button, and hide it if the user does not have an image set. Without the action it would have been considered decorative and should be hidden. * Change accessibilityLabel of Profile tab nav bar item to ‘Options’ “More” is considered overly generic. This commit also adds two additional user input label options * Add accessibility labels for the Profile tab `Picker` Previously, these labels were the default accessibility label provided by the SF symbol, that almost, but not quite, made sense * Remove StatusRowView swipe actions if VoiceOver is running These swipe actions are automagically added to the accessibility element’s custom actions, in addition to the ones already there, which means that there is a significant (and confusing) amount of doubling up going on. * Fix typo in StatusRowView.accessibilityActions * Add accessibilityLabels to all StatusRowActionsView actions * Provide explicit combined accessibility label for unfocused StatusRowView Previously, this was a synthesized label, which read the elements in their traversal order, and didn’t provide any context for which of the three numbers corresponded to replies, boosts or favourites. Now, we create an explicit combined label when the post isn’t being viewed by itself. * Improve accessibility of StatusRow(Reblog|Reply)View They are now combined elements and don’t vend the icon as its own element. * Add missing punctuation to accessibility hints * Remove interaction from Profile tab @username and profile note elements These elements open the profile photo url, which is already provided explicitly through the profile photo * Prefer spoiler warning for StatusRowView accessibility label …but place the full, unredacted content in an `AccessibilityCustomContent` field for easy access. Additionally, if VoiceOver is running, an action to expand the warning is also available. * Represent `FollowButton` elements as Toggles to accessibility Since these buttons have two states (though arguable in the case of following, but handled here by not changing the representation if a request is pending), it makes sense to handle them as toggles, so they will be read as “Following, On, <Trait>” * Remove errant comment * Add “Verified” accessibilityValue to profile fields * Fix bug StatusRowView default action bug affecting VoiceOver users Previously, the default (‘Activate’) action for VoiceOver users would be to share a link to the toot, rather than navigate to its detail. It’s hard to say exactly what caused this, but the root was the inclusion of the `contextMenu` in the `accessibilityActions`. Now, double-tapping on a a non-focused `StatusRowView` will take you to the toot detail. * Add header trait to Profile tab display name and familiar followers These stand out as being header-like in presentation and represent the beginning of specific parts of the screen. * Add conditional accessibility modifier to Profile tab user-defined fields that opens the correct link * Add accessibility container that contextualises the user-defined fields When VoiceOver users first enter a user-defined field, the container label will be read out before the element’s spoken description. * Improve StatusRowView combined accessibility label It will now start with: “X boosted Y”, “X replied to @Y”, or “X…” depending on the context of the toot. * Change familiar follows thumbnail to a Button; add display name as accessibility label Previously, this button had no context, and would just be a series of images with nothing to allow users to disambiguate them. * Revert changes from ZStack with tap gesture to Button Using a Button for this purpose caused high weirdness in tap zones. Basically everything down to the familiar followers triggered both image buttons. * Add image alt text to StatusRowView and StatusRowMediaPreviewView Previously, there was no way for the intended audience for the alt text to find said text. There is a tap gesture on each image in the focused status row, but this is not advertised to the user. Now, the first image’s alt text is read as part of the non-focused, combined representation, and each image has its own alt text attributed in the focused representation. * Add Profile tab accessibility labels to indicate private/bot/muted/blocked accounts Previously, the icon did not have any accessible representation (an empty text string). * Add header trait to Profile “pinned post” * Use the Account.Field.name for the user input label * Replace spaces with commas in StatusRowView.combinedAccessibilityLabel
2023-03-19 15:27:18 +00:00
// The actions associated with the swipes are exposed as custom accessibility actions and there is no way to remove them.
if !isCompact, accessibilityVoiceOverEnabled == false {
StatusRowSwipeView(viewModel: viewModel, mode: .leading)
2023-02-01 20:51:03 +00:00
}
}
#if os(visionOS)
.listRowBackground(RoundedRectangle(cornerRadius: 8)
2024-01-16 19:55:55 +00:00
.foregroundStyle(.background).hoverEffect())
.listRowHoverEffectDisabled()
#else
2023-12-19 14:07:51 +00:00
.listRowBackground(viewModel.highlightRowColor)
#endif
2024-01-22 05:27:56 +00:00
.listRowInsets(.init(top: 0,
leading: .layoutPadding,
2024-01-22 05:27:56 +00:00
bottom: 0,
trailing: .layoutPadding))
.accessibilityElement(children: isFocused ? .contain : .combine)
.accessibilityLabel(isFocused == false && accessibilityVoiceOverEnabled
2024-01-02 07:58:20 +00:00
? StatusRowAccessibilityLabel(viewModel: viewModel).finalLabel() : Text(""))
.accessibilityHidden(viewModel.filter?.filter.filterAction == .hide)
Profile tab accessibility uplift (#1274) * Combine `joinedAtView` into one accessibility element Previously, the calendar image was visible with a nonsensical label. We use the `.combine` operator here to maintain the proper string formatting of the date. * Improve the accessibility of the AccountDetailHeaderView Previously, this image had no description and no indication that it had an associated interaction. Now, we wrap it in a button that performs the tap gesture action, and remove the element altogether if there is no avatar image set. This commit also handles the checkmark for supporter users * Tweak accessibility of Profile CustomInfoLabels This commit: - Reverses the order of title and value - Sets the value as an `accessibilityValue` - Adds a hint indicating what the button does, as they perform slightly different actions * Make Profile tab header image into a Button This element has an action associated with it (quicklook), so it makes more sense to have it as a button, and hide it if the user does not have an image set. Without the action it would have been considered decorative and should be hidden. * Change accessibilityLabel of Profile tab nav bar item to ‘Options’ “More” is considered overly generic. This commit also adds two additional user input label options * Add accessibility labels for the Profile tab `Picker` Previously, these labels were the default accessibility label provided by the SF symbol, that almost, but not quite, made sense * Remove StatusRowView swipe actions if VoiceOver is running These swipe actions are automagically added to the accessibility element’s custom actions, in addition to the ones already there, which means that there is a significant (and confusing) amount of doubling up going on. * Fix typo in StatusRowView.accessibilityActions * Add accessibilityLabels to all StatusRowActionsView actions * Provide explicit combined accessibility label for unfocused StatusRowView Previously, this was a synthesized label, which read the elements in their traversal order, and didn’t provide any context for which of the three numbers corresponded to replies, boosts or favourites. Now, we create an explicit combined label when the post isn’t being viewed by itself. * Improve accessibility of StatusRow(Reblog|Reply)View They are now combined elements and don’t vend the icon as its own element. * Add missing punctuation to accessibility hints * Remove interaction from Profile tab @username and profile note elements These elements open the profile photo url, which is already provided explicitly through the profile photo * Prefer spoiler warning for StatusRowView accessibility label …but place the full, unredacted content in an `AccessibilityCustomContent` field for easy access. Additionally, if VoiceOver is running, an action to expand the warning is also available. * Represent `FollowButton` elements as Toggles to accessibility Since these buttons have two states (though arguable in the case of following, but handled here by not changing the representation if a request is pending), it makes sense to handle them as toggles, so they will be read as “Following, On, <Trait>” * Remove errant comment * Add “Verified” accessibilityValue to profile fields * Fix bug StatusRowView default action bug affecting VoiceOver users Previously, the default (‘Activate’) action for VoiceOver users would be to share a link to the toot, rather than navigate to its detail. It’s hard to say exactly what caused this, but the root was the inclusion of the `contextMenu` in the `accessibilityActions`. Now, double-tapping on a a non-focused `StatusRowView` will take you to the toot detail. * Add header trait to Profile tab display name and familiar followers These stand out as being header-like in presentation and represent the beginning of specific parts of the screen. * Add conditional accessibility modifier to Profile tab user-defined fields that opens the correct link * Add accessibility container that contextualises the user-defined fields When VoiceOver users first enter a user-defined field, the container label will be read out before the element’s spoken description. * Improve StatusRowView combined accessibility label It will now start with: “X boosted Y”, “X replied to @Y”, or “X…” depending on the context of the toot. * Change familiar follows thumbnail to a Button; add display name as accessibility label Previously, this button had no context, and would just be a series of images with nothing to allow users to disambiguate them. * Revert changes from ZStack with tap gesture to Button Using a Button for this purpose caused high weirdness in tap zones. Basically everything down to the familiar followers triggered both image buttons. * Add image alt text to StatusRowView and StatusRowMediaPreviewView Previously, there was no way for the intended audience for the alt text to find said text. There is a tap gesture on each image in the focused status row, but this is not advertised to the user. Now, the first image’s alt text is read as part of the non-focused, combined representation, and each image has its own alt text attributed in the focused representation. * Add Profile tab accessibility labels to indicate private/bot/muted/blocked accounts Previously, the icon did not have any accessible representation (an empty text string). * Add header trait to Profile “pinned post” * Use the Account.Field.name for the user input label * Replace spaces with commas in StatusRowView.combinedAccessibilityLabel
2023-03-19 15:27:18 +00:00
.accessibilityAction {
guard !isFocused else { return }
Profile tab accessibility uplift (#1274) * Combine `joinedAtView` into one accessibility element Previously, the calendar image was visible with a nonsensical label. We use the `.combine` operator here to maintain the proper string formatting of the date. * Improve the accessibility of the AccountDetailHeaderView Previously, this image had no description and no indication that it had an associated interaction. Now, we wrap it in a button that performs the tap gesture action, and remove the element altogether if there is no avatar image set. This commit also handles the checkmark for supporter users * Tweak accessibility of Profile CustomInfoLabels This commit: - Reverses the order of title and value - Sets the value as an `accessibilityValue` - Adds a hint indicating what the button does, as they perform slightly different actions * Make Profile tab header image into a Button This element has an action associated with it (quicklook), so it makes more sense to have it as a button, and hide it if the user does not have an image set. Without the action it would have been considered decorative and should be hidden. * Change accessibilityLabel of Profile tab nav bar item to ‘Options’ “More” is considered overly generic. This commit also adds two additional user input label options * Add accessibility labels for the Profile tab `Picker` Previously, these labels were the default accessibility label provided by the SF symbol, that almost, but not quite, made sense * Remove StatusRowView swipe actions if VoiceOver is running These swipe actions are automagically added to the accessibility element’s custom actions, in addition to the ones already there, which means that there is a significant (and confusing) amount of doubling up going on. * Fix typo in StatusRowView.accessibilityActions * Add accessibilityLabels to all StatusRowActionsView actions * Provide explicit combined accessibility label for unfocused StatusRowView Previously, this was a synthesized label, which read the elements in their traversal order, and didn’t provide any context for which of the three numbers corresponded to replies, boosts or favourites. Now, we create an explicit combined label when the post isn’t being viewed by itself. * Improve accessibility of StatusRow(Reblog|Reply)View They are now combined elements and don’t vend the icon as its own element. * Add missing punctuation to accessibility hints * Remove interaction from Profile tab @username and profile note elements These elements open the profile photo url, which is already provided explicitly through the profile photo * Prefer spoiler warning for StatusRowView accessibility label …but place the full, unredacted content in an `AccessibilityCustomContent` field for easy access. Additionally, if VoiceOver is running, an action to expand the warning is also available. * Represent `FollowButton` elements as Toggles to accessibility Since these buttons have two states (though arguable in the case of following, but handled here by not changing the representation if a request is pending), it makes sense to handle them as toggles, so they will be read as “Following, On, <Trait>” * Remove errant comment * Add “Verified” accessibilityValue to profile fields * Fix bug StatusRowView default action bug affecting VoiceOver users Previously, the default (‘Activate’) action for VoiceOver users would be to share a link to the toot, rather than navigate to its detail. It’s hard to say exactly what caused this, but the root was the inclusion of the `contextMenu` in the `accessibilityActions`. Now, double-tapping on a a non-focused `StatusRowView` will take you to the toot detail. * Add header trait to Profile tab display name and familiar followers These stand out as being header-like in presentation and represent the beginning of specific parts of the screen. * Add conditional accessibility modifier to Profile tab user-defined fields that opens the correct link * Add accessibility container that contextualises the user-defined fields When VoiceOver users first enter a user-defined field, the container label will be read out before the element’s spoken description. * Improve StatusRowView combined accessibility label It will now start with: “X boosted Y”, “X replied to @Y”, or “X…” depending on the context of the toot. * Change familiar follows thumbnail to a Button; add display name as accessibility label Previously, this button had no context, and would just be a series of images with nothing to allow users to disambiguate them. * Revert changes from ZStack with tap gesture to Button Using a Button for this purpose caused high weirdness in tap zones. Basically everything down to the familiar followers triggered both image buttons. * Add image alt text to StatusRowView and StatusRowMediaPreviewView Previously, there was no way for the intended audience for the alt text to find said text. There is a tap gesture on each image in the focused status row, but this is not advertised to the user. Now, the first image’s alt text is read as part of the non-focused, combined representation, and each image has its own alt text attributed in the focused representation. * Add Profile tab accessibility labels to indicate private/bot/muted/blocked accounts Previously, the icon did not have any accessible representation (an empty text string). * Add header trait to Profile “pinned post” * Use the Account.Field.name for the user input label * Replace spaces with commas in StatusRowView.combinedAccessibilityLabel
2023-03-19 15:27:18 +00:00
viewModel.navigateToDetail()
}
.accessibilityActions {
2023-12-28 11:26:09 +00:00
if !isFocused, viewModel.showActions, accessibilityVoiceOverEnabled {
Accessibility tweaks + Notifications and Messages tab uplift (#1292) * Improve StatusRowView accessibility actions Previously, there was no way to interact with links and hashtags. Now, these are added to the Actions rotor * Hide `topPaddingView`s from accessibility * Fix accessible header rendering in non-filterable TimelineViews Previously, all navigation title views were assumed to be popup buttons. Now, we only change the representation for timelines that are filterable. * Combine tagHeaderView text elements Previously, these were two separate items * Prefer shorter Quote action label * Improve accessibility of StatusEmbeddedView Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions. * Add haptics to StatusRowView accessibility actions * Improve accessibility of ConversationsListRow This commit adds: - A combined representation of the component views - “Unread” as the first part of the label (if this is the case) - All relevant actions as custom actions - Reply as magic tap * Remove StatusRowView accessibilityActions if viewModel.showActions is false * Hide media attachments from accessibility if the view is not focused * Combine NotificationRowView accessibility elements; add user actions Previously, there was no real way to interact with these notifications. Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile. * Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning` This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well. --------- Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
accessibilityActions
}
}
.background {
Color.clear
.contentShape(Rectangle())
.onTapGesture {
guard !isFocused else { return }
viewModel.navigateToDetail()
2023-02-15 18:27:26 +00:00
}
}
.overlay {
if viewModel.isLoadingRemoteContent {
remoteContentLoadingView
2023-01-22 05:38:30 +00:00
}
}
.alert(isPresented: $viewModel.showDeleteAlert, content: {
Alert(
title: Text("status.action.delete.confirm.title"),
message: Text("status.action.delete.confirm.message"),
primaryButton: .destructive(
Text("status.action.delete"))
{
Task {
await viewModel.delete()
}
},
secondaryButton: .cancel()
)
})
2024-01-31 06:56:50 +00:00
.confirmationDialog("",
2024-02-14 11:48:14 +00:00
isPresented: $isBlockConfirmationPresented)
{
2024-01-31 06:56:50 +00:00
Button("account.action.block", role: .destructive) {
Task {
do {
let operationAccount = viewModel.status.reblog?.account ?? viewModel.status.account
viewModel.authorRelationship = try await client.post(endpoint: Accounts.block(id: operationAccount.id))
2024-02-14 11:48:14 +00:00
} catch {}
2024-01-31 06:56:50 +00:00
}
}
}
.alignmentGuide(.listRowSeparatorLeading) { _ in
-100
2022-12-20 19:33:45 +00:00
}
.sheet(isPresented: $showSelectableText) {
let content = viewModel.status.reblog?.content.asSafeMarkdownAttributedString ?? viewModel.status.content.asSafeMarkdownAttributedString
SelectTextView(content: content)
}
.environment(
2023-03-02 19:15:07 +00:00
StatusDataControllerProvider.shared.dataController(for: viewModel.finalStatus,
2023-03-02 20:16:03 +00:00
client: viewModel.client)
)
2023-01-03 11:24:15 +00:00
}
2023-03-13 12:38:28 +00:00
2023-02-09 08:12:44 +00:00
@ViewBuilder
Profile tab accessibility uplift (#1274) * Combine `joinedAtView` into one accessibility element Previously, the calendar image was visible with a nonsensical label. We use the `.combine` operator here to maintain the proper string formatting of the date. * Improve the accessibility of the AccountDetailHeaderView Previously, this image had no description and no indication that it had an associated interaction. Now, we wrap it in a button that performs the tap gesture action, and remove the element altogether if there is no avatar image set. This commit also handles the checkmark for supporter users * Tweak accessibility of Profile CustomInfoLabels This commit: - Reverses the order of title and value - Sets the value as an `accessibilityValue` - Adds a hint indicating what the button does, as they perform slightly different actions * Make Profile tab header image into a Button This element has an action associated with it (quicklook), so it makes more sense to have it as a button, and hide it if the user does not have an image set. Without the action it would have been considered decorative and should be hidden. * Change accessibilityLabel of Profile tab nav bar item to ‘Options’ “More” is considered overly generic. This commit also adds two additional user input label options * Add accessibility labels for the Profile tab `Picker` Previously, these labels were the default accessibility label provided by the SF symbol, that almost, but not quite, made sense * Remove StatusRowView swipe actions if VoiceOver is running These swipe actions are automagically added to the accessibility element’s custom actions, in addition to the ones already there, which means that there is a significant (and confusing) amount of doubling up going on. * Fix typo in StatusRowView.accessibilityActions * Add accessibilityLabels to all StatusRowActionsView actions * Provide explicit combined accessibility label for unfocused StatusRowView Previously, this was a synthesized label, which read the elements in their traversal order, and didn’t provide any context for which of the three numbers corresponded to replies, boosts or favourites. Now, we create an explicit combined label when the post isn’t being viewed by itself. * Improve accessibility of StatusRow(Reblog|Reply)View They are now combined elements and don’t vend the icon as its own element. * Add missing punctuation to accessibility hints * Remove interaction from Profile tab @username and profile note elements These elements open the profile photo url, which is already provided explicitly through the profile photo * Prefer spoiler warning for StatusRowView accessibility label …but place the full, unredacted content in an `AccessibilityCustomContent` field for easy access. Additionally, if VoiceOver is running, an action to expand the warning is also available. * Represent `FollowButton` elements as Toggles to accessibility Since these buttons have two states (though arguable in the case of following, but handled here by not changing the representation if a request is pending), it makes sense to handle them as toggles, so they will be read as “Following, On, <Trait>” * Remove errant comment * Add “Verified” accessibilityValue to profile fields * Fix bug StatusRowView default action bug affecting VoiceOver users Previously, the default (‘Activate’) action for VoiceOver users would be to share a link to the toot, rather than navigate to its detail. It’s hard to say exactly what caused this, but the root was the inclusion of the `contextMenu` in the `accessibilityActions`. Now, double-tapping on a a non-focused `StatusRowView` will take you to the toot detail. * Add header trait to Profile tab display name and familiar followers These stand out as being header-like in presentation and represent the beginning of specific parts of the screen. * Add conditional accessibility modifier to Profile tab user-defined fields that opens the correct link * Add accessibility container that contextualises the user-defined fields When VoiceOver users first enter a user-defined field, the container label will be read out before the element’s spoken description. * Improve StatusRowView combined accessibility label It will now start with: “X boosted Y”, “X replied to @Y”, or “X…” depending on the context of the toot. * Change familiar follows thumbnail to a Button; add display name as accessibility label Previously, this button had no context, and would just be a series of images with nothing to allow users to disambiguate them. * Revert changes from ZStack with tap gesture to Button Using a Button for this purpose caused high weirdness in tap zones. Basically everything down to the familiar followers triggered both image buttons. * Add image alt text to StatusRowView and StatusRowMediaPreviewView Previously, there was no way for the intended audience for the alt text to find said text. There is a tap gesture on each image in the focused status row, but this is not advertised to the user. Now, the first image’s alt text is read as part of the non-focused, combined representation, and each image has its own alt text attributed in the focused representation. * Add Profile tab accessibility labels to indicate private/bot/muted/blocked accounts Previously, the icon did not have any accessible representation (an empty text string). * Add header trait to Profile “pinned post” * Use the Account.Field.name for the user input label * Replace spaces with commas in StatusRowView.combinedAccessibilityLabel
2023-03-19 15:27:18 +00:00
private var accessibilityActions: some View {
Accessibility tweaks + Notifications and Messages tab uplift (#1292) * Improve StatusRowView accessibility actions Previously, there was no way to interact with links and hashtags. Now, these are added to the Actions rotor * Hide `topPaddingView`s from accessibility * Fix accessible header rendering in non-filterable TimelineViews Previously, all navigation title views were assumed to be popup buttons. Now, we only change the representation for timelines that are filterable. * Combine tagHeaderView text elements Previously, these were two separate items * Prefer shorter Quote action label * Improve accessibility of StatusEmbeddedView Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions. * Add haptics to StatusRowView accessibility actions * Improve accessibility of ConversationsListRow This commit adds: - A combined representation of the component views - “Unread” as the first part of the label (if this is the case) - All relevant actions as custom actions - Reply as magic tap * Remove StatusRowView accessibilityActions if viewModel.showActions is false * Hide media attachments from accessibility if the view is not focused * Combine NotificationRowView accessibility elements; add user actions Previously, there was no real way to interact with these notifications. Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile. * Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning` This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well. --------- Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
// Add reply and quote, which are lost when the swipe actions are removed
Button("status.action.reply") {
HapticManager.shared.fireHaptic(.notification(.success))
Accessibility tweaks + Notifications and Messages tab uplift (#1292) * Improve StatusRowView accessibility actions Previously, there was no way to interact with links and hashtags. Now, these are added to the Actions rotor * Hide `topPaddingView`s from accessibility * Fix accessible header rendering in non-filterable TimelineViews Previously, all navigation title views were assumed to be popup buttons. Now, we only change the representation for timelines that are filterable. * Combine tagHeaderView text elements Previously, these were two separate items * Prefer shorter Quote action label * Improve accessibility of StatusEmbeddedView Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions. * Add haptics to StatusRowView accessibility actions * Improve accessibility of ConversationsListRow This commit adds: - A combined representation of the component views - “Unread” as the first part of the label (if this is the case) - All relevant actions as custom actions - Reply as magic tap * Remove StatusRowView accessibilityActions if viewModel.showActions is false * Hide media attachments from accessibility if the view is not focused * Combine NotificationRowView accessibility elements; add user actions Previously, there was no real way to interact with these notifications. Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile. * Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning` This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well. --------- Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
viewModel.routerPath.presentedSheet = .replyToStatusEditor(status: viewModel.status)
}
Button("settings.swipeactions.status.action.quote") {
HapticManager.shared.fireHaptic(.notification(.success))
Accessibility tweaks + Notifications and Messages tab uplift (#1292) * Improve StatusRowView accessibility actions Previously, there was no way to interact with links and hashtags. Now, these are added to the Actions rotor * Hide `topPaddingView`s from accessibility * Fix accessible header rendering in non-filterable TimelineViews Previously, all navigation title views were assumed to be popup buttons. Now, we only change the representation for timelines that are filterable. * Combine tagHeaderView text elements Previously, these were two separate items * Prefer shorter Quote action label * Improve accessibility of StatusEmbeddedView Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions. * Add haptics to StatusRowView accessibility actions * Improve accessibility of ConversationsListRow This commit adds: - A combined representation of the component views - “Unread” as the first part of the label (if this is the case) - All relevant actions as custom actions - Reply as magic tap * Remove StatusRowView accessibilityActions if viewModel.showActions is false * Hide media attachments from accessibility if the view is not focused * Combine NotificationRowView accessibility elements; add user actions Previously, there was no real way to interact with these notifications. Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile. * Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning` This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well. --------- Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
viewModel.routerPath.presentedSheet = .quoteStatusEditor(status: viewModel.status)
2023-02-09 08:12:44 +00:00
}
.disabled(viewModel.status.visibility == .direct || viewModel.status.visibility == .priv)
2023-03-13 12:38:28 +00:00
if viewModel.finalStatus.mediaAttachments.isEmpty == false {
Button("accessibility.status.media-viewer-action.label") {
HapticManager.shared.fireHaptic(.notification(.success))
2023-10-16 17:08:59 +00:00
let attachments = viewModel.finalStatus.mediaAttachments
2024-01-09 12:28:57 +00:00
#if targetEnvironment(macCatalyst) || os(visionOS)
2023-12-18 07:22:59 +00:00
openWindow(value: WindowDestinationMedia.mediaViewer(
attachments: attachments,
selectedAttachment: attachments[0]
))
#else
quickLook.prepareFor(selectedMediaAttachment: attachments[0], mediaAttachments: attachments)
#endif
}
}
2023-02-09 08:12:44 +00:00
Button(viewModel.displaySpoiler ? "status.show-more" : "status.show-less") {
withAnimation {
viewModel.displaySpoiler.toggle()
}
}
2023-03-13 12:38:28 +00:00
2023-02-09 08:12:44 +00:00
Button("@\(viewModel.status.account.username)") {
HapticManager.shared.fireHaptic(.notification(.success))
viewModel.routerPath.navigate(to: .accountDetail(id: viewModel.status.account.id))
2023-02-09 08:12:44 +00:00
}
Accessibility tweaks + Notifications and Messages tab uplift (#1292) * Improve StatusRowView accessibility actions Previously, there was no way to interact with links and hashtags. Now, these are added to the Actions rotor * Hide `topPaddingView`s from accessibility * Fix accessible header rendering in non-filterable TimelineViews Previously, all navigation title views were assumed to be popup buttons. Now, we only change the representation for timelines that are filterable. * Combine tagHeaderView text elements Previously, these were two separate items * Prefer shorter Quote action label * Improve accessibility of StatusEmbeddedView Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions. * Add haptics to StatusRowView accessibility actions * Improve accessibility of ConversationsListRow This commit adds: - A combined representation of the component views - “Unread” as the first part of the label (if this is the case) - All relevant actions as custom actions - Reply as magic tap * Remove StatusRowView accessibilityActions if viewModel.showActions is false * Hide media attachments from accessibility if the view is not focused * Combine NotificationRowView accessibility elements; add user actions Previously, there was no real way to interact with these notifications. Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile. * Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning` This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well. --------- Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
// Add a reference to the post creator
if viewModel.status.account != viewModel.finalStatus.account {
Button("@\(viewModel.finalStatus.account.username)") {
HapticManager.shared.fireHaptic(.notification(.success))
Accessibility tweaks + Notifications and Messages tab uplift (#1292) * Improve StatusRowView accessibility actions Previously, there was no way to interact with links and hashtags. Now, these are added to the Actions rotor * Hide `topPaddingView`s from accessibility * Fix accessible header rendering in non-filterable TimelineViews Previously, all navigation title views were assumed to be popup buttons. Now, we only change the representation for timelines that are filterable. * Combine tagHeaderView text elements Previously, these were two separate items * Prefer shorter Quote action label * Improve accessibility of StatusEmbeddedView Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions. * Add haptics to StatusRowView accessibility actions * Improve accessibility of ConversationsListRow This commit adds: - A combined representation of the component views - “Unread” as the first part of the label (if this is the case) - All relevant actions as custom actions - Reply as magic tap * Remove StatusRowView accessibilityActions if viewModel.showActions is false * Hide media attachments from accessibility if the view is not focused * Combine NotificationRowView accessibility elements; add user actions Previously, there was no real way to interact with these notifications. Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile. * Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning` This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well. --------- Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
viewModel.routerPath.navigate(to: .accountDetail(id: viewModel.finalStatus.account.id))
}
}
// Add in each detected link in the content
ForEach(viewModel.finalStatus.content.links) { link in
switch link.type {
2023-07-19 05:46:25 +00:00
case .url:
if UIApplication.shared.canOpenURL(link.url) {
Button("accessibility.tabs.timeline.content-link-\(link.title)") {
HapticManager.shared.fireHaptic(.notification(.success))
Accessibility tweaks + Notifications and Messages tab uplift (#1292) * Improve StatusRowView accessibility actions Previously, there was no way to interact with links and hashtags. Now, these are added to the Actions rotor * Hide `topPaddingView`s from accessibility * Fix accessible header rendering in non-filterable TimelineViews Previously, all navigation title views were assumed to be popup buttons. Now, we only change the representation for timelines that are filterable. * Combine tagHeaderView text elements Previously, these were two separate items * Prefer shorter Quote action label * Improve accessibility of StatusEmbeddedView Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions. * Add haptics to StatusRowView accessibility actions * Improve accessibility of ConversationsListRow This commit adds: - A combined representation of the component views - “Unread” as the first part of the label (if this is the case) - All relevant actions as custom actions - Reply as magic tap * Remove StatusRowView accessibilityActions if viewModel.showActions is false * Hide media attachments from accessibility if the view is not focused * Combine NotificationRowView accessibility elements; add user actions Previously, there was no real way to interact with these notifications. Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile. * Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning` This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well. --------- Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
_ = viewModel.routerPath.handle(url: link.url)
}
2023-07-19 05:46:25 +00:00
}
case .hashtag:
Button("accessibility.tabs.timeline.content-hashtag-\(link.title)") {
HapticManager.shared.fireHaptic(.notification(.success))
2023-07-19 05:46:25 +00:00
_ = viewModel.routerPath.handle(url: link.url)
}
case .mention:
Button("\(link.title)") {
HapticManager.shared.fireHaptic(.notification(.success))
2023-07-19 05:46:25 +00:00
_ = viewModel.routerPath.handle(url: link.url)
}
Accessibility tweaks + Notifications and Messages tab uplift (#1292) * Improve StatusRowView accessibility actions Previously, there was no way to interact with links and hashtags. Now, these are added to the Actions rotor * Hide `topPaddingView`s from accessibility * Fix accessible header rendering in non-filterable TimelineViews Previously, all navigation title views were assumed to be popup buttons. Now, we only change the representation for timelines that are filterable. * Combine tagHeaderView text elements Previously, these were two separate items * Prefer shorter Quote action label * Improve accessibility of StatusEmbeddedView Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions. * Add haptics to StatusRowView accessibility actions * Improve accessibility of ConversationsListRow This commit adds: - A combined representation of the component views - “Unread” as the first part of the label (if this is the case) - All relevant actions as custom actions - Reply as magic tap * Remove StatusRowView accessibilityActions if viewModel.showActions is false * Hide media attachments from accessibility if the view is not focused * Combine NotificationRowView accessibility elements; add user actions Previously, there was no real way to interact with these notifications. Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile. * Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning` This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well. --------- Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
}
}
2023-02-09 08:12:44 +00:00
}
2023-03-13 12:38:28 +00:00
2023-01-03 11:24:15 +00:00
private func makeFilterView(filter: Filter) -> some View {
HStack {
Text("status.filter.filtered-by-\(filter.title)")
2023-01-03 11:24:15 +00:00
Button {
withAnimation {
viewModel.isFiltered = false
}
} label: {
Text("status.filter.show-anyway")
2023-12-31 12:17:09 +00:00
.foregroundStyle(theme.tintColor)
}
.buttonStyle(.plain)
}
.onTapGesture {
withAnimation {
viewModel.isFiltered = false
2023-01-03 11:24:15 +00:00
}
2022-12-27 08:11:12 +00:00
}
.accessibilityAction {
viewModel.isFiltered = false
}
2022-12-16 12:16:48 +00:00
}
2023-03-13 12:38:28 +00:00
private var remoteContentLoadingView: some View {
ZStack(alignment: .center) {
VStack {
Spacer()
HStack {
Spacer()
ProgressView()
Spacer()
}
Spacer()
}
}
.background(Color.black.opacity(0.40))
.transition(.opacity)
}
2022-11-21 08:31:32 +00:00
}
Profile tab accessibility uplift (#1274) * Combine `joinedAtView` into one accessibility element Previously, the calendar image was visible with a nonsensical label. We use the `.combine` operator here to maintain the proper string formatting of the date. * Improve the accessibility of the AccountDetailHeaderView Previously, this image had no description and no indication that it had an associated interaction. Now, we wrap it in a button that performs the tap gesture action, and remove the element altogether if there is no avatar image set. This commit also handles the checkmark for supporter users * Tweak accessibility of Profile CustomInfoLabels This commit: - Reverses the order of title and value - Sets the value as an `accessibilityValue` - Adds a hint indicating what the button does, as they perform slightly different actions * Make Profile tab header image into a Button This element has an action associated with it (quicklook), so it makes more sense to have it as a button, and hide it if the user does not have an image set. Without the action it would have been considered decorative and should be hidden. * Change accessibilityLabel of Profile tab nav bar item to ‘Options’ “More” is considered overly generic. This commit also adds two additional user input label options * Add accessibility labels for the Profile tab `Picker` Previously, these labels were the default accessibility label provided by the SF symbol, that almost, but not quite, made sense * Remove StatusRowView swipe actions if VoiceOver is running These swipe actions are automagically added to the accessibility element’s custom actions, in addition to the ones already there, which means that there is a significant (and confusing) amount of doubling up going on. * Fix typo in StatusRowView.accessibilityActions * Add accessibilityLabels to all StatusRowActionsView actions * Provide explicit combined accessibility label for unfocused StatusRowView Previously, this was a synthesized label, which read the elements in their traversal order, and didn’t provide any context for which of the three numbers corresponded to replies, boosts or favourites. Now, we create an explicit combined label when the post isn’t being viewed by itself. * Improve accessibility of StatusRow(Reblog|Reply)View They are now combined elements and don’t vend the icon as its own element. * Add missing punctuation to accessibility hints * Remove interaction from Profile tab @username and profile note elements These elements open the profile photo url, which is already provided explicitly through the profile photo * Prefer spoiler warning for StatusRowView accessibility label …but place the full, unredacted content in an `AccessibilityCustomContent` field for easy access. Additionally, if VoiceOver is running, an action to expand the warning is also available. * Represent `FollowButton` elements as Toggles to accessibility Since these buttons have two states (though arguable in the case of following, but handled here by not changing the representation if a request is pending), it makes sense to handle them as toggles, so they will be read as “Following, On, <Trait>” * Remove errant comment * Add “Verified” accessibilityValue to profile fields * Fix bug StatusRowView default action bug affecting VoiceOver users Previously, the default (‘Activate’) action for VoiceOver users would be to share a link to the toot, rather than navigate to its detail. It’s hard to say exactly what caused this, but the root was the inclusion of the `contextMenu` in the `accessibilityActions`. Now, double-tapping on a a non-focused `StatusRowView` will take you to the toot detail. * Add header trait to Profile tab display name and familiar followers These stand out as being header-like in presentation and represent the beginning of specific parts of the screen. * Add conditional accessibility modifier to Profile tab user-defined fields that opens the correct link * Add accessibility container that contextualises the user-defined fields When VoiceOver users first enter a user-defined field, the container label will be read out before the element’s spoken description. * Improve StatusRowView combined accessibility label It will now start with: “X boosted Y”, “X replied to @Y”, or “X…” depending on the context of the toot. * Change familiar follows thumbnail to a Button; add display name as accessibility label Previously, this button had no context, and would just be a series of images with nothing to allow users to disambiguate them. * Revert changes from ZStack with tap gesture to Button Using a Button for this purpose caused high weirdness in tap zones. Basically everything down to the familiar followers triggered both image buttons. * Add image alt text to StatusRowView and StatusRowMediaPreviewView Previously, there was no way for the intended audience for the alt text to find said text. There is a tap gesture on each image in the focused status row, but this is not advertised to the user. Now, the first image’s alt text is read as part of the non-focused, combined representation, and each image has its own alt text attributed in the focused representation. * Add Profile tab accessibility labels to indicate private/bot/muted/blocked accounts Previously, the icon did not have any accessible representation (an empty text string). * Add header trait to Profile “pinned post” * Use the Account.Field.name for the user input label * Replace spaces with commas in StatusRowView.combinedAccessibilityLabel
2023-03-19 15:27:18 +00:00
2024-02-13 17:50:51 +00:00
#Preview {
List {
StatusRowView(viewModel:
2024-02-14 11:48:14 +00:00
.init(status: .placeholder(),
client: .init(server: ""),
routerPath: RouterPath()),
context: .timeline)
2024-02-13 17:50:51 +00:00
StatusRowView(viewModel:
2024-02-14 11:48:14 +00:00
.init(status: .placeholder(),
client: .init(server: ""),
routerPath: RouterPath()),
context: .timeline)
2024-02-13 17:50:51 +00:00
StatusRowView(viewModel:
2024-02-14 11:48:14 +00:00
.init(status: .placeholder(),
client: .init(server: ""),
routerPath: RouterPath()),
context: .timeline)
}
.listStyle(.plain)
.withPreviewsEnv()
.environment(Theme.shared)
2024-02-13 17:50:51 +00:00
}