Fix quote button not showing for unlisted posts (#1537)

This commit is contained in:
Chanhwi Joo 2023-08-10 15:58:43 +09:00 committed by GitHub
parent 5da1128a4d
commit 5fb9ab1c5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View file

@ -11,7 +11,7 @@ public struct StatusRowView: View {
@Environment(\.isInCaptureMode) private var isInCaptureMode: Bool
@Environment(\.redactionReasons) private var reasons
@Environment(\.isCompact) private var isCompact: Bool
@Environment(\.accessibilityEnabled) private var accessibilityEnabled
@Environment(\.accessibilityVoiceOverEnabled) private var accessibilityVoiceOverEnabled
@EnvironmentObject private var quickLook: QuickLook
@EnvironmentObject private var theme: Theme
@ -107,13 +107,13 @@ public struct StatusRowView: View {
}
.swipeActions(edge: .trailing) {
// The actions associated with the swipes are exposed as custom accessibility actions and there is no way to remove them.
if !isCompact, accessibilityEnabled == false {
if !isCompact, accessibilityVoiceOverEnabled == false {
StatusRowSwipeView(viewModel: viewModel, mode: .trailing)
}
}
.swipeActions(edge: .leading) {
// The actions associated with the swipes are exposed as custom accessibility actions and there is no way to remove them.
if !isCompact, accessibilityEnabled == false {
if !isCompact, accessibilityVoiceOverEnabled == false {
StatusRowSwipeView(viewModel: viewModel, mode: .leading)
}
}
@ -123,7 +123,7 @@ public struct StatusRowView: View {
bottom: 12,
trailing: .layoutPadding))
.accessibilityElement(children: viewModel.isFocused ? .contain : .combine)
.accessibilityLabel(viewModel.isFocused == false && accessibilityEnabled
.accessibilityLabel(viewModel.isFocused == false && accessibilityVoiceOverEnabled
? CombinedAccessibilityLabel(viewModel: viewModel).finalLabel() : Text(""))
.accessibilityHidden(viewModel.filter?.filter.filterAction == .hide)
.accessibilityAction {
@ -181,6 +181,7 @@ public struct StatusRowView: View {
HapticManager.shared.fireHaptic(of: .notification(.success))
viewModel.routerPath.presentedSheet = .quoteStatusEditor(status: viewModel.status)
}
.disabled(viewModel.status.visibility == .direct || viewModel.status.visibility == .priv)
if viewModel.finalStatus.mediaAttachments.isEmpty == false {
Button("accessibility.status.media-viewer-action.label") {

View file

@ -54,14 +54,12 @@ struct StatusRowContextMenu: View {
} label: {
Label("status.action.reply", systemImage: "arrowshape.turn.up.left")
}
}
if viewModel.status.visibility == .pub, !viewModel.isRemote {
Button {
viewModel.routerPath.presentedSheet = .quoteStatusEditor(status: viewModel.status)
} label: {
Label("status.action.quote", systemImage: "quote.bubble")
}
.disabled(viewModel.status.visibility == .direct || viewModel.status.visibility == .priv)
}
Divider()

View file

@ -60,6 +60,7 @@ struct StatusRowSwipeView: View {
makeSwipeButtonForRouterPath(action: action, destination: .replyToStatusEditor(status: viewModel.status))
case .quote:
makeSwipeButtonForRouterPath(action: action, destination: .quoteStatusEditor(status: viewModel.status))
.disabled(viewModel.status.visibility == .direct || viewModel.status.visibility == .priv)
case .favorite:
makeSwipeButtonForTask(action: action) {
await statusDataController.toggleFavorite(remoteStatus: nil)