fix(iOS): Message details not shown in push notifications in some cases #5596
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.
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
known bug
)Screenshots
Types of changes
Checklist
Further comments
CORE-85