Add Menu in chatroom

This commit is contained in:
Benoit Martins 2024-10-24 17:55:11 +02:00
parent ed619e58e1
commit 73ea3362b0
3 changed files with 86 additions and 9 deletions

View file

@ -928,6 +928,40 @@
}
}
},
"conversation_action_mute" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Mute"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Mettre en sourdine"
}
}
}
},
"conversation_action_unmute" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Un-mute"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Enlever la sourdine"
}
}
}
},
"conversation_composing_label_multiple" : {
"extractionState" : "manual",
"localizations" : {
@ -1303,6 +1337,40 @@
}
}
},
"conversation_menu_configure_ephemeral_messages" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Ephemeral messages"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Messages éphémères"
}
}
}
},
"conversation_menu_go_to_info" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Conversation info"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "Informations"
}
}
}
},
"conversation_message_forward_cancelled_toast" : {
"extractionState" : "manual",
"localizations" : {

View file

@ -223,10 +223,12 @@ struct ConversationFragment: View {
isMenuOpen = false
} label: {
HStack {
Text("See contact")
Text("conversation_menu_go_to_info")
Spacer()
Image("user-circle")
Image("info")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.grayMain2c500)
.frame(width: 25, height: 25, alignment: .leading)
.padding(.all, 10)
}
@ -236,23 +238,27 @@ struct ConversationFragment: View {
isMenuOpen = false
} label: {
HStack {
Text("Copy SIP address")
Text(conversationViewModel.displayedConversation!.isMuted ? "conversation_action_unmute" : "conversation_action_mute")
Spacer()
Image("copy")
Image(conversationViewModel.displayedConversation!.isMuted ? "bell-simple" : "bell-simple-slash")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.grayMain2c500)
.frame(width: 25, height: 25, alignment: .leading)
.padding(.all, 10)
}
}
Button(role: .destructive) {
Button {
isMenuOpen = false
} label: {
HStack {
Text("Delete history")
Text("conversation_menu_configure_ephemeral_messages")
Spacer()
Image("trash-simple-red")
Image("clock-countdown")
.renderingMode(.template)
.resizable()
.foregroundStyle(Color.grayMain2c500)
.frame(width: 25, height: 25, alignment: .leading)
.padding(.all, 10)
}

View file

@ -22,7 +22,7 @@ import linphonesw
import Combine
// swiftlint:disable line_length
class ConversationModel: ObservableObject {
class ConversationModel: ObservableObject, Identifiable {
private var coreContext = CoreContext.shared
private var contactsManager = ContactsManager.shared
@ -101,8 +101,11 @@ class ConversationModel: ObservableObject {
func toggleMute() {
coreContext.doOnCoreQueue { _ in
let chatRoomMuted = self.chatRoom.muted
self.chatRoom.muted.toggle()
self.isMuted = self.chatRoom.muted
DispatchQueue.main.async {
self.isMuted = !chatRoomMuted
}
}
}