mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-23 20:10:05 +08:00
Merge commit '637cd81424b9a18cdec9735492a21f06be4e7ccf'
This commit is contained in:
68
lib/index.d.ts
vendored
68
lib/index.d.ts
vendored
@@ -64,6 +64,14 @@ declare module "react-native-firebase" {
|
||||
*/
|
||||
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: {
|
||||
crashlytics(): RNFirebase.crashlytics.Crashlytics;
|
||||
};
|
||||
@@ -641,6 +649,11 @@ declare module "react-native-firebase" {
|
||||
*/
|
||||
currentUser: User | null
|
||||
|
||||
/**
|
||||
* Gets/Sets the language for the app instance
|
||||
*/
|
||||
languageCode: string | null;
|
||||
|
||||
/**
|
||||
* Listen for changes in the users auth state (logging in and out).
|
||||
* This method returns a unsubscribe function to stop listening to events.
|
||||
@@ -895,5 +908,60 @@ declare module "react-native-firebase" {
|
||||
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',
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ export default class Auth extends ModuleBase {
|
||||
});
|
||||
this._user = null;
|
||||
this._authResult = null;
|
||||
this._languageCode = getNativeModule(this).APP_LANGUAGE[app._name] || getNativeModule(this).APP_LANGUAGE['[DEFAULT]'];
|
||||
|
||||
SharedEventEmitter.addListener(
|
||||
// sub to internal native event - this fans out to
|
||||
@@ -335,6 +336,16 @@ export default class Auth extends ModuleBase {
|
||||
return getNativeModule(this).fetchProvidersForEmail(email);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the language for the auth module
|
||||
* @param code
|
||||
* @returns {*}
|
||||
*/
|
||||
set languageCode(code: string) {
|
||||
this._languageCode = code;
|
||||
getNativeModule(this).setLanguageCode(code);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currently signed in user
|
||||
* @return {Promise}
|
||||
@@ -343,6 +354,10 @@ export default class Auth extends ModuleBase {
|
||||
return this._user;
|
||||
}
|
||||
|
||||
get languageCode(): string {
|
||||
return this._languageCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* KNOWN UNSUPPORTED METHODS
|
||||
*/
|
||||
@@ -366,6 +381,11 @@ export default class Auth extends ModuleBase {
|
||||
signInWithRedirect() {
|
||||
throw new Error(INTERNALS.STRINGS.ERROR_UNSUPPORTED_MODULE_METHOD('auth', 'signInWithRedirect'));
|
||||
}
|
||||
|
||||
// firebase issue - https://github.com/invertase/react-native-firebase/pull/655#issuecomment-349904680
|
||||
useDeviceLanguage() {
|
||||
throw new Error(INTERNALS.STRINGS.ERROR_UNSUPPORTED_MODULE_METHOD('auth', 'useDeviceLanguage'));
|
||||
}
|
||||
}
|
||||
|
||||
export const statics = {
|
||||
|
||||
Reference in New Issue
Block a user