Skip to content

Commit

Permalink
Merge pull request #169 from alerta/update-notification-sound
Browse files Browse the repository at this point in the history
Play notification sound for new (ie. not repeat) open alerts
  • Loading branch information
satterly authored May 11, 2019
2 parents ff51f42 + a928d98 commit 7a1d417
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
Binary file removed public/audio/Bike Horn.mp3
Binary file not shown.
Binary file added public/audio/alert_high-intensity.ogg
Binary file not shown.
3 changes: 1 addition & 2 deletions src/components/Preferences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
label="Play notification sounds"
hide-details
class="my-0"
:disabled="!$config.audio.new"
/>
</v-radio-group>
</v-card-actions>
Expand Down Expand Up @@ -173,7 +172,7 @@ export default {
},
isPlaySounds: {
get() {
return this.$config.audio.new ? !this.$store.getters.getPreference('isMute') : false
return !this.$store.getters.getPreference('isMute')
},
set(value) {
this.$store.dispatch('toggle', ['isMute', !value])
Expand Down
3 changes: 2 additions & 1 deletion src/store/modules/preferences.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import stateMerge from 'vue-object-merge'
const getDefaults = () => {
return {
isDark: false,
isMute: false,
isMute: true,
audioURL: '/audio/alert_high-intensity.ogg',
dates: {
longDate: 'ddd D MMM, YYYY HH:mm:ss.SSS Z',
mediumDate: 'ddd D MMM HH:mm',
Expand Down
5 changes: 4 additions & 1 deletion src/views/Alerts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<audio
ref="audio"
:src="$config.audio.new"
:src="audioURL"
/>

<alert-detail
Expand Down Expand Up @@ -117,6 +117,9 @@ export default {
timer: null
}),
computed: {
audioURL() {
return this.$config.audio.new || this.$store.getters.getPreference('audioURL')
},
defaultTab() {
return utils.fromHash(this.hash).environment ? `tab-${utils.fromHash(this.hash).environment}` : 'tab-ALL'
},
Expand Down

0 comments on commit 7a1d417

Please sign in to comment.