Only show SIP contacts list by default when default proxy config is a sip.linphone.org account

This commit is contained in:
Sylvain Berfini 2020-08-20 15:45:16 +02:00
parent 932a3a7265
commit 7ee8ba34b0
4 changed files with 7 additions and 3 deletions

View file

@ -23,10 +23,10 @@ import androidx.lifecycle.MediatorLiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import java.util.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.util.*
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.core.AudioDevice
import org.linphone.core.Call

View file

@ -75,7 +75,7 @@ class ChatRoomCreationViewModel : ErrorReportingViewModel() {
init {
createGroupChat.value = false
sipContactsSelected.value = true
sipContactsSelected.value = coreContext.contactsManager.shouldDisplaySipContactsList()
isEncrypted.value = false
selectedAddresses.value = arrayListOf()

View file

@ -45,7 +45,7 @@ class ContactsListViewModel : ViewModel() {
}
init {
sipContactsSelected.value = true
sipContactsSelected.value = coreContext.contactsManager.shouldDisplaySipContactsList()
coreContext.contactsManager.addListener(contactsUpdatedListener)
}

View file

@ -132,6 +132,10 @@ class ContactsManager(private val context: Context) {
)
}
fun shouldDisplaySipContactsList(): Boolean {
return coreContext.core.defaultProxyConfig?.identityAddress?.domain == corePreferences.defaultDomain
}
@Synchronized
fun fetchContactsAsync() {
if (loadContactsTask != null) {