Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions worker_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 12 additions & 1 deletion worker_api/notifications/services/push/config_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading