Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
trazyn committed Jul 16, 2018
1 parent aa7a3fa commit 52dd1da
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
26 changes: 15 additions & 11 deletions src/js/stores/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function resolveMessage(message) {
break;
case 3:
// Image
let image = helper.parseKV(content);
let image = {};
image.src = `${axios.defaults.baseURL}cgi-bin/mmwebwx-bin/webwxgetmsgimg?&msgid=${message.MsgId}&skey=${auth.skey}`;
message.image = image;
break;
Expand Down Expand Up @@ -177,15 +177,19 @@ async function resolveMessage(message) {
function hasUnreadMessage(messages) {
var counter = 0;

messages.keys().map(e => {
var item = messages.get(e);

counter += (item.data.length - item.unread);
});
Array.from(messages.keys()).map(
e => {
var item = messages.get(e);
counter += (item.data.length - item.unread);
}
);

ipcRenderer.send('message-unread', {
counter,
});
ipcRenderer.send(
'message-unread',
{
counter,
}
);
}

async function updateMenus({ conversations = [], contacts = [] }) {
Expand Down Expand Up @@ -524,8 +528,7 @@ class Chat {
FromUserName: message.from,
ToUserName: message.to,
ClientMsgId: message.ClientMsgId,
LocalID: message.LocalID,
MediaId: message.file.mediaId,
LocalID: '',
Type: 3,
},
Scene: isForward ? 2 : 0,
Expand Down Expand Up @@ -692,6 +695,7 @@ class Chat {
return false;
}
} catch (ex) {
console.error('Failed to send message: %o', ex);
return false;
}

Expand Down
9 changes: 6 additions & 3 deletions src/js/stores/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,12 @@ class Session {
}
};

response.data.AddMsgList.map(async e => {
await chat.loadChats(e.StatusNotifyUserName);
});
// Load the rencets chats
response.data.AddMsgList.map(
async e => {
await chat.loadChats(e.StatusNotifyUserName);
}
);

self.loading = false;
self.genSyncKey(response.data.SyncCheckKey.List);
Expand Down

0 comments on commit 52dd1da

Please sign in to comment.