mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
Use CorePreferences contactsFilter for contact filtering
This commit is contained in:
parent
6827bdc1dc
commit
d4b10d38ae
4 changed files with 9 additions and 19 deletions
|
|
@ -248,11 +248,6 @@ class CoreContext: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Temporary workaround until SDK fixs
|
||||
if CorePreferences.defaultDomain == "" {
|
||||
CorePreferences.defaultDomain = core.defaultAccount?.params?.domain ?? ""
|
||||
}
|
||||
|
||||
self.actionsToPerformOnCoreQueueWhenCoreIsStarted.forEach { $0(core) }
|
||||
self.actionsToPerformOnCoreQueueWhenCoreIsStarted.removeAll()
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@ import Foundation
|
|||
|
||||
public enum AppGitInfo {
|
||||
public static let branch = "master"
|
||||
public static let commit = "ed08190ff"
|
||||
public static let commit = "6827bdc1d"
|
||||
public static let tag = "6.1.0-alpha"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -594,7 +594,7 @@ struct ContentView: View {
|
|||
magicSearch.searchForContacts()
|
||||
} label: {
|
||||
HStack {
|
||||
Text(magicSearch.domainDefaultAccount == "*" ? String(localized: "contacts_list_filter_popup_see_sip_only") : String(format: String(localized: "contacts_list_filter_popup_see_linphone_only"), Bundle.main.displayName))
|
||||
Text(!magicSearch.linphoneDomain ? String(localized: "contacts_list_filter_popup_see_sip_only") : String(format: String(localized: "contacts_list_filter_popup_see_linphone_only"), Bundle.main.displayName))
|
||||
Spacer()
|
||||
if !magicSearch.allContact {
|
||||
Image("green-check")
|
||||
|
|
|
|||
|
|
@ -36,9 +36,9 @@ final class MagicSearchSingleton: ObservableObject {
|
|||
|
||||
private var limitSearchToLinphoneAccounts = true
|
||||
|
||||
@Published var allContact = false
|
||||
let allContactKey = "all_contact"
|
||||
@Published var allContact = true
|
||||
|
||||
var linphoneDomain = true
|
||||
var domainDefaultAccount = ""
|
||||
|
||||
var searchDelegate: MagicSearchDelegate?
|
||||
|
|
@ -56,15 +56,11 @@ final class MagicSearchSingleton: ObservableObject {
|
|||
}
|
||||
|
||||
private init() {
|
||||
let preferences = UserDefaults.standard
|
||||
if preferences.object(forKey: allContactKey) == nil {
|
||||
preferences.set(allContact, forKey: allContactKey)
|
||||
} else {
|
||||
allContact = preferences.bool(forKey: allContactKey)
|
||||
}
|
||||
allContact = CorePreferences.contactsFilter == ""
|
||||
|
||||
coreContext.doOnCoreQueue { core in
|
||||
self.domainDefaultAccount = (core.defaultAccount?.params?.domain?.contains("sip.linphone.org") == true) ? (core.defaultAccount?.params?.domain ?? "") : "*"
|
||||
self.linphoneDomain = CorePreferences.defaultDomain == core.defaultAccount?.params?.domain
|
||||
self.domainDefaultAccount = CorePreferences.contactsFilter
|
||||
|
||||
self.magicSearch = try? core.createMagicSearch()
|
||||
|
||||
|
|
@ -161,10 +157,9 @@ final class MagicSearchSingleton: ObservableObject {
|
|||
}
|
||||
|
||||
func changeAllContact(allContactBool: Bool) {
|
||||
let preferences = UserDefaults.standard
|
||||
|
||||
allContact = allContactBool
|
||||
preferences.set(allContact, forKey: allContactKey)
|
||||
domainDefaultAccount = allContactBool ? "" : (linphoneDomain ? CorePreferences.defaultDomain : "*")
|
||||
CorePreferences.contactsFilter = domainDefaultAccount
|
||||
}
|
||||
|
||||
func updateContacts(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue