Skip to content

Commit

Permalink
Added PAGE_LINK_PATHPREFIX preference for specifying Android pathPref…
Browse files Browse the repository at this point in the history
…ix (#82)

* Added PAGE_LINK_PATHPREFIX preference for specifying Android pathPrefix

* Added FirebaseDynamicLinksCustomDomains to iOS Info.plist

* Refactor preferences to APP_DOMAIN_NAME and APP_DOMAIN_PATH

* Update README.md for APP_DOMAIN_NAME and APP_DOMAIN_PATH changes

* Fixed APP_DOMAIN_PATH typo in README.md example

* Append APP_DOMAIN_PATH to DOMAIN_URI_PREFIX
  • Loading branch information
mcfarljw authored Oct 21, 2020
1 parent d449507 commit fd194bc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@

## Installation

$ cordova plugin add cordova-plugin-firebase-dynamiclinks --variable PAGE_LINK_DOMAIN="mydomain.page.link"
$ cordova plugin add cordova-plugin-firebase-dynamiclinks --variable APP_DOMAIN_NAME="mydomain.page.link"

Use variable `PAGE_LINK_DOMAIN` specify your `*.page.link` domain.
Use variable `APP_DOMAIN_NAME` to specify your Google generated `*.page.link` domain or other custom domain.

$ cordova plugin add cordova-plugin-firebase-dynamiclinks --variable APP_DOMAIN_NAME="mydomain.com" --variable APP_DOMAIN_PATH="/app1"

Use variables `APP_DOMAIN_PATH` to speciy a specific domain path prefix when using a custom domain. This is useful if multiple apps share the same root level domain. If specified this path **must** begin with a `/`.

Use variables `IOS_FIREBASE_DYNAMICLINKS_VERSION` and `ANDROID_FIREBASE_DYNAMICLINKS_VERSION` to override dependency versions for Firebase SDKs.

Expand Down
22 changes: 15 additions & 7 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ xmlns:android="http://schemas.android.com/apk/res/android"
<merges target="cordova.plugins.firebase.dynamiclinks" />
</js-module>

<preference name="PAGE_LINK_DOMAIN" />
<preference name="APP_DOMAIN_NAME" />
<preference name="APP_DOMAIN_PATH" default="/" />

<dependency id="cordova-plugin-firebase-analytics" version="~4.5.0"/>

<platform name="android">
<preference name="ANDROID_FIREBASE_DYNAMICLINKS_VERSION" default="19.1.+"/>

<config-file parent="/*" target="res/xml/config.xml">
<preference name="DOMAIN_URI_PREFIX" value="https://$PAGE_LINK_DOMAIN"/>
<preference name="DOMAIN_URI_PREFIX" value="https://$APP_DOMAIN_NAME$APP_DOMAIN_PATH"/>
<feature name="FirebaseDynamicLinks">
<param name="android-package" value="by.chemerisuk.cordova.firebase.FirebaseDynamicLinksPlugin" />
</feature>
Expand All @@ -37,8 +38,8 @@ xmlns:android="http://schemas.android.com/apk/res/android"
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="$PAGE_LINK_DOMAIN" android:scheme="http"/>
<data android:host="$PAGE_LINK_DOMAIN" android:scheme="https"/>
<data android:host="$APP_DOMAIN_NAME" android:pathPrefix="$APP_DOMAIN_PATH" android:scheme="http"/>
<data android:host="$APP_DOMAIN_NAME" android:pathPrefix="$APP_DOMAIN_PATH" android:scheme="https"/>
</intent-filter>
</config-file>

Expand All @@ -54,7 +55,7 @@ xmlns:android="http://schemas.android.com/apk/res/android"
<preference name="IOS_FIREBASE_DYNAMICLINKS_VERSION" default="~> 6.32.2"/>

<config-file parent="/*" target="config.xml">
<preference name="DOMAIN_URI_PREFIX" value="https://$PAGE_LINK_DOMAIN"/>
<preference name="DOMAIN_URI_PREFIX" value="https://$APP_DOMAIN_NAME$APP_DOMAIN_PATH"/>
<feature name="FirebaseDynamicLinks">
<param name="ios-package" value="FirebaseDynamicLinksPlugin" />
</feature>
Expand All @@ -75,15 +76,22 @@ xmlns:android="http://schemas.android.com/apk/res/android"
</array>
</config-file>

<config-file target="*-Info.plist" parent="FirebaseDynamicLinksCustomDomains">
<array>
<string>http://$APP_DOMAIN_NAME$APP_DOMAIN_PATH</string>
<string>https://$APP_DOMAIN_NAME$APP_DOMAIN_PATH</string>
</array>
</config-file>

<config-file target="*-Debug.plist" parent="com.apple.developer.associated-domains">
<array>
<string>applinks:$PAGE_LINK_DOMAIN</string>
<string>applinks:$APP_DOMAIN_NAME</string>
</array>
</config-file>

<config-file target="*-Release.plist" parent="com.apple.developer.associated-domains">
<array>
<string>applinks:$PAGE_LINK_DOMAIN</string>
<string>applinks:$APP_DOMAIN_NAME</string>
</array>
</config-file>

Expand Down

0 comments on commit fd194bc

Please sign in to comment.