add button edit

This commit is contained in:
cheykrym 2025-12-11 03:20:27 +03:00
parent af89cea3fb
commit 951ee3f5f5
2 changed files with 43 additions and 1 deletions

View File

@ -809,6 +809,17 @@
} }
} }
}, },
"Изменить" : {
"comment" : "Message profile edit contact button",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Edit"
}
}
}
},
"Изменить контакт" : { "Изменить контакт" : {
"comment" : "Contacts context action edit" "comment" : "Contacts context action edit"
}, },
@ -2523,6 +2534,17 @@
} }
} }
}, },
"Редактирование контакта появится позже." : {
"comment" : "Message profile edit contact alert message",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Contact editing will be available later."
}
}
}
},
"Редактор контактов скоро появится. Мы сохраним имя, телефон и заметку." : { "Редактор контактов скоро появится. Мы сохраним имя, телефон и заметку." : {
"comment" : "Message profile add contact alert message" "comment" : "Message profile add contact alert message"
}, },
@ -3077,4 +3099,4 @@
} }
}, },
"version" : "1.0" "version" : "1.0"
} }

View File

@ -43,6 +43,15 @@ struct MessageProfileView: View {
.background(Color(UIColor.systemGroupedBackground).ignoresSafeArea()) .background(Color(UIColor.systemGroupedBackground).ignoresSafeArea())
.navigationTitle(NSLocalizedString("Профиль", comment: "Message profile navigation title")) .navigationTitle(NSLocalizedString("Профиль", comment: "Message profile navigation title"))
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
if canEditContact {
Button(NSLocalizedString("Изменить", comment: "Message profile edit contact button")) {
handleEditContactTap()
}
}
}
}
.alert(item: $placeholderAlert) { alert in .alert(item: $placeholderAlert) { alert in
Alert( Alert(
title: Text(alert.title), title: Text(alert.title),
@ -526,6 +535,13 @@ struct MessageProfileView: View {
) )
} }
private func handleEditContactTap() {
showPlaceholderAction(
title: NSLocalizedString("Изменить контакт", comment: "Contacts context action edit"),
message: NSLocalizedString("Редактирование контакта появится позже.", comment: "Message profile edit contact alert message")
)
}
private func handleBlockToggleTap() { private func handleBlockToggleTap() {
guard !isProcessingBlockAction else { return } guard !isProcessingBlockAction else { return }
@ -826,6 +842,10 @@ struct MessageProfileView: View {
chatProfile ?? chat.chatData chatProfile ?? chat.chatData
} }
private var canEditContact: Bool {
currentChatProfile?.relationship?.isTargetInContactsOfCurrentUser ?? false
}
private var isBlockedByCurrentUser: Bool { isBlockedByCurrentUserState } private var isBlockedByCurrentUser: Bool { isBlockedByCurrentUserState }
private var avatarUrl: URL? { private var avatarUrl: URL? {