mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
Objective-C
47 lines
1.1 KiB
Objective-C
//
|
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
#import "OWSProfileKeyMessage.h"
|
|
#import "OWSSignalServiceProtos.pb.h"
|
|
#import "ProfileManagerProtocol.h"
|
|
#import "ProtoBuf+OWS.h"
|
|
#import "TextSecureKitEnv.h"
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@implementation OWSProfileKeyMessage
|
|
|
|
- (BOOL)shouldBeSaved
|
|
{
|
|
return NO;
|
|
}
|
|
|
|
- (BOOL)shouldSyncTranscript
|
|
{
|
|
return NO;
|
|
}
|
|
|
|
- (OWSSignalServiceProtosDataMessage *)buildDataMessage:(NSString *_Nullable)recipientId
|
|
{
|
|
OWSAssert(self.thread);
|
|
|
|
OWSSignalServiceProtosDataMessageBuilder *builder = [self dataMessageBuilder];
|
|
[builder setTimestamp:self.timestamp];
|
|
[builder addLocalProfileKey];
|
|
[builder setFlags:OWSSignalServiceProtosDataMessageFlagsProfileKeyUpdate];
|
|
|
|
if (recipientId.length > 0) {
|
|
// Once we've shared our profile key with a user (perhaps due to being
|
|
// a member of a whitelisted group), make sure they're whitelisted.
|
|
id<ProfileManagerProtocol> profileManager = [TextSecureKitEnv sharedEnv].profileManager;
|
|
[profileManager addUserToProfileWhitelist:recipientId];
|
|
}
|
|
|
|
return [builder build];
|
|
}
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|