restore call-back for changed identities

// FREEBIE
pull/1/head
Michael Kirk 9 years ago
parent 12b5c2c26a
commit 167961a45f

@ -22,12 +22,6 @@ extern NSString *const kNSNotificationName_IdentityStateDidChange;
+ (instancetype)sharedManager; + (instancetype)sharedManager;
/**
* @param recipientId unique stable identifier for the recipient, e.g. e164 phone number
* @returns if the recipient's current identity is trusted.
*/
- (BOOL)isCurrentIdentityTrustedForSendingToRecipientId:(NSString *)recipientId;
- (void)generateNewIdentityKey; - (void)generateNewIdentityKey;
- (nullable NSData *)identityKeyForRecipientId:(NSString *)recipientId; - (nullable NSData *)identityKeyForRecipientId:(NSString *)recipientId;
@ -41,11 +35,10 @@ extern NSString *const kNSNotificationName_IdentityStateDidChange;
/** /**
* @param recipientId unique stable identifier for the recipient, e.g. e164 phone number * @param recipientId unique stable identifier for the recipient, e.g. e164 phone number
* @returns nil if the recipient does not exist, or if the recipient exists and is OWSVerificationStateVerified or * @returns nil if the recipient does not exist, or is trusted for sending
* OWSVerificationStateDefault else return the no longer verified identity * else returns the untrusted recipient.
*/ */
- (nullable OWSRecipientIdentity *)noLongerVerifiedIdentityForRecipientId:(NSString *)recipientId - (nullable OWSRecipientIdentity *)untrustedIdentityForSendingToRecipientId:(NSString *)recipientId;
NS_SWIFT_NAME(noLongerVerifiedIdentity(recipientId:));
@end @end

@ -78,18 +78,6 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa
return self; return self;
} }
- (BOOL)isCurrentIdentityTrustedForSendingToRecipientId:(NSString *)recipientId
{
OWSAssert(recipientId.length > 0);
@synchronized(self)
{
OWSRecipientIdentity *currentIdentity = [OWSRecipientIdentity fetchObjectWithUniqueID:recipientId];
return [self isTrustedIdentityKey:currentIdentity.identityKey
recipientId:recipientId
direction:TSMessageDirectionOutgoing];
}
}
- (void)generateNewIdentityKey - (void)generateNewIdentityKey
{ {
@ -236,19 +224,22 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa
} }
} }
- (nullable OWSRecipientIdentity *)noLongerVerifiedIdentityForRecipientId:(NSString *)recipientId - (nullable OWSRecipientIdentity *)untrustedIdentityForSendingToRecipientId:(NSString *)recipientId
{ {
OWSAssert(recipientId.length > 0); OWSAssert(recipientId.length > 0);
@synchronized(self) @synchronized(self)
{ {
OWSRecipientIdentity *_Nullable identity = [OWSRecipientIdentity fetchObjectWithUniqueID:recipientId]; OWSRecipientIdentity *_Nullable recipientIdentity = [OWSRecipientIdentity fetchObjectWithUniqueID:recipientId];
BOOL isTrusted = [self isTrustedIdentityKey:recipientIdentity.identityKey
if (identity && identity.verificationState == OWSVerificationStateNoLongerVerified) { recipientId:recipientId
return identity; direction:TSMessageDirectionOutgoing];
if (isTrusted) {
return nil;
} else {
return recipientIdentity;
} }
} }
return nil;
} }
- (void)fireIdentityStateChangeNotification - (void)fireIdentityStateChangeNotification

@ -202,7 +202,7 @@ NS_ASSUME_NONNULL_BEGIN
*/ */
- (NSString *)descriptionForSyncMessage:(OWSSignalServiceProtosSyncMessage *)syncMessage - (NSString *)descriptionForSyncMessage:(OWSSignalServiceProtosSyncMessage *)syncMessage
{ {
NSMutableString *description = [[NSMutableString alloc] initWithString:@"CallMessage: "]; NSMutableString *description = [[NSMutableString alloc] initWithString:@""];
if (syncMessage.hasSent) { if (syncMessage.hasSent) {
[description appendString:@"SentTranscript"]; [description appendString:@"SentTranscript"];
} else if (syncMessage.hasRequest) { } else if (syncMessage.hasRequest) {

Loading…
Cancel
Save