diff --git a/ElementX/Resources/Localizations/en.lproj/Localizable.strings b/ElementX/Resources/Localizations/en.lproj/Localizable.strings index cf65b9ce8..0b5de9c78 100644 --- a/ElementX/Resources/Localizations/en.lproj/Localizable.strings +++ b/ElementX/Resources/Localizations/en.lproj/Localizable.strings @@ -1,21 +1,16 @@ "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"; @@ -38,11 +33,9 @@ "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"; @@ -94,6 +87,7 @@ "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"; @@ -238,7 +232,8 @@ "notification_invitation_action_join" = "Join"; "notification_invitation_action_reject" = "Reject"; "notification_invite_body" = "Invited you to chat"; -"notification_mentioned_you_body" = "Mentioned you: %1$@"; +"notification_mentioned_you_body" = "%1$@ mentioned you.\n%2$@"; +"notification_mentioned_you_fallback_body" = "You have been mentioned.\n%1$@"; "notification_new_messages" = "New Messages"; "notification_reaction_body" = "Reacted with %1$@"; "notification_room_action_mark_as_read" = "Mark as read"; @@ -375,7 +370,6 @@ "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."; diff --git a/ElementX/Sources/Generated/Strings.swift b/ElementX/Sources/Generated/Strings.swift index fdbcd674c..9e1a28d2b 100644 --- a/ElementX/Sources/Generated/Strings.swift +++ b/ElementX/Sources/Generated/Strings.swift @@ -18,16 +18,10 @@ 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 @@ -38,12 +32,6 @@ 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)) @@ -58,10 +46,6 @@ 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 @@ -106,16 +90,12 @@ 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 @@ -564,9 +544,15 @@ public enum L10n { } /// Invited you to chat public static var notificationInviteBody: String { return L10n.tr("Localizable", "notification_invite_body") } - /// Mentioned you: %1$@ - public static func notificationMentionedYouBody(_ p1: Any) -> String { - return L10n.tr("Localizable", "notification_mentioned_you_body", String(describing: p1)) + /// %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)) } /// New Messages public static var notificationNewMessages: String { return L10n.tr("Localizable", "notification_new_messages") } @@ -928,8 +914,6 @@ 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 @@ -1616,6 +1600,11 @@ 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 diff --git a/NSE/Sources/NotificationContentBuilder.swift b/NSE/Sources/NotificationContentBuilder.swift index 497af9132..1f1ab1914 100644 --- a/NSE/Sources/NotificationContentBuilder.swift +++ b/NSE/Sources/NotificationContentBuilder.swift @@ -101,8 +101,17 @@ struct NotificationContentBuilder { let displayName = notificationItem.senderDisplayName ?? notificationItem.roomDisplayName let message = String(messageEventStringBuilder.buildAttributedString(for: messageType, senderDisplayName: displayName, prefixWithSenderName: false).characters) - - notification.body = notificationItem.hasMention ? L10n.notificationMentionedYouBody(message) : message + 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 switch messageType { case .image(content: let content):