Skip to content

Commit 07617fd

Browse files
authored
Merge pull request #11 from OpenPecha/notification
Enhance platform normalization in push configuration
2 parents f870aa5 + c9aca44 commit 07617fd

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

worker_api/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
NOTIFICATION_DEFAULT_TITLE="WebBuddhist",
4141
NOTIFICATION_DEFAULT_BODY="Time for your daily practice.",
4242

43+
NOTIFICATION_DISPATCH_SECRET_TOKEN="Dispatch",
4344
# Optional Redis idempotency during dispatch
4445
NOTIFICATION_IDEMPOTENCY_ENABLED="false",
4546
NOTIFICATION_IDEMPOTENCY_TTL_SECONDS=3600,

worker_api/notifications/services/push/config_loader.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,18 @@ def is_fcm_configured() -> bool:
6161
return bool(get("GOOGLE_CLOUD_PROJECT").strip())
6262

6363

64+
def _normalize_platform(platform: str) -> str:
65+
value = platform
66+
if hasattr(platform, "value"):
67+
value = platform.value
68+
value = str(value)
69+
if "." in value:
70+
value = value.rsplit(".", 1)[-1]
71+
return value.lower()
72+
73+
6474
def is_push_configured(platform: str) -> bool:
65-
if platform in ("android", "ios"):
75+
normalized = _normalize_platform(platform)
76+
if normalized in ("android", "ios"):
6677
return is_fcm_configured()
6778
return False

0 commit comments

Comments
 (0)