feat(firebase-dynamic-links): update to conform to the latest version of the plugin

feat(firebase-dynamic-links): update to conform to the latest version of the plugin
This commit is contained in:
Daniel Sogl 2018-03-17 00:52:55 +01:00 committed by GitHub
commit b9a254aa2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,22 +1,19 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable';
export interface DynamicLinksOptions { export interface IDynamicLink {
title: string; matchType: 'Weak' | 'Strong';
message: string; deepLink: string;
deepLink?: string;
callToActionText?: string;
} }
/** /**
* @beta * @beta
* @name Firebase Dynamic Links * @name Firebase Dynamic Links
* @description * @description
* Cordova plugin for Firebase Invites and Firebase Dynamic Links * Cordova plugin for Firebase Dynamic Links
* *
* Variables APP_DOMAIN and APP_PATH specify web URL where your app will start an activity to handle the link. They also used to setup support for App Indexing. * Variables APP_DOMAIN and APP_PATH specify web URL where your app will start an activity to handle the link. They also used to setup support for App Indexing.
* Variable REVERSED_CLIENT_ID can be found in your GoogleService-Info.plist under the same key name.
* Variable PHOTO_LIBRARY_USAGE_DESCRIPTION specifies required value for NSPhotoLibraryUsageDescription on iOS.
* Go to firebase console and export google-services.json and GoogleService-Info.plist. Put those files into the root of your cordova app folder. * Go to firebase console and export google-services.json and GoogleService-Info.plist. Put those files into the root of your cordova app folder.
* *
* Preferences: * Preferences:
@ -41,17 +38,6 @@ export interface DynamicLinksOptions {
* constructor(private firebaseDynamicLinks: FirebaseDynamicLinks) { } * constructor(private firebaseDynamicLinks: FirebaseDynamicLinks) { }
* *
* ... * ...
* // The deepLink and callToActionText properties are optional
* const options: DynamicLinksOptions = {
* title: 'My Title';
* message: 'My message';
* deepLink: 'http://example.com/';
* callToActionText: 'Message on button';
* }
*
* this.firebaseDynamicLinks.sendInvitation(options)
* .then((res: any) => console.log(res))
* .catch((error: any) => console.error(error));
* *
* this.firebaseDynamicLinks.onDynamicLink() * this.firebaseDynamicLinks.onDynamicLink()
* .then((res: any) => console.log(res)) //Handle the logic here after opening the app with the Dynamic link * .then((res: any) => console.log(res)) //Handle the logic here after opening the app with the Dynamic link
@ -75,17 +61,12 @@ export class FirebaseDynamicLinks extends IonicNativePlugin {
/** /**
* Registers callback that is triggered on each dynamic link click. * Registers callback that is triggered on each dynamic link click.
* @return {Promise<any>} Returns a promise * @return {Observable<IDynamicLink>} Returns an observable
*/ */
@Cordova() @Cordova({
onDynamicLink(): Promise<any> { return; } callbackOrder: 'reverse',
observable: true,
/** })
* Display invitation dialog. onDynamicLink(): Observable<IDynamicLink> { return; }
* @param options {DynamicLinksOptions} Some param to configure something
* @return {Promise<any>} Returns a promise
*/
@Cordova()
sendInvitation(options: DynamicLinksOptions): Promise<any> { return; }
} }