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(iOS): Message details not shown in push notifications in some cases #5596

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

diegolmello
Copy link
Member

@diegolmello diegolmello commented Feb 26, 2024

Proposed changes

Sometimes secured push notification could reach a point where no push content would be fetched, showing You have a new message for every notification.
I could track a bug to MMKV being the root cause. At least on one specific case.

After the device is booted, iOS asks for password in order to unlock features.
If a push is received while phone is active, but it's still locked, MMKV would not have enough permission to read credentials.
Since the previous behavior on NotificationService was to create a reusable instance of RocketChat class to request for content, we would create an instance without credentials.
What would happen is that the app would make push.get requests without userId and token.
And it was even worse, because the failing instance would be kept in memory even after the app was force closed on the OS.

On this PR, I've removed the singletons in order to create objects as needed to fetch push content.

Known bug

MMKV won't be able to read credentials right after boot still, so it's expected to fail to fetch content in some cases. We need to test more in order to understand exactly those cases, but it should be temporary.

Issue(s)

Closes #5496

How to test or reproduce

  • Reboot phone
  • Receive push notifications before unlocking phone
  • Push content should be there (read known bug)

Screenshots

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

CORE-85

@diegolmello diegolmello force-pushed the fix.push branch 2 times, most recently from 39639db to b9f8bbb Compare February 27, 2024 18:56
@diegolmello diegolmello marked this pull request as ready for review February 27, 2024 18:56
@diegolmello diegolmello changed the title fix: One instance per push fix: Message details not shown in push notifications in some cases Feb 27, 2024
@diegolmello diegolmello changed the title fix: Message details not shown in push notifications in some cases fix(iOS): Message details not shown in push notifications in some cases Feb 27, 2024
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.

Message details not shown in push notifications anymore
1 participant