IceCubesApp/Packages/Account/Sources/Account/AccountDetailHeaderView.swift

418 lines
15 KiB
Swift
Raw Normal View History

2022-12-18 19:30:19 +00:00
import DesignSystem
2023-01-17 10:36:01 +00:00
import EmojiText
2022-12-22 09:53:36 +00:00
import Env
2023-01-17 10:36:01 +00:00
import Models
2022-12-25 06:43:02 +00:00
import NukeUI
2023-01-17 10:36:01 +00:00
import SwiftUI
2022-12-17 12:37:46 +00:00
2023-09-18 19:03:52 +00:00
@MainActor
2022-12-17 12:37:46 +00:00
struct AccountDetailHeaderView: View {
2023-02-12 15:13:57 +00:00
enum Constants {
static let headerHeight: CGFloat = 200
}
2023-02-12 15:29:41 +00:00
2023-10-24 16:34:45 +00:00
@Environment(\.openWindow) private var openWindow
2023-09-18 19:03:52 +00:00
@Environment(Theme.self) private var theme
@Environment(QuickLook.self) private var quickLook
@Environment(RouterPath.self) private var routerPath
@Environment(CurrentAccount.self) private var currentAccount
2022-12-17 12:37:46 +00:00
@Environment(\.redactionReasons) private var reasons
@Environment(\.isSupporter) private var isSupporter: Bool
2023-01-17 10:36:01 +00:00
var viewModel: AccountDetailViewModel
2022-12-20 08:37:07 +00:00
let account: Account
2022-12-27 08:11:12 +00:00
let scrollViewProxy: ScrollViewProxy?
2023-01-17 10:36:01 +00:00
2022-12-17 12:37:46 +00:00
var body: some View {
VStack(alignment: .leading) {
ZStack(alignment: .bottomTrailing) {
Rectangle()
.frame(height: Constants.headerHeight)
.overlay {
headerImageView
}
if viewModel.relationship?.followedBy == true {
Text("account.relation.follows-you")
.font(.scaledFootnote)
.fontWeight(.semibold)
.padding(4)
.background(.ultraThinMaterial)
.cornerRadius(4)
.padding(8)
}
}
2022-12-17 12:37:46 +00:00
accountInfoView
}
}
2023-01-17 10:36:01 +00:00
2022-12-17 12:37:46 +00:00
private var headerImageView: some View {
2023-01-19 07:41:45 +00:00
ZStack(alignment: .bottomTrailing) {
if reasons.contains(.placeholder) {
Rectangle()
.foregroundColor(theme.secondaryBackgroundColor)
2023-02-12 15:13:57 +00:00
.frame(height: Constants.headerHeight)
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
.accessibilityHidden(true)
2023-01-19 07:41:45 +00:00
} else {
LazyImage(url: account.header) { state in
if let image = state.image {
image
.resizable()
.aspectRatio(contentMode: .fill)
.overlay(account.haveHeader ? .black.opacity(0.50) : .clear)
.frame(height: Constants.headerHeight)
.clipped()
2023-01-19 07:41:45 +00:00
} else {
theme.secondaryBackgroundColor
2023-02-12 15:13:57 +00:00
.frame(height: Constants.headerHeight)
2023-01-19 07:41:45 +00:00
}
2022-12-25 06:43:02 +00:00
}
2023-02-12 15:13:57 +00:00
.frame(height: Constants.headerHeight)
2023-01-19 07:41:45 +00:00
}
2022-12-20 08:37:07 +00:00
}
#if !os(visionOS)
.background(theme.secondaryBackgroundColor)
#endif
2023-02-12 15:13:57 +00:00
.frame(height: Constants.headerHeight)
2022-12-20 08:37:07 +00:00
.onTapGesture {
guard account.haveHeader else {
return
}
2023-10-16 17:08:59 +00:00
let attachement = MediaAttachment.imageWith(url: account.header)
2024-01-09 12:28:57 +00:00
#if targetEnvironment(macCatalyst) || os(visionOS)
openWindow(value: WindowDestinationMedia.mediaViewer(
attachments: [attachement],
2023-12-18 07:22:59 +00:00
selectedAttachment: attachement
))
#else
2023-10-24 16:34:45 +00:00
quickLook.prepareFor(selectedMediaAttachment: attachement, mediaAttachments: [attachement])
2023-12-18 07:22:59 +00:00
#endif
2022-12-20 08:37:07 +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
.accessibilityElement(children: .combine)
.accessibilityAddTraits([.isImage, .isButton])
.accessibilityLabel("accessibility.tabs.profile.header-image.label")
.accessibilityHint("accessibility.tabs.profile.header-image.hint")
.accessibilityHidden(account.haveHeader == false)
2022-12-17 12:37:46 +00:00
}
2023-01-17 10:36:01 +00:00
2022-12-17 12:37:46 +00:00
private var accountAvatarView: some View {
HStack {
ZStack(alignment: .topTrailing) {
AvatarView(account.avatar, config: .account)
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
.accessibilityLabel("accessibility.tabs.profile.user-avatar.label")
if viewModel.isCurrentUser, isSupporter {
Image(systemName: "checkmark.seal.fill")
.resizable()
.frame(width: 25, height: 25)
.foregroundColor(theme.tintColor)
2023-03-04 08:16:00 +00:00
.offset(x: theme.avatarShape == .circle ? 0 : 10,
y: theme.avatarShape == .circle ? 0 : -10)
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
.accessibilityRemoveTraits(.isSelected)
.accessibilityLabel("accessibility.tabs.profile.user-avatar.supporter.label")
2022-12-22 09:56:24 +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
.onTapGesture {
guard account.haveAvatar else {
return
}
2023-10-16 17:08:59 +00:00
let attachement = MediaAttachment.imageWith(url: account.avatar)
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: [attachement],
selectedAttachment: attachement))
#else
quickLook.prepareFor(selectedMediaAttachment: attachement, mediaAttachments: [attachement])
#endif
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
}
.accessibilityElement(children: .combine)
.accessibilityAddTraits([.isImage, .isButton])
.accessibilityHint("accessibility.tabs.profile.user-avatar.hint")
.accessibilityHidden(account.haveAvatar == false)
2022-12-17 12:37:46 +00:00
Spacer()
Group {
2022-12-27 08:11:12 +00:00
Button {
withAnimation {
scrollViewProxy?.scrollTo("status", anchor: .top)
}
} label: {
2023-07-04 06:37:30 +00:00
makeCustomInfoLabel(title: "account.posts", count: account.statusesCount ?? 0)
2022-12-27 08:11:12 +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
.accessibilityHint("accessibility.tabs.profile.post-count.hint")
2023-02-12 15:13:57 +00:00
.buttonStyle(.borderless)
2023-02-12 15:29:41 +00:00
2023-02-12 15:13:57 +00:00
Button {
routerPath.navigate(to: .following(id: account.id))
} label: {
2023-07-04 06:37:30 +00:00
makeCustomInfoLabel(title: "account.following", count: account.followingCount ?? 0)
2022-12-23 17:47:19 +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
.accessibilityHint("accessibility.tabs.profile.following-count.hint")
2023-02-12 15:13:57 +00:00
.buttonStyle(.borderless)
Button {
routerPath.navigate(to: .followers(id: account.id))
} label: {
makeCustomInfoLabel(
title: "account.followers",
2023-07-04 06:37:30 +00:00
count: account.followersCount ?? 0,
needsBadge: currentAccount.account?.id == account.id && !currentAccount.followRequests.isEmpty
)
2022-12-23 17:47:19 +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
.accessibilityHint("accessibility.tabs.profile.follower-count.hint")
2023-02-12 15:13:57 +00:00
.buttonStyle(.borderless)
2023-02-12 15:29:41 +00:00
2022-12-17 12:37:46 +00:00
}.offset(y: 20)
}
}
2023-01-17 10:36:01 +00:00
2022-12-17 12:37:46 +00:00
private var accountInfoView: some View {
Group {
accountAvatarView
HStack(alignment: .firstTextBaseline) {
2022-12-20 16:11:12 +00:00
VStack(alignment: .leading, spacing: 0) {
HStack(alignment: .center, spacing: 2) {
EmojiTextApp(.init(stringValue: account.safeDisplayName), emojis: account.emojis)
.font(.scaledHeadline)
.foregroundColor(theme.labelColor)
2024-02-05 07:55:24 +00:00
.emojiText.size(Font.scaledHeadlineFont.emojiSize)
.emojiText.baselineOffset(Font.scaledHeadlineFont.emojiBaselineOffset)
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
.accessibilityAddTraits(.isHeader)
// The views here are wrapped in ZStacks as a Text(Image) does not provide an `accessibilityLabel`.
if account.bot {
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
ZStack {
Text(Image(systemName: "poweroutlet.type.b.fill"))
.font(.footnote)
}.accessibilityLabel("accessibility.tabs.profile.user.account-bot.label")
}
if account.locked {
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
ZStack {
Text(Image(systemName: "lock.fill"))
.font(.footnote)
}.accessibilityLabel("accessibility.tabs.profile.user.account-private.label")
}
if viewModel.relationship?.blocking == true {
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
ZStack {
Text(Image(systemName: "person.crop.circle.badge.xmark.fill"))
.font(.footnote)
}.accessibilityLabel("accessibility.tabs.profile.user.account-blocked.label")
}
if viewModel.relationship?.muting == true {
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
ZStack {
Text(Image(systemName: "speaker.slash.fill"))
.font(.footnote)
}.accessibilityLabel("accessibility.tabs.profile.user.account-muted.label")
}
}
2022-12-24 12:41:25 +00:00
Text("@\(account.acct)")
.font(.scaledCallout)
2023-12-04 14:49:44 +00:00
.foregroundStyle(.secondary)
.textSelection(.enabled)
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
.accessibilityRespondsToUserInteraction(false)
joinedAtView
}
.accessibilityElement(children: .contain)
.accessibilitySortPriority(1)
2022-12-20 16:11:12 +00:00
Spacer()
if let relationship = viewModel.relationship, !viewModel.isCurrentUser {
HStack {
FollowButton(viewModel: .init(accountId: account.id,
relationship: relationship,
shouldDisplayNotify: true,
relationshipUpdated: { relationship in
2023-01-22 05:38:30 +00:00
viewModel.relationship = relationship
}))
}
2023-12-28 21:18:13 +00:00
} else if !viewModel.isCurrentUser {
ProgressView()
2022-12-20 16:11:12 +00:00
}
}
2023-02-21 06:23:42 +00:00
if let note = viewModel.relationship?.note, !note.isEmpty,
2023-02-21 06:23:42 +00:00
!viewModel.isCurrentUser
{
makeNoteView(note)
}
EmojiTextApp(account.note, emojis: account.emojis)
.font(.scaledBody)
.foregroundColor(theme.labelColor)
2024-02-05 07:55:24 +00:00
.emojiText.size(Font.scaledBodyFont.emojiSize)
.emojiText.baselineOffset(Font.scaledBodyFont.emojiBaselineOffset)
2022-12-17 12:37:46 +00:00
.padding(.top, 8)
.textSelection(.enabled)
.environment(\.openURL, OpenURLAction { url in
routerPath.handle(url: url)
})
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
.accessibilityRespondsToUserInteraction(false)
2023-02-21 06:23:42 +00:00
if let translation = viewModel.translation, !viewModel.isLoadingTranslation {
GroupBox {
VStack(alignment: .leading, spacing: 4) {
Text(translation.content.asSafeMarkdownAttributedString)
.font(.scaledBody)
Text(getLocalizedStringLabel(langCode: translation.detectedSourceLanguage, provider: translation.provider))
.font(.footnote)
2023-12-04 14:49:44 +00:00
.foregroundStyle(.secondary)
}
}
.fixedSize(horizontal: false, vertical: true)
}
2023-02-19 10:35:46 +00:00
fieldsView
2022-12-17 12:37:46 +00:00
}
.padding(.horizontal, .layoutPadding)
2022-12-17 12:37:46 +00:00
.offset(y: -40)
}
2023-01-17 10:36:01 +00:00
private func getLocalizedStringLabel(langCode: String, provider: String) -> String {
if let localizedLanguage = Locale.current.localizedString(forLanguageCode: langCode) {
let format = NSLocalizedString("status.action.translated-label-from-%@-%@", comment: "")
return String.localizedStringWithFormat(format, localizedLanguage, provider)
} else {
return "status.action.translated-label-\(provider)"
}
}
private func makeCustomInfoLabel(title: LocalizedStringKey, count: Int, needsBadge: Bool = false) -> some View {
2022-12-17 12:37:46 +00:00
VStack {
Text(count, format: .number.notation(.compactName))
.font(.scaledHeadline)
2022-12-24 14:09:17 +00:00
.foregroundColor(theme.tintColor)
.overlay(alignment: .trailing) {
if needsBadge {
Circle()
.fill(Color.red)
.frame(width: 9, height: 9)
.offset(x: 12)
}
}
2022-12-17 12:37:46 +00:00
Text(title)
.font(.scaledFootnote)
2023-12-04 14:49:44 +00:00
.foregroundStyle(.secondary)
2022-12-17 12:37:46 +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
.accessibilityElement(children: .ignore)
.accessibilityLabel(title)
.accessibilityValue("\(count)")
2022-12-17 12:37:46 +00:00
}
@ViewBuilder
private var joinedAtView: some View {
if let joinedAt = viewModel.account?.createdAt.asDate {
HStack(spacing: 4) {
Image(systemName: "calendar")
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
.accessibilityHidden(true)
Text("account.joined")
Text(joinedAt, style: .date)
}
2023-12-04 14:49:44 +00:00
.foregroundStyle(.secondary)
.font(.footnote)
.padding(.top, 6)
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
.accessibilityElement(children: .combine)
}
}
2023-02-21 06:23:42 +00:00
@ViewBuilder
private func makeNoteView(_ note: String) -> some View {
VStack(alignment: .leading, spacing: 4) {
Text("account.relation.note.label")
2023-12-04 14:49:44 +00:00
.foregroundStyle(.secondary)
Text(note)
2023-02-18 20:25:45 +00:00
.frame(maxWidth: .infinity, alignment: .leading)
.padding(8)
#if !os(visionOS)
.background(theme.secondaryBackgroundColor)
#endif
.cornerRadius(4)
.overlay(
RoundedRectangle(cornerRadius: 4)
.stroke(.gray.opacity(0.35), lineWidth: 1)
)
}
}
2023-02-21 06:23:42 +00:00
2023-02-19 10:35:46 +00:00
@ViewBuilder
private var fieldsView: some View {
if !viewModel.fields.isEmpty {
VStack(alignment: .leading) {
ForEach(viewModel.fields) { field in
HStack {
VStack(alignment: .leading, spacing: 2) {
EmojiTextApp(.init(stringValue: field.name), emojis: viewModel.account?.emojis ?? [])
2024-02-05 07:55:24 +00:00
.emojiText.size(Font.scaledHeadlineFont.emojiSize)
.emojiText.baselineOffset(Font.scaledHeadlineFont.emojiBaselineOffset)
2023-07-17 17:49:42 +00:00
.font(.scaledHeadline)
2023-02-19 10:35:46 +00:00
HStack {
if field.verifiedAt != nil {
Image(systemName: "checkmark.seal")
.foregroundColor(Color.green.opacity(0.80))
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
.accessibilityHidden(true)
2023-02-19 10:35:46 +00:00
}
EmojiTextApp(field.value, emojis: viewModel.account?.emojis ?? [])
2024-02-05 07:55:24 +00:00
.emojiText.size(Font.scaledBodyFont.emojiSize)
.emojiText.baselineOffset(Font.scaledBodyFont.emojiBaselineOffset)
2023-02-19 10:35:46 +00:00
.foregroundColor(theme.tintColor)
.environment(\.openURL, OpenURLAction { url in
routerPath.handle(url: url)
2023-02-19 10:35:46 +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
.accessibilityValue(field.verifiedAt != nil ? "accessibility.tabs.profile.fields.verified.label" : "")
2023-02-19 10:35:46 +00:00
}
.font(.scaledBody)
if viewModel.fields.last != field {
Divider()
.padding(.vertical, 4)
}
}
Spacer()
}
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
.accessibilityElement(children: .combine)
.modifier(ConditionalUserDefinedFieldAccessibilityActionModifier(field: field, routerPath: routerPath))
2023-02-19 10:35:46 +00:00
}
}
.padding(8)
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
.accessibilityElement(children: .contain)
.accessibilityLabel("accessibility.tabs.profile.fields.container.label")
#if os(visionOS)
2024-02-14 11:48:14 +00:00
.background(Material.thick)
#else
2024-02-14 11:48:14 +00:00
.background(theme.secondaryBackgroundColor)
#endif
2024-02-14 11:48:14 +00:00
.cornerRadius(4)
.overlay(
RoundedRectangle(cornerRadius: 4)
.stroke(.gray.opacity(0.35), lineWidth: 1)
)
2023-02-19 10:35:46 +00:00
}
}
2022-12-17 12:37:46 +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
/// A ``ViewModifier`` that creates a attaches an accessibility action if the field value is a valid link
private struct ConditionalUserDefinedFieldAccessibilityActionModifier: ViewModifier {
let field: Account.Field
let routerPath: RouterPath
func body(content: Content) -> some View {
if let url = URL(string: field.value.asRawText), UIApplication.shared.canOpenURL(url) {
content
.accessibilityAction {
let _ = routerPath.handle(url: url)
}
// SwiftUI will automatically decorate this element with the link trait, so we remove the button trait manually.
// March 18th, 2023: The button trait is still re-applied
.accessibilityRemoveTraits(.isButton)
.accessibilityInputLabels([field.name])
} else {
content
// This element is not interactive; setting this property removes its button trait
.accessibilityRespondsToUserInteraction(false)
}
}
}
2022-12-17 12:37:46 +00:00
struct AccountDetailHeaderView_Previews: PreviewProvider {
static var previews: some View {
AccountDetailHeaderView(viewModel: .init(account: .placeholder()),
2022-12-20 16:11:12 +00:00
account: .placeholder(),
2023-02-12 15:13:57 +00:00
scrollViewProxy: nil)
2022-12-17 12:37:46 +00:00
}
}