2017-07-31 20:48:43 +02:00
|
|
|
//
|
|
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
2017-07-31 23:49:52 +02:00
|
|
|
extern NSString *const kNSNotificationName_LocalProfileDidChange;
|
2017-08-02 15:27:29 +02:00
|
|
|
extern NSString *const kNSNotificationName_OtherUsersProfileDidChange;
|
2017-08-01 19:53:51 +02:00
|
|
|
|
2017-07-31 20:48:43 +02:00
|
|
|
// This class can be safely accessed and used from any thread.
|
|
|
|
@interface OWSProfilesManager : NSObject
|
|
|
|
|
|
|
|
- (instancetype)init NS_UNAVAILABLE;
|
|
|
|
|
|
|
|
+ (instancetype)sharedManager;
|
|
|
|
|
2017-08-01 18:52:15 +02:00
|
|
|
#pragma mark - Local Profile
|
|
|
|
|
2017-08-01 19:53:51 +02:00
|
|
|
@property (atomic, readonly) NSData *localProfileKey;
|
2017-08-01 17:31:00 +02:00
|
|
|
@property (atomic, nullable, readonly) NSString *localProfileName;
|
|
|
|
@property (atomic, nullable, readonly) UIImage *localProfileAvatarImage;
|
2017-07-31 23:49:52 +02:00
|
|
|
|
2017-08-01 16:51:01 +02:00
|
|
|
// This method is used to update the "local profile" state on the client
|
|
|
|
// and the service. Client state is only updated if service state is
|
|
|
|
// successfully updated.
|
2017-08-01 17:31:00 +02:00
|
|
|
- (void)updateLocalProfileName:(nullable NSString *)localProfileName
|
|
|
|
localProfileAvatarImage:(nullable UIImage *)localProfileAvatarImage
|
|
|
|
success:(void (^)())successBlock
|
|
|
|
failure:(void (^)())failureBlock;
|
2017-08-01 16:51:01 +02:00
|
|
|
|
2017-08-01 22:30:24 +02:00
|
|
|
- (void)appLaunchDidBegin;
|
|
|
|
|
2017-08-01 18:52:15 +02:00
|
|
|
#pragma mark - Profile Whitelist
|
|
|
|
|
|
|
|
- (void)addUserToProfileWhitelist:(NSString *)recipientId;
|
|
|
|
|
|
|
|
- (BOOL)isUserInProfileWhitelist:(NSString *)recipientId;
|
|
|
|
|
2017-08-01 20:56:53 +02:00
|
|
|
- (void)addGroupIdToProfileWhitelist:(NSData *)groupId;
|
|
|
|
|
|
|
|
- (BOOL)isGroupIdInProfileWhitelist:(NSData *)groupId;
|
|
|
|
|
2017-08-01 19:53:51 +02:00
|
|
|
- (void)setContactRecipientIds:(NSArray<NSString *> *)contactRecipientIds;
|
|
|
|
|
2017-08-02 15:27:29 +02:00
|
|
|
#pragma mark - Other User's Profiles
|
2017-08-01 18:52:15 +02:00
|
|
|
|
|
|
|
- (void)setProfileKey:(NSData *)profileKey forRecipientId:(NSString *)recipientId;
|
|
|
|
|
|
|
|
- (nullable NSData *)profileKeyForRecipientId:(NSString *)recipientId;
|
|
|
|
|
2017-08-02 15:27:29 +02:00
|
|
|
- (nullable NSString *)profileNameForRecipientId:(NSString *)recipientId;
|
|
|
|
|
|
|
|
- (nullable UIImage *)profileAvatarForRecipientId:(NSString *)recipientId;
|
|
|
|
|
2017-07-31 20:48:43 +02:00
|
|
|
@end
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|