mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
Fix SIP contacts filter
This commit is contained in:
parent
bcee4439f5
commit
4fbb43f38c
9 changed files with 305 additions and 254 deletions
|
|
@ -188,6 +188,7 @@
|
|||
"contacts_list_favourites_title" = "Favourites";
|
||||
"contacts_list_filter_popup_see_all" = "See all";
|
||||
"contacts_list_filter_popup_see_linphone_only" = "See %@ contacts";
|
||||
"contacts_list_filter_popup_see_sip_only" = "See SIP contacts";
|
||||
"conversation_action_call" = "Call";
|
||||
"conversation_action_configure_ephemeral_messages" = "Configure ephemeral messages";
|
||||
"conversation_action_delete" = "Delete conversation";
|
||||
|
|
|
|||
|
|
@ -188,6 +188,7 @@
|
|||
"contacts_list_favourites_title" = "Favoris";
|
||||
"contacts_list_filter_popup_see_all" = "Tous les contacts";
|
||||
"contacts_list_filter_popup_see_linphone_only" = "Contacts %@";
|
||||
"contacts_list_filter_popup_see_sip_only" = "Contacts SIP";
|
||||
"conversation_action_call" = "Appeler";
|
||||
"conversation_action_configure_ephemeral_messages" = "Configurer les messages éphémères";
|
||||
"conversation_action_delete" = "Supprimer la conversation";
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ struct ContactsInnerFragment: View {
|
|||
|
||||
@ObservedObject var sharedMainViewModel = SharedMainViewModel.shared
|
||||
@ObservedObject var contactsManager = ContactsManager.shared
|
||||
@ObservedObject var magicSearch = MagicSearchSingleton.shared
|
||||
|
||||
@EnvironmentObject var contactsListViewModel: ContactsListViewModel
|
||||
|
||||
|
|
@ -33,6 +34,7 @@ struct ContactsInnerFragment: View {
|
|||
@Binding var text: String
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
VStack(alignment: .leading) {
|
||||
if contactsManager.avatarListModel.contains(where: { $0.starred }) {
|
||||
HStack(alignment: .center) {
|
||||
|
|
@ -105,6 +107,13 @@ struct ContactsInnerFragment: View {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
if magicSearch.isLoading {
|
||||
ProgressView()
|
||||
.controlSize(.large)
|
||||
.progressViewStyle(CircularProgressViewStyle(tint: .orangeMain500))
|
||||
}
|
||||
}
|
||||
.navigationBarHidden(true)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -544,7 +544,7 @@ struct ContentView: View {
|
|||
magicSearch.searchForContacts()
|
||||
} label: {
|
||||
HStack {
|
||||
Text(String(format: String(localized: "contacts_list_filter_popup_see_linphone_only"), Bundle.main.displayName))
|
||||
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))
|
||||
Spacer()
|
||||
if !magicSearch.allContact {
|
||||
Image("green-check")
|
||||
|
|
|
|||
|
|
@ -141,6 +141,7 @@ struct ConversationForwardMessageFragment: View {
|
|||
.padding(.vertical)
|
||||
.padding(.horizontal)
|
||||
|
||||
ZStack {
|
||||
ScrollView {
|
||||
if !conversationForwardMessageViewModel.conversationsList.isEmpty {
|
||||
HStack(alignment: .center) {
|
||||
|
|
@ -187,6 +188,13 @@ struct ConversationForwardMessageFragment: View {
|
|||
suggestionsList
|
||||
}
|
||||
}
|
||||
|
||||
if magicSearch.isLoading {
|
||||
ProgressView()
|
||||
.controlSize(.large)
|
||||
.progressViewStyle(CircularProgressViewStyle(tint: .orangeMain500))
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ struct StartConversationFragment: View {
|
|||
)
|
||||
}
|
||||
|
||||
ZStack {
|
||||
ScrollView {
|
||||
if !ContactsManager.shared.lastSearch.isEmpty {
|
||||
HStack(alignment: .center) {
|
||||
|
|
@ -200,6 +201,13 @@ struct StartConversationFragment: View {
|
|||
suggestionsList
|
||||
}
|
||||
}
|
||||
|
||||
if magicSearch.isLoading {
|
||||
ProgressView()
|
||||
.controlSize(.large)
|
||||
.progressViewStyle(CircularProgressViewStyle(tint: .orangeMain500))
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,6 +235,7 @@ struct StartCallFragment: View {
|
|||
)
|
||||
}
|
||||
|
||||
ZStack {
|
||||
ScrollView {
|
||||
if !ContactsManager.shared.lastSearch.isEmpty {
|
||||
HStack(alignment: .center) {
|
||||
|
|
@ -306,6 +307,13 @@ struct StartCallFragment: View {
|
|||
suggestionsList
|
||||
}
|
||||
}
|
||||
|
||||
if magicSearch.isLoading {
|
||||
ProgressView()
|
||||
.controlSize(.large)
|
||||
.progressViewStyle(CircularProgressViewStyle(tint: .orangeMain500))
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ struct AddParticipantsFragment: View {
|
|||
.padding(.bottom)
|
||||
.padding(.horizontal)
|
||||
|
||||
ZStack {
|
||||
ScrollView {
|
||||
ForEach(0..<contactsManager.avatarListModel.count, id: \.self) { index in
|
||||
HStack {
|
||||
|
|
@ -238,6 +239,13 @@ struct AddParticipantsFragment: View {
|
|||
|
||||
suggestionsList
|
||||
}
|
||||
|
||||
if magicSearch.isLoading {
|
||||
ProgressView()
|
||||
.controlSize(.large)
|
||||
.progressViewStyle(CircularProgressViewStyle(tint: .orangeMain500))
|
||||
}
|
||||
}
|
||||
}
|
||||
Button {
|
||||
withAnimation {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ final class MagicSearchSingleton: ObservableObject {
|
|||
@Published var allContact = false
|
||||
let allContactKey = "all_contact"
|
||||
|
||||
private var domainDefaultAccount = ""
|
||||
var domainDefaultAccount = ""
|
||||
|
||||
var searchDelegate: MagicSearchDelegate?
|
||||
|
||||
|
|
@ -49,6 +49,8 @@ final class MagicSearchSingleton: ObservableObject {
|
|||
let linphoneAddressBookFriendList = "Linphone address-book"
|
||||
let tempRemoteAddressBookFriendList = "TempRemoteDirectoryContacts address-book"
|
||||
|
||||
@Published var isLoading = false
|
||||
|
||||
func destroyMagicSearch() {
|
||||
magicSearch = nil
|
||||
}
|
||||
|
|
@ -62,7 +64,7 @@ final class MagicSearchSingleton: ObservableObject {
|
|||
}
|
||||
|
||||
coreContext.doOnCoreQueue { core in
|
||||
self.domainDefaultAccount = core.defaultAccount?.params?.domain ?? ""
|
||||
self.domainDefaultAccount = (core.defaultAccount?.params?.domain?.contains("sip.linphone.org") == true) ? (core.defaultAccount?.params?.domain ?? "") : "*"
|
||||
|
||||
self.magicSearch = try? core.createMagicSearch()
|
||||
|
||||
|
|
@ -185,6 +187,8 @@ final class MagicSearchSingleton: ObservableObject {
|
|||
NotificationCenter.default.post(name: NSNotification.Name("ContactLoaded"), object: nil)
|
||||
}
|
||||
|
||||
self.isLoading = false
|
||||
|
||||
self.contactLoadedDebounceWorkItem = workItem
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: workItem)
|
||||
}
|
||||
|
|
@ -192,6 +196,10 @@ final class MagicSearchSingleton: ObservableObject {
|
|||
|
||||
func searchForContacts() {
|
||||
coreContext.doOnCoreQueue { _ in
|
||||
DispatchQueue.main.async {
|
||||
self.isLoading = true
|
||||
}
|
||||
|
||||
var needResetCache = false
|
||||
|
||||
if let oldFilter = self.previousFilter {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue