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

View file

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

View file

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