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

TF-3275 Fix FCM iOS foreground desync #3314

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tddang-linagora
Copy link
Contributor

@tddang-linagora tddang-linagora commented Nov 28, 2024

Issue

Root cause

  • Notification from FCM contains mutable-content: true
  • Those notification will be transfered to Notification Service Extension (See here) whether the app is in background or foreground
  • Due to the app is in foreground, no notification will be shown
  • Due to NSE handle the data, FCM on Flutter side cannot handle it

Resolved

Screen.Recording.2024-11-28.at.14.55.12.mov

ios/Runner/AppDelegate.swift Outdated Show resolved Hide resolved
@@ -143,6 +145,7 @@ class NotificationService: UNNotificationServiceExtension {
self.modifiedContent?.body = message
self.modifiedContent?.badge = NSNumber(value: 1)
self.modifiedContent?.sound = .default
self.modifiedContent?.userInfo = ["data": originalContent.userInfo]
Copy link
Member

Choose a reason for hiding this comment

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

why do we need data key?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

onMessage of FCM Flutter is using data key for its payload.

Comment on lines 161 to 163
var combinedUserInfo = userInfo
combinedUserInfo["data"] = originalContent.userInfo
self.modifiedContent?.userInfo = combinedUserInfo
Copy link
Member

Choose a reason for hiding this comment

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

Also please test notification on onBackground

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FCM background is not affected

@dab246
Copy link
Member

dab246 commented Dec 2, 2024

  • Tested on tmail.linagora.com environment. Real device iOS 18.1.1. It still doesn't work.
Screenshot 2024-12-02 at 15 07 26

IMG_9764

@tddang-linagora
Copy link
Contributor Author

It still doesn't work.

Screen.Recording.2024-12-02.at.16.11.56.mov

tmail.linagora.com worked fine

@hoangdat
Copy link
Member

hoangdat commented Dec 2, 2024

did you tested with iOS v18.* @tddang-linagora

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.

3 participants