Attach a profile key if we're friends with a contact.

This commit is contained in:
Mikunj 2019-11-29 13:21:09 +11:00
parent 9cde326254
commit eafc2afe4a
2 changed files with 6 additions and 1 deletions

View File

@ -916,6 +916,8 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
TSGroupThread *groupThread = (TSGroupThread *)thread;
NSData *groupId = groupThread.groupModel.groupId;
return [self isGroupIdInProfileWhitelist:groupId];
} else if (thread.friendRequestStatus == LKThreadFriendRequestStatusFriends) {
return true;
} else {
NSString *recipientId = thread.contactIdentifier;
return [self isUserInProfileWhitelist:recipientId];
@ -1067,7 +1069,7 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error);
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
if (userProfile.avatarUrlPath.length < 1) {
OWSFailDebug(@"Malformed avatar URL: %@", userProfile.avatarUrlPath);
OWSLogDebug(@"Skipping downloading avatar for %@ because url is not set", userProfile.recipientId);
return;
}
NSString *_Nullable avatarUrlPathAtStart = userProfile.avatarUrlPath;

View File

@ -8,6 +8,7 @@
#import "OWSContactsOutputStream.h"
#import "OWSIdentityManager.h"
#import "ProfileManagerProtocol.h"
#import "ProtoUtils.h"
#import "SSKEnvironment.h"
#import "SignalAccount.h"
#import "TSAccountManager.h"
@ -111,6 +112,8 @@ NS_ASSUME_NONNULL_BEGIN
[profileBuilder setProfilePicture:profilePictureURL ?: @""];
SSKProtoDataMessageBuilder *messageBuilder = [SSKProtoDataMessage builder];
[messageBuilder setProfile:[profileBuilder buildAndReturnError:nil]];
[ProtoUtils addLocalProfileKeyToDataMessageBuilder:messageBuilder];
SSKProtoSyncMessageSentBuilder *transcriptBuilder = [SSKProtoSyncMessageSent builder];
[transcriptBuilder setMessage:[messageBuilder buildAndReturnError:nil]];
[syncMessageBuilder setSent:[transcriptBuilder buildAndReturnError:nil]];