DM reply now open on a window on macOS

This commit is contained in:
Thomas Ricouard 2024-01-04 16:52:58 +01:00
parent 60ade66251
commit 9ec9c94c9a

View file

@ -6,6 +6,8 @@ import SwiftUI
@MainActor @MainActor
struct ConversationsListRow: View { struct ConversationsListRow: View {
@Environment(\.openWindow) private var openWindow
@Environment(Client.self) private var client @Environment(Client.self) private var client
@Environment(RouterPath.self) private var routerPath @Environment(RouterPath.self) private var routerPath
@Environment(Theme.self) private var theme @Environment(Theme.self) private var theme
@ -81,7 +83,11 @@ struct ConversationsListRow: View {
.accessibilityAction(.magicTap) { .accessibilityAction(.magicTap) {
if let lastStatus = conversation.lastStatus { if let lastStatus = conversation.lastStatus {
HapticManager.shared.fireHaptic(.notification(.success)) HapticManager.shared.fireHaptic(.notification(.success))
routerPath.presentedSheet = .replyToStatusEditor(status: lastStatus) #if targetEnvironment(macCatalyst)
openWindow(value: WindowDestinationEditor.replyToStatusEditor(status: lastStatus))
#else
routerPath.presentedSheet = .replyToStatusEditor(status: lastStatus)
#endif
} }
} }
} }
@ -92,7 +98,14 @@ struct ConversationsListRow: View {
private var actionsView: some View { private var actionsView: some View {
HStack(spacing: 12) { HStack(spacing: 12) {
Button { Button {
routerPath.presentedSheet = .replyToStatusEditor(status: conversation.lastStatus!) if let lastStatus = conversation.lastStatus {
HapticManager.shared.fireHaptic(.notification(.success))
#if targetEnvironment(macCatalyst)
openWindow(value: WindowDestinationEditor.replyToStatusEditor(status: lastStatus))
#else
routerPath.presentedSheet = .replyToStatusEditor(status: lastStatus)
#endif
}
} label: { } label: {
Image(systemName: "arrowshape.turn.up.left.fill") Image(systemName: "arrowshape.turn.up.left.fill")
} }