Merge branch 'charlesmchen/honorPrivacyInCallNotifications'

pull/1/head
Matthew Chen 8 years ago
commit fcbc709b9f

@ -63,7 +63,7 @@ NS_ASSUME_NONNULL_BEGIN
NSString *detailString;
switch (status) {
case kCallMissed:
detailString = [NSString stringWithFormat:NSLocalizedString(@"MSGVIEW_MISSED_CALL", nil), name];
detailString = [NSString stringWithFormat:NSLocalizedString(@"MSGVIEW_MISSED_CALL_WITH_NAME", nil), name];
break;
case kCallIncoming:
detailString = [NSString stringWithFormat:NSLocalizedString(@"MSGVIEW_RECEIVED_CALL", nil), name];

@ -103,8 +103,9 @@ class UserNotificationsAdaptee: NSObject, OWSCallNotificationsAdaptee, UNUserNot
case .noNameNoPreview:
return CallStrings.missedCallNotificationBody
case .nameNoPreview, .namePreview:
let format = CallStrings.missedCallNotificationBodyWithCallerName
return String(format: format, callerName)
return (Environment.getCurrent().preferences.isCallKitPrivacyEnabled()
? CallStrings.missedCallNotificationBodyWithoutCallerName
: String(format: CallStrings.missedCallNotificationBodyWithCallerName, callerName))
}}()
content.body = notificationBody

@ -10,6 +10,7 @@ import Foundation
@objc class CallStrings: NSObject {
static let callBackButtonTitle = NSLocalizedString("CALLBACK_BUTTON_TITLE", comment: "notification action")
static let missedCallNotificationBody = NSLocalizedString("MISSED_CALL", comment: "notification title")
static let missedCallNotificationBodyWithCallerName = NSLocalizedString("MSGVIEW_MISSED_CALL", comment: "notification title. Embeds {{Caller's Name}}")
static let missedCallNotificationBodyWithCallerName = NSLocalizedString("MSGVIEW_MISSED_CALL_WITH_NAME", comment: "notification title. Embeds {{Caller's Name}}")
static let missedCallNotificationBodyWithoutCallerName = NSLocalizedString("MSGVIEW_MISSED_CALL_WITHOUT_NAME", comment: "notification title.")
static let callStatusFormat = NSLocalizedString("CALL_STATUS_FORMAT", comment: "embeds {{Call Status}} in call screen label. For ongoing calls, {{Call Status}} is a seconds timer like 01:23, otherwise {{Call Status}} is a short text like 'Ringing', 'Busy', or 'Failed Call'")
}

@ -68,8 +68,9 @@
case NotificationNameNoPreview: {
notification.userInfo = @{ Signal_Call_UserInfo_Key : cThread.contactIdentifier };
notification.category = Signal_CallBack_Category;
notification.alertBody =
[NSString stringWithFormat:[CallStrings missedCallNotificationBodyWithCallerName], [thread name]];
notification.alertBody = ([[Environment getCurrent].preferences isCallKitPrivacyEnabled]
? [CallStrings missedCallNotificationBodyWithoutCallerName]
: [NSString stringWithFormat:[CallStrings missedCallNotificationBodyWithCallerName], [thread name]]);
break;
}
}
@ -135,8 +136,9 @@
}
case NotificationNameNoPreview:
case NotificationNamePreview: {
alertMessage =
[NSString stringWithFormat:[CallStrings missedCallNotificationBodyWithCallerName], callerName];
alertMessage = ([[Environment getCurrent].preferences isCallKitPrivacyEnabled]
? [CallStrings missedCallNotificationBodyWithoutCallerName]
: [NSString stringWithFormat:[CallStrings missedCallNotificationBodyWithCallerName], callerName]);
break;
}
}

@ -520,7 +520,10 @@
"MISSING_CAMERA_PERMISSION_TITLE" = "Signal needs to access your camera.";
/* notification title. Embeds {{Caller's Name}} */
"MSGVIEW_MISSED_CALL" = "Missed call from %@.";
"MSGVIEW_MISSED_CALL_WITH_NAME" = "Missed call from %@.";
/* notification title. */
"MSGVIEW_MISSED_CALL_WITHOUT_NAME" = "Missed call from Signal User.";
/* No comment provided by engineer. */
"MSGVIEW_RECEIVED_CALL" = "You received a call from %@.";

Loading…
Cancel
Save