mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Fixes regarding contacts list filter when switching account
This commit is contained in:
parent
9c8c5f309e
commit
fbc19c7053
1 changed files with 15 additions and 9 deletions
|
|
@ -38,7 +38,6 @@ import org.linphone.core.MagicSearchListenerStub
|
||||||
import org.linphone.core.SearchResult
|
import org.linphone.core.SearchResult
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
import org.linphone.ui.main.contacts.model.ContactAvatarModel
|
import org.linphone.ui.main.contacts.model.ContactAvatarModel
|
||||||
import org.linphone.ui.main.model.isEndToEndEncryptionMandatory
|
|
||||||
import org.linphone.ui.main.viewmodel.AbstractMainViewModel
|
import org.linphone.ui.main.viewmodel.AbstractMainViewModel
|
||||||
import org.linphone.utils.Event
|
import org.linphone.utils.Event
|
||||||
import org.linphone.utils.FileUtils
|
import org.linphone.utils.FileUtils
|
||||||
|
|
@ -143,9 +142,11 @@ class ContactsListViewModel
|
||||||
fun applyCurrentDefaultAccountFilter() {
|
fun applyCurrentDefaultAccountFilter() {
|
||||||
coreContext.postOnCoreThread {
|
coreContext.postOnCoreThread {
|
||||||
updateDomainFilter()
|
updateDomainFilter()
|
||||||
}
|
|
||||||
|
|
||||||
applyFilter(currentFilter)
|
coreContext.postOnMainThread {
|
||||||
|
applyFilter(currentFilter)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@UiThread
|
@UiThread
|
||||||
|
|
@ -181,17 +182,22 @@ class ContactsListViewModel
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
private fun updateDomainFilter() {
|
private fun updateDomainFilter() {
|
||||||
val defaultAccount = coreContext.core.defaultAccount
|
val defaultAccount = coreContext.core.defaultAccount
|
||||||
val defaultDomain = defaultAccount?.params?.domain == corePreferences.defaultDomain
|
val defaultDomain = corePreferences.defaultDomain
|
||||||
isDefaultAccountLinphone.postValue(defaultDomain)
|
val isAccountOnDefaultDomain = defaultAccount?.params?.domain == defaultDomain
|
||||||
|
isDefaultAccountLinphone.postValue(isAccountOnDefaultDomain)
|
||||||
|
|
||||||
Log.i("$TAG Currently selected filter is [${corePreferences.contactsFilter}]")
|
|
||||||
domainFilter = corePreferences.contactsFilter
|
domainFilter = corePreferences.contactsFilter
|
||||||
if (isEndToEndEncryptionMandatory() && (domainFilter.isEmpty() || domainFilter == "*")) {
|
Log.i("$TAG Currently selected filter is [$domainFilter]")
|
||||||
domainFilter = corePreferences.defaultDomain
|
if (!isAccountOnDefaultDomain && domainFilter == defaultDomain) {
|
||||||
|
domainFilter = "*"
|
||||||
corePreferences.contactsFilter = domainFilter
|
corePreferences.contactsFilter = domainFilter
|
||||||
Log.i(
|
Log.i(
|
||||||
"$TAG Filter updated to [${corePreferences.contactsFilter}] to match mandatory IM encryption"
|
"$TAG New default account isn't on default domain, changing filter to all SIP contacts instead"
|
||||||
)
|
)
|
||||||
|
} else if (isAccountOnDefaultDomain && domainFilter != "") {
|
||||||
|
domainFilter = defaultDomain
|
||||||
|
corePreferences.contactsFilter = domainFilter
|
||||||
|
Log.i("$TAG New default account is on default domain, using that as filter instead")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue