capacitor-plugins icon indicating copy to clipboard operation
capacitor-plugins copied to clipboard

App listener 'appUrlOpen' not firing when opening iOS push notification with deep-link

Open KirstenStake opened this issue 3 years ago • 2 comments

Bug Report

Plugin(s)

Capacitor Version

Latest Dependencies:

  @capacitor/cli: 4.3.0
  @capacitor/core: 4.3.0
  @capacitor/android: 4.3.0
  @capacitor/ios: 4.3.0

Installed Dependencies:

  @capacitor/cli: 3.4.3
  @capacitor/android: 3.5.1
  @capacitor/core: 3.5.1
  @capacitor/ios: 3.5.1

Platform(s)

  • iOS

Current Behavior

When linking a deep-link to a push notification, click the push notification, the app opens BUT the "appUrlOpen" event does not fire. This only happens with a push notification on iOS.

The deep-linking set up seems to be working and correct as clicking these deep-links from an external source on the device (e.g. messenger, slack etc) will open the app and trigger the event. As well as clicking the deep-link from inside the app, also triggers the "appUrlOpen" event. The only one failing is iOS push. (Android working fine in all use cases)

  1. push notification is received and has a deep-link attached when clicked
  2. user clicks push
  3. app opens
  4. **** appUrlOpen event is NOT fired

Expected Behavior

Expect the appUrlOpen even to fire/get triggered if the app is opening from a push notification.

Code Reproduction

app.component.ts

this._platform.ready().then(async () => {
    this._initEventSusbcription();
}

(I added logging to the html so I could debug iOS from TestFlight) service code block for event

  private _initEventSusbcription() {
    let storedLog;
    this.deepLinkSubject$.next({init: true}); <-------------------- *** This log triggers on app open from a push, so the subscription is initialised. rest of code below never fires for the event from a push open.

    App.addListener('appUrlOpen', (event: URLOpenListenerEvent) => {
      this._ngZone.run(() => {
        storedLog = this.deepLinkSubject$.value;
        this.deepLinkSubject$.next({...storedLog, initialEvent: event});
        if (!event) return;

       ........rest of logic code for routes
      });
    });
  }

Other Technical Details

  • Braze (Appboy) is used as our provider to send out the push notification (note. sending a push via braze for Android is triggering the event fine)

KirstenStake avatar Sep 30 '22 03:09 KirstenStake

This issue may need more information before it can be addressed. In particular, it will need a reliable Code Reproduction that demonstrates the issue.

Please see the Contributing Guide for how to create a Code Reproduction.

Thanks! Ionitron 💙

Ionitron avatar Oct 10 '22 11:10 Ionitron

Unsure how to provide a code reproduction when it comes to push notifications from an external source. Please provide guidance if this is required.

KirstenStake avatar Oct 11 '22 01:10 KirstenStake

Closing since I can't reproduce and no sample app was provided.

jcesarmobile avatar Feb 27 '23 12:02 jcesarmobile

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Mar 29 '23 12:03 ionitron-bot[bot]