fix(apple): Persist last notified version#8122
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
c2589f2 to
ce90e36
Compare
|
Sentry Issue: APPLE-CLIENT-2B |
thomaseizinger
approved these changes
Feb 13, 2025
Member
thomaseizinger
left a comment
There was a problem hiding this comment.
Worth a changelog entry?
ce90e36 to
0798e5f
Compare
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.
Notifications on Apple platforms are delivered with best-effort reliability and are not guaranteed.
They can also be queued up by the system so that, for example, it's possible to issue a notification, quit the app, and then upon the next launch of the app, receive the notification.
In this second case, if the user dismissed the notification, we will crash. This is because we only track the
lastNotifiedVersionin theNotificationAdapterinstance object and don't persist it to disk, then we assert the value not to be nil when saving the user'sdismissaction.To fix this, we persist the
lastNotifiedVersionto theUserDefaultsstore and attempt to read this when the user is dismissing the notification. If we can't read it for some reason, we still dismiss the notification but won't prevent showing it again on the next update check.A minor bug is also fixed where the original author didn't correctly call the function's
completionHandler. Also, unused instance varslastDismissedVersionleft over from the original author are removed as well.