Reduced conversation list refresh to once, triggered after fetching all contacts

This commit is contained in:
Benoit Martins 2025-01-29 15:23:10 +01:00
parent 34ff5bcf16
commit e74df76301
4 changed files with 2 additions and 12 deletions

View file

@ -89,7 +89,6 @@ final class ContactsManager: ObservableObject {
} }
let store = CNContactStore() let store = CNContactStore()
store.requestAccess(for: .contacts) { (granted, error) in store.requestAccess(for: .contacts) { (granted, error) in
if let error = error { if let error = error {
print("\(#function) - failed to request access", error) print("\(#function) - failed to request access", error)
@ -162,10 +161,10 @@ final class ContactsManager: ObservableObject {
DispatchQueue.main.async { DispatchQueue.main.async {
self.avatarListModel += addedAvatarListModel self.avatarListModel += addedAvatarListModel
} }
MagicSearchSingleton.shared.searchForContacts(sourceFlags: MagicSearch.Source.Friends.rawValue | MagicSearch.Source.LdapServers.rawValue)
}) })
self.friendList?.addDelegate(delegate: self.friendListDelegate!) self.friendList?.addDelegate(delegate: self.friendListDelegate!)
MagicSearchSingleton.shared.searchForContacts(sourceFlags: MagicSearch.Source.Friends.rawValue | MagicSearch.Source.LdapServers.rawValue)
} }
} }
} }

View file

@ -1340,9 +1340,6 @@ struct ContentView: View {
.zIndex(6) .zIndex(6)
} }
} }
.onAppear {
MagicSearchSingleton.shared.searchForContacts(sourceFlags: MagicSearch.Source.Friends.rawValue | MagicSearch.Source.LdapServers.rawValue)
}
.onChange(of: navigationManager.selectedCallId) { newCallId in .onChange(of: navigationManager.selectedCallId) { newCallId in
if newCallId != nil { if newCallId != nil {
self.index = 2 self.index = 2

View file

@ -69,11 +69,6 @@ struct ConversationsListFragment: View {
.padding(.all) .padding(.all)
) )
} }
.onChange(of: scenePhase) { newPhase in
if newPhase == .active {
conversationsListViewModel.computeChatRoomsList(filter: "")
}
}
.navigationTitle("") .navigationTitle("")
.navigationBarHidden(true) .navigationBarHidden(true)
} }

View file

@ -37,7 +37,6 @@ class ConversationsListViewModel: ObservableObject {
var selectedConversation: ConversationModel? var selectedConversation: ConversationModel?
init() { init() {
computeChatRoomsList(filter: "")
addConversationDelegate() addConversationDelegate()
} }