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 #5815

Merged
merged 30 commits into from
Sep 16, 2024

Conversation

diegolmello
Copy link
Member

@diegolmello diegolmello commented Aug 1, 2024

Proposed changes

  • Changed Secured Push Notification to use SecItemCopyMatching (react-native-keychain) on native iOS side, because MMKV has issues trying to fetch storage in some edge OS cases.
  • Removed shared credentials instance
  • Changed You have a new message logic to display a single push notification without content, since it's not helpful to fill notification center with it

Issue(s)

Closes #5496

Note: we've been discussing a change on rate limiter for this feature specifically, since some users might receive too many notifications in a short amount of time and that would reach the limit, making push notifications to be displayed as You have a new message still.
Even though we do a reverse fibonacci for retry, the timing might not be enough, since the default time limit is of 5 minutes and the timeframe to fetch notification content is of 30 seconds.

How to test or reproduce

  • Enable Hide message content from Apple and Google (and the Gateway, if enabled) (aka Secured Push Notification)
  • Receive several push notifications
  • They should be displayed correctly on Notification Center

Here's a simple bash to help triggering those push notifications

#!/bin/bash
for i in {1..30}
do
	now=$(date +"%d-%m-%y %H:%M:%S")
	response=$(curl --location --request POST 'https://mobile.rocket.chat/api/v1/chat.postMessage' \
		--header 'content-type: application/json' \
		--header 'x-auth-token: xxx' \
		--header 'x-user-id: xxx' \
		--data-raw '{
				"roomId": "xxxx",
				"msg": "'"$now"'"
		}')

	if [ "$response" -ne 200 ]; then
		echo "[$now] Error: Request failed with status code $response\n" >> error_log.txt
	else
		echo "[$now] Success: Message sent successfully\n"
	fi

	sleep 0.5
done

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 marked this pull request as ready for review August 13, 2024 13:22
@diegolmello diegolmello merged commit 5cdddc9 into develop Sep 16, 2024
14 of 19 checks passed
@diegolmello diegolmello deleted the fix.push-secure branch September 16, 2024 17:53
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