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:
Cyrille BéraudandCopilot committed 2026-05-20 18:55:12 -04:00
1 parent ba753dde6f
commit 87bb2842ce
1 file changed
+7 -1
+7 -1
View File
@@ -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;
}