New status row context menu
This commit is contained in:
parent
9a8568d3fa
commit
46b8fbde29
|
@ -37,6 +37,16 @@ struct StatusRowContextMenu: View {
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
if !viewModel.isRemote {
|
if !viewModel.isRemote {
|
||||||
|
ControlGroup {
|
||||||
|
Button {
|
||||||
|
#if targetEnvironment(macCatalyst) || os(visionOS)
|
||||||
|
openWindow(value: WindowDestinationEditor.replyToStatusEditor(status: viewModel.status))
|
||||||
|
#else
|
||||||
|
viewModel.routerPath.presentedSheet = .replyToStatusEditor(status: viewModel.status)
|
||||||
|
#endif
|
||||||
|
} label: {
|
||||||
|
Label("status.action.reply", systemImage: "arrowshape.turn.up.left")
|
||||||
|
}
|
||||||
Button { Task {
|
Button { Task {
|
||||||
HapticManager.shared.fireHaptic(.notification(.success))
|
HapticManager.shared.fireHaptic(.notification(.success))
|
||||||
SoundEffectManager.shared.playSound(.favorite)
|
SoundEffectManager.shared.playSound(.favorite)
|
||||||
|
@ -60,15 +70,8 @@ struct StatusRowContextMenu: View {
|
||||||
Label(statusDataController.isBookmarked ? "status.action.unbookmark" : "status.action.bookmark",
|
Label(statusDataController.isBookmarked ? "status.action.unbookmark" : "status.action.bookmark",
|
||||||
systemImage: statusDataController.isBookmarked ? "bookmark.fill" : "bookmark")
|
systemImage: statusDataController.isBookmarked ? "bookmark.fill" : "bookmark")
|
||||||
}
|
}
|
||||||
Button {
|
|
||||||
#if targetEnvironment(macCatalyst) || os(visionOS)
|
|
||||||
openWindow(value: WindowDestinationEditor.replyToStatusEditor(status: viewModel.status))
|
|
||||||
#else
|
|
||||||
viewModel.routerPath.presentedSheet = .replyToStatusEditor(status: viewModel.status)
|
|
||||||
#endif
|
|
||||||
} label: {
|
|
||||||
Label("status.action.reply", systemImage: "arrowshape.turn.up.left")
|
|
||||||
}
|
}
|
||||||
|
.controlGroupStyle(.compactMenu)
|
||||||
Button {
|
Button {
|
||||||
#if targetEnvironment(macCatalyst) || os(visionOS)
|
#if targetEnvironment(macCatalyst) || os(visionOS)
|
||||||
openWindow(value: WindowDestinationEditor.quoteStatusEditor(status: viewModel.status))
|
openWindow(value: WindowDestinationEditor.quoteStatusEditor(status: viewModel.status))
|
||||||
|
@ -194,45 +197,6 @@ struct StatusRowContextMenu: View {
|
||||||
} else {
|
} else {
|
||||||
if !viewModel.isRemote {
|
if !viewModel.isRemote {
|
||||||
Section(viewModel.status.reblog?.account.acct ?? viewModel.status.account.acct) {
|
Section(viewModel.status.reblog?.account.acct ?? viewModel.status.account.acct) {
|
||||||
Button {
|
|
||||||
viewModel.routerPath.presentedSheet = .mentionStatusEditor(account: viewModel.status.reblog?.account ?? viewModel.status.account, visibility: .pub)
|
|
||||||
} label: {
|
|
||||||
Label("status.action.mention", systemImage: "at")
|
|
||||||
}
|
|
||||||
Button {
|
|
||||||
viewModel.routerPath.presentedSheet = .mentionStatusEditor(account: viewModel.status.reblog?.account ?? viewModel.status.account, visibility: .direct)
|
|
||||||
} label: {
|
|
||||||
Label("status.action.message", systemImage: "tray.full")
|
|
||||||
}
|
|
||||||
|
|
||||||
if viewModel.authorRelationship?.blocking == true {
|
|
||||||
Button {
|
|
||||||
Task {
|
|
||||||
do {
|
|
||||||
let operationAccount = viewModel.status.reblog?.account ?? viewModel.status.account
|
|
||||||
viewModel.authorRelationship = try await client.post(endpoint: Accounts.unblock(id: operationAccount.id))
|
|
||||||
} catch {
|
|
||||||
print("Error while unblocking: \(error.localizedDescription)")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} label: {
|
|
||||||
Label("account.action.unblock", systemImage: "person.crop.circle.badge.exclamationmark")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Button {
|
|
||||||
Task {
|
|
||||||
do {
|
|
||||||
let operationAccount = viewModel.status.reblog?.account ?? viewModel.status.account
|
|
||||||
viewModel.authorRelationship = try await client.post(endpoint: Accounts.block(id: operationAccount.id))
|
|
||||||
} catch {
|
|
||||||
print("Error while blocking: \(error.localizedDescription)")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} label: {
|
|
||||||
Label("account.action.block", systemImage: "person.crop.circle.badge.xmark")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if viewModel.authorRelationship?.muting == true {
|
if viewModel.authorRelationship?.muting == true {
|
||||||
Button {
|
Button {
|
||||||
Task {
|
Task {
|
||||||
|
@ -264,6 +228,45 @@ struct StatusRowContextMenu: View {
|
||||||
Label("account.action.mute", systemImage: "speaker.slash")
|
Label("account.action.mute", systemImage: "speaker.slash")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ControlGroup {
|
||||||
|
Button {
|
||||||
|
viewModel.routerPath.presentedSheet = .mentionStatusEditor(account: viewModel.status.reblog?.account ?? viewModel.status.account, visibility: .pub)
|
||||||
|
} label: {
|
||||||
|
Label("status.action.mention", systemImage: "at")
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
viewModel.routerPath.presentedSheet = .mentionStatusEditor(account: viewModel.status.reblog?.account ?? viewModel.status.account, visibility: .direct)
|
||||||
|
} label: {
|
||||||
|
Label("status.action.message", systemImage: "tray.full")
|
||||||
|
}
|
||||||
|
if viewModel.authorRelationship?.blocking == true {
|
||||||
|
Button {
|
||||||
|
Task {
|
||||||
|
do {
|
||||||
|
let operationAccount = viewModel.status.reblog?.account ?? viewModel.status.account
|
||||||
|
viewModel.authorRelationship = try await client.post(endpoint: Accounts.unblock(id: operationAccount.id))
|
||||||
|
} catch {
|
||||||
|
print("Error while unblocking: \(error.localizedDescription)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Label("account.action.unblock", systemImage: "person.crop.circle.badge.exclamationmark")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Button {
|
||||||
|
Task {
|
||||||
|
do {
|
||||||
|
let operationAccount = viewModel.status.reblog?.account ?? viewModel.status.account
|
||||||
|
viewModel.authorRelationship = try await client.post(endpoint: Accounts.block(id: operationAccount.id))
|
||||||
|
} catch {
|
||||||
|
print("Error while blocking: \(error.localizedDescription)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Label("account.action.block", systemImage: "person.crop.circle.badge.xmark")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Section {
|
Section {
|
||||||
|
|
Loading…
Reference in New Issue