Page MenuHomePhabricator

[Tunnelbroker] implement sending APNs notif
ClosedPublic

Authored by kamil on Jun 28 2024, 5:37 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 29, 5:29 PM
Unknown Object (File)
Mon, Oct 28, 11:57 AM
Unknown Object (File)
Fri, Oct 11, 12:52 AM
Unknown Object (File)
Fri, Oct 11, 12:52 AM
Unknown Object (File)
Fri, Oct 11, 12:52 AM
Unknown Object (File)
Fri, Oct 11, 12:52 AM
Unknown Object (File)
Fri, Oct 11, 12:51 AM
Unknown Object (File)
Sep 21 2024, 10:38 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.Jun 28 2024, 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.Jul 1 2024, 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.