Skip to content

Commit 2b7d095

Browse files
authored
Merge pull request #410 from zapcannon87/master
fix: limit some up commands
2 parents 292239f + 081a522 commit 2b7d095

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

Sources/RTM/IMConversation.swift

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -878,11 +878,14 @@ extension IMConversation {
878878
// MARK: Message Reading
879879

880880
private func _read(message: IMMessage?) {
881-
guard self.unreadMessageCount > 0,
881+
guard
882+
self.convType != .transient,
883+
self.unreadMessageCount > 0,
882884
let message = message ?? self.lastMessage,
883885
let messageID = message.ID,
884-
let timestamp = message.sentTimestamp else {
885-
return
886+
let timestamp = message.sentTimestamp
887+
else {
888+
return
886889
}
887890
self.isUnreadMessageContainMention = false
888891
self.client?.sendCommand(constructor: { () -> IMGenericCommand in
@@ -1169,6 +1172,17 @@ extension IMConversation {
11691172
reason: "Not support, client options not contains \(IMClient.Options.receiveUnreadMessageCountAfterSessionDidOpen).")
11701173
}
11711174
}
1175+
guard
1176+
self.convType != .transient,
1177+
self.convType != .system
1178+
else {
1179+
let convClassName = (self.convType == .transient)
1180+
? "\(IMChatRoom.self)"
1181+
: "\(IMServiceConversation.self)"
1182+
throw LCError(
1183+
code: .inconsistency,
1184+
reason: "\(convClassName) NOT support this function.")
1185+
}
11721186
self.client?.sendCommand(constructor: { () -> IMGenericCommand in
11731187
var outCommand = IMGenericCommand()
11741188
outCommand.cmd = .conv

0 commit comments

Comments
 (0)