mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
call button from contacts
This commit is contained in:
@@ -43,6 +43,11 @@ private func addTermItem(_ items: inout [TerminalItem], _ item: TerminalItem) {
|
||||
items.append(item)
|
||||
}
|
||||
|
||||
enum OpenChatAction {
|
||||
case message
|
||||
case call(media: CallMediaType)
|
||||
}
|
||||
|
||||
final class ChatModel: ObservableObject {
|
||||
@Published var onboardingStage: OnboardingStage?
|
||||
@Published var setDeliveryReceipts = false
|
||||
@@ -64,6 +69,7 @@ final class ChatModel: ObservableObject {
|
||||
// map of connections network statuses, key is agent connection id
|
||||
@Published var networkStatuses: Dictionary<String, NetworkStatus> = [:]
|
||||
// current chat
|
||||
@Published var openChatAction: OpenChatAction?
|
||||
@Published var chatId: String?
|
||||
@Published var reversedChatItems: [ChatItem] = []
|
||||
var chatItemStatuses: Dictionary<Int64, CIStatus> = [:]
|
||||
|
||||
@@ -420,9 +420,9 @@ struct ChatInfoView: View {
|
||||
dismiss()
|
||||
makeCall = .audio
|
||||
} else {
|
||||
chatModel.openChatAction = .call(media: .audio)
|
||||
chatModel.chatId = chat.id
|
||||
}
|
||||
// CallController.shared.startCall(contact, .audio)
|
||||
} label: {
|
||||
actionButton("phone.fill", "call")
|
||||
}
|
||||
@@ -435,9 +435,9 @@ struct ChatInfoView: View {
|
||||
dismiss()
|
||||
makeCall = .video
|
||||
} else {
|
||||
chatModel.openChatAction = .call(media: .video)
|
||||
chatModel.chatId = chat.id
|
||||
}
|
||||
// CallController.shared.startCall(contact, .video)
|
||||
} label: {
|
||||
actionButton("video.fill", "video")
|
||||
}
|
||||
|
||||
@@ -257,6 +257,12 @@ struct ChatView: View {
|
||||
await markChatUnread(chat, unreadChat: false)
|
||||
}
|
||||
}
|
||||
switch chatModel.openChatAction {
|
||||
case .some(.message): ()
|
||||
case let .some(.call(media)): makeCall = media
|
||||
case .none: ()
|
||||
}
|
||||
chatModel.openChatAction = nil
|
||||
}
|
||||
|
||||
private func searchToolbar() -> some View {
|
||||
|
||||
Reference in New Issue
Block a user