From 9ec9c94c9ab9b1f49de011d54b20225b7e4d3b54 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Thu, 4 Jan 2024 16:52:58 +0100 Subject: [PATCH] DM reply now open on a window on macOS --- .../List/ConversationsListRow.swift | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Packages/Conversations/Sources/Conversations/List/ConversationsListRow.swift b/Packages/Conversations/Sources/Conversations/List/ConversationsListRow.swift index 56927da8..a1a14ba3 100644 --- a/Packages/Conversations/Sources/Conversations/List/ConversationsListRow.swift +++ b/Packages/Conversations/Sources/Conversations/List/ConversationsListRow.swift @@ -6,6 +6,8 @@ import SwiftUI @MainActor struct ConversationsListRow: View { + @Environment(\.openWindow) private var openWindow + @Environment(Client.self) private var client @Environment(RouterPath.self) private var routerPath @Environment(Theme.self) private var theme @@ -81,7 +83,11 @@ struct ConversationsListRow: View { .accessibilityAction(.magicTap) { if let lastStatus = conversation.lastStatus { 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 { HStack(spacing: 12) { 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: { Image(systemName: "arrowshape.turn.up.left.fill") }