add thread flag for only notifying mentiongs

This commit is contained in:
ryanzhao 2021-07-26 15:42:45 +10:00
parent 798b541241
commit f0d2826403
2 changed files with 8 additions and 0 deletions

View File

@ -18,6 +18,7 @@ extern NSString *const TSGroupThread_NotificationKey_UniqueId;
@property (nonatomic, strong) TSGroupModel *groupModel;
@property (nonatomic, readonly) BOOL isOpenGroup;
@property (nonatomic, readonly) BOOL isClosedGroup;
@property (nonatomic) BOOL isOnlyNotifyMentions;
+ (instancetype)getOrCreateThreadWithGroupModel:(TSGroupModel *)groupModel;
+ (instancetype)getOrCreateThreadWithGroupModel:(TSGroupModel *)groupModel

View File

@ -14,6 +14,7 @@ public class ThreadViewModel: NSObject {
@objc public let contactSessionID: String?
@objc public let name: String
@objc public let isMuted: Bool
@objc public let isOnlyNotifyMentions: Bool
var isContactThread: Bool {
return !isGroupThread
@ -39,6 +40,12 @@ public class ThreadViewModel: NSObject {
} else {
self.contactSessionID = nil
}
if let groupThread = thread as? TSGroupThread {
self.isOnlyNotifyMentions = groupThread.isOnlyNotifyMentions
} else {
self.isOnlyNotifyMentions = false
}
self.unreadCount = thread.unreadMessageCount(transaction: transaction)
self.hasUnreadMessages = unreadCount > 0