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.
session-ios/SignalServiceKit/src/Contacts/SignalRecipient.h

48 lines
2.0 KiB
C

//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
10 years ago
#import "TSYapDatabaseObject.h"
NS_ASSUME_NONNULL_BEGIN
// SignalRecipient serves two purposes:
//
// a) It serves as a cache of "known" Signal accounts. When the service indicates
// that an account exists, we make sure that an instance of SignalRecipient exists
// for that recipient id (using mark as registered).
// When the service indicates that an account does not exist, we remove any
// SignalRecipient.
// b) We hang the "known device list" for known signal accounts on this entity.
10 years ago
@interface SignalRecipient : TSYapDatabaseObject
@property (nonatomic, readonly) NSOrderedSet *devices;
- (instancetype)init NS_UNAVAILABLE;
10 years ago
+ (nullable instancetype)registeredRecipientForRecipientId:(NSString *)recipientId
transaction:(YapDatabaseReadTransaction *)transaction;
7 years ago
+ (instancetype)getOrBuildUnsavedRecipientForRecipientId:(NSString *)recipientId
transaction:(YapDatabaseReadTransaction *)transaction;
10 years ago
- (void)updateRegisteredRecipientWithDevicesToAdd:(nullable NSArray *)devicesToAdd
devicesToRemove:(nullable NSArray *)devicesToRemove
transaction:(YapDatabaseReadWriteTransaction *)transaction;
10 years ago
- (NSString *)recipientId;
- (NSComparisonResult)compare:(SignalRecipient *)other;
7 years ago
+ (BOOL)isRegisteredRecipient:(NSString *)recipientId transaction:(YapDatabaseReadTransaction *)transaction;
+ (SignalRecipient *)markRecipientAsRegisteredAndGet:(NSString *)recipientId
transaction:(YapDatabaseReadWriteTransaction *)transaction;
+ (void)markRecipientAsRegistered:(NSString *)recipientId
deviceId:(UInt32)deviceId
transaction:(YapDatabaseReadWriteTransaction *)transaction;
+ (void)removeUnregisteredRecipient:(NSString *)recipientId transaction:(YapDatabaseReadWriteTransaction *)transaction;
10 years ago
@end
NS_ASSUME_NONNULL_END