diff --git a/artifacts/tx-os/src/hooks/use-push-subscription.ts b/artifacts/tx-os/src/hooks/use-push-subscription.ts index 0d0e33f5..cd3bd3a4 100644 --- a/artifacts/tx-os/src/hooks/use-push-subscription.ts +++ b/artifacts/tx-os/src/hooks/use-push-subscription.ts @@ -25,6 +25,7 @@ export type EnableReason = | "unsupported" | "unsupported_ios_safari" | "permission_denied" + | "permission_dismissed" | "vapid_unavailable" | "subscribe_failed" | "server_rejected"; @@ -148,7 +149,15 @@ export function usePushSubscription() { const perm = await Notification.requestPermission(); if (perm !== "granted") { setStatus(perm === "denied" ? "denied" : "default"); - return { ok: false, reason: "permission_denied" }; + // Distinguish a hard "blocked" decision from the user just + // dismissing the prompt without choosing — the messages need + // to differ so we don't tell users to "unblock" when they + // simply haven't decided yet. + return { + ok: false, + reason: + perm === "denied" ? "permission_denied" : "permission_dismissed", + }; } const reg = await getRegistration(); if (!reg) return { ok: false, reason: "subscribe_failed" }; diff --git a/artifacts/tx-os/src/locales/ar.json b/artifacts/tx-os/src/locales/ar.json index ac17e21f..f2e36926 100644 --- a/artifacts/tx-os/src/locales/ar.json +++ b/artifacts/tx-os/src/locales/ar.json @@ -240,6 +240,7 @@ "unsupported": "هذا المتصفح لا يدعم إشعارات شاشة القفل.", "unsupported_ios_safari": "على الآيفون/الآيباد، افتح Tx من أيقونة الشاشة الرئيسية أولاً (مشاركة → إضافة إلى الشاشة الرئيسية)، ثم فعّل الإشعارات من داخل التطبيق.", "permission_denied": "أذِن المتصفح للإشعارات مرفوض. افتح إعدادات الجهاز ← Tx وفعّل الإشعارات يدوياً.", + "permission_dismissed": "لم يتم منح الإذن بعد. اضغط \"تفعيل\" مرة أخرى واختر \"السماح\" في نافذة المتصفح.", "vapid_unavailable": "تعذّر الاتصال بخادم الإشعارات. تأكّد من اتصالك ثم حاول مرة أخرى.", "subscribe_failed": "تعذّر تسجيل الجهاز لاستقبال الإشعارات. حاول مرة أخرى.", "server_rejected": "رفض الخادم تسجيل هذا الجهاز. حاول مرة أخرى أو أعد تسجيل الدخول." diff --git a/artifacts/tx-os/src/locales/en.json b/artifacts/tx-os/src/locales/en.json index f49b8fda..54006caf 100644 --- a/artifacts/tx-os/src/locales/en.json +++ b/artifacts/tx-os/src/locales/en.json @@ -246,6 +246,7 @@ "unsupported": "This browser does not support lock-screen notifications.", "unsupported_ios_safari": "On iPhone/iPad, open Tx OS from its Home Screen icon first (Share → Add to Home Screen), then enable notifications from inside the app.", "permission_denied": "Notification permission is blocked. Open Settings → Tx OS on your device and enable notifications manually.", + "permission_dismissed": "Permission wasn't granted yet. Tap \"Enable\" again and choose \"Allow\" in the browser prompt.", "vapid_unavailable": "Could not reach the notifications server. Check your connection and try again.", "subscribe_failed": "Could not register this device for notifications. Try again.", "server_rejected": "The server refused to register this device. Try again or sign in again."