mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Added setting in CorePreferences to hide phone numbers from contacts (also disables contacts list filter)
This commit is contained in:
parent
5cee11c779
commit
b1a03db96f
5 changed files with 14 additions and 3 deletions
|
|
@ -860,8 +860,11 @@ fun Friend.getListOfSipAddressesAndPhoneNumbers(listener: ContactNumberOrAddress
|
|||
)
|
||||
addressesAndNumbers.add(data)
|
||||
}
|
||||
val indexOfLastSipAddress = addressesAndNumbers.count()
|
||||
if (corePreferences.hidePhoneNumbers) {
|
||||
return addressesAndNumbers
|
||||
}
|
||||
|
||||
val indexOfLastSipAddress = addressesAndNumbers.count()
|
||||
for (number in phoneNumbersWithLabel) {
|
||||
val presenceModel = getPresenceModelForUriOrTel(number.phoneNumber)
|
||||
val hasPresenceInfo = !presenceModel?.contact.isNullOrEmpty()
|
||||
|
|
|
|||
|
|
@ -228,6 +228,10 @@ class CorePreferences
|
|||
val maxAccountsCount: Int
|
||||
get() = config.getInt("ui", "max_account", 0) // 0 means no max
|
||||
|
||||
@get:WorkerThread
|
||||
val hidePhoneNumbers: Boolean
|
||||
get() = config.getBool("ui", "hide_phone_numbers", false)
|
||||
|
||||
@get:WorkerThread
|
||||
val hideSettings: Boolean
|
||||
get() = config.getBool("ui", "hide_settings", false)
|
||||
|
|
|
|||
|
|
@ -58,6 +58,8 @@ class ContactsListViewModel
|
|||
|
||||
val showFavourites = MutableLiveData<Boolean>()
|
||||
|
||||
val showFilter = MutableLiveData<Boolean>()
|
||||
|
||||
val isListFiltered = MutableLiveData<Boolean>()
|
||||
|
||||
val isDefaultAccountLinphone = MutableLiveData<Boolean>()
|
||||
|
|
@ -100,6 +102,7 @@ class ContactsListViewModel
|
|||
init {
|
||||
fetchInProgress.value = true
|
||||
showFavourites.value = corePreferences.showFavoriteContacts
|
||||
showFilter.value = !corePreferences.hidePhoneNumbers
|
||||
|
||||
coreContext.postOnCoreThread { core ->
|
||||
updateDomainFilter()
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import androidx.core.text.toSpannable
|
|||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
import org.linphone.R
|
||||
import org.linphone.contacts.getListOfSipAddresses
|
||||
import org.linphone.core.Account
|
||||
|
|
@ -116,7 +117,7 @@ class LinphoneUtils {
|
|||
val numbersCount = friend.phoneNumbers.size
|
||||
|
||||
// Do not consider phone numbers if default account is in secure mode
|
||||
val enablePhoneNumbers = !isEndToEndEncryptionMandatory()
|
||||
val enablePhoneNumbers = !corePreferences.hidePhoneNumbers && !isEndToEndEncryptionMandatory()
|
||||
|
||||
if (addressesCount == 1 && (numbersCount == 0 || !enablePhoneNumbers)) {
|
||||
val address = addresses.first()
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
android:id="@+id/top_bar"
|
||||
layout="@layout/main_activity_top_bar"
|
||||
bind:viewModel="@{viewModel}"
|
||||
bind:enableExtraAction="@{true}"
|
||||
bind:enableExtraAction="@{viewModel.showFilter}"
|
||||
bind:extraActionIcon="@{@drawable/funnel}"
|
||||
bind:extraActionClickListener="@{filterClickListener}"
|
||||
bind:extraActionContentDescription="@{@string/content_description_contacts_list_filters}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue