mirror of
https://github.com/danog/telegram-tt.git
synced 2024-12-03 10:07:55 +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 {
|
} else {
|
||||||
const dispatch = getDispatch();
|
const dispatch = getDispatch();
|
||||||
const notification = new Notification(title, {
|
const options: NotificationOptions = {
|
||||||
body,
|
body,
|
||||||
icon: 'icon-192x192.png',
|
icon: 'icon-192x192.png',
|
||||||
badge: 'icon-192x192.png',
|
badge: 'icon-192x192.png',
|
||||||
tag: message.id.toString(),
|
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.onclick = () => {
|
||||||
notification.close();
|
notification.close();
|
||||||
|
Loading…
Reference in New Issue
Block a user