forked from mirrors/linphone-iphone
Edit contact in main thread
This commit is contained in:
parent
cf109f9787
commit
00bbf41f9a
1 changed files with 20 additions and 19 deletions
|
|
@ -136,11 +136,9 @@ struct EditContactFragment: View {
|
|||
.padding(.top, 2)
|
||||
.disabled(editContactViewModel.firstName.isEmpty)
|
||||
.onTapGesture {
|
||||
withAnimation {
|
||||
addOrEditFriend()
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: 50)
|
||||
.padding(.horizontal)
|
||||
|
|
@ -532,8 +530,8 @@ struct EditContactFragment: View {
|
|||
contact: newContact, linphoneFriend: true, existingFriend: editContactViewModel.selectedEditFriend) {
|
||||
MagicSearchSingleton.shared.searchForContacts(sourceFlags: MagicSearch.Source.Friends.rawValue | MagicSearch.Source.LdapServers.rawValue)
|
||||
|
||||
if editContactViewModel.selectedEditFriend != nil
|
||||
&& editContactViewModel.selectedEditFriend!.name != editContactViewModel.firstName + " " + editContactViewModel.lastName {
|
||||
DispatchQueue.main.async {
|
||||
if editContactViewModel.selectedEditFriend != nil {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
let result = ContactsManager.shared.lastSearch.firstIndex(where: {
|
||||
$0.friend!.name == newContact.firstName + " " + newContact.lastName
|
||||
|
|
@ -548,13 +546,16 @@ struct EditContactFragment: View {
|
|||
isShowEditContactFragment.toggle()
|
||||
}
|
||||
} else {
|
||||
withAnimation {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
editContactViewModel.resetValues()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
EditContactFragment(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue