Skip to content

Commit b144ae2

Browse files
try fixing notification
1 parent 423cbdf commit b144ae2

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/app/core/services/user-notification.service.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,18 @@ export class UserNotificationService {
2828
this.notificationData.pipe(
2929
tap(val => {
3030
if (this.hasNotificationSupport && this.hasGrantedNotificationSupport) {
31-
new Notification('RiverSurf', {
32-
body: val.content,
33-
tag: val.surfEventName,
34-
icon: '/assets/icons/icon-512x512.png',
35-
vibrate: 400
36-
});
31+
try {
32+
const notification = new Notification('RiverSurf', {
33+
body: val.content,
34+
tag: val.surfEventName,
35+
icon: '/assets/icons/icon-256x256.png',
36+
vibrate: 400
37+
});
38+
} catch {
39+
if (this.hasVibrationSupport) {
40+
window.navigator.vibrate(400);
41+
}
42+
}
3743
} else {
3844
if (this.hasVibrationSupport) {
3945
window.navigator.vibrate(400);

0 commit comments

Comments
 (0)