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;
/**
* @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;
- (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
* @returns nil if the recipient does not exist, or if the recipient exists and is OWSVerificationStateVerified or
* OWSVerificationStateDefault else return the no longer verified identity
* @returns nil if the recipient does not exist, or is trusted for sending
* else returns the untrusted recipient.
*/
- (nullable OWSRecipientIdentity *)noLongerVerifiedIdentityForRecipientId:(NSString *)recipientId
NS_SWIFT_NAME(noLongerVerifiedIdentity(recipientId:));
- (nullable OWSRecipientIdentity *)untrustedIdentityForSendingToRecipientId:(NSString *)recipientId;
@end

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

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

Loading…
Cancel
Save