Edit carddav friend

This commit is contained in:
Benoit Martins 2025-10-20 15:49:07 +02:00
parent 41f9db8199
commit ac6b478eb1
3 changed files with 7 additions and 2 deletions

View file

@ -211,7 +211,7 @@ struct ContactInnerActionsFragment: View {
.background(Color.gray100)
VStack(spacing: 0) {
if !contactAvatarModel.nativeUri.isEmpty {
if !contactAvatarModel.editable {
Button {
actionEditButton()
} label: {

View file

@ -72,8 +72,9 @@ struct ContactInnerFragment: View {
Spacer()
if !contactAvatarModel.nativeUri.isEmpty {
if !contactAvatarModel.editable {
Button(action: {
print("nativeUrinativeUri 00 \(contactAvatarModel.nativeUri)")
editNativeContact()
}, label: {
Image("pencil-simple")
@ -99,6 +100,7 @@ struct ContactInnerFragment: View {
}
.simultaneousGesture(
TapGesture().onEnded {
print("nativeUrinativeUri 11 \(contactAvatarModel.nativeUri)")
isShowEditContactFragmentInContactDetails = true
}
)

View file

@ -32,6 +32,7 @@ class ContactAvatarModel: ObservableObject, Identifiable {
@Published var phoneNumbersWithLabel: [(label: String, phoneNumber: String)] = []
var nativeUri: String = ""
var editable: Bool = true
var withPresence: Bool?
@Published var starred: Bool = false
@ -70,6 +71,7 @@ class ContactAvatarModel: ObservableObject, Identifiable {
}
}
let nativeUriTmp = friend?.nativeUri ?? ""
let editableTmp = friend?.friendList?.type == .CardDAV || nativeUriTmp.isEmpty
let withPresenceTmp = withPresence
let starredTmp = friend?.starred ?? false
let vcardTmp = friend?.vcard ?? nil
@ -108,6 +110,7 @@ class ContactAvatarModel: ObservableObject, Identifiable {
self.addresses = addressesTmp
self.phoneNumbersWithLabel = phoneNumbersWithLabelTmp
self.nativeUri = nativeUriTmp
self.editable = editableTmp
self.withPresence = withPresenceTmp
self.starred = starredTmp
self.vcard = vcardTmp