[services] Tunnelbroker - Add payload to APNs message to make it content-available
Summary:
This diff introduces changes to the Rust notification library to add an optional APNs push message payload.
To wake up the iOS app from the background we should send a message with the payload. In this case, a message will be with the content-available attribute, so we can do background information processing in the app.
Apple's related documentation, apple forum thread.
The message payload is optional in the library.
Related Linear task: ENG-1743
Test Plan:
- Successfully built app without errors.
- Device testing:
To test the APNs notification physical iOS device is required.
- Isolated testing can be done using the apns-ios-push-tester XCode project. To test it clone the apns-ios-push-tester and follow the instruction to set the certificate, run the app on the physical iOS device and get the device token.
- Comm app testing can be done using the apns certificate provided in 1Password.
Send the apns message using the following library call from C++:
#include "cxxbridge_code/src/lib.rs.h" #include "rust/cxx.h ... const std::string cert_path = argv[1]; const std::string cert_pass = argv[2]; const std::string topic = argv[3]; const std::string device_token = argv[4]; const std::string message_text = argv[5]; const std::string message_payload = argv[6]; const bool sandbox = true; // True if your certificate is for development. sendNotifToAPNS(cert_path, cert_pass, topic, device_token, message_text, message_payload, sandbox);
The expected result is push message delivery to the device if the credentials are correct. Errors if some of the credentials are wrong.
Reviewers: jon, karol, tomek
Reviewed By: jon, tomek
Subscribers: ashoat, tomek, atul, karol, abosh
Differential Revision: https://phab.comm.dev/D5083