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

Fix balance notification subscription issue #2027

Merged
merged 2 commits into from
Oct 28, 2024
Merged

Conversation

atn4z7
Copy link
Collaborator

@atn4z7 atn4z7 commented Oct 28, 2024

Description

Ticket: CP-9389

when trying to subscribe to the backend, we will skip the logic if the balance notification prompt has not been presented to user. this means users will never receive any notifications. this happens in 2 cases AFAIK:

case 1:

  • balance change notification flag is disabled
  • user has latest prod build
  • user goes to app settings/notifications
  • the Allow Push Notifications banner is displayed
  • user clicks Open Device Settings
  • this will toggle all the switches to ON (even for the ones that are not displayed like the Balance switch)
  • balance change notification flag is enabled
  • Balance notification switch is displayed with ON value
  • user will never receive balance notifications unless he/she toggles the switch to OFF + reopens the app + approves prompt

case 2

  • balance change notification flag is disabled
  • user has latest prod build
  • user goes to app settings/notifications
  • balance change notification flag is enabled
  • Balance notification switch is displayed with OFF value
  • user toggles the Balance notification switch to ON
  • user will never receive balance notifications unless he/she toggles the switch to OFF + reopens the app + approves prompt

this pr fixes the above issue by:

  • making sure when Open Device Settings is clicked, we only enable all the switches that are displayed to the user at the time
  • adjust the subscribe logic to 1/ always run even if balance change notification prompt has not been presented and 2/ only skip it if the Balance notification switch is OFF.

Screenshots/Videos

I did some testing with these scenarios
1/ disable balance notification flag -> install fresh app -> enable balance notification flag -> reopen app -> approve prompt
https://github.com/user-attachments/assets/eae99b8b-78d5-4040-b30a-a644084f26fe

2/ disable balance notification flag -> install fresh app -> enable balance notification flag -> reopen app -> deny approve prompt -> enable Balance switch
https://github.com/user-attachments/assets/cbf9e0b8-c33d-49d0-a45a-7e05ad74558b

3/ disable balance notification flag -> install fresh app -> enable balance notification flag -> enable Balance switch
https://github.com/user-attachments/assets/2114aa4a-f96c-46d0-918b-50abe7b9dcb7

Testing

Please make sure 1/ notifications are still working correctly based on user preferences and 2/ production users who are not receiving notifications will start receiving them with this fix

Checklist

Please check all that apply (if applicable)

  • I have performed a self-review of my code
  • I have verified the code works
  • I have added/updated necessary unit tests
  • I have updated the documentation

Copy link
Collaborator

@neven-s neven-s left a comment

Choose a reason for hiding this comment

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

Thank you!

@atn4z7 atn4z7 merged commit b1b0df6 into hot-fix-staking Oct 28, 2024
1 check passed
@atn4z7 atn4z7 deleted the fix-notif branch October 28, 2024 20:35
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