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.
52 lines
1.0 KiB
Matlab
52 lines
1.0 KiB
Matlab
|
9 years ago
|
//
|
||
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||
|
|
//
|
||
|
|
|
||
|
|
#import "SignalAccount.h"
|
||
|
|
#import "SignalRecipient.h"
|
||
|
|
#import "TSStorageManager.h"
|
||
|
|
|
||
|
|
NS_ASSUME_NONNULL_BEGIN
|
||
|
|
|
||
|
|
@interface SignalAccount ()
|
||
|
|
|
||
|
|
@property (nonatomic) NSString *recipientId;
|
||
|
|
|
||
|
|
@end
|
||
|
|
|
||
|
|
#pragma mark -
|
||
|
|
|
||
|
|
@implementation SignalAccount
|
||
|
|
|
||
|
|
- (instancetype)initWithSignalRecipient:(SignalRecipient *)signalRecipient
|
||
|
|
{
|
||
|
|
if (self = [super init]) {
|
||
|
|
OWSAssert(signalRecipient);
|
||
|
|
|
||
|
|
_recipientId = signalRecipient.uniqueId;
|
||
|
|
}
|
||
|
|
return self;
|
||
|
|
}
|
||
|
|
|
||
|
|
- (instancetype)initWithRecipientId:(NSString *)recipientId
|
||
|
|
{
|
||
|
|
if (self = [super init]) {
|
||
|
|
OWSAssert(recipientId.length > 0);
|
||
|
|
|
||
|
|
_recipientId = recipientId;
|
||
|
|
}
|
||
|
|
return self;
|
||
|
|
}
|
||
|
|
|
||
|
|
- (nullable SignalRecipient *)signalRecipientWithTransaction:(YapDatabaseReadTransaction *)transaction
|
||
|
|
{
|
||
|
|
OWSAssert([NSThread isMainThread]);
|
||
|
|
OWSAssert(transaction);
|
||
|
|
|
||
|
|
return [SignalRecipient recipientWithTextSecureIdentifier:self.recipientId withTransaction:transaction];
|
||
|
|
}
|
||
|
|
|
||
|
|
@end
|
||
|
|
|
||
|
|
NS_ASSUME_NONNULL_END
|