mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
proxy: include priority field in push notification JSON payload
The HTTP Urgency header set on WebPush requests is not exposed to
UnifiedPush Android clients by the connector library. Include a
"priority" field ("high" or "normal") directly in the JSON body
so that clients can determine whether a push notification requires
immediate wake-up processing or can be deferred until the next
natural activity.
This complements the daemon-side priority assignment (Gerrit #34059)
and allows UnifiedPush (F-Droid) builds to benefit from the same
battery savings as FCM builds.
Change-Id: Id316ff89e64e59d1b224f5b4e14da6b36dc62c95
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
ba753dde6f
commit
87bb2842ce
1 file changed
+7
-1
@@ -1191,7 +1191,13 @@ DhtProxyServer::handlePushListen(const InfoHash& infoHash,
|
||||
minPriority,
|
||||
values.size());
|
||||
|
||||
sendPushNotification(pushToken, std::move(json), type, !expired and minPriority == 0, topic);
|
||||
// Include priority in the JSON payload so that UnifiedPush clients
|
||||
// (which don't have access to the HTTP Urgency header) can determine
|
||||
// whether a push requires immediate processing or can be deferred.
|
||||
bool highPriority = !expired and minPriority == 0;
|
||||
json["priority"] = highPriority ? "high" : "normal";
|
||||
|
||||
sendPushNotification(pushToken, std::move(json), type, highPriority, topic);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user