Catalyst: Fix mention window

This commit is contained in:
Thomas Ricouard 2024-01-03 13:40:53 +01:00
parent 75a61cb534
commit ad4995ad70
3 changed files with 11 additions and 2 deletions

View file

@ -76,6 +76,8 @@ extension IceCubesApp {
StatusEditorView(mode: .quote(status: status)) StatusEditorView(mode: .quote(status: status))
case let .replyToStatusEditor(status): case let .replyToStatusEditor(status):
StatusEditorView(mode: .replyTo(status: status)) StatusEditorView(mode: .replyTo(status: status))
case let .mentionStatusEditor(account, visibility):
StatusEditorView(mode: .mention(account: account, visibility: visibility))
case .none: case .none:
EmptyView() EmptyView()
} }

View file

@ -11,6 +11,7 @@ import SwiftUI
public struct AccountDetailView: View { public struct AccountDetailView: View {
@Environment(\.openURL) private var openURL @Environment(\.openURL) private var openURL
@Environment(\.redactionReasons) private var reasons @Environment(\.redactionReasons) private var reasons
@Environment(\.openWindow) private var openWindow
@Environment(StreamWatcher.self) private var watcher @Environment(StreamWatcher.self) private var watcher
@Environment(CurrentAccount.self) private var currentAccount @Environment(CurrentAccount.self) private var currentAccount
@ -329,8 +330,13 @@ public struct AccountDetailView: View {
if !viewModel.isCurrentUser { if !viewModel.isCurrentUser {
Button { Button {
if let account = viewModel.account { if let account = viewModel.account {
routerPath.presentedSheet = .mentionStatusEditor(account: account, #if targetEnvironment(macCatalyst)
visibility: preferences.postVisibility) openWindow(value: WindowDestinationEditor.mentionStatusEditor(account: account, visibility: preferences.postVisibility))
#else
routerPath.presentedSheet = .mentionStatusEditor(account: account,
visibility: preferences.postVisibility)
#endif
} }
} label: { } label: {
Image(systemName: "arrowshape.turn.up.left") Image(systemName: "arrowshape.turn.up.left")

View file

@ -30,6 +30,7 @@ public enum WindowDestinationEditor: Hashable, Codable {
case editStatusEditor(status: Status) case editStatusEditor(status: Status)
case replyToStatusEditor(status: Status) case replyToStatusEditor(status: Status)
case quoteStatusEditor(status: Status) case quoteStatusEditor(status: Status)
case mentionStatusEditor(account: Account, visibility: Models.Visibility)
} }
public enum WindowDestinationMedia: Hashable, Codable { public enum WindowDestinationMedia: Hashable, Codable {