Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mentioned notifications copy improvement #2144

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions ElementX/Resources/Localizations/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
"Notification" = "Notification";
"a11y_delete" = "Delete";
"a11y_hide_password" = "Hide password";
"a11y_jump_to_bottom" = "Jump to bottom";
"a11y_notifications_mentions_only" = "Mentions only";
"a11y_notifications_muted" = "Muted";
"a11y_page_n" = "Page %1$d";
"a11y_pause" = "Pause";
"a11y_pin_field" = "PIN field";
"a11y_play" = "Play";
"a11y_poll" = "Poll";
"a11y_poll_end" = "Ended poll";
"a11y_react_with" = "React with %1$@";
"a11y_react_with_other_emojis" = "React with other emojis";
"a11y_read_receipts_multiple" = "Read by %1$@ and %2$@";
"a11y_read_receipts_single" = "Read by %1$@";
"a11y_read_receipts_tap_to_show_all" = "Tap to show all";
"a11y_remove_reaction_with" = "Remove reaction with %1$@";
"a11y_send_files" = "Send files";
"a11y_show_password" = "Show password";
"a11y_start_call" = "Start a call";
Expand All @@ -33,9 +38,11 @@
"action_create" = "Create";
"action_create_a_room" = "Create a room";
"action_decline" = "Decline";
"action_delete_poll" = "Delete Poll";
"action_disable" = "Disable";
"action_done" = "Done";
"action_edit" = "Edit";
"action_edit_poll" = "Edit poll";
"action_enable" = "Enable";
"action_end_poll" = "End poll";
"action_enter_pin" = "Enter PIN";
Expand Down Expand Up @@ -87,7 +94,6 @@
"action_try_again" = "Try again";
"action_view_source" = "View source";
"action_yes" = "Yes";
"action.edit_poll" = "Edit poll";
"common_about" = "About";
"common_acceptable_use_policy" = "Acceptable use policy";
"common_advanced_settings" = "Advanced settings";
Expand Down Expand Up @@ -232,8 +238,7 @@
"notification_invitation_action_join" = "Join";
"notification_invitation_action_reject" = "Reject";
"notification_invite_body" = "Invited you to chat";
"notification_mentioned_you_body" = "%1$@ mentioned you.\n%2$@";
"notification_mentioned_you_fallback_body" = "You have been mentioned.\n%1$@";
"notification_mentioned_you_body" = "Mentioned you: %1$@";
"notification_new_messages" = "New Messages";
"notification_reaction_body" = "Reacted with %1$@";
"notification_room_action_mark_as_read" = "Mark as read";
Expand Down Expand Up @@ -370,6 +375,7 @@
"screen_create_room_public_option_title" = "Public room (anyone)";
"screen_create_room_room_name_label" = "Room name";
"screen_create_room_topic_label" = "Topic (optional)";
"screen_edit_poll_title" = "Edit poll";
"screen_edit_profile_display_name" = "Display name";
"screen_edit_profile_display_name_placeholder" = "Your display name";
"screen_edit_profile_error" = "An unknown error was encountered and the information couldn't be changed.";
Expand Down
39 changes: 25 additions & 14 deletions ElementX/Sources/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ public enum L10n {
}
/// Hide password
public static var a11yHidePassword: String { return L10n.tr("Localizable", "a11y_hide_password") }
/// Jump to bottom
public static var a11yJumpToBottom: String { return L10n.tr("Localizable", "a11y_jump_to_bottom") }
/// Mentions only
public static var a11yNotificationsMentionsOnly: String { return L10n.tr("Localizable", "a11y_notifications_mentions_only") }
/// Muted
public static var a11yNotificationsMuted: String { return L10n.tr("Localizable", "a11y_notifications_muted") }
/// Page %1$d
public static func a11yPageN(_ p1: Int) -> String {
return L10n.tr("Localizable", "a11y_page_n", p1)
}
/// Pause
public static var a11yPause: String { return L10n.tr("Localizable", "a11y_pause") }
/// PIN field
Expand All @@ -32,6 +38,12 @@ public enum L10n {
public static var a11yPoll: String { return L10n.tr("Localizable", "a11y_poll") }
/// Ended poll
public static var a11yPollEnd: String { return L10n.tr("Localizable", "a11y_poll_end") }
/// React with %1$@
public static func a11yReactWith(_ p1: Any) -> String {
return L10n.tr("Localizable", "a11y_react_with", String(describing: p1))
}
/// React with other emojis
public static var a11yReactWithOtherEmojis: String { return L10n.tr("Localizable", "a11y_react_with_other_emojis") }
/// Read by %1$@ and %2$@
public static func a11yReadReceiptsMultiple(_ p1: Any, _ p2: Any) -> String {
return L10n.tr("Localizable", "a11y_read_receipts_multiple", String(describing: p1), String(describing: p2))
Expand All @@ -46,6 +58,10 @@ public enum L10n {
}
/// Tap to show all
public static var a11yReadReceiptsTapToShowAll: String { return L10n.tr("Localizable", "a11y_read_receipts_tap_to_show_all") }
/// Remove reaction with %1$@
public static func a11yRemoveReactionWith(_ p1: Any) -> String {
return L10n.tr("Localizable", "a11y_remove_reaction_with", String(describing: p1))
}
/// Send files
public static var a11ySendFiles: String { return L10n.tr("Localizable", "a11y_send_files") }
/// Show password
Expand Down Expand Up @@ -90,12 +106,16 @@ public enum L10n {
public static var actionCreateARoom: String { return L10n.tr("Localizable", "action_create_a_room") }
/// Decline
public static var actionDecline: String { return L10n.tr("Localizable", "action_decline") }
/// Delete Poll
public static var actionDeletePoll: String { return L10n.tr("Localizable", "action_delete_poll") }
/// Disable
public static var actionDisable: String { return L10n.tr("Localizable", "action_disable") }
/// Done
public static var actionDone: String { return L10n.tr("Localizable", "action_done") }
/// Edit
public static var actionEdit: String { return L10n.tr("Localizable", "action_edit") }
/// Edit poll
public static var actionEditPoll: String { return L10n.tr("Localizable", "action_edit_poll") }
/// Enable
public static var actionEnable: String { return L10n.tr("Localizable", "action_enable") }
/// End poll
Expand Down Expand Up @@ -544,15 +564,9 @@ public enum L10n {
}
/// Invited you to chat
public static var notificationInviteBody: String { return L10n.tr("Localizable", "notification_invite_body") }
/// %1$@ mentioned you.
/// %2$@
public static func notificationMentionedYouBody(_ p1: Any, _ p2: Any) -> String {
return L10n.tr("Localizable", "notification_mentioned_you_body", String(describing: p1), String(describing: p2))
}
/// You have been mentioned.
/// %1$@
public static func notificationMentionedYouFallbackBody(_ p1: Any) -> String {
return L10n.tr("Localizable", "notification_mentioned_you_fallback_body", String(describing: p1))
/// Mentioned you: %1$@
public static func notificationMentionedYouBody(_ p1: Any) -> String {
return L10n.tr("Localizable", "notification_mentioned_you_body", String(describing: p1))
}
/// New Messages
public static var notificationNewMessages: String { return L10n.tr("Localizable", "notification_new_messages") }
Expand Down Expand Up @@ -914,6 +928,8 @@ public enum L10n {
public static var screenDmDetailsUnblockAlertDescription: String { return L10n.tr("Localizable", "screen_dm_details_unblock_alert_description") }
/// Unblock user
public static var screenDmDetailsUnblockUser: String { return L10n.tr("Localizable", "screen_dm_details_unblock_user") }
/// Edit poll
public static var screenEditPollTitle: String { return L10n.tr("Localizable", "screen_edit_poll_title") }
/// Display name
public static var screenEditProfileDisplayName: String { return L10n.tr("Localizable", "screen_edit_profile_display_name") }
/// Your display name
Expand Down Expand Up @@ -1600,11 +1616,6 @@ public enum L10n {
public static var testLanguageIdentifier: String { return L10n.tr("Localizable", "test_language_identifier") }
/// en
public static var testUntranslatedDefaultLanguageIdentifier: String { return L10n.tr("Localizable", "test_untranslated_default_language_identifier") }

public enum Action {
/// Edit poll
public static var editPoll: String { return L10n.tr("Localizable", "action.edit_poll") }
}
}
// swiftlint:enable explicit_type_interface function_parameter_count identifier_name line_length
// swiftlint:enable nesting type_body_length type_name vertical_whitespace_opening_braces
Expand Down
13 changes: 2 additions & 11 deletions NSE/Sources/NotificationContentBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,8 @@ struct NotificationContentBuilder {

let displayName = notificationItem.senderDisplayName ?? notificationItem.roomDisplayName
let message = String(messageEventStringBuilder.buildAttributedString(for: messageType, senderDisplayName: displayName, prefixWithSenderName: false).characters)
let body: String
if notificationItem.hasMention {
if let senderDisplayName = notificationItem.senderDisplayName {
body = L10n.notificationMentionedYouBody(senderDisplayName, message)
} else {
body = L10n.notificationMentionedYouFallbackBody(message)
}
} else {
body = message
}
notification.body = body

notification.body = notificationItem.hasMention ? L10n.notificationMentionedYouBody(message) : message

switch messageType {
case .image(content: let content):
Expand Down
1 change: 1 addition & 0 deletions changelog.d/2139.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mentioned notifications have a new less verbose copy.
Loading