mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-02-09 08:18:44 +01:00
refs #190 Sound a system sound when user favourite or reblog
This commit is contained in:
parent
814a784ddf
commit
b6123f6bd3
@ -24,7 +24,7 @@ else if (process.env.BUILD_TARGET === 'web') web()
|
|||||||
else build()
|
else build()
|
||||||
|
|
||||||
function clean () {
|
function clean () {
|
||||||
del.sync(['build/*', '!build/icons', '!build/icons/icon.*'])
|
del.sync(['build/*', '!build/icons', '!build/icons/icon.*', '!build/sounds', '!build/sounds/*'])
|
||||||
console.log(`\n${doneLog}\n`)
|
console.log(`\n${doneLog}\n`)
|
||||||
process.exit()
|
process.exit()
|
||||||
}
|
}
|
||||||
|
5
package-lock.json
generated
5
package-lock.json
generated
@ -13699,6 +13699,11 @@
|
|||||||
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
|
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"simplayer": {
|
||||||
|
"version": "0.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/simplayer/-/simplayer-0.0.8.tgz",
|
||||||
|
"integrity": "sha1-8gzrIzFmrH84J0VmbSPzxIeSw8g="
|
||||||
|
},
|
||||||
"single-line-log": {
|
"single-line-log": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/single-line-log/-/single-line-log-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/single-line-log/-/single-line-log-1.1.2.tgz",
|
||||||
|
@ -39,6 +39,9 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"output": "build"
|
"output": "build"
|
||||||
},
|
},
|
||||||
|
"extraResources": [
|
||||||
|
"build/sounds/"
|
||||||
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"dist/electron/**/*",
|
"dist/electron/**/*",
|
||||||
"build/icons/*"
|
"build/icons/*"
|
||||||
@ -87,6 +90,7 @@
|
|||||||
"mastodon-api": "^1.3.0",
|
"mastodon-api": "^1.3.0",
|
||||||
"moment": "^2.21.0",
|
"moment": "^2.21.0",
|
||||||
"nedb": "^1.8.0",
|
"nedb": "^1.8.0",
|
||||||
|
"simplayer": "0.0.8",
|
||||||
"vue": "^2.3.3",
|
"vue": "^2.3.3",
|
||||||
"vue-awesome": "^2.3.5",
|
"vue-awesome": "^2.3.5",
|
||||||
"vue-electron": "^1.0.6",
|
"vue-electron": "^1.0.6",
|
||||||
|
@ -5,6 +5,8 @@ import Datastore from 'nedb'
|
|||||||
import empty from 'is-empty'
|
import empty from 'is-empty'
|
||||||
import log from 'electron-log'
|
import log from 'electron-log'
|
||||||
import windowStateKeeper from 'electron-window-state'
|
import windowStateKeeper from 'electron-window-state'
|
||||||
|
import simplayer from 'simplayer'
|
||||||
|
import path from 'path'
|
||||||
|
|
||||||
import Authentication from './auth'
|
import Authentication from './auth'
|
||||||
import Account from './account'
|
import Account from './account'
|
||||||
@ -21,7 +23,7 @@ log.transports.file.level = 'info'
|
|||||||
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
|
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html
|
||||||
*/
|
*/
|
||||||
if (process.env.NODE_ENV !== 'development') {
|
if (process.env.NODE_ENV !== 'development') {
|
||||||
global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
|
global.__static = path.join(__dirname, '/static').replace(/\\/g, '\\\\')
|
||||||
}
|
}
|
||||||
|
|
||||||
let mainWindow
|
let mainWindow
|
||||||
@ -192,7 +194,7 @@ function createWindow () {
|
|||||||
width: mainWindowState.width,
|
width: mainWindowState.width,
|
||||||
height: mainWindowState.height,
|
height: mainWindowState.height,
|
||||||
useContentSize: true,
|
useContentSize: true,
|
||||||
icon: require('path').join(__dirname, '../../build/icons/256x256.png')
|
icon: path.join(__dirname, '../../build/icons/256x256.png')
|
||||||
})
|
})
|
||||||
mainWindowState.manage(mainWindow)
|
mainWindowState.manage(mainWindow)
|
||||||
|
|
||||||
@ -441,6 +443,16 @@ ipcMain.on('stop-public-streaming', (event, _) => {
|
|||||||
publicStreaming = null
|
publicStreaming = null
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// sounds
|
||||||
|
ipcMain.on('operation-sound', (event, _) => {
|
||||||
|
const sound = process.env.NODE_ENV === 'development'
|
||||||
|
? path.join(__dirname, '../../build/sounds/operation_sound.wav')
|
||||||
|
: path.join(process.resourcesPath, 'build/sounds/operation_sound.wav')
|
||||||
|
simplayer(sound, (err) => {
|
||||||
|
if (err) log.error(err)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Auto Updater
|
* Auto Updater
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import Mastodon from 'mastodon-api'
|
import Mastodon from 'mastodon-api'
|
||||||
|
import { ipcRenderer } from 'electron'
|
||||||
|
|
||||||
const Toot = {
|
const Toot = {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
@ -19,6 +20,7 @@ const Toot = {
|
|||||||
// Reblog target status is in the data.reblog.
|
// Reblog target status is in the data.reblog.
|
||||||
// So I send data.reblog as status for update local timeline.
|
// So I send data.reblog as status for update local timeline.
|
||||||
commit('TimelineSpace/updateToot', data.reblog, { root: true })
|
commit('TimelineSpace/updateToot', data.reblog, { root: true })
|
||||||
|
ipcRenderer.send('operation-sound')
|
||||||
resolve(data.reblog)
|
resolve(data.reblog)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -49,6 +51,7 @@ const Toot = {
|
|||||||
client.post(`/statuses/${message.id}/favourite`, {}, (err, data, res) => {
|
client.post(`/statuses/${message.id}/favourite`, {}, (err, data, res) => {
|
||||||
if (err) return reject(err)
|
if (err) return reject(err)
|
||||||
commit('TimelineSpace/updateToot', data, { root: true })
|
commit('TimelineSpace/updateToot', data, { root: true })
|
||||||
|
ipcRenderer.send('operation-sound')
|
||||||
resolve(data)
|
resolve(data)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user