mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-13 06:35:24 +03:00
Improve wording
This commit is contained in:
parent
037718fb3f
commit
d0e46b3ce8
@ -193,8 +193,8 @@ export default function NotificationView({
|
|||||||
<div className="max-w-6xl">
|
<div className="max-w-6xl">
|
||||||
<div className="mb-5 mt-2 flex max-w-5xl flex-col gap-2 text-sm text-primary-variant">
|
<div className="mb-5 mt-2 flex max-w-5xl flex-col gap-2 text-sm text-primary-variant">
|
||||||
<p>
|
<p>
|
||||||
Frigate can natively send push notifications to Frigate when it
|
Frigate can natively send push notifications to your device when
|
||||||
is running in the browser or installed as a PWA.
|
it is running in the browser or installed as a PWA.
|
||||||
</p>
|
</p>
|
||||||
<div className="flex items-center text-primary">
|
<div className="flex items-center text-primary">
|
||||||
<Link
|
<Link
|
||||||
@ -285,52 +285,49 @@ export default function NotificationView({
|
|||||||
</form>
|
</form>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
||||||
{config?.notifications.enabled && (
|
<div className="mt-4 space-y-6">
|
||||||
<div className="mt-4 space-y-6">
|
<div className="space-y-3">
|
||||||
<div className="space-y-3">
|
<Separator className="my-2 flex bg-secondary" />
|
||||||
<Separator className="my-2 flex bg-secondary" />
|
<Button
|
||||||
<Button
|
disabled={
|
||||||
disabled={publicKey == undefined}
|
!config?.notifications.enabled || publicKey == undefined
|
||||||
onClick={() => {
|
}
|
||||||
if (registration == null) {
|
onClick={() => {
|
||||||
Notification.requestPermission().then((permission) => {
|
if (registration == null) {
|
||||||
if (permission === "granted") {
|
Notification.requestPermission().then((permission) => {
|
||||||
navigator.serviceWorker
|
if (permission === "granted") {
|
||||||
.register(NOTIFICATION_SERVICE_WORKER)
|
navigator.serviceWorker
|
||||||
.then((registration) => {
|
.register(NOTIFICATION_SERVICE_WORKER)
|
||||||
setRegistration(registration);
|
.then((registration) => {
|
||||||
|
setRegistration(registration);
|
||||||
|
|
||||||
if (registration.active) {
|
if (registration.active) {
|
||||||
subscribeToNotifications(registration);
|
subscribeToNotifications(registration);
|
||||||
} else {
|
} else {
|
||||||
setTimeout(
|
setTimeout(
|
||||||
() => subscribeToNotifications(registration),
|
() => subscribeToNotifications(registration),
|
||||||
1000,
|
1000,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
registration.pushManager
|
||||||
|
.getSubscription()
|
||||||
|
.then((pushSubscription) => {
|
||||||
|
pushSubscription?.unsubscribe();
|
||||||
|
registration.unregister();
|
||||||
|
setRegistration(null);
|
||||||
|
removeMessage("notification_settings", "registration");
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
registration.pushManager
|
}}
|
||||||
.getSubscription()
|
>
|
||||||
.then((pushSubscription) => {
|
{`${registration != null ? "Unregister" : "Register"} for notifications on this device`}
|
||||||
pushSubscription?.unsubscribe();
|
</Button>
|
||||||
registration.unregister();
|
|
||||||
setRegistration(null);
|
|
||||||
removeMessage(
|
|
||||||
"notification_settings",
|
|
||||||
"registration",
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{`${registration != null ? "Unregister" : "Register"} for notifications on this device`}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user