diff --git a/package.json b/package.json index d4abae9..160de52 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "usbmux": "^0.1.0", "v-lazy-image": "^1.4.0", "vue": "^2.6.11", + "vue-avatar": "^2.3.3", "vue-confirm-dialog": "^1.0.2", "vue-feather": "^1.1.1", "vue-js-popover": "^1.2.1", @@ -65,4 +66,4 @@ "vue-devtools": "^5.1.4", "vue-template-compiler": "^2.6.11" } -} \ No newline at end of file +} diff --git a/src/App.vue b/src/App.vue index 872a2f1..b5a37cb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -24,6 +24,9 @@ + @@ -43,6 +46,7 @@ :read="chat.read" :docid="chat.docid" :showNum="chat.showNum" + :isGroup="chat.personId.startsWith('chat') && !chat.personId.includes('@') && chat.personId.length >= 20" @deleted="deleteChat(chat)"> @@ -129,6 +133,7 @@ export default { methods: { markAsRead (val) { let chatIndex = this.chats.findIndex(obj => obj.personId == val) + if (chatIndex > -1) { let chat = this.chats[chatIndex] @@ -265,6 +270,13 @@ export default { } }) + $(document).mousedown(event => { + if (event.which == 3) { + //this is a right click, so electron-context-menu will be appearing momentarily... + ipcRenderer.send('rightClickMessage', null) + } + }) + ipcRenderer.send('loaded') ipcRenderer.on('update_available', () => { @@ -363,7 +375,7 @@ export default { const notification = { title: messageData.name, - body: body, + body: body == '' ? 'Attachment' : body, silent: !this.$store.state.systemSound } @@ -409,8 +421,8 @@ export default { if (reactions && reactions.length > 0 && reactions[0].sender != 1 && remote.Notification.isSupported()) { let reaction = reactions[0] if (this.$store.state.mutedChats.includes(reaction.personId)) return - if (this.lastNotificationGUID == messageData.guid) return - this.lastNotificationGUID = messageData.guid + if (this.lastNotificationGUID == reaction.guid) return + this.lastNotificationGUID = reaction.guid const notification = { title: chatData.author, diff --git a/src/assets/profile.jpg b/src/assets/profile.jpg index e7ca3a2..21cf4d9 100644 Binary files a/src/assets/profile.jpg and b/src/assets/profile.jpg differ diff --git a/src/background.js b/src/background.js index ab538b0..6e9d256 100644 --- a/src/background.js +++ b/src/background.js @@ -19,6 +19,7 @@ const autoLauncher = new AutoLaunch({ let tray = null let win = null let startMinimized = (process.argv || []).indexOf('--hidden') !== -1; +let rightClickedMessage = null // Scheme must be registered before the app is ready protocol.registerSchemesAsPrivileged([ @@ -27,6 +28,13 @@ protocol.registerSchemesAsPrivileged([ contextMenu({ prepend: (defaultActions, params, browserWindow) => [ + { + label: "Tapback", + visible: rightClickedMessage !== null, + click() { + win.webContents.send('reactToMessage', rightClickedMessage) + } + } ] }) @@ -49,7 +57,8 @@ async function createWindow() { nodeIntegration: true, preload: path.join(__dirname, 'preload.js'), enableRemoteModule: true, - devTools: isDevelopment && !process.env.IS_TEST + devTools: isDevelopment && !process.env.IS_TEST, + spellcheck: true }, icon: path.join(__static, 'icon.png'), title: 'WebMessage' @@ -103,6 +112,19 @@ async function createWindow() { } win.webContents.send('win_id', win.id) + + win.webContents.session.on('will-download', (event, item, webContents) => { + item.on('updated', (event, state) => { + if (state === 'interrupted') { + console.log('Download is interrupted but can be resumed') + } else if (state === 'progressing') { + win.setProgressBar(item.getReceivedBytes()/item.getTotalBytes()) + } + }) + item.once('done', (event, state) => { + win.setProgressBar(-1) + }) + }) } async function loadURL () { @@ -191,6 +213,10 @@ ipcMain.on('loaded', (event) => { registerShortcuts() }) +ipcMain.on('rightClickMessage', (event, args) => { + rightClickedMessage = args +}) + ipcMain.on('app_version', (event) => { event.sender.send('app_version', { version: app.getVersion() }) }) diff --git a/src/components/AudioPlayer.vue b/src/components/AudioPlayer.vue new file mode 100644 index 0000000..755f21f --- /dev/null +++ b/src/components/AudioPlayer.vue @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file diff --git a/src/components/Avatar.vue b/src/components/Avatar.vue new file mode 100644 index 0000000..0038589 --- /dev/null +++ b/src/components/Avatar.vue @@ -0,0 +1,118 @@ +// Forked from eliep/vue-avatar + + + + \ No newline at end of file diff --git a/src/components/Chat.vue b/src/components/Chat.vue index 03201f2..954a0eb 100644 --- a/src/components/Chat.vue +++ b/src/components/Chat.vue @@ -3,7 +3,12 @@
- +
@@ -31,9 +36,10 @@ + + \ No newline at end of file diff --git a/src/components/ReactionMenu.vue b/src/components/ReactionMenu.vue index 121d696..d605fd0 100644 --- a/src/components/ReactionMenu.vue +++ b/src/components/ReactionMenu.vue @@ -34,7 +34,8 @@ export default { target: { type: Object }, guid: { type: String }, part: { type: Number }, - reactions: { type: Array } + reactions: { type: Array }, + balloon: { type: Boolean, default: false } }, watch: { target(newTarget) { @@ -53,7 +54,7 @@ export default { if (newTarget == null) return let target = newTarget.children().last() - let parent = newTarget.parent().parent() + let parent = newTarget.parent().parent().parent() let p = target.offset() let w = target.width() let h = target.height() @@ -93,7 +94,7 @@ export default { this.position.left = (p.left - 15) + 'px' } - let activeReactionsList = this.reactions.filter(reaction => reaction.reactionType >= 2000 && reaction.reactionType < 3000 && reaction.sender == 1 && reaction.forPart == this.part) + let activeReactionsList = this.reactions.filter(reaction => reaction.reactionType >= 2000 && reaction.reactionType < 3000 && reaction.sender == 1 && reaction.forPart == (this.balloon ? 'b' : this.part)) this.activeReactions = [] activeReactionsList.forEach((reaction) => { this.activeReactions.push(reaction.reactionType) @@ -175,7 +176,7 @@ export default { content: ""; position: absolute; bottom: -5px; - right: 20px; + right: 11px; width: 10px; height: 10px; border-radius: 50%; @@ -185,8 +186,8 @@ export default { &:before { content: ""; position: absolute; - bottom: -12px; - right: 19px; + bottom: -11px; + right: 9px; width: 6px; height: 6px; border-radius: 50%; @@ -195,12 +196,12 @@ export default { &.left { &:after { - left: 20px; + left: 11px; right: unset; } &:before { - left: 19px; + left: 9px; right: unset; } } diff --git a/src/components/Reactions.vue b/src/components/Reactions.vue index 6a19b18..98b2cae 100644 --- a/src/components/Reactions.vue +++ b/src/components/Reactions.vue @@ -22,11 +22,13 @@ export default { targetFromMe: { type: Boolean }, target: { type: String }, part: { type: Number }, - click: { type: Function } + click: { type: Function }, + balloon: { type: Boolean, default: false }, }, computed: { reactionList() { - let reactions = this.reactions.filter(reaction => reaction.reactionType >= 2000 && reaction.reactionType < 3000 && reaction.forPart == this.part) + if (!this.reactions) return [] + let reactions = this.reactions.filter(reaction => reaction.reactionType >= 2000 && reaction.reactionType < 3000 && reaction.forPart == (this.balloon ? 'b' : this.part)) let reactionFromMe = null reactions.forEach((reaction) => { diff --git a/src/components/Settings.vue b/src/components/Settings.vue index b0150fe..a89d809 100644 --- a/src/components/Settings.vue +++ b/src/components/Settings.vue @@ -6,67 +6,74 @@