File tree Expand file tree Collapse file tree 5 files changed +14
-8
lines changed
Expand file tree Collapse file tree 5 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,6 @@ const mockNotificationSettings: NotificationSettingsState = {
9393 markAsDoneOnOpen : false ,
9494 markAsDoneOnUnsubscribe : false ,
9595 delayNotificationState : false ,
96- notificationVolume : 20 ,
9796} ;
9897
9998const mockSystemSettings : SystemSettingsState = {
@@ -102,6 +101,7 @@ const mockSystemSettings: SystemSettingsState = {
102101 showNotificationsCountInTray : true ,
103102 showNotifications : true ,
104103 playSound : true ,
104+ notificationVolume : 20 ,
105105 useAlternateIdleIcon : false ,
106106 openAtStartup : false ,
107107} ;
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ import {
1818
1919import { APPLICATION } from '../../../shared/constants' ;
2020import { isLinux , isMacOS } from '../../../shared/platform' ;
21- import { AppContext } from '../../context/App' ;
21+ import { AppContext , defaultSettings } from '../../context/App' ;
2222import { OpenPreference } from '../../types' ;
2323import { Constants } from '../../utils/constants' ;
2424import { Checkbox } from '../fields/Checkbox' ;
@@ -91,7 +91,7 @@ export const SystemSettings: FC = () => {
9191 onChange = { ( evt ) => updateSetting ( 'playSound' , evt . target . checked ) }
9292 />
9393
94- { settings . playSound && (
94+ < Box className = "pl-6" hidden = { ! settings . playSound } >
9595 < Stack
9696 direction = "horizontal"
9797 gap = "condensed"
@@ -145,13 +145,16 @@ export const SystemSettings: FC = () => {
145145 icon = { XCircleIcon }
146146 unsafeDisableTooltip = { true }
147147 onClick = { ( ) => {
148- updateSetting ( 'notificationVolume' , 20 ) ;
148+ updateSetting (
149+ 'notificationVolume' ,
150+ defaultSettings . notificationVolume ,
151+ ) ;
149152 } }
150153 data-testid = "settings-volume-reset"
151154 />
152155 </ ButtonGroup >
153156 </ Stack >
154- ) }
157+ </ Box >
155158
156159 < Checkbox
157160 name = "useAlternateIdleIcon"
Original file line number Diff line number Diff line change @@ -85,7 +85,6 @@ const defaultNotificationSettings: NotificationSettingsState = {
8585 markAsDoneOnOpen : false ,
8686 markAsDoneOnUnsubscribe : false ,
8787 delayNotificationState : false ,
88- notificationVolume : 20 ,
8988} ;
9089
9190const defaultSystemSettings : SystemSettingsState = {
@@ -94,6 +93,7 @@ const defaultSystemSettings: SystemSettingsState = {
9493 showNotificationsCountInTray : true ,
9594 showNotifications : true ,
9695 playSound : true ,
96+ notificationVolume : 20 ,
9797 useAlternateIdleIcon : false ,
9898 openAtStartup : false ,
9999} ;
Original file line number Diff line number Diff line change @@ -81,7 +81,6 @@ export interface NotificationSettingsState {
8181 markAsDoneOnOpen : boolean ;
8282 markAsDoneOnUnsubscribe : boolean ;
8383 delayNotificationState : boolean ;
84- notificationVolume : number ;
8584}
8685
8786export interface SystemSettingsState {
@@ -91,6 +90,7 @@ export interface SystemSettingsState {
9190 showNotifications : boolean ;
9291 useAlternateIdleIcon : boolean ;
9392 playSound : boolean ;
93+ notificationVolume : number ;
9494 openAtStartup : boolean ;
9595}
9696
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import path from 'node:path';
22
33import { APPLICATION } from '../../../shared/constants' ;
44import { isWindows } from '../../../shared/platform' ;
5+ import { defaultSettings } from '../../context/App' ;
56import type { AccountNotifications , GitifyState } from '../../types' ;
67import { Notification } from '../../typesGitHub' ;
78import { getAccountUUID } from '../auth/utils' ;
@@ -86,7 +87,9 @@ export const raiseNativeNotification = (notifications: Notification[]) => {
8687 return nativeNotification ;
8788} ;
8889
89- export const raiseSoundNotification = ( volume = 0.2 ) => {
90+ export const raiseSoundNotification = (
91+ volume = defaultSettings . notificationVolume / 100 ,
92+ ) => {
9093 const audio = new Audio (
9194 path . join (
9295 __dirname ,
You can’t perform that action at this time.
0 commit comments