Skip to content

MOBILE-652: Confirm push delivery from the notification service extension - #857

Merged
Vailence merged 9 commits into
mission/transactional-pushfrom
feature/MOBILE-652-delivery-confirmation-request
Nov 23, 2026
Merged

Vailence merged 9 commits into
mission/transactional-pushfrom
feature/MOBILE-652-delivery-confirmation-request

Conversation

@Vailence

Copy link
Copy Markdown
Collaborator

The backend needs to know that a push reached the phone, so that a cascade can fall back from push to a more expensive channel only when the push did not arrive. The notification service extension now reports the delivery itself, as soon as it gets the push.

What the extension does in the standard didReceive(_:withContentHandler:):

  • reads callbacks.deliveredUrl from the push. The field is optional: a push without it, with null, with a non-https or unparsable URL is handled exactly as before, with no request and no file;
  • writes a file to the App Group before the request: the URL and the time the push was received;
  • sends one POST to that URL: body {}, the same four headers as the requests of the main module (Mindbox-Integration, Mindbox-Integration-Version, User-Agent, Content-Type), and dateTimeOffset added to the query — milliseconds from receiving the push to sending the request. Other query parameters keep their order and encoding. A redirect is not followed;
  • waits for the answer for at most 3 seconds;
  • removes the file on 2xx and on 4xx except 429, without reading the response body. On 429, 5xx, 3xx and no answer the file stays;
  • shows the push once, when both the image and the confirmation are finished. A push with neither an image nor a delivered URL is still shown synchronously.

Not in this PR:

  • the app does not read the files that stay, and nothing is retried through guaranteed delivery or paused on 429. That is a separate task; the file is the hand-off for it;
  • clients with their own notification service get no confirmation: pushDelivered(_:) still only writes a log. That is MOBILE-657.

All the code is in MindboxNotifications. The main module, Package.swift and the podspecs are not touched, and the public API does not change. The delivered URL is read through the existing internal Payload model.

Two things differ from the wording of the task card: the wait is 3 seconds, not 5 (under discussion), and an http URL is dropped while parsing the push instead of being tried once — either way nothing is retried.

Checked on a real iPhone with pushes sent from the Apple Push Notifications console, traffic recorded in Proxyman:

  • a push with a delivered URL: one POST with the body {}, the four headers and dateTimeOffset=3;
  • a push without callbacks: no request;
  • a URL that never answers: the request was dropped after 3008 ms and the push was shown.

Checked on the simulator, with the service code running in an extension process and Proxyman answering: 200 and 404 remove the file; 429, 500 and a broken TLS connection leave it.

Not checked: the file on the real device (the App Group folder cannot be read from outside), and a 200 from the real backend — staging has no confirmation endpoint yet, so the live answer was 404.

The full unit test run passed before the branch was rebased onto the current mission branch (2673 tests); it was not repeated locally after the rebase, which brought in only main-module changes from MOBILE-541.

https://tracker.yandex.ru/MOBILE-652

Vailence added 7 commits November 20, 2026 16:56
The notification extension takes callbacks.deliveredUrl (https only) and
builds a POST with the body {}, the SDK headers and dateTimeOffset in
the query.
didReceive writes a file to the App Group, sends one request (3 s for
the answer) and shows the push. 2xx and 4xx except 429 remove the file;
429, 5xx and no answer leave it for guaranteed delivery.
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor
TestsPassed ✅SkippedFailedTime ⏱
Unit tests report3223 ran3223 ✅3m 23s 876ms

Vailence added 2 commits November 20, 2026 17:20
The notification service extension now sends the delivery confirmation
itself, so MindboxNotifications no longer collects nothing.
The parameter was appended, so a URL that already had it sent two.
Now every dateTimeOffset of the URL is dropped and one is added at the
end, as on Android. The other parameters keep their place and encoding.
@Vailence
Vailence merged commit bea4d13 into mission/transactional-push Nov 23, 2026
9 checks passed
@Vailence
Vailence deleted the feature/MOBILE-652-delivery-confirmation-request branch November 23, 2026 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants