Update strings from feedback.

This commit is contained in:
Doug
2021-08-17 15:38:01 +01:00
parent e0d171c307
commit 41506040b9
2 changed files with 15 additions and 8 deletions

View File

@@ -54,13 +54,13 @@
/** Media Messages **/
/* New image message from a specific person, not referencing a room. */
"IMAGE_FROM_USER" = "%@ sent a picture %@";
"PICTURE_FROM_USER" = "%@ sent a picture";
/* New image message from a specific person in a named room. */
"IMAGE_FROM_USER_IN_ROOM" = "%@ posted a picture %@ in %@";
/* New video message from a specific person, not referencing a room. */
"VIDEO_FROM_USER" = "%@ sent a video %@";
"VIDEO_FROM_USER" = "%@ sent a video";
/* New audio message from a specific person, not referencing a room. */
"AUDIO_FROM_USER" = "%@ sent an audio file %@";
@@ -142,7 +142,7 @@
"USER_UPDATED_AVATAR" = "%@ changed their avatar";
/* A user's membership has updated in an unknown way */
"USER_MEMBERSHIP_UPDATED" = "%@ updated their details";
"USER_MEMBERSHIP_UPDATED" = "%@ updated their profile";
/** Calls **/

View File

@@ -379,9 +379,9 @@ class NotificationService: UNNotificationServiceExtension {
case kMXMessageTypeEmote:
notificationBody = NSString.localizedUserNotificationString(forKey: "ACTION_FROM_USER", arguments: [eventSenderName, messageContent as Any])
case kMXMessageTypeImage:
notificationBody = NSString.localizedUserNotificationString(forKey: "IMAGE_FROM_USER", arguments: [eventSenderName, messageContent as Any])
notificationBody = NSString.localizedUserNotificationString(forKey: "PICTURE_FROM_USER", arguments: [eventSenderName])
case kMXMessageTypeVideo:
notificationBody = NSString.localizedUserNotificationString(forKey: "VIDEO_FROM_USER", arguments: [eventSenderName, messageContent as Any])
notificationBody = NSString.localizedUserNotificationString(forKey: "VIDEO_FROM_USER", arguments: [eventSenderName])
case kMXMessageTypeAudio:
if event.isVoiceMessage() {
notificationBody = NSString.localizedUserNotificationString(forKey: "VOICE_MESSAGE_FROM_USER", arguments: [eventSenderName])
@@ -406,17 +406,24 @@ class NotificationService: UNNotificationServiceExtension {
if NotificationService.backgroundSyncService.roomSummary(forRoomId: roomId)?.membership == .join {
notificationTitle = self.messageTitle(for: eventSenderName, in: roomDisplayName)
// If the sender's membership is join and hasn't changed.
if event.content["membership"] as? String == "join",
let prevContent = event.prevContent,
prevContent["membership"] as? String == "join" {
let previousContent = event.prevContent,
previousContent["membership"] as? String == "join" {
// Check for display name changes
if let displayname = event.content["displayname"] as? String,
let oldDisplayname = prevContent["displayname"] as? String,
let oldDisplayname = previousContent["displayname"] as? String,
displayname != oldDisplayname {
notificationBody = NSString.localizedUserNotificationString(forKey: "USER_UPDATED_DISPLAYNAME", arguments: [oldDisplayname, displayname])
} else {
// If the display name hasn't changed, handle as an avatar change.
notificationBody = NSString.localizedUserNotificationString(forKey: "USER_UPDATED_AVATAR", arguments: [eventSenderName])
}
} else {
// No known reports of having reached this situation for a membership notification
// So use a generic membership updated fallback.
notificationBody = NSString.localizedUserNotificationString(forKey: "USER_MEMBERSHIP_UPDATED", arguments: [eventSenderName])
}
// Otherwise treat the notification as an invite.