Only show SIP contacts list by default when default proxy config is a sip.linphone.org account
This commit is contained in:
parent
932a3a7265
commit
7ee8ba34b0
4 changed files with 7 additions and 3 deletions
|
@ -23,10 +23,10 @@ import androidx.lifecycle.MediatorLiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import java.util.*
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import java.util.*
|
|
||||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||||
import org.linphone.core.AudioDevice
|
import org.linphone.core.AudioDevice
|
||||||
import org.linphone.core.Call
|
import org.linphone.core.Call
|
||||||
|
|
|
@ -75,7 +75,7 @@ class ChatRoomCreationViewModel : ErrorReportingViewModel() {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
createGroupChat.value = false
|
createGroupChat.value = false
|
||||||
sipContactsSelected.value = true
|
sipContactsSelected.value = coreContext.contactsManager.shouldDisplaySipContactsList()
|
||||||
isEncrypted.value = false
|
isEncrypted.value = false
|
||||||
|
|
||||||
selectedAddresses.value = arrayListOf()
|
selectedAddresses.value = arrayListOf()
|
||||||
|
|
|
@ -45,7 +45,7 @@ class ContactsListViewModel : ViewModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
sipContactsSelected.value = true
|
sipContactsSelected.value = coreContext.contactsManager.shouldDisplaySipContactsList()
|
||||||
|
|
||||||
coreContext.contactsManager.addListener(contactsUpdatedListener)
|
coreContext.contactsManager.addListener(contactsUpdatedListener)
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,6 +132,10 @@ class ContactsManager(private val context: Context) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun shouldDisplaySipContactsList(): Boolean {
|
||||||
|
return coreContext.core.defaultProxyConfig?.identityAddress?.domain == corePreferences.defaultDomain
|
||||||
|
}
|
||||||
|
|
||||||
@Synchronized
|
@Synchronized
|
||||||
fun fetchContactsAsync() {
|
fun fetchContactsAsync() {
|
||||||
if (loadContactsTask != null) {
|
if (loadContactsTask != null) {
|
||||||
|
|
Loading…
Reference in a new issue