Repository navigation
Conversation
The extension could stop without calling its content handler: after the icon download, several paths in buildContent() fell through to return nil, and didReceive only called the handler when it got content back. It also never implemented serviceExtensionTimeWillExpire. In both cases iOS waited for the time limit and showed the unencrypted fallback text instead of the decrypted title and body. Keep the handler and the content being built behind a lock, deliver the best attempt when time runs out, call the handler at most once, and add the missing return after the attachment path. Related to Dimillian#2447
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #2447 and #2438
The notification service extension could stop without ever calling its content handler. In
buildContent(), the paths after the icon download (the image does not decode, the follow-up API request fails, or the notification type is unsupported) fell through toreturn nil, anddidReceiveonly called the handler when it got content back. iOS then waited for the time limit and showed the unencrypted fallback text, "A new notification has been received." This matches the 30 second delay described in #2447. Before the Swift 6 changes in 6297a42, every path called the handler.The extension also never implemented
serviceExtensionTimeWillExpire, so a slow network request produced the same result.This change keeps the handler and the content being built behind a lock, adds
serviceExtensionTimeWillExpireso the decrypted title and body are delivered when time runs out, makes sure the handler is called at most once, and adds the missing return after the attachment path.Testing: the IceCubesNotifications scheme builds. I sent test pushes to an iPhone SE simulator with
simctl push, but the simulator does not run notification service extensions, so the expiry path could not be exercised there. It needs a device with a real push to confirm.