Fix status menu on Catalyst

This commit is contained in:
Thomas Ricouard 2024-01-23 06:55:12 +01:00
parent d2014d3aec
commit ba071eb4c8
1 changed files with 55 additions and 37 deletions

View File

@ -228,14 +228,43 @@ struct StatusRowContextMenu: View {
Label("account.action.mute", systemImage: "speaker.slash") Label("account.action.mute", systemImage: "speaker.slash")
} }
} }
#if targetEnvironment(macCatalyst)
accountContactMenuItems
#else
ControlGroup { ControlGroup {
accountContactMenuItems
}
#endif
}
}
Section {
Button(role: .destructive) {
viewModel.routerPath.presentedSheet = .report(status: viewModel.status.reblogAsAsStatus ?? viewModel.status)
} label: {
Label("status.action.report", systemImage: "exclamationmark.bubble")
}
}
}
}
@ViewBuilder
private var accountContactMenuItems: some View {
Button { Button {
#if targetEnvironment(macCatalyst) || os(visionOS)
openWindow(value: WindowDestinationEditor.mentionStatusEditor(account: viewModel.status.reblog?.account ?? viewModel.status.account, visibility: .pub))
#else
viewModel.routerPath.presentedSheet = .mentionStatusEditor(account: viewModel.status.reblog?.account ?? viewModel.status.account, visibility: .pub) viewModel.routerPath.presentedSheet = .mentionStatusEditor(account: viewModel.status.reblog?.account ?? viewModel.status.account, visibility: .pub)
#endif
} label: { } label: {
Label("status.action.mention", systemImage: "at") Label("status.action.mention", systemImage: "at")
} }
Button { Button {
#if targetEnvironment(macCatalyst) || os(visionOS)
openWindow(value: WindowDestinationEditor.mentionStatusEditor(account: viewModel.status.reblog?.account ?? viewModel.status.account, visibility: .direct))
#else
viewModel.routerPath.presentedSheet = .mentionStatusEditor(account: viewModel.status.reblog?.account ?? viewModel.status.account, visibility: .direct) viewModel.routerPath.presentedSheet = .mentionStatusEditor(account: viewModel.status.reblog?.account ?? viewModel.status.account, visibility: .direct)
#endif
} label: { } label: {
Label("status.action.message", systemImage: "tray.full") Label("status.action.message", systemImage: "tray.full")
} }
@ -267,17 +296,6 @@ struct StatusRowContextMenu: View {
} }
} }
} }
}
}
Section {
Button(role: .destructive) {
viewModel.routerPath.presentedSheet = .report(status: viewModel.status.reblogAsAsStatus ?? viewModel.status)
} label: {
Label("status.action.report", systemImage: "exclamationmark.bubble")
}
}
}
}
} }
struct ActivityView: UIViewControllerRepresentable { struct ActivityView: UIViewControllerRepresentable {