forked from geeeeeeeeek/electronic-wechat
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const localforage = require('localforage'); | ||
|
||
class HistoryManager { | ||
saveHistory(peerUserName, oMessage) { | ||
localforage.getItem(peerUserName).then(function(/*Array*/history){ | ||
history = history || []; | ||
history.push(oMessage); | ||
localforage.setItem(peerUserName, history); | ||
}); | ||
} | ||
|
||
getHistory(peerUserName) { | ||
return localforage.getItem(peerUserName); | ||
} | ||
} | ||
|
||
module.exports = HistoryManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
594693e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
保存图片类型的消息时有问题,debug显示是
localforage
这个lib有bug,准备替换掉它,考虑使用 leveldb 做存储。594693e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有一个bug. 我在发送信息之后. 聊天窗口上没立刻显示出我发送得信息. 在旁边得联系人窗口上有信息显示. 我需要切换联系人. 然后再切换回来. 这时我得聊天窗口才显示出来我发送得信息.
594693e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的,已知bug,我还没有搞清楚原因。
594693e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
restoreChatHistory这里的逻辑也不完善,没有处理scope.chatContent.length > 0 同时存在历史记录的情况。应该merge这2个Array。
594693e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
从群里单挑一个人聊天时,也会出现问题。scope 被重置了,需要更新引用。
594693e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eleveni386 上班路上想明白了,秘密在
window._chatContent
里。web微信的所有消息都存储在此。今晚回去有时间再修正一下。594693e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dongyuwei 太好了. 期待能修复. 另外, 我发现我在npm run build:linux之后, 执行electronic-wechat二进制文件会一直卡在splash, 和我没安装localforage依赖时得情景一样. 不知道是怎么回事. 而我直接在工程目录下执行 npm start, 就能很快得打开main windows, 跳过splash.
你微信多少? 方便交流一下.:D
594693e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eleveni386 你打开DevTools看看Console 日志有什么异常吗?
594693e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eleveni386 我的最新commit已经解决了上面所描述的几个bug,欢迎试用。我的微信id 154136125, 欢迎来交流 :)
594693e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dongyuwei 实在太棒了. 微信已加你, 确认一下吧.