fix: hide push notifications on electron app

This commit is contained in:
Paul Makles 2022-06-29 16:46:25 +01:00
parent 45692999bf
commit 05516c5823

View file

@ -61,6 +61,7 @@ export const Notifications = observer(() => {
settings.set("notifications:desktop", desktopEnabled);
}}
/>
{!window.native && (
<Checkbox
disabled={typeof pushEnabled === "undefined"}
value={pushEnabled ?? false}
@ -76,15 +77,15 @@ export const Notifications = observer(() => {
await navigator.serviceWorker?.getRegistration();
if (reg) {
if (pushEnabled) {
const sub = await reg.pushManager.subscribe(
{
const sub =
await reg.pushManager.subscribe({
userVisibleOnly: true,
applicationServerKey:
urlBase64ToUint8Array(
client.configuration!.vapid,
client.configuration!
.vapid,
),
},
);
});
// tell the server we just subscribed
const json = sub.toJSON();
@ -112,6 +113,7 @@ export const Notifications = observer(() => {
}
}}
/>
)}
</Column>
<h3>
<Text id="app.settings.pages.notifications.sounds" />