Added config option to show secure chat button in contact details & call history even if no LIME capability in presence (or no presence at all)
This commit is contained in:
parent
5c657261dd
commit
4c6ead64f4
3 changed files with 9 additions and 3 deletions
|
@ -204,7 +204,8 @@ class ContactViewModel(friend: Friend, async: Boolean = false) : MessageNotifier
|
|||
val presenceModel = friend.getPresenceModelForUriOrTel(value)
|
||||
val hasPresence = presenceModel?.basicStatus == PresenceBasicStatus.Open
|
||||
val isMe = coreContext.core.defaultAccount?.params?.identityAddress?.weakEqual(address) ?: false
|
||||
val secureChatAllowed = LinphoneUtils.isEndToEndEncryptedChatAvailable() && !isMe && friend.getPresenceModelForUriOrTel(value)?.hasCapability(FriendCapability.LimeX3Dh) ?: false
|
||||
val hasLimeCapability = corePreferences.allowEndToEndEncryptedChatWithoutPresence || (friend.getPresenceModelForUriOrTel(value)?.hasCapability(FriendCapability.LimeX3Dh) ?: false)
|
||||
val secureChatAllowed = LinphoneUtils.isEndToEndEncryptedChatAvailable() && !isMe && hasLimeCapability
|
||||
val displayValue = if (coreContext.core.defaultAccount?.params?.domain == address.domain) (address.username ?: value) else value
|
||||
val noa = ContactNumberOrAddressData(address, hasPresence, displayValue, showSecureChat = secureChatAllowed, listener = listener)
|
||||
list.add(noa)
|
||||
|
@ -218,7 +219,8 @@ class ContactViewModel(friend: Friend, async: Boolean = false) : MessageNotifier
|
|||
val address = coreContext.core.interpretUrl(contactAddress, true)
|
||||
address?.displayName = displayName.value.orEmpty()
|
||||
val isMe = if (address != null) coreContext.core.defaultAccount?.params?.identityAddress?.weakEqual(address) ?: false else false
|
||||
val secureChatAllowed = LinphoneUtils.isEndToEndEncryptedChatAvailable() && !isMe && friend.getPresenceModelForUriOrTel(number)?.hasCapability(FriendCapability.LimeX3Dh) ?: false
|
||||
val hasLimeCapability = corePreferences.allowEndToEndEncryptedChatWithoutPresence || (friend.getPresenceModelForUriOrTel(number)?.hasCapability(FriendCapability.LimeX3Dh) ?: false)
|
||||
val secureChatAllowed = LinphoneUtils.isEndToEndEncryptedChatAvailable() && !isMe && hasLimeCapability
|
||||
val label = PhoneNumberUtils.vcardParamStringToAddressBookLabel(coreContext.context.resources, phoneNumber.label ?: "")
|
||||
val noa = ContactNumberOrAddressData(address, hasPresence, number, isSip = false, showSecureChat = secureChatAllowed, typeLabel = label, listener = listener)
|
||||
list.add(noa)
|
||||
|
|
|
@ -101,7 +101,7 @@ class CallLogViewModel(val callLog: CallLog, private val isRelated: Boolean = fa
|
|||
|
||||
val hidePlainChat = corePreferences.forceEndToEndEncryptedChat
|
||||
|
||||
val secureChatAllowed = LinphoneUtils.isEndToEndEncryptedChatAvailable() && (contact.value?.getPresenceModelForUriOrTel(peerSipUri)?.hasCapability(FriendCapability.LimeX3Dh) ?: false)
|
||||
val secureChatAllowed = LinphoneUtils.isEndToEndEncryptedChatAvailable() && (corePreferences.allowEndToEndEncryptedChatWithoutPresence || (contact.value?.getPresenceModelForUriOrTel(peerSipUri)?.hasCapability(FriendCapability.LimeX3Dh) ?: false))
|
||||
|
||||
val relatedCallLogs = MutableLiveData<ArrayList<CallLogViewModel>>()
|
||||
|
||||
|
|
|
@ -470,6 +470,10 @@ class CorePreferences constructor(private val context: Context) {
|
|||
val forceEndToEndEncryptedChat: Boolean
|
||||
get() = config.getBool("app", "force_lime_chat_rooms", false)
|
||||
|
||||
// Turning this ON will show the secure chat button even if there is no LIME capability in presence (or no presence)
|
||||
val allowEndToEndEncryptedChatWithoutPresence: Boolean
|
||||
get() = config.getBool("app", "allow_lime_friend_without_capability", false)
|
||||
|
||||
// This will prevent UI from showing up, except for the launcher & the foreground service notification
|
||||
val preventInterfaceFromShowingUp: Boolean
|
||||
get() = config.getBool("app", "keep_app_invisible", false)
|
||||
|
|
Loading…
Reference in a new issue