diff --git a/Signal/src/textsecure/Messages/InvalidKeyMessages/TSInvalidIdentityKeySendingErrorMessage.h b/Signal/src/textsecure/Messages/InvalidKeyMessages/TSInvalidIdentityKeySendingErrorMessage.h index 243f6e52e..004adf78e 100644 --- a/Signal/src/textsecure/Messages/InvalidKeyMessages/TSInvalidIdentityKeySendingErrorMessage.h +++ b/Signal/src/textsecure/Messages/InvalidKeyMessages/TSInvalidIdentityKeySendingErrorMessage.h @@ -21,4 +21,6 @@ preKeyBundle:(PreKeyBundle*)preKeyBundle withTransaction:(YapDatabaseReadWriteTransaction*)transaction; +- (NSString*)recipientId; + @end diff --git a/Signal/src/view controllers/MessagesViewController.m b/Signal/src/view controllers/MessagesViewController.m index ffc9c672b..b2b0cf735 100644 --- a/Signal/src/view controllers/MessagesViewController.m +++ b/Signal/src/view controllers/MessagesViewController.m @@ -1101,7 +1101,16 @@ typedef enum : NSUInteger { if ([message isKindOfClass:[TSInvalidIdentityKeyErrorMessage class]]) { TSInvalidIdentityKeyErrorMessage *errorMessage = (TSInvalidIdentityKeyErrorMessage*)message; NSString *newKeyFingerprint = [errorMessage newIdentityKey]; - NSString *messageString = [NSString stringWithFormat:NSLocalizedString(@"ACCEPT_IDENTITYKEY_QUESTION", @""), _thread.name, newKeyFingerprint]; + + NSString *keyOwner; + if ([message isKindOfClass:[TSInvalidIdentityKeySendingErrorMessage class]]) { + TSInvalidIdentityKeySendingErrorMessage *m = (TSInvalidIdentityKeySendingErrorMessage*)message; + keyOwner = [[[Environment getCurrent] contactsManager] nameStringForPhoneIdentifier:m.recipientId]; + } else { + keyOwner = [self.thread name]; + } + + NSString *messageString = [NSString stringWithFormat:NSLocalizedString(@"ACCEPT_IDENTITYKEY_QUESTION", @""), keyOwner, newKeyFingerprint]; NSArray *actions = @[NSLocalizedString(@"ACCEPT_IDENTITYKEY_BUTTON", @""), NSLocalizedString(@"COPY_IDENTITYKEY_BUTTON", @"")]; [self dismissKeyBoard];