update the title of daily checks to match Time Safari
This commit is contained in:
8
app.py
8
app.py
@@ -177,7 +177,7 @@ class WebPushService():
|
||||
else:
|
||||
print("Error other than unsubscribed/expired.", ex.args[0], flush=True)
|
||||
|
||||
return {"success": False, "message": ex.args[0], "error": ex, "unsubscribed": unsubscribed}
|
||||
return {"success": False, "message": str(ex), "error": ex, "unsubscribed": unsubscribed}
|
||||
|
||||
|
||||
def _send_daily_notifications(self) -> None:
|
||||
@@ -212,7 +212,10 @@ class WebPushService():
|
||||
vapid_key = VAPIDKey.query.first()
|
||||
|
||||
# Constructing the push notification message
|
||||
message = {"title": "Daily Update", "message": f"Update for {now}"}
|
||||
# The title value is a key, triggering the device to apply logic and customize both title and message.
|
||||
# See https://gitea.anomalistdesign.com/trent_larson/crowd-funder-for-time-pwa/src/commit/f8d3fe2ee18171553785424e88c2b8e1df9c603d/sw_scripts/additional-scripts.js#L64
|
||||
UPDATE_TITLE = "DAILY_CHECK"
|
||||
message = {"title": UPDATE_TITLE, "message": f"Update for {now}"}
|
||||
|
||||
# Sending a push notification to each subscribed client
|
||||
for subscription in all_subscriptions:
|
||||
@@ -422,6 +425,7 @@ class WebPushService():
|
||||
1. Retrieves the subscription information from the incoming request.
|
||||
2. Looks up the subscription in the database.
|
||||
3. Calls the _send_push_notification method to send a test push notification.
|
||||
- The subscription will include the "title" and "message" if supplied in the body object.
|
||||
4. Returns the result of the _send_push_notification call.
|
||||
|
||||
URL: /web-push/send-test
|
||||
|
||||
Reference in New Issue
Block a user