2017-05-17 16:02:46 +02:00
|
|
|
//
|
2018-01-31 20:11:40 +01:00
|
|
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
2017-05-17 16:02:46 +02:00
|
|
|
//
|
2015-12-07 03:31:43 +01:00
|
|
|
|
|
|
|
#import "TSGroupModel.h"
|
|
|
|
#import "TSThread.h"
|
|
|
|
|
2016-10-14 23:00:29 +02:00
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
@class TSAttachmentStream;
|
2017-09-13 21:35:33 +02:00
|
|
|
@class YapDatabaseReadWriteTransaction;
|
2016-10-14 23:00:29 +02:00
|
|
|
|
2018-04-25 22:50:07 +02:00
|
|
|
extern NSString *const TSGroupThreadAvatarChangedNotification;
|
2018-05-18 21:37:38 +02:00
|
|
|
extern NSString *const TSGroupThread_NotificationKey_UniqueId;
|
2018-04-25 22:50:07 +02:00
|
|
|
|
2015-12-07 03:31:43 +01:00
|
|
|
@interface TSGroupThread : TSThread
|
2016-08-23 22:38:05 +02:00
|
|
|
|
2015-12-07 03:31:43 +01:00
|
|
|
@property (nonatomic, strong) TSGroupModel *groupModel;
|
2016-08-23 22:38:05 +02:00
|
|
|
|
2016-10-24 19:54:00 +02:00
|
|
|
+ (instancetype)getOrCreateThreadWithGroupModel:(TSGroupModel *)groupModel;
|
2015-12-07 03:31:43 +01:00
|
|
|
+ (instancetype)getOrCreateThreadWithGroupModel:(TSGroupModel *)groupModel
|
|
|
|
transaction:(YapDatabaseReadWriteTransaction *)transaction;
|
|
|
|
|
2017-10-03 19:41:48 +02:00
|
|
|
+ (instancetype)getOrCreateThreadWithGroupId:(NSData *)groupId;
|
|
|
|
+ (instancetype)getOrCreateThreadWithGroupId:(NSData *)groupId
|
|
|
|
transaction:(YapDatabaseReadWriteTransaction *)transaction;
|
2016-08-23 22:38:05 +02:00
|
|
|
|
2017-10-03 19:41:48 +02:00
|
|
|
+ (nullable instancetype)threadWithGroupId:(NSData *)groupId transaction:(YapDatabaseReadTransaction *)transaction;
|
2015-12-07 03:31:43 +01:00
|
|
|
|
2016-10-14 23:00:29 +02:00
|
|
|
+ (NSString *)threadIdFromGroupId:(NSData *)groupId;
|
|
|
|
|
2018-09-14 17:29:18 +02:00
|
|
|
+ (NSString *)defaultGroupName;
|
|
|
|
|
2017-05-17 16:35:04 +02:00
|
|
|
// all group threads containing recipient as a member
|
2018-01-25 22:40:20 +01:00
|
|
|
+ (NSArray<TSGroupThread *> *)groupThreadsWithRecipientId:(NSString *)recipientId
|
|
|
|
transaction:(YapDatabaseReadWriteTransaction *)transaction;
|
2017-05-17 16:02:46 +02:00
|
|
|
|
2018-09-10 19:25:38 +02:00
|
|
|
- (void)leaveGroupWithSneakyTransaction;
|
|
|
|
- (void)leaveGroupWithTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
|
|
|
|
2016-10-14 23:00:29 +02:00
|
|
|
- (void)updateAvatarWithAttachmentStream:(TSAttachmentStream *)attachmentStream;
|
2017-09-13 21:35:33 +02:00
|
|
|
- (void)updateAvatarWithAttachmentStream:(TSAttachmentStream *)attachmentStream
|
|
|
|
transaction:(YapDatabaseReadWriteTransaction *)transaction;
|
2016-10-14 23:00:29 +02:00
|
|
|
|
2018-05-18 21:37:38 +02:00
|
|
|
- (void)fireAvatarChangedNotification;
|
|
|
|
|
2015-12-07 03:31:43 +01:00
|
|
|
@end
|
2016-10-14 23:00:29 +02:00
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|