@aochuang/client-sdk 1.0.291 → 1.0.293

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aochuang/client-sdk",
3
- "version": "1.0.291",
3
+ "version": "1.0.293",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -861,7 +861,7 @@ export default class ClientChatContacts {
861
861
  // 一般用在切换群的时候,把前一次的群缓存的数据清理一下,避免占用内存
862
862
  clearRoomMemberData (roomId) {
863
863
  this.setRoomMemberData(roomId, null)
864
- if (this.loadRoomMemberDataPromiseMap[roomId]) {
864
+ if (this.loadRoomMemberDataPromiseMap && this.loadRoomMemberDataPromiseMap[roomId]) {
865
865
  delete this.loadRoomMemberDataPromiseMap[roomId]
866
866
  }
867
867
  }
@@ -152,6 +152,23 @@ class ClientChat {
152
152
  } else {
153
153
  this.sessionUnread.updateSession(session.conversationId, session)
154
154
  }
155
+ // 更新账号未读消息数量
156
+ this.account.updateAccountUnreadMessageNum(session.wechatAccountId, ({ unreadMesasgeNum, unreadMessageMuteNum }) => {
157
+ const beforeUnreadMsgCount = changeProps.unreadMsgCount.before || 0
158
+ const afterUnreadMsgCount = changeProps.unreadMsgCount.after || 0
159
+ const nextUnreadMessageNum = Math.max(0, (unreadMesasgeNum || 0) - beforeUnreadMsgCount) + afterUnreadMsgCount
160
+ if (session.mute) {
161
+ return {
162
+ num: nextUnreadMessageNum,
163
+ muteNum: Math.max(0, (unreadMessageMuteNum || 0) - beforeUnreadMsgCount) + afterUnreadMsgCount
164
+ }
165
+ } else {
166
+ return {
167
+ num: nextUnreadMessageNum,
168
+ muteNum: unreadMessageMuteNum || 0
169
+ }
170
+ }
171
+ })
155
172
  }
156
173
  const sessionInstances = this.sessionManage.getSessionInstacesBySessionId(session.conversationId)
157
174
  sessionInstances.forEach(sessionInstance => {
@@ -775,21 +792,6 @@ class ClientChat {
775
792
  }))
776
793
  }
777
794
  },
778
- // 群聊有变化,如分配的情况
779
- onCmdChatroomInfoChanged: ({ data }) => {
780
- // 移除群聊
781
- if (data.changeType === 3) {
782
- this.contacts.removeRoom(data.wechatChatroomId)
783
- } else {
784
- // 其他情况就重新刷新一下群信息
785
- if (this.sessionManage.currentSession && this.sessionManage.currentSession.targetId === data.wechatChatroomId) {
786
- this.contacts.getRoom(data.wechatChatroomId, true) // 强制刷新群数据
787
- this.contacts.loadRoomMemberData(data.wechatChatroomId, { // 强制刷新群成员数据,因为有可能群主变化了
788
- wechatChatroomId: data.wechatChatroomId
789
- }, true)
790
- }
791
- }
792
- },
793
795
  onCmdChatroomMemberInfoChanged: ({ data }) => {
794
796
  // 如果没有changeType的时候,目前看应该是群成员或者群信息变化了,需要重新刷新一下群成员和群信息
795
797
  if (this.sessionManage.currentSession && this.sessionManage.currentSession.targetId === data.wechatChatroomId) {
@@ -905,17 +907,18 @@ class ClientChat {
905
907
  if (session) {
906
908
  this.session.removeSession(session.conversationId)
907
909
  }
908
- // 删除好友
910
+ // 删除群聊
909
911
  this.contacts.removeRoom(data.wechatChatroomId)
910
912
  }
911
- // 更新好友
912
- else if (data.changeType === 2) {
913
- this.contacts.getRoom({
914
- wechatAccountId: data.wechatAccountId,
915
- wechatChatroomId: data.wechatChatroomId
916
- }).then(rs => {
917
- this.contacts.updateRoom(data.wechatChatroomId, rs.data)
918
- })
913
+ // 更新群聊
914
+ else {
915
+ // 其他情况就重新刷新一下群信息
916
+ if (this.sessionManage.currentSession && this.sessionManage.currentSession.targetId === data.wechatChatroomId) {
917
+ this.contacts.getRoom(data.wechatChatroomId, true) // 强制刷新群数据
918
+ this.contacts.loadRoomMemberData(data.wechatChatroomId, { // 强制刷新群成员数据,因为有可能群主变化了
919
+ wechatChatroomId: data.wechatChatroomId
920
+ }, true)
921
+ }
919
922
  }
920
923
  },
921
924
  // 下载视频任务