mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-10 01:03:36 -05:00
fix: hide push notifications on electron app
This commit is contained in:
parent
45692999bf
commit
05516c5823
1 changed files with 52 additions and 50 deletions
|
@ -61,6 +61,7 @@ export const Notifications = observer(() => {
|
||||||
settings.set("notifications:desktop", desktopEnabled);
|
settings.set("notifications:desktop", desktopEnabled);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
{!window.native && (
|
||||||
<Checkbox
|
<Checkbox
|
||||||
disabled={typeof pushEnabled === "undefined"}
|
disabled={typeof pushEnabled === "undefined"}
|
||||||
value={pushEnabled ?? false}
|
value={pushEnabled ?? false}
|
||||||
|
@ -76,15 +77,15 @@ export const Notifications = observer(() => {
|
||||||
await navigator.serviceWorker?.getRegistration();
|
await navigator.serviceWorker?.getRegistration();
|
||||||
if (reg) {
|
if (reg) {
|
||||||
if (pushEnabled) {
|
if (pushEnabled) {
|
||||||
const sub = await reg.pushManager.subscribe(
|
const sub =
|
||||||
{
|
await reg.pushManager.subscribe({
|
||||||
userVisibleOnly: true,
|
userVisibleOnly: true,
|
||||||
applicationServerKey:
|
applicationServerKey:
|
||||||
urlBase64ToUint8Array(
|
urlBase64ToUint8Array(
|
||||||
client.configuration!.vapid,
|
client.configuration!
|
||||||
|
.vapid,
|
||||||
),
|
),
|
||||||
},
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// tell the server we just subscribed
|
// tell the server we just subscribed
|
||||||
const json = sub.toJSON();
|
const json = sub.toJSON();
|
||||||
|
@ -112,6 +113,7 @@ export const Notifications = observer(() => {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
</Column>
|
</Column>
|
||||||
<h3>
|
<h3>
|
||||||
<Text id="app.settings.pages.notifications.sounds" />
|
<Text id="app.settings.pages.notifications.sounds" />
|
||||||
|
|
Loading…
Reference in a new issue