Page MenuHomePhabricator

[Tunnelbroker] implement sending APNs notif
ClosedPublic

Authored by kamil on Fri, Jun 28, 5:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 29, 12:47 AM
Unknown Object (File)
Sat, Jun 29, 12:47 AM
Unknown Object (File)
Sat, Jun 29, 12:46 AM
Subscribers

Details

Summary

Sending notif according APNs docs.

Depends on D12613

Test Plan

Implement a couple tests and ran locally to call this function (using device token of my personal iOS device) and this notif:

let payload = json!({
    "aps" : {
        "alert" : {
            "title" : "your_title_here",
            "body" : "your_body_here"
        },
    "mutable-content": 1
    }
});

Tested both successful notifications (verifying on my device) and different error codes.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil held this revision as a draft.
kamil published this revision for review.Fri, Jun 28, 6:32 AM
kamil edited the test plan for this revision. (Show Details)
bartek added inline comments.
services/tunnelbroker/src/notifs/apns/mod.rs
122 ↗(On Diff #41792)

Is this to check if the payload is a valid JSON?
Otherwise, you could replace below http2_client.post(...).json(&payload) with .body(&notif.payload). But you'd probably add a Content-Type: application/json request header manually

135–136 ↗(On Diff #41792)

This should be possible

This revision is now accepted and ready to land.Mon, Jul 1, 2:28 AM

address review

services/tunnelbroker/src/notifs/apns/mod.rs
122 ↗(On Diff #41792)

good call, adding header is already done in D12612

This revision was automatically updated to reflect the committed changes.