diff --git a/yobble/Resources/Localizable.xcstrings b/yobble/Resources/Localizable.xcstrings index d218b2e..1bb003c 100644 --- a/yobble/Resources/Localizable.xcstrings +++ b/yobble/Resources/Localizable.xcstrings @@ -809,6 +809,17 @@ } } }, + "Изменить" : { + "comment" : "Message profile edit contact button", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "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" }, @@ -3077,4 +3099,4 @@ } }, "version" : "1.0" -} \ No newline at end of file +} diff --git a/yobble/Views/Chat/MessageProfileView.swift b/yobble/Views/Chat/MessageProfileView.swift index a6ba210..b283349 100644 --- a/yobble/Views/Chat/MessageProfileView.swift +++ b/yobble/Views/Chat/MessageProfileView.swift @@ -43,6 +43,15 @@ struct MessageProfileView: View { .background(Color(UIColor.systemGroupedBackground).ignoresSafeArea()) .navigationTitle(NSLocalizedString("Профиль", comment: "Message profile navigation title")) .navigationBarTitleDisplayMode(.inline) + .toolbar { + ToolbarItem(placement: .navigationBarTrailing) { + if canEditContact { + Button(NSLocalizedString("Изменить", comment: "Message profile edit contact button")) { + handleEditContactTap() + } + } + } + } .alert(item: $placeholderAlert) { alert in Alert( 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() { guard !isProcessingBlockAction else { return } @@ -826,6 +842,10 @@ struct MessageProfileView: View { chatProfile ?? chat.chatData } + private var canEditContact: Bool { + currentChatProfile?.relationship?.isTargetInContactsOfCurrentUser ?? false + } + private var isBlockedByCurrentUser: Bool { isBlockedByCurrentUserState } private var avatarUrl: URL? {