-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unregister push on logout #1309
Conversation
@@ -106,6 +106,7 @@ public class NotifyClient { | |||
try await identityClient.unregister(account: account) | |||
notifyWatcherAgreementKeysProvider.removeAgreement(account: account) | |||
try notifyStorage.clearDatabase(account: account) | |||
Task { try await pushClient.unregister()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the unregister fails (e.g. no internet?) Will this flow be tried again or will the push registration still be present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, I will make it throw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chris13524 what code push api returns for already unregistered client on /unregister ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It gives the same response code regardless if the client was already unregistered or not: 200
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will make it throw
I still think there is an issue. If it throws, what does caller do with that? If simply display an error message, the question to me is when will it do the unregister again?
Looks to me that you are clearing the notify storage database (and other things) before you unregister the push client. So this would mean if the way the unregister takes place is based on the notify storage, then the unregister won't happen again. I'm assuming that logout should be an atomic operation to prevent the receiving of push notifications it should not.
c6df64d
to
e31e5e4
Compare
do { | ||
let (_, response) = try await URLSession.shared.data(for: request) | ||
|
||
guard let httpResponse = response as? HTTPURLResponse, httpResponse.statusCode == 200 else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
200
Instead of checking for a specific status code, can you check if it is any 2xx status code? We may want e.g. change to 204 (no content) and all 2xx codes mean success
Quality Gate passedIssues Measures |
Description
Resolves # (issue)
How Has This Been Tested?
Due Dilligence