Skip to content
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

Turn off push notifications on logout #2644

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danieldaquino
Copy link
Contributor

@danieldaquino danieldaquino commented Nov 6, 2024

Summary

Turn off push notifications during logout to prevent unwanted push notifications.

This is the basic solution, based on a best effort attempt to unsubscribe the user from receiving notifications.

The following has not been implemented/considered:

  • Handle edge cases (what if revoking the token fails? What if the user did not have push notifications to start? etc)
  • Improve error handling (If things fails, what do we show the user?)
  • What if the user already logged out before this change and their npub is still registered on our servers? How can we detect that and revoke?

However, this PR probably solve the problem for most scenarios (probably 90%+), and improves behaviour significantly compared to the current state, so it's worthwhile in my opinion.

Checklist

  • I have read (or I am familiar with) the Contribution Guidelines
  • I have tested the changes in this PR
  • My PR is either small, or I have split it into smaller logical commits that are easier to review
  • I have added the signoff line to all my commits. See Signing off your work
  • I have added appropriate changelog entries for the changes in this PR. See Adding changelog entries
  • I have added appropriate Closes: or Fixes: tags in the commit messages wherever applicable, or made sure those are not needed. See Submitting patches

Test report

Device: iPhone 16 simulator

iOS: 18.1

Damus: 2a2ddb3674159c87490df52efbdc321936e34490

Setup:

  1. Staging env for push notifications
  2. An extra device and account to trigger push notifications

Steps:

  1. Send a DM to the user under test
  2. Push notification should be received
  3. Logout
  4. Repeat step 1
  5. Push notification should not appear

Results:

  • PASS

damus/Models/DamusState.swift Outdated Show resolved Hide resolved
Copy link
Collaborator

@jb55 jb55 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one suggestion

Closes: damus-io#1707
Changelog-Fixed: Fixed issue where users continue to receive push notifications after logout
Signed-off-by: Daniel D’Aquino <[email protected]>
@danieldaquino danieldaquino marked this pull request as ready for review January 17, 2025 11:39
@danieldaquino
Copy link
Contributor Author

@jb55, addressed concerns, and tested the change!

@danieldaquino danieldaquino changed the title DRAFT: Turn off push notifications on logout Turn off push notifications on logout Jan 17, 2025
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