cordova-plugin-firebasex icon indicating copy to clipboard operation
cordova-plugin-firebasex copied to clipboard

Support other push notification providers on iOS

Open stephanejais opened this issue 3 years ago • 2 comments

Feature request

Firebasex catches all notification responses sent by UNUserNotificationCenter, as long as the trigger is of type UNPushNotificationTrigger.

In AppDelegate+FirebasePlugin.m

// Asks the delegate to process the user's response to a delivered notification.
// Called when user taps on system notification
- (void) userNotificationCenter:(UNUserNotificationCenter *)center
 didReceiveNotificationResponse:(UNNotificationResponse *)response
          withCompletionHandler:(void (^)(void))completionHandler
{
    @try{
        
        if (![response.notification.request.trigger isKindOfClass:UNPushNotificationTrigger.class] && ![response.notification.request.trigger isKindOfClass:UNTimeIntervalNotificationTrigger.class]){

           // FIXME: with push notifications, we never reach this line.

            if (_previousDelegate) {
                // bubbling event
                [_previousDelegate userNotificationCenter:center
                               didReceiveNotificationResponse:response
                            withCompletionHandler:completionHandler];
                return;

This prevents other push providers from listening to clicks on their push notifications. I see a couple ways to fix this:

  1. why not systematically forward clicks, whatever the trigger?
  2. let developers override this behavior with a cordova setting.

stephanejais avatar May 20 '22 09:05 stephanejais

@dpa99c Hey, any feedback on this?

stephanejais avatar Sep 07 '22 09:09 stephanejais

@stephanejais You are welcome to submit a PR implementing this

dpa99c avatar Sep 07 '22 09:09 dpa99c