Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions MC1/Views/Contacts/ContactContextMenuModifier.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import MC1Services
import SwiftUI

/// Long-press context-menu actions for a node row: delete, block/unblock, favorite/unfavorite,
/// matching the conversation list. Delete is gated while a removal is in flight so a rapid re-press
/// can't double-fire.
/// Long-press context-menu actions for a node row: send message (chat contacts only), delete,
/// block/unblock, favorite/unfavorite, matching the conversation list. Delete is gated while a
/// removal is in flight so a rapid re-press can't double-fire.
struct ContactContextMenuModifier: ViewModifier {
@Environment(\.appState) private var appState

Expand All @@ -22,6 +22,15 @@ struct ContactContextMenuModifier: ViewModifier {

func body(content: Content) -> some View {
content.contextMenu {
if contact.type == .chat, !contact.isBlocked {
Button {
appState.navigation.navigateToChat(with: contact)
} label: {
Label(L10n.Contacts.Contacts.Detail.sendMessage, systemImage: "message.fill")
}
.disabled(!isConnected)
}

if !isVContact {
Button(role: .destructive) {
Task {
Expand Down