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 @@