mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-04-17 11:48:27 +00:00
Add chat room popups
This commit is contained in:
parent
e6b1b632d4
commit
3ecd79fc77
5 changed files with 151 additions and 5 deletions
|
|
@ -268,6 +268,24 @@
|
|||
"conversation_info_participant_is_admin_label" = "Admin";
|
||||
"conversation_info_participants_list_title" = "Group members (%d)";
|
||||
"conversation_invalid_participant_due_to_security_mode_toast" = "Can't create conversation with a participant not on the same domain due to security restrictions!";
|
||||
|
||||
|
||||
"conversation_info_dialog_delete_all_call_logs_title" = "Do you really want to delete all messages?";
|
||||
"conversation_info_dialog_delete_all_message" = "All messages will be removed from the history";
|
||||
"conversation_info_delete_history_confirm" = "Delete";
|
||||
"conversation_info_history_deleted_toast" = "History has been successfully deleted";
|
||||
|
||||
"conversation_info_dialog_leave_chatroom_title" = "Leave this conversation?";
|
||||
"conversation_info_dialog_leave_chatroom_message" = "You will leave this conversation. You can be added again later.";
|
||||
"conversation_info_leave_chatroom_confirm" = "Leave";
|
||||
"conversation_info_left_chatroom_toast" = "You have left the conversation";
|
||||
|
||||
"conversation_info_dialog_delete_chatroom_title" = "Delete this conversation?";
|
||||
"conversation_info_dialog_delete_chatroom_message" = "This conversation will be permanently deleted for all participants.";
|
||||
"conversation_info_delete_chatroom_confirm" = "Delete";
|
||||
"conversation_info_chatroom_deleted_toast" = "Conversation deleted";
|
||||
|
||||
|
||||
"conversation_menu_search_in_messages" = "Search";
|
||||
"conversation_menu_go_to_info" = "Conversation info";
|
||||
"conversation_menu_configure_ephemeral_messages" = "Ephemeral messages";
|
||||
|
|
|
|||
|
|
@ -265,6 +265,24 @@
|
|||
"conversation_info_participant_is_admin_label" = "Administrateur";
|
||||
"conversation_info_participants_list_title" = "Participants (%d)";
|
||||
"conversation_invalid_participant_due_to_security_mode_toast" = "Pour des raisons de sécurité, la création d'une conversation avec un participant d'un domaine tiers est désactivé.";
|
||||
|
||||
|
||||
"conversation_info_dialog_delete_all_call_logs_title" = "Supprimer l'historique ?";
|
||||
"conversation_info_dialog_delete_all_message" = "Tous les messages de cette conversation seront supprimés.";
|
||||
"conversation_info_delete_history_confirm" = "Supprimer";
|
||||
"conversation_info_history_deleted_toast" = "Historique supprimé";
|
||||
|
||||
"conversation_info_dialog_leave_chatroom_title" = "Quitter la conversation ?";
|
||||
"conversation_info_dialog_leave_chatroom_message" = "Vous allez quitter cette conversation. Vous pourrez y être ajouté à nouveau plus tard.";
|
||||
"conversation_info_leave_chatroom_confirm" = "Quitter";
|
||||
"conversation_info_left_chatroom_toast" = "Vous avez quitté la conversation";
|
||||
|
||||
"conversation_info_dialog_delete_chatroom_title" = "Supprimer la conversation ?";
|
||||
"conversation_info_dialog_delete_chatroom_message" = "Cette conversation sera définitivement supprimée pour tous les participants.";
|
||||
"conversation_info_delete_chatroom_confirm" = "Supprimer";
|
||||
"conversation_info_chatroom_deleted_toast" = "Conversation supprimée";
|
||||
|
||||
|
||||
"conversation_menu_search_in_messages" = "Chercher";
|
||||
"conversation_menu_go_to_info" = "Informations";
|
||||
"conversation_menu_configure_ephemeral_messages" = "Messages éphémères";
|
||||
|
|
|
|||
|
|
@ -91,6 +91,10 @@ struct ContentView: View {
|
|||
@State var isShowUpdatePasswordPopup: Bool = false
|
||||
@State var passwordUpdateAddress: String = ""
|
||||
|
||||
@State var showLeaveConversationPopup: Bool = false
|
||||
@State var showDeleteConversationPopup: Bool = false
|
||||
@State var showDeleteConversationHistoryPopup: Bool = false
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { geometry in
|
||||
VStack(spacing: 0) {
|
||||
|
|
@ -1337,6 +1341,7 @@ struct ContentView: View {
|
|||
if let historyListVM = historyListViewModel {
|
||||
historyListVM.removeCallLogs()
|
||||
}
|
||||
|
||||
self.isShowDeleteAllHistoryPopup.toggle()
|
||||
sharedMainViewModel.displayedCall = nil
|
||||
|
||||
|
|
@ -1357,6 +1362,90 @@ struct ContentView: View {
|
|||
}
|
||||
}
|
||||
|
||||
if showLeaveConversationPopup {
|
||||
PopupView(
|
||||
isShowPopup: $isShowDeleteContactPopup,
|
||||
title: Text("conversation_info_dialog_leave_chatroom_title"),
|
||||
content: Text("conversation_info_dialog_leave_chatroom_message"),
|
||||
titleFirstButton: nil,
|
||||
actionFirstButton: {},
|
||||
titleSecondButton: Text("conversation_info_leave_chatroom_confirm"),
|
||||
actionSecondButton: {
|
||||
if let conversationsListVM = conversationsListViewModel, let targetConversation = conversationsListVM.targetConversation {
|
||||
targetConversation.deleteHistory()
|
||||
}
|
||||
self.isShowDeleteAllHistoryPopup.toggle()
|
||||
},
|
||||
titleThirdButton: Text("dialog_cancel"),
|
||||
actionThirdButton: {
|
||||
self.showLeaveConversationPopup.toggle()
|
||||
}
|
||||
)
|
||||
.background(.black.opacity(0.65))
|
||||
.zIndex(3)
|
||||
.onTapGesture {
|
||||
self.showLeaveConversationPopup.toggle()
|
||||
}
|
||||
}
|
||||
|
||||
if showDeleteConversationPopup {
|
||||
PopupView(
|
||||
isShowPopup: $isShowDeleteContactPopup,
|
||||
title: Text("conversation_info_dialog_delete_chatroom_title"),
|
||||
content: Text("conversation_info_dialog_delete_chatroom_message"),
|
||||
titleFirstButton: nil,
|
||||
actionFirstButton: {},
|
||||
titleSecondButton: Text("conversation_info_delete_chatroom_confirm"),
|
||||
actionSecondButton: {
|
||||
if let historyListVM = historyListViewModel {
|
||||
historyListVM.removeCallLogs()
|
||||
}
|
||||
self.isShowDeleteAllHistoryPopup.toggle()
|
||||
sharedMainViewModel.displayedCall = nil
|
||||
|
||||
ToastViewModel.shared.show("Success_remove_call_logs")
|
||||
},
|
||||
titleThirdButton: Text("dialog_cancel"),
|
||||
actionThirdButton: {
|
||||
self.showDeleteConversationPopup.toggle()
|
||||
}
|
||||
)
|
||||
.background(.black.opacity(0.65))
|
||||
.zIndex(3)
|
||||
.onTapGesture {
|
||||
self.showDeleteConversationPopup.toggle()
|
||||
}
|
||||
}
|
||||
|
||||
if showDeleteConversationHistoryPopup {
|
||||
PopupView(
|
||||
isShowPopup: $isShowDeleteContactPopup,
|
||||
title: Text("conversation_info_dialog_delete_all_call_logs_title"),
|
||||
content: Text("conversation_info_dialog_delete_all_message"),
|
||||
titleFirstButton: nil,
|
||||
actionFirstButton: {},
|
||||
titleSecondButton: Text("conversation_info_delete_history_confirm"),
|
||||
actionSecondButton: {
|
||||
if let historyListVM = historyListViewModel {
|
||||
historyListVM.removeCallLogs()
|
||||
}
|
||||
self.isShowDeleteAllHistoryPopup.toggle()
|
||||
sharedMainViewModel.displayedCall = nil
|
||||
|
||||
ToastViewModel.shared.show("Success_remove_call_logs")
|
||||
},
|
||||
titleThirdButton: Text("dialog_cancel"),
|
||||
actionThirdButton: {
|
||||
self.showDeleteConversationHistoryPopup.toggle()
|
||||
}
|
||||
)
|
||||
.background(.black.opacity(0.65))
|
||||
.zIndex(3)
|
||||
.onTapGesture {
|
||||
self.showDeleteConversationHistoryPopup.toggle()
|
||||
}
|
||||
}
|
||||
|
||||
if isShowDismissPopup {
|
||||
PopupView(
|
||||
isShowPopup: $isShowDismissPopup,
|
||||
|
|
|
|||
|
|
@ -414,15 +414,35 @@ class ConversationModel: ObservableObject, Identifiable {
|
|||
|
||||
func deleteChatRoom() {
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
Log.info("\(ConversationModel.TAG) Deleting conversation \(LinphoneUtils.getConversationId(chatRoom: self.chatRoom))")
|
||||
core.deleteChatRoom(chatRoom: self.chatRoom)
|
||||
}
|
||||
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.show("Success_remove_call_logs")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
func deleteHistory() {
|
||||
CoreContext.shared.doOnCoreQueue { core in
|
||||
Log.info("\(ConversationModel.TAG) Cleaning conversation \(LinphoneUtils.getConversationId(chatRoom: self.chatRoom)) history")
|
||||
CoreContext.shared.doOnCoreQueue { _ in
|
||||
Log.info("\(ConversationModel.TAG) Deleting history for conversation \(LinphoneUtils.getConversationId(chatRoom: self.chatRoom))")
|
||||
self.chatRoom.deleteHistory()
|
||||
|
||||
DispatchQueue.main.async {
|
||||
ToastViewModel.shared.show("Success_remove_call_logs")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func leaveChatRoom() {
|
||||
CoreContext.shared.doOnCoreQueue { _ in
|
||||
Log.info("\(ConversationModel.TAG) Leaving conversation \(LinphoneUtils.getConversationId(chatRoom: self.chatRoom))")
|
||||
self.chatRoom.leave()
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.isReadOnly = true
|
||||
ToastViewModel.shared.show("Success_remove_call_logs")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class ConversationsListViewModel: ObservableObject {
|
|||
@Published var displayedConversation: ConversationModel?
|
||||
@Published var conversationsList: [ConversationModel] = []
|
||||
|
||||
var targetConversation: ConversationModel?
|
||||
var selectedConversation: ConversationModel?
|
||||
|
||||
private var chatRoomDelegate: ChatRoomDelegate?
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue