Don't show notifications for logged out accounts (part one for DMs) #4076
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.
Why
Notifications may be received for logged out accounts, even if we log out first. One option would be to add an endpoint to the backend such as
unregisterPushToken
, but this wouldn't be a 100% reliable method. For example, something could happen during the logout where the request for unregistering fails but the client still removes the account from the logged in sessions.Instead, we can take advantage of the new notification handling logic to store logged out/disabled DIDs and prevent notifications for those accounts from showing up.
Right now, this will only work for DMs since we need to implement the
recipientDid
or similar in notifications as well. (We might be able to parse the subject for some types, will have to look).For general performance reasons, I am also converting the all of the string array preference types to a map instead. These could get a little chunky for future use cases like thread mutes, so better to get ahead of that now.
Screen.Recording.2024-05-17.at.2.34.44.AM.mov