Socket
Book a DemoInstallSign in
Socket

@joinflux/capacitor-firebase-dynamic-links

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@joinflux/capacitor-firebase-dynamic-links

Capacitor Plugin for Firebase Dynamic Links

latest
Source
npmnpm
Version
2.1.0
Version published
Weekly downloads
20
566.67%
Maintainers
2
Weekly downloads
 
Created
Source

npm version

Capacitor plugin for Firebase Dynamic Links

Installation

npm i @joinflux/capacitor-firebase-dynamic-links

Versioning

  • Version 0.2.0 or lower will target the latest Capacitor version
    • Capacitor 3 is recommended for this version
  • Version 1.x.x will target Capacitor 4
  • Version 2.x.x will target Capacitor 5

Android

Unknown, at the moment we have not tested the implementation on Android.

iOS

Nothing more needed

Web

None

Configuration

NameTypeDescription
universalLinksNotificationNamestring(IOS only) Overrides the default notification name used by Capacitor. Configure this if you have other plugins (e.g. Apps Flyer) that also use deep links. See more info below

Provide configuration in root capacitor.config.json

{
  "plugins": {
    "FirebaseDynamicLinks": {
      "universalLinksNotificationName": "firebaseOpenUniversalLink"
    }
  }
}

or in capacitor.config.ts

const config: CapacitorConfig = {
  plugins: {
    FirebaseDynamicLinks: {
      universalLinksNotificationName: 'firebaseOpenUniversalLink',
    },
  },
};

(IOS only) Additional set up for universalLinksNotificationName

If you use this configuration, you need to intercept Firebase Dynamic links in your AppDelegate.swift file. For example:


@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    ...omitted for brevity

    func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
        // To get Firebase dynamic links to play along nicely with Apps Flyer,
        // we intercept them and use a custom notification name
        let url = userActivity.webpageURL?.absoluteString
        if (url != nil && isFirebaseDynamicLink(url: url!)) {
            // The notification name has to match what you've specified in your Capacitor config
            NotificationCenter.default.post(name: Notification.Name("firebaseOpenUniversalLink"), object: [
                "url": userActivity.webpageURL
            ])
            return true
        }

        // Called when the app was launched with an activity, including Universal Links.
        // Feel free to add additional processing here, but if you want the App API to support
        // tracking app url opens, make sure to keep this call
        return ApplicationDelegateProxy.shared.application(application, continue: userActivity, restorationHandler: restorationHandler)
    }

    func isFirebaseDynamicLink(url: String) -> Bool {
        return url.hasPrefix("https://your-firebase-links.page.link")
    }
}

Methods

AddListener

Add this method when the app starts to listen for the dynamic link.

CapacitorFirebaseDynamicLinks.addListener(
  'deepLinkOpen',
  (data: { url: string }) => {
    // Implement your navigation handler
  },
);

Keywords

capacitor

FAQs

Package last updated on 13 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts