mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-02 09:37:47 +01:00
Notifications: Vibrate only if supported (#1124)
This commit is contained in:
parent
6732636dcb
commit
9b2d498715
@ -277,13 +277,18 @@ export function showNewMessageNotification({
|
||||
}
|
||||
} else {
|
||||
const dispatch = getDispatch();
|
||||
const notification = new Notification(title, {
|
||||
const options: NotificationOptions = {
|
||||
body,
|
||||
icon: 'icon-192x192.png',
|
||||
badge: 'icon-192x192.png',
|
||||
tag: message.id.toString(),
|
||||
vibrate: [200, 100, 200],
|
||||
});
|
||||
};
|
||||
|
||||
if ('vibrate' in navigator) {
|
||||
options.vibrate = [200, 100, 200];
|
||||
}
|
||||
|
||||
const notification = new Notification(title, options);
|
||||
|
||||
notification.onclick = () => {
|
||||
notification.close();
|
||||
|
Loading…
Reference in New Issue
Block a user