File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 11import { APPLICATION } from '../../shared/constants' ;
22
33import type { Notification } from '../../typesGitHub' ;
4+ import { isTauriEnvironment } from '../environment' ;
45import { generateGitHubWebUrl } from '../helpers' ;
56
67export async function raiseNativeNotification ( notifications : Notification [ ] ) {
8+ if ( ! isTauriEnvironment ( ) ) {
9+ // Browser fallback - use browser notifications
10+ if ( 'Notification' in window && Notification . permission === 'granted' ) {
11+ if ( notifications . length === 1 ) {
12+ const notification = notifications [ 0 ] ;
13+ new Notification ( notification . repository . full_name , {
14+ body : notification . subject . title ,
15+ } ) ;
16+ } else {
17+ new Notification ( APPLICATION . NAME , {
18+ body : `You have ${ notifications . length } notifications` ,
19+ } ) ;
20+ }
21+ }
22+ return ;
23+ }
24+
725 let title : string ;
826 let body : string ;
927 let url : string | undefined ;
Original file line number Diff line number Diff line change 11import type { Percentage } from '../../types' ;
2+ import { isTauriEnvironment } from '../environment' ;
23
34const MINIMUM_VOLUME_PERCENTAGE = 0 as Percentage ;
45const MAXIMUM_VOLUME_PERCENTAGE = 100 as Percentage ;
56const VOLUME_STEP = 10 as Percentage ;
67
78export async function raiseSoundNotification ( volume : Percentage ) {
9+ if ( ! isTauriEnvironment ( ) ) {
10+ // Browser fallback - no sound notification
11+ return ;
12+ }
13+
814 const path = await window . gitify . notificationSoundPath ( ) ;
915
1016 const audio = new Audio ( path ) ;
You can’t perform that action at this time.
0 commit comments