diff --git a/Linphone/GeneratedGit.swift b/Linphone/GeneratedGit.swift index 075feeece..3c6ae57f7 100644 --- a/Linphone/GeneratedGit.swift +++ b/Linphone/GeneratedGit.swift @@ -2,6 +2,6 @@ import Foundation public enum AppGitInfo { public static let branch = "master" - public static let commit = "1fff8d6d3" + public static let commit = "23f521113" public static let tag = "6.1.0-alpha" } diff --git a/Linphone/UI/Main/Conversations/Fragments/ConversationFragment.swift b/Linphone/UI/Main/Conversations/Fragments/ConversationFragment.swift index d2b94af5e..8d6995842 100644 --- a/Linphone/UI/Main/Conversations/Fragments/ConversationFragment.swift +++ b/Linphone/UI/Main/Conversations/Fragments/ConversationFragment.swift @@ -458,41 +458,41 @@ struct ConversationFragment: View { .padding(.all, 10) } } - - Button { - isMenuOpen = false - withAnimation { - isShowMediaFilesFragment = true - } - } label: { - HStack { - Text("conversation_menu_media_files") - Spacer() - Image("image") - .renderingMode(.template) - .resizable() - .foregroundStyle(Color.grayMain2c500) - .frame(width: 25, height: 25, alignment: .leading) - .padding(.all, 10) - } + } + + Button { + isMenuOpen = false + withAnimation { + isShowMediaFilesFragment = true } - - Button { - isMenuOpen = false - withAnimation { - isShowDocumentsFilesFragment = true - } - } label: { - HStack { - Text("conversation_menu_documents_files") - Spacer() - Image("file-pdf") - .renderingMode(.template) - .resizable() - .foregroundStyle(Color.grayMain2c500) - .frame(width: 25, height: 25, alignment: .leading) - .padding(.all, 10) - } + } label: { + HStack { + Text("conversation_menu_media_files") + Spacer() + Image("image") + .renderingMode(.template) + .resizable() + .foregroundStyle(Color.grayMain2c500) + .frame(width: 25, height: 25, alignment: .leading) + .padding(.all, 10) + } + } + + Button { + isMenuOpen = false + withAnimation { + isShowDocumentsFilesFragment = true + } + } label: { + HStack { + Text("conversation_menu_documents_files") + Spacer() + Image("file-pdf") + .renderingMode(.template) + .resizable() + .foregroundStyle(Color.grayMain2c500) + .frame(width: 25, height: 25, alignment: .leading) + .padding(.all, 10) } } } label: { diff --git a/Linphone/UI/Main/Conversations/Model/ConversationModel.swift b/Linphone/UI/Main/Conversations/Model/ConversationModel.swift index fe307a8d1..f9ca0ea0f 100644 --- a/Linphone/UI/Main/Conversations/Model/ConversationModel.swift +++ b/Linphone/UI/Main/Conversations/Model/ConversationModel.swift @@ -30,7 +30,7 @@ class ConversationModel: ObservableObject, Identifiable { var chatRoom: ChatRoom var lastMessage: ChatMessage? - let isDisabledBecauseNotSecured: Bool = false + var isDisabledBecauseNotSecured: Bool = false static let TAG = "[Conversation Model]" @@ -68,8 +68,19 @@ class ConversationModel: ObservableObject, Identifiable { self.remoteSipUri = chatRoom.peerAddress?.asStringUriOnly() ?? "" self.isGroup = !chatRoom.hasCapability(mask: ChatRoom.Capabilities.OneToOne.rawValue) && chatRoom.hasCapability(mask: ChatRoom.Capabilities.Conference.rawValue) + + if (!chatRoom.hasCapability(mask: ChatRoom.Capabilities.Encrypted.rawValue)) { + if let localAddress = chatRoom.localAddress , LinphoneUtils.getAccountForAddress(address: localAddress)?.params?.instantMessagingEncryptionMandatory == true { + Log.warn("\(ConversationModel.TAG) Conversation with subject \(chatRoom.subjectUtf8 ?? "No subject") is considered as read-only because it isn't encrypted and default account is in secure mode") + self.isDisabledBecauseNotSecured = true + } else { + self.isDisabledBecauseNotSecured = false + } + } else { + self.isDisabledBecauseNotSecured = false + } - self.isReadOnly = chatRoom.isReadOnly + self.isReadOnly = chatRoom.isReadOnly || self.isDisabledBecauseNotSecured let chatRoomParticipants = chatRoom.participants let addressFriend = (chatRoomParticipants.first != nil && chatRoomParticipants.first!.address != nil) diff --git a/Linphone/UI/Main/Conversations/ViewModel/ConversationViewModel.swift b/Linphone/UI/Main/Conversations/ViewModel/ConversationViewModel.swift index 219c01f33..a99190ba2 100644 --- a/Linphone/UI/Main/Conversations/ViewModel/ConversationViewModel.swift +++ b/Linphone/UI/Main/Conversations/ViewModel/ConversationViewModel.swift @@ -161,7 +161,7 @@ class ConversationViewModel: ObservableObject { if displayedConversation.isGroup { self.getEventMessage(eventLog: eventLog) } - let isReadOnly = chatRoom.isReadOnly + let isReadOnly = chatRoom.isReadOnly || displayedConversation.isDisabledBecauseNotSecured DispatchQueue.main.async { displayedConversation.isReadOnly = isReadOnly } @@ -171,7 +171,7 @@ class ConversationViewModel: ObservableObject { if displayedConversation.isGroup { self.getEventMessage(eventLog: eventLog) } - let isReadOnly = chatRoom.isReadOnly + let isReadOnly = chatRoom.isReadOnly || displayedConversation.isDisabledBecauseNotSecured DispatchQueue.main.async { displayedConversation.isReadOnly = isReadOnly }