2023-01-05 11:21:54 +00:00
|
|
|
import DesignSystem
|
|
|
|
import Env
|
2023-01-17 10:36:01 +00:00
|
|
|
import Models
|
2023-01-05 11:21:54 +00:00
|
|
|
import Network
|
2023-01-17 10:36:01 +00:00
|
|
|
import SwiftUI
|
2023-01-05 11:21:54 +00:00
|
|
|
|
2023-09-18 19:03:52 +00:00
|
|
|
@MainActor
|
2023-01-05 11:21:54 +00:00
|
|
|
struct ConversationsListRow: View {
|
2024-01-04 15:52:58 +00:00
|
|
|
@Environment(\.openWindow) private var openWindow
|
2024-02-14 11:48:14 +00:00
|
|
|
|
2023-09-18 05:01:23 +00:00
|
|
|
@Environment(Client.self) private var client
|
|
|
|
@Environment(RouterPath.self) private var routerPath
|
2023-09-18 19:03:52 +00:00
|
|
|
@Environment(Theme.self) private var theme
|
2023-09-18 05:01:23 +00:00
|
|
|
@Environment(CurrentAccount.self) private var currentAccount
|
2023-02-26 05:45:57 +00:00
|
|
|
|
2023-02-26 05:45:31 +00:00
|
|
|
@Binding var conversation: Conversation
|
2023-09-18 05:01:23 +00:00
|
|
|
var viewModel: ConversationsListViewModel
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2023-01-05 11:21:54 +00:00
|
|
|
var body: some View {
|
Accessibility tweaks + Notifications and Messages tab uplift (#1292)
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
|
|
|
Button {
|
|
|
|
Task {
|
|
|
|
await viewModel.markAsRead(conversation: conversation)
|
|
|
|
}
|
|
|
|
routerPath.navigate(to: .conversationDetail(conversation: conversation))
|
|
|
|
} label: {
|
|
|
|
VStack(alignment: .leading) {
|
|
|
|
HStack(alignment: .top, spacing: 8) {
|
2023-11-27 08:00:52 +00:00
|
|
|
AvatarView(conversation.accounts.first!.avatar)
|
Accessibility tweaks + Notifications and Messages tab uplift (#1292)
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
|
|
|
.accessibilityHidden(true)
|
|
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
|
|
HStack {
|
2023-09-16 12:15:03 +00:00
|
|
|
EmojiTextApp(.init(stringValue: conversation.accounts.map(\.safeDisplayName).joined(separator: ", ")),
|
|
|
|
emojis: conversation.accounts.flatMap(\.emojis))
|
Accessibility tweaks + Notifications and Messages tab uplift (#1292)
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
|
|
|
.font(.scaledSubheadline)
|
|
|
|
.foregroundColor(theme.labelColor)
|
2024-02-05 07:55:24 +00:00
|
|
|
.emojiText.size(Font.scaledSubheadlineFont.emojiSize)
|
|
|
|
.emojiText.baselineOffset(Font.scaledSubheadlineFont.emojiBaselineOffset)
|
Accessibility tweaks + Notifications and Messages tab uplift (#1292)
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
|
|
|
.fontWeight(.semibold)
|
|
|
|
.foregroundColor(theme.labelColor)
|
|
|
|
.multilineTextAlignment(.leading)
|
|
|
|
Spacer()
|
|
|
|
if conversation.unread {
|
|
|
|
Circle()
|
|
|
|
.foregroundColor(theme.tintColor)
|
|
|
|
.frame(width: 10, height: 10)
|
|
|
|
.accessibilityRepresentation {
|
|
|
|
Text("accessibility.tabs.messages.unread.label")
|
|
|
|
}
|
|
|
|
.accessibilitySortPriority(1)
|
|
|
|
}
|
|
|
|
if let message = conversation.lastStatus {
|
|
|
|
Text(message.createdAt.relativeFormatted)
|
|
|
|
.font(.scaledFootnote)
|
|
|
|
}
|
2023-02-08 05:27:44 +00:00
|
|
|
}
|
Accessibility tweaks + Notifications and Messages tab uplift (#1292)
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
|
|
|
EmojiTextApp(conversation.lastStatus?.content ?? HTMLString(stringValue: ""), emojis: conversation.lastStatus?.emojis ?? [])
|
|
|
|
.multilineTextAlignment(.leading)
|
|
|
|
.font(.scaledBody)
|
|
|
|
.foregroundColor(theme.labelColor)
|
2024-02-05 07:55:24 +00:00
|
|
|
.emojiText.size(Font.scaledBodyFont.emojiSize)
|
|
|
|
.emojiText.baselineOffset(Font.scaledBodyFont.emojiBaselineOffset)
|
Accessibility tweaks + Notifications and Messages tab uplift (#1292)
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
|
|
|
.accessibilityLabel(conversation.lastStatus?.content.asRawText ?? "")
|
2023-01-05 11:21:54 +00:00
|
|
|
}
|
Accessibility tweaks + Notifications and Messages tab uplift (#1292)
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
|
|
|
Spacer()
|
2023-01-05 11:21:54 +00:00
|
|
|
}
|
Accessibility tweaks + Notifications and Messages tab uplift (#1292)
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
|
|
|
.padding(.top, 4)
|
|
|
|
if conversation.lastStatus != nil {
|
|
|
|
actionsView
|
|
|
|
.padding(.bottom, 4)
|
|
|
|
.accessibilityHidden(true)
|
2023-01-05 11:21:54 +00:00
|
|
|
}
|
|
|
|
}
|
Accessibility tweaks + Notifications and Messages tab uplift (#1292)
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
|
|
|
.contextMenu {
|
|
|
|
contextMenu
|
|
|
|
.accessibilityHidden(true)
|
|
|
|
}
|
|
|
|
.accessibilityElement(children: .combine)
|
|
|
|
.accessibilityActions {
|
|
|
|
replyAction
|
|
|
|
contextMenu
|
|
|
|
accessibilityActions
|
|
|
|
}
|
|
|
|
.accessibilityAction(.magicTap) {
|
|
|
|
if let lastStatus = conversation.lastStatus {
|
2023-11-07 10:22:36 +00:00
|
|
|
HapticManager.shared.fireHaptic(.notification(.success))
|
2024-01-09 12:28:57 +00:00
|
|
|
#if targetEnvironment(macCatalyst) || os(visionOS)
|
2024-01-04 15:52:58 +00:00
|
|
|
openWindow(value: WindowDestinationEditor.replyToStatusEditor(status: lastStatus))
|
|
|
|
#else
|
|
|
|
routerPath.presentedSheet = .replyToStatusEditor(status: lastStatus)
|
|
|
|
#endif
|
Accessibility tweaks + Notifications and Messages tab uplift (#1292)
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
|
|
|
}
|
2023-02-08 05:27:44 +00:00
|
|
|
}
|
2023-01-05 11:21:54 +00:00
|
|
|
}
|
2023-12-19 08:51:20 +00:00
|
|
|
.buttonStyle(.plain)
|
|
|
|
.hoverEffectDisabled()
|
2023-01-05 11:21:54 +00:00
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2023-01-05 11:21:54 +00:00
|
|
|
private var actionsView: some View {
|
|
|
|
HStack(spacing: 12) {
|
|
|
|
Button {
|
2024-01-04 15:52:58 +00:00
|
|
|
if let lastStatus = conversation.lastStatus {
|
|
|
|
HapticManager.shared.fireHaptic(.notification(.success))
|
2024-01-09 12:28:57 +00:00
|
|
|
#if targetEnvironment(macCatalyst) || os(visionOS)
|
2024-01-04 15:52:58 +00:00
|
|
|
openWindow(value: WindowDestinationEditor.replyToStatusEditor(status: lastStatus))
|
|
|
|
#else
|
|
|
|
routerPath.presentedSheet = .replyToStatusEditor(status: lastStatus)
|
|
|
|
#endif
|
|
|
|
}
|
2023-01-05 11:21:54 +00:00
|
|
|
} label: {
|
|
|
|
Image(systemName: "arrowshape.turn.up.left.fill")
|
|
|
|
}
|
|
|
|
Menu {
|
|
|
|
contextMenu
|
|
|
|
} label: {
|
|
|
|
Image(systemName: "ellipsis")
|
|
|
|
.frame(width: 30, height: 30)
|
|
|
|
.contentShape(Rectangle())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.padding(.leading, 48)
|
2023-12-04 14:49:44 +00:00
|
|
|
.foregroundStyle(.secondary)
|
2023-01-05 11:21:54 +00:00
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2023-01-05 11:21:54 +00:00
|
|
|
@ViewBuilder
|
|
|
|
private var contextMenu: some View {
|
Accessibility tweaks + Notifications and Messages tab uplift (#1292)
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
|
|
|
if conversation.unread {
|
|
|
|
Button {
|
|
|
|
Task {
|
|
|
|
await viewModel.markAsRead(conversation: conversation)
|
|
|
|
}
|
|
|
|
} label: {
|
|
|
|
Label("conversations.action.mark-read", systemImage: "eye")
|
2023-01-05 11:21:54 +00:00
|
|
|
}
|
|
|
|
}
|
2023-01-17 10:36:01 +00:00
|
|
|
|
2023-02-26 05:45:57 +00:00
|
|
|
if let message = conversation.lastStatus {
|
|
|
|
Section("conversations.latest.message") {
|
|
|
|
Button {
|
|
|
|
UIPasteboard.general.string = message.content.asRawText
|
|
|
|
} label: {
|
|
|
|
Label("status.action.copy-text", systemImage: "doc.on.doc")
|
|
|
|
}
|
|
|
|
likeAndBookmark
|
|
|
|
}
|
|
|
|
Divider()
|
|
|
|
if message.account.id != currentAccount.account?.id {
|
|
|
|
Section(message.reblog?.account.acct ?? message.account.acct) {
|
|
|
|
Button {
|
|
|
|
routerPath.presentedSheet = .mentionStatusEditor(account: message.reblog?.account ?? message.account, visibility: .pub)
|
|
|
|
} label: {
|
|
|
|
Label("status.action.mention", systemImage: "at")
|
2023-02-26 05:45:31 +00:00
|
|
|
}
|
2023-02-26 05:45:57 +00:00
|
|
|
}
|
|
|
|
Section {
|
|
|
|
Button(role: .destructive) {
|
|
|
|
routerPath.presentedSheet = .report(status: message.reblogAsAsStatus ?? message)
|
|
|
|
} label: {
|
|
|
|
Label("status.action.report", systemImage: "exclamationmark.bubble")
|
2023-02-26 05:45:31 +00:00
|
|
|
}
|
2023-02-26 05:45:57 +00:00
|
|
|
}
|
2023-02-26 05:45:31 +00:00
|
|
|
}
|
2023-02-26 05:45:57 +00:00
|
|
|
}
|
|
|
|
|
2023-01-05 11:21:54 +00:00
|
|
|
Button(role: .destructive) {
|
|
|
|
Task {
|
|
|
|
await viewModel.delete(conversation: conversation)
|
|
|
|
}
|
|
|
|
} label: {
|
2023-01-19 17:14:08 +00:00
|
|
|
Label("conversations.action.delete", systemImage: "trash")
|
2023-01-05 11:21:54 +00:00
|
|
|
}
|
|
|
|
}
|
2023-02-26 05:45:31 +00:00
|
|
|
|
|
|
|
@ViewBuilder
|
|
|
|
private var likeAndBookmark: some View {
|
|
|
|
Button {
|
2023-02-26 05:45:57 +00:00
|
|
|
Task {
|
|
|
|
await viewModel.favorite(conversation: conversation)
|
|
|
|
}
|
2023-02-26 05:45:31 +00:00
|
|
|
} label: {
|
|
|
|
Label(conversation.lastStatus?.favourited ?? false ? "status.action.unfavorite" : "status.action.favorite",
|
2023-02-26 05:45:57 +00:00
|
|
|
systemImage: conversation.lastStatus?.favourited ?? false ? "star.fill" : "star")
|
2023-02-26 05:45:31 +00:00
|
|
|
}
|
|
|
|
Button {
|
2023-02-26 05:45:57 +00:00
|
|
|
Task {
|
|
|
|
await viewModel.bookmark(conversation: conversation)
|
|
|
|
}
|
2023-02-26 05:45:31 +00:00
|
|
|
} label: {
|
2023-02-26 05:45:57 +00:00
|
|
|
Label(conversation.lastStatus?.bookmarked ?? false ? "status.action.unbookmark" : "status.action.bookmark",
|
|
|
|
systemImage: conversation.lastStatus?.bookmarked ?? false ? "bookmark.fill" : "bookmark")
|
2023-02-26 05:45:31 +00:00
|
|
|
}
|
|
|
|
}
|
Accessibility tweaks + Notifications and Messages tab uplift (#1292)
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
|
|
|
|
|
|
|
// MARK: - Accessibility actions
|
|
|
|
|
|
|
|
@ViewBuilder
|
|
|
|
var replyAction: some View {
|
|
|
|
if let lastStatus = conversation.lastStatus {
|
|
|
|
Button("status.action.reply") {
|
2023-11-07 10:22:36 +00:00
|
|
|
HapticManager.shared.fireHaptic(.notification(.success))
|
Accessibility tweaks + Notifications and Messages tab uplift (#1292)
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
|
|
|
routerPath.presentedSheet = .replyToStatusEditor(status: lastStatus)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
EmptyView()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@ViewBuilder
|
|
|
|
private var accessibilityActions: some View {
|
|
|
|
if let lastStatus = conversation.lastStatus {
|
|
|
|
if lastStatus.account.id != currentAccount.account?.id {
|
|
|
|
Button("@\(lastStatus.account.username)") {
|
2023-11-07 10:22:36 +00:00
|
|
|
HapticManager.shared.fireHaptic(.notification(.success))
|
Accessibility tweaks + Notifications and Messages tab uplift (#1292)
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
|
|
|
routerPath.navigate(to: .accountDetail(id: lastStatus.account.id))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Add in each detected link in the content
|
|
|
|
ForEach(lastStatus.content.links) { link in
|
|
|
|
switch link.type {
|
2023-07-19 05:46:25 +00:00
|
|
|
case .url:
|
|
|
|
if UIApplication.shared.canOpenURL(link.url) {
|
|
|
|
Button("accessibility.tabs.timeline.content-link-\(link.title)") {
|
2023-11-07 10:22:36 +00:00
|
|
|
HapticManager.shared.fireHaptic(.notification(.success))
|
Accessibility tweaks + Notifications and Messages tab uplift (#1292)
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
|
|
|
_ = routerPath.handle(url: link.url)
|
|
|
|
}
|
2023-07-19 05:46:25 +00:00
|
|
|
}
|
|
|
|
case .hashtag:
|
|
|
|
Button("accessibility.tabs.timeline.content-hashtag-\(link.title)") {
|
2023-11-07 10:22:36 +00:00
|
|
|
HapticManager.shared.fireHaptic(.notification(.success))
|
2023-07-19 05:46:25 +00:00
|
|
|
_ = routerPath.handle(url: link.url)
|
|
|
|
}
|
|
|
|
case .mention:
|
|
|
|
Button("\(link.title)") {
|
2023-11-07 10:22:36 +00:00
|
|
|
HapticManager.shared.fireHaptic(.notification(.success))
|
2023-07-19 05:46:25 +00:00
|
|
|
_ = routerPath.handle(url: link.url)
|
|
|
|
}
|
Accessibility tweaks + Notifications and Messages tab uplift (#1292)
* Improve StatusRowView accessibility actions
Previously, there was no way to interact with links and hashtags.
Now, these are added to the Actions rotor
* Hide `topPaddingView`s from accessibility
* Fix accessible header rendering in non-filterable TimelineViews
Previously, all navigation title views were assumed to be popup buttons.
Now, we only change the representation for timelines that are filterable.
* Combine tagHeaderView text elements
Previously, these were two separate items
* Prefer shorter Quote action label
* Improve accessibility of StatusEmbeddedView
Previously, this element would be three different ones, and include all the actions on the `StatusRowView` proper. Now, it presents as one element with no actions.
* Add haptics to StatusRowView accessibility actions
* Improve accessibility of ConversationsListRow
This commit adds:
- A combined representation of the component views
- “Unread” as the first part of the label (if this is the case)
- All relevant actions as custom actions
- Reply as magic tap
* Remove StatusRowView accessibilityActions if viewModel.showActions is false
* Hide media attachments from accessibility if the view is not focused
* Combine NotificationRowView accessibility elements; add user actions
Previously, there was no real way to interact with these notifications.
Now, the notifications that show the actions row have the appropriate StatusRowView-derived actions, and new followers notifications have more actions that let you see each user’s profile.
* Prefer @Environment’s `accessibilityEnabled` over `isVoiceOverRunning`
This way we can cater for Voice Control, Full Keyboard Access and Switch Control as well.
---------
Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
2023-03-24 06:52:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-05 11:21:54 +00:00
|
|
|
}
|