( notifications: GitifyNotification[], )
| 14 | * @param notifications - The notifications to surface as a native OS notification. |
| 15 | */ |
| 16 | export async function raiseNativeNotification( |
| 17 | notifications: GitifyNotification[], |
| 18 | ) { |
| 19 | let title: string; |
| 20 | let body: string; |
| 21 | let url: string | null = null; |
| 22 | |
| 23 | if (notifications.length === 1) { |
| 24 | const notification = notifications[0]; |
| 25 | title = window.gitify.platform.isWindows() |
| 26 | ? '' |
| 27 | : notification.repository.fullName; |
| 28 | body = notification.subject.title; |
| 29 | url = await generateGitHubWebUrl(notification); |
| 30 | } else { |
| 31 | title = APPLICATION.NAME; |
| 32 | body = `You have ${notifications.length} notifications`; |
| 33 | } |
| 34 | |
| 35 | return window.gitify.raiseNativeNotification(title, body, url ?? undefined); |
| 36 | } |
no test coverage detected