Signal-iOS/SignalServiceKit/src/Messages/OWSProfileKeyMessage.m
Michael Kirk be197621ac Add read receipts field/configuration protos
Also converge with Android protos where possible

// FREEBIE
2017-10-02 16:03:17 -04:00

48 lines
1.3 KiB
Objective-C

//
// Copyright (c) 2017 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
- (void)saveWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
{
// override superclass with no-op.
//
// There's no need to save this message, since it's not displayed to the user.
}
- (BOOL)shouldSyncTranscript
{
return NO;
}
- (OWSSignalServiceProtosDataMessage *)buildDataMessage:(NSString *_Nullable)recipientId
{
OWSAssert(self.thread);
OWSSignalServiceProtosDataMessageBuilder *builder = [self dataMessageBuilder];
[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