Moving LIME server URL from Core to Accounts
This commit is contained in:
parent
64a736eeeb
commit
68d34735a6
14 changed files with 44 additions and 18 deletions
|
@ -19,6 +19,7 @@
|
|||
<entry name="push_notification_allowed" overwrite="true">0</entry>
|
||||
<entry name="cpim_in_basic_chat_rooms_enabled" overwrite="true">0</entry>
|
||||
<entry name="rtp_bundle" overwrite="true">0</entry>
|
||||
<entry name="lime_server_url" overwrite="true"></entry>
|
||||
</section>
|
||||
<section name="nat_policy_default_values">
|
||||
<entry name="stun_server" overwrite="true"></entry>
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
<entry name="push_notification_allowed" overwrite="true">1</entry>
|
||||
<entry name="cpim_in_basic_chat_rooms_enabled" overwrite="true">1</entry>
|
||||
<entry name="rtp_bundle" overwrite="true">1</entry>
|
||||
<entry name="lime_server_url" overwrite="true">https://lime.linphone.org/lime-server/lime-server.php</entry>
|
||||
</section>
|
||||
<section name="nat_policy_default_values">
|
||||
<entry name="stun_server" overwrite="true">stun.linphone.org</entry>
|
||||
|
|
|
@ -37,6 +37,7 @@ notify_each_friend_individually_when_presence_received=0
|
|||
[app]
|
||||
activation_code_length=4
|
||||
prefer_basic_chat_room=1
|
||||
record_aware=1
|
||||
|
||||
[assistant]
|
||||
xmlrpc_url=https://subscribe.linphone.org:444/wizard.php
|
||||
|
|
|
@ -41,7 +41,7 @@ class ChatRoomCreationViewModel : ContactsSelectionViewModel() {
|
|||
|
||||
val waitForChatRoomCreation = MutableLiveData<Boolean>()
|
||||
|
||||
val limeAvailable: Boolean = LinphoneUtils.isLimeAvailable()
|
||||
val secureChatAvailable: Boolean = LinphoneUtils.isEndToEndEncryptedChatAvailable()
|
||||
|
||||
private val listener = object : ChatRoomListenerStub() {
|
||||
override fun onStateChanged(room: ChatRoom, state: ChatRoom.State) {
|
||||
|
|
|
@ -204,7 +204,7 @@ 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.isLimeAvailable() && !isMe && friend.getPresenceModelForUriOrTel(value)?.hasCapability(FriendCapability.LimeX3Dh) ?: false
|
||||
val secureChatAllowed = LinphoneUtils.isEndToEndEncryptedChatAvailable() && !isMe && friend.getPresenceModelForUriOrTel(value)?.hasCapability(FriendCapability.LimeX3Dh) ?: false
|
||||
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 +218,7 @@ 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.isLimeAvailable() && !isMe && friend.getPresenceModelForUriOrTel(number)?.hasCapability(FriendCapability.LimeX3Dh) ?: false
|
||||
val secureChatAllowed = LinphoneUtils.isEndToEndEncryptedChatAvailable() && !isMe && friend.getPresenceModelForUriOrTel(number)?.hasCapability(FriendCapability.LimeX3Dh) ?: false
|
||||
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)
|
||||
|
|
|
@ -99,7 +99,7 @@ class CallLogViewModel(val callLog: CallLog, private val isRelated: Boolean = fa
|
|||
|
||||
val chatAllowed = !corePreferences.disableChat
|
||||
|
||||
val secureChatAllowed = LinphoneUtils.isLimeAvailable() && (contact.value?.getPresenceModelForUriOrTel(peerSipUri)?.hasCapability(FriendCapability.LimeX3Dh) ?: false)
|
||||
val secureChatAllowed = LinphoneUtils.isEndToEndEncryptedChatAvailable() && (contact.value?.getPresenceModelForUriOrTel(peerSipUri)?.hasCapability(FriendCapability.LimeX3Dh) ?: false)
|
||||
|
||||
val relatedCallLogs = MutableLiveData<ArrayList<CallLogViewModel>>()
|
||||
|
||||
|
|
|
@ -428,6 +428,15 @@ class AccountSettingsViewModel(val account: Account) : GenericSettingsViewModel(
|
|||
}
|
||||
val audioVideoConferenceFactoryUri = MutableLiveData<String>()
|
||||
|
||||
val limeServerUrlListener = object : SettingListenerStub() {
|
||||
override fun onTextValueChanged(newValue: String) {
|
||||
val params = account.params.clone()
|
||||
params.limeServerUrl = newValue
|
||||
account.params = params
|
||||
}
|
||||
}
|
||||
val limeServerUrl = MutableLiveData<String>()
|
||||
|
||||
init {
|
||||
update()
|
||||
account.addListener(listener)
|
||||
|
@ -485,6 +494,7 @@ class AccountSettingsViewModel(val account: Account) : GenericSettingsViewModel(
|
|||
|
||||
conferenceFactoryUri.value = params.conferenceFactoryUri
|
||||
audioVideoConferenceFactoryUri.value = params.audioVideoConferenceFactoryAddress?.asStringUriOnly()
|
||||
limeServerUrl.value = params.limeServerUrl
|
||||
}
|
||||
|
||||
private fun initTransportList() {
|
||||
|
|
|
@ -384,13 +384,16 @@ class CoreContext(
|
|||
core.isVibrationOnIncomingCallEnabled = true
|
||||
core.config.setBool("app", "incoming_call_vibration", false)
|
||||
}
|
||||
|
||||
if (core.config.getInt("misc", "conference_layout", 1) > 1) {
|
||||
core.config.setInt("misc", "conference_layout", 1)
|
||||
}
|
||||
|
||||
if (!core.config.getBool("app", "conference_migration", false)) {
|
||||
core.isRecordAwareEnabled = true
|
||||
core.config.setBool("app", "conference_migration", true)
|
||||
// Now LIME server URL is set on accounts
|
||||
val limeServerUrl = core.limeX3DhServerUrl.orEmpty()
|
||||
if (limeServerUrl.isNotEmpty()) {
|
||||
Log.w("[Context] Removing LIME X3DH server URL from Core config")
|
||||
core.limeX3DhServerUrl = null
|
||||
}
|
||||
|
||||
// Disable Telecom Manager on Android < 10 to prevent crash due to OS bug in Android 9
|
||||
|
@ -446,6 +449,12 @@ class CoreContext(
|
|||
Log.i("[Context] CPIM allowed in basic chat rooms for account ${params.identityAddress?.asString()}")
|
||||
}
|
||||
|
||||
if (account.params.limeServerUrl == null && limeServerUrl.isNotEmpty()) {
|
||||
params.limeServerUrl = limeServerUrl
|
||||
paramsChanged = true
|
||||
Log.i("[Context] Moving Core's LIME X3DH server URL [$limeServerUrl] on account ${params.identityAddress?.asString()}")
|
||||
}
|
||||
|
||||
if (paramsChanged) {
|
||||
Log.i("[Context] Account params have been updated, apply changes")
|
||||
account.params = params
|
||||
|
@ -497,10 +506,6 @@ class CoreContext(
|
|||
friendList.rlsAddress = rlsAddress
|
||||
}
|
||||
}
|
||||
|
||||
if (core.limeX3DhAvailable()) {
|
||||
core.limeX3DhServerUrl = corePreferences.defaultLimeServerUrl
|
||||
}
|
||||
} else {
|
||||
Log.i("[Context] Background mode with foreground service automatically enabled")
|
||||
corePreferences.keepServiceAlive = true
|
||||
|
|
|
@ -483,9 +483,6 @@ class CorePreferences constructor(private val context: Context) {
|
|||
val defaultRlsUri: String
|
||||
get() = config.getString("sip", "rls_uri", "sips:rls@sip.linphone.org")!!
|
||||
|
||||
val defaultLimeServerUrl: String
|
||||
get() = config.getString("lime", "lime_server_url", "https://lime.linphone.org/lime-server/lime-server.php")!!
|
||||
|
||||
val debugPopupCode: String
|
||||
get() = config.getString("app", "debug_popup_magic", "#1234#")!!
|
||||
|
||||
|
|
|
@ -104,10 +104,10 @@ class LinphoneUtils {
|
|||
}
|
||||
}
|
||||
|
||||
fun isLimeAvailable(): Boolean {
|
||||
fun isEndToEndEncryptedChatAvailable(): Boolean {
|
||||
val core = coreContext.core
|
||||
return core.limeX3DhAvailable() && core.isLimeX3DhEnabled &&
|
||||
core.limeX3DhServerUrl != null &&
|
||||
return core.limeX3DhAvailable() &&
|
||||
core.defaultAccount?.params?.limeServerUrl != null &&
|
||||
core.defaultAccount?.params?.conferenceFactoryUri != null
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
android:src="@drawable/back" />
|
||||
|
||||
<LinearLayout
|
||||
android:visibility="@{viewModel.limeAvailable ? View.VISIBLE : View.INVISIBLE}"
|
||||
android:visibility="@{viewModel.secureChatAvailable ? View.VISIBLE : View.INVISIBLE}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="5dp"
|
||||
|
|
|
@ -247,6 +247,13 @@
|
|||
linphone:defaultValue="@{viewModel.audioVideoConferenceFactoryUri}"
|
||||
linphone:inputType="@{InputType.TYPE_CLASS_TEXT}"/>
|
||||
|
||||
<include
|
||||
layout="@layout/settings_widget_text"
|
||||
linphone:title="@{@string/account_setting_end_to_end_encryption_keys_server_url}"
|
||||
linphone:listener="@{viewModel.limeServerUrlListener}"
|
||||
linphone:defaultValue="@{viewModel.limeServerUrl}"
|
||||
linphone:inputType="@{InputType.TYPE_CLASS_TEXT}"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
|
|
@ -747,4 +747,7 @@
|
|||
<string name="conference_schedule_edit">Modifier la réunion</string>
|
||||
<string name="conference_update_title">La réunion a été modifiée : </string>
|
||||
<string name="conference_cancel_title">La réunion a été annulée : </string>
|
||||
<string name="account_setting_conference_factory_address">Adresse du serveur de conversation de groupe/sécurisées</string>
|
||||
<string name="account_setting_audio_video_conference_factory_address">Adresse du serveur de conférence audio/vidéo</string>
|
||||
<string name="account_setting_end_to_end_encryption_keys_server_url">URL du serveur de clés pour le chiffrement de bout en bout</string>
|
||||
</resources>
|
|
@ -689,6 +689,7 @@
|
|||
<string name="account_settings_escape_plus_title">Replace + by 00</string>
|
||||
<string name="account_setting_conference_factory_address">Conference factory URI</string>
|
||||
<string name="account_setting_audio_video_conference_factory_address">Audio/video conference factory URI</string>
|
||||
<string name="account_setting_end_to_end_encryption_keys_server_url">E2E encryption keys server URL</string>
|
||||
|
||||
<!-- Conferences settings -->
|
||||
<string name="conferences_settings_layout_title">Default layout</string>
|
||||
|
|
Loading…
Reference in a new issue