Policies section (business-details-form.tsx) Late Arrival Policy, Booking Terms and Privacy Policy URL are gone. The section now has Cancellation Policy plus the Terms & Privacy name and email dropdowns. Their database columns stay, so nothing is lost. Saving no longer touches them. Email and push only One switch, IN_APP_NOTIFICATIONS_VISIBLE in in-app.ts, is set to false and controls everything below. Bell icon: gone for customers, staff and owners, including the unread badge. Notification pages: /notifications, /staff/notifications and /owner/notifications now return 404. Settings: Settings → Notifications shows only Email and Push toggles. Testing: I checked all of this in a local test app as the owner.
This commit is contained in:
19 files changed
+263
-40
No files matched your search
@@ -2,6 +2,21 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
/**
|
||||
* The app icon's badge number counts push notifications still sitting in
|
||||
* the notification shelf (see updateAppBadge in public/sw.js). Opening the
|
||||
* app is the "I've seen it" signal, so clear both together — otherwise the
|
||||
* next push would count notifications the person already dealt with.
|
||||
*/
|
||||
function clearAppBadgeAndNotifications() {
|
||||
const badging = navigator as Navigator & { clearAppBadge?: () => Promise<void> };
|
||||
badging.clearAppBadge?.().catch(() => {});
|
||||
navigator.serviceWorker?.ready
|
||||
.then((registration) => registration.getNotifications())
|
||||
.then((notifications) => notifications.forEach((notification) => notification.close()))
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers the service worker once, app-wide, and surfaces the
|
||||
* update-available handshake public/sw.js sets up: a new SW version
|
||||
@@ -17,6 +32,12 @@ export function ServiceWorkerManager() {
|
||||
useEffect(() => {
|
||||
if (!("serviceWorker" in navigator)) return;
|
||||
|
||||
const onVisibilityChange = () => {
|
||||
if (document.visibilityState === "visible") clearAppBadgeAndNotifications();
|
||||
};
|
||||
onVisibilityChange();
|
||||
document.addEventListener("visibilitychange", onVisibilityChange);
|
||||
|
||||
navigator.serviceWorker
|
||||
.register("/sw.js")
|
||||
.then((registration) => {
|
||||
@@ -48,7 +69,10 @@ export function ServiceWorkerManager() {
|
||||
window.location.reload();
|
||||
};
|
||||
navigator.serviceWorker.addEventListener("controllerchange", onControllerChange);
|
||||
return () => navigator.serviceWorker.removeEventListener("controllerchange", onControllerChange);
|
||||
return () => {
|
||||
document.removeEventListener("visibilitychange", onVisibilityChange);
|
||||
navigator.serviceWorker.removeEventListener("controllerchange", onControllerChange);
|
||||
};
|
||||
}, []);
|
||||
|
||||
if (!waitingWorker || dismissed) return null;
|
||||
|
||||
Reference in new issue
Block a user