Merge pull request #757 from pheromonez/master

Add Typescript definitions for Dynamic Links
This commit is contained in:
Michael Diarmid 2018-01-17 15:06:49 +00:00 committed by GitHub
commit 26be35ce40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 63 additions and 0 deletions

63
lib/index.d.ts vendored
View File

@ -64,6 +64,14 @@ declare module "react-native-firebase" {
*/ */
crash(): RNFirebase.crash.Crash; crash(): RNFirebase.crash.Crash;
/**
* Firebase Dynamic Links are links that work the way you want, on multiple
* platforms, and whether or not your app is already installed.
* See the official Firebase docs:
* https://firebase.google.com/docs/dynamic-links/
*/
links(): RNFirebase.links.Links;
static fabric: { static fabric: {
crashlytics(): RNFirebase.crashlytics.Crashlytics; crashlytics(): RNFirebase.crashlytics.Crashlytics;
}; };
@ -895,5 +903,60 @@ declare module "react-native-firebase" {
setUserIdentifier(userId: string): void; setUserIdentifier(userId: string): void;
} }
} }
namespace links {
interface Links {
/** Creates a standard dynamic link. */
createDynamicLink(parameters: LinkConfiguration): Promise<string>;
/** Creates a short dynamic link. */
createShortDynamicLink(parameters: LinkConfiguration): Promise<string>;
/**
* Returns the URL that the app has been launched from. If the app was
* not launched from a URL the return value will be null.
*/
getInitialLink(): Promise<string | null>;
/**
* Subscribe to URL open events while the app is still running.
* The listener is called from URL open events whilst the app is still
* running, use getInitialLink for URLs which cause the app to open
* from a previously closed / not running state.
* Returns an unsubscribe function, call the returned function to
* unsubscribe from all future events.
*/
onLink(listener: (url) => void): () => void;
}
/**
* Configuration when creating a Dynamic Link (standard or short). For
* more information about each parameter, see the official Firebase docs:
* https://firebase.google.com/docs/reference/dynamic-links/link-shortener
*/
interface LinkConfiguration {
link: string,
dynamicLinkDomain: string,
androidInfo?: {
androidLink?: string,
androidPackageName: string,
androidFallbackLink?: string,
androidMinPackageVersionCode?: string,
},
iosInfo?: {
iosBundleId: string,
iosAppStoreId?: string,
iosFallbackLink?: string,
iosCustomScheme?: string,
iosIpadBundleId?: string,
iosIpadFallbackLink?: string,
},
socialMetaTagInfo?: {
socialTitle: string,
socialImageLink: string,
socialDescription: string,
},
suffix?: {
option: 'SHORT' | 'UNGUESSABLE',
},
}
}
} }
} }