Skip to content

Conversation

@WontakKim
Copy link

Description

This PR fixes an issue where completionHandler in userNotificationCenter:willPresentNotification:withCompletionHandler: is called before the original delegate, preventing custom foreground notification presentation logic from working.

Related issues

#8754

Release Summary

Fixed iOS messaging to respect custom notification presentation logic by calling the original delegate before consuming the completionHandler.

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
    • Other (macOS, web)
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan

Tested Scenario:

  1. Implemented custom willPresentNotification handler in AppDelegate to control notification presentation
  2. Sent FCM notification while app is in foreground
  3. Verified custom logic is now executed and controls notification display behavior

Before Fix:

  • Custom completion handler in AppDelegate was ignored
  • Notifications always displayed with library's default options

After Fix:

  • Custom completion handler in AppDelegate is respected
  • Developers can control whether/how to display foreground notifications
  • Default behavior preserved when no custom delegate exists

Code Example Tested:

// AppDelegate.m
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
willPresentNotification:(UNNotification *)notification
withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
  // Custom logic to determine notification presentation
  if (shouldShowNotification) {
    completionHandler(UNNotificationPresentationOptionBanner | 
                     UNNotificationPresentationOptionSound);
  } else {
    completionHandler(UNNotificationPresentationOptionNone);
  }
}

@vercel
Copy link

vercel bot commented Dec 1, 2025

@wrtn-wontak is attempting to deploy a commit to the Invertase Team on Vercel.

A member of the Team first needs to authorize it.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@WontakKim WontakKim changed the title fix(messaging, ios): prioritize delegate call order in willPresentNot… fix(messaging, ios): prioritize delegate call order in willPresentNotification Dec 1, 2025
@MichaelVerdon
Copy link
Collaborator

MichaelVerdon commented Dec 1, 2025

Hi there @WontakKim looks good to me just fix the linter issues please and I will approve it and ensure the CLA is signed.

@WontakKim
Copy link
Author

WontakKim commented Dec 2, 2025

Hi @MichaelVerdon, I've signed the CLA docs and ran clang-format -i packages/messaging/ios/RNFBMessaging/RNFBMessaging+UNUserNotificationCenter.m. It seems to have changed some unnecessary lines. Could you please review my changes again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants