Push Notifications: Do not show muted (#1063)
This commit is contained in:
parent
21a2155ad5
commit
f2622099d1
@ -2,6 +2,11 @@ import { DEBUG } from '../config';
|
|||||||
|
|
||||||
declare const self: ServiceWorkerGlobalScope;
|
declare const self: ServiceWorkerGlobalScope;
|
||||||
|
|
||||||
|
enum Boolean {
|
||||||
|
True = '1',
|
||||||
|
False = '0'
|
||||||
|
}
|
||||||
|
|
||||||
export type NotificationData = {
|
export type NotificationData = {
|
||||||
custom: {
|
custom: {
|
||||||
msg_id?: string;
|
msg_id?: string;
|
||||||
@ -9,8 +14,8 @@ export type NotificationData = {
|
|||||||
chat_id?: string;
|
chat_id?: string;
|
||||||
from_id?: string;
|
from_id?: string;
|
||||||
};
|
};
|
||||||
mute: '0' | '1';
|
mute: Boolean;
|
||||||
badge: '0' | '1';
|
badge: Boolean;
|
||||||
loc_key: string;
|
loc_key: string;
|
||||||
loc_args: string[];
|
loc_args: string[];
|
||||||
random_id: number;
|
random_id: number;
|
||||||
@ -42,7 +47,9 @@ export function handlePush(e: PushEvent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const data = getPushData(e);
|
const data = getPushData(e);
|
||||||
if (!data) return;
|
|
||||||
|
// Do not show muted notifications
|
||||||
|
if (!data || data.mute === Boolean.True) return;
|
||||||
|
|
||||||
const title = data.title || process.env.APP_INFO!;
|
const title = data.title || process.env.APP_INFO!;
|
||||||
const body = data.description;
|
const body = data.description;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user