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.
84 lines
3.5 KiB
C
84 lines
3.5 KiB
C
7 years ago
|
//
|
||
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import <SignalServiceKit/TSYapDatabaseObject.h>
|
||
|
|
||
|
NS_ASSUME_NONNULL_BEGIN
|
||
|
|
||
|
typedef void (^OWSUserProfileCompletion)(void);
|
||
|
|
||
|
@class OWSAES256Key;
|
||
|
|
||
|
extern NSString *const kLocalProfileUniqueId;
|
||
|
|
||
|
// This class should be completely thread-safe.
|
||
|
@interface OWSUserProfile : TSYapDatabaseObject
|
||
|
|
||
|
@property (atomic, readonly) NSString *recipientId;
|
||
|
@property (atomic, readonly, nullable) OWSAES256Key *profileKey;
|
||
|
@property (atomic, readonly, nullable) NSString *profileName;
|
||
|
@property (atomic, readonly, nullable) NSString *avatarUrlPath;
|
||
|
// This filename is relative to OWSProfileManager.profileAvatarsDirPath.
|
||
|
@property (atomic, readonly, nullable) NSString *avatarFileName;
|
||
|
|
||
|
// This should reflect when either:
|
||
|
//
|
||
|
// * The last successful update finished.
|
||
|
// * The current in-flight update began.
|
||
|
@property (atomic, readonly, nullable) NSDate *lastUpdateDate;
|
||
|
|
||
|
- (instancetype)init NS_UNAVAILABLE;
|
||
|
|
||
|
+ (OWSUserProfile *)getOrBuildUserProfileForRecipientId:(NSString *)recipientId
|
||
|
dbConnection:(YapDatabaseConnection *)dbConnection;
|
||
|
|
||
|
#pragma mark - Update With... Methods
|
||
|
|
||
|
- (void)updateWithProfileName:(nullable NSString *)profileName
|
||
|
profileKey:(OWSAES256Key *)profileKey
|
||
|
avatarUrlPath:(nullable NSString *)avatarUrlPath
|
||
|
avatarFileName:(nullable NSString *)avatarFileName
|
||
|
dbConnection:(YapDatabaseConnection *)dbConnection
|
||
|
completion:(nullable OWSUserProfileCompletion)completion;
|
||
|
|
||
|
- (void)updateWithProfileName:(nullable NSString *)profileName
|
||
|
avatarUrlPath:(nullable NSString *)avatarUrlPath
|
||
|
avatarFileName:(nullable NSString *)avatarFileName
|
||
|
dbConnection:(YapDatabaseConnection *)dbConnection
|
||
|
completion:(nullable OWSUserProfileCompletion)completion;
|
||
|
|
||
|
- (void)updateWithProfileName:(nullable NSString *)profileName
|
||
|
avatarUrlPath:(nullable NSString *)avatarUrlPath
|
||
|
avatarFileName:(nullable NSString *)avatarFileName
|
||
|
lastUpdateDate:(nullable NSDate *)lastUpdateDate
|
||
|
dbConnection:(YapDatabaseConnection *)dbConnection
|
||
|
completion:(nullable OWSUserProfileCompletion)completion;
|
||
|
|
||
|
- (void)updateWithProfileName:(nullable NSString *)profileName
|
||
|
avatarUrlPath:(nullable NSString *)avatarUrlPath
|
||
|
lastUpdateDate:(nullable NSDate *)lastUpdateDate
|
||
|
dbConnection:(YapDatabaseConnection *)dbConnection
|
||
|
completion:(nullable OWSUserProfileCompletion)completion;
|
||
|
|
||
|
- (void)updateWithAvatarUrlPath:(nullable NSString *)avatarUrlPath
|
||
|
avatarFileName:(nullable NSString *)avatarFileName
|
||
|
dbConnection:(YapDatabaseConnection *)dbConnection
|
||
|
completion:(nullable OWSUserProfileCompletion)completion;
|
||
|
|
||
|
- (void)updateWithAvatarFileName:(nullable NSString *)avatarFileName
|
||
|
dbConnection:(YapDatabaseConnection *)dbConnection
|
||
|
completion:(nullable OWSUserProfileCompletion)completion;
|
||
|
|
||
|
- (void)updateWithLastUpdateDate:(nullable NSDate *)lastUpdateDate
|
||
|
dbConnection:(YapDatabaseConnection *)dbConnection
|
||
|
completion:(nullable OWSUserProfileCompletion)completion;
|
||
|
|
||
|
- (void)clearWithProfileKey:(OWSAES256Key *)profileKey
|
||
|
dbConnection:(YapDatabaseConnection *)dbConnection
|
||
|
completion:(nullable OWSUserProfileCompletion)completion;
|
||
|
|
||
|
@end
|
||
|
|
||
|
NS_ASSUME_NONNULL_END
|