diff --git a/worker_api/config.py b/worker_api/config.py index 9223a38..6968bf1 100644 --- a/worker_api/config.py +++ b/worker_api/config.py @@ -40,6 +40,7 @@ NOTIFICATION_DEFAULT_TITLE="WebBuddhist", NOTIFICATION_DEFAULT_BODY="Time for your daily practice.", +NOTIFICATION_DISPATCH_SECRET_TOKEN="Dispatch", # Optional Redis idempotency during dispatch NOTIFICATION_IDEMPOTENCY_ENABLED="false", NOTIFICATION_IDEMPOTENCY_TTL_SECONDS=3600, diff --git a/worker_api/notifications/services/push/config_loader.py b/worker_api/notifications/services/push/config_loader.py index d47abe8..24e9ad4 100644 --- a/worker_api/notifications/services/push/config_loader.py +++ b/worker_api/notifications/services/push/config_loader.py @@ -61,7 +61,18 @@ def is_fcm_configured() -> bool: return bool(get("GOOGLE_CLOUD_PROJECT").strip()) +def _normalize_platform(platform: str) -> str: + value = platform + if hasattr(platform, "value"): + value = platform.value + value = str(value) + if "." in value: + value = value.rsplit(".", 1)[-1] + return value.lower() + + def is_push_configured(platform: str) -> bool: - if platform in ("android", "ios"): + normalized = _normalize_platform(platform) + if normalized in ("android", "ios"): return is_fcm_configured() return False