change some Object type to any to unblock typing,
add GoogleApiAvailabilityType, add namespace for auth, messaging
This commit is contained in:
parent
c42077f491
commit
e5382b96df
|
@ -7,8 +7,9 @@ declare module "react-native-firebase" {
|
|||
|
||||
export default class FireBase {
|
||||
constructor(config?: RNFirebase.configurationOptions)
|
||||
log: any
|
||||
analytics(): RNFirebase.Analytics;
|
||||
auth(): RNFirebase.Auth;
|
||||
auth(): RNFirebase.auth.Auth;
|
||||
on(type: string, handler: (msg: any) => void): any;
|
||||
/** mimics firebase Web SDK */
|
||||
database(): RNFirebase.database.Database;
|
||||
|
@ -22,7 +23,7 @@ declare module "react-native-firebase" {
|
|||
* As the Firebase Web SDK has limited messaging functionality,
|
||||
* the following methods within react-native-firebase have been created to handle FCM in the React Native environment.
|
||||
*/
|
||||
messaging(): RNFirebase.Messaging;
|
||||
messaging(): RNFirebase.messaging.Messaging;
|
||||
/**
|
||||
* RNFirebase provides crash reporting for your app out of the box.
|
||||
* Please note crashes do not appear in real-time on the console,
|
||||
|
@ -30,13 +31,93 @@ declare module "react-native-firebase" {
|
|||
* If you want to manually report a crash,
|
||||
* such as a pre-caught exception this is possible by using the report method.
|
||||
*/
|
||||
crash(): RNFirebase.Crash;
|
||||
crash(): RNFirebase.crash.Crash;
|
||||
|
||||
googleApiAvailability: RNFirebase.GoogleApiAvailabilityType;
|
||||
static initializeApp(options?: any, name?: string): FireBase
|
||||
}
|
||||
|
||||
namespace RNFirebase {
|
||||
interface RnError extends Error {
|
||||
code?: string;
|
||||
}
|
||||
|
||||
type GoogleApiAvailabilityType = {
|
||||
status: number,
|
||||
isAvailable: boolean,
|
||||
isUserResolvableError?: boolean,
|
||||
error?: string
|
||||
};
|
||||
|
||||
/**
|
||||
* pass custom options by passing an object with configuration options.
|
||||
* The configuration object will be generated first by the native configuration object, if set and then will be overridden if passed in JS.
|
||||
* That is, all of the following key/value pairs are optional if the native configuration is set.
|
||||
*/
|
||||
interface configurationOptions {
|
||||
/**
|
||||
* default false
|
||||
* When set to true, RNFirebase will log messages to the console and fire debug events we can listen to in js
|
||||
* @usage
|
||||
* firebase.on('debug', msg => console.log('Received debug message', msg))
|
||||
*/
|
||||
debug?: boolean;
|
||||
/**
|
||||
* default false
|
||||
* When set to true, database persistence will be enabled.
|
||||
*/
|
||||
persistence?: boolean;
|
||||
/**
|
||||
* Default from app [NSBundle mainBundle] The bundle ID for the app to be bundled with
|
||||
*/
|
||||
bundleID?: string;
|
||||
/**
|
||||
* defualt ""
|
||||
* The Google App ID that is used to uniquely identify an instance of an app.
|
||||
*/
|
||||
googleAppID?: string;
|
||||
/**
|
||||
* deufalt ""
|
||||
* The database root (i.e. https://my-app.firebaseio.com)
|
||||
*/
|
||||
databaseURL?: string;
|
||||
/**
|
||||
* defualt ""
|
||||
* URL scheme to set up durable deep link service
|
||||
*/
|
||||
deepLinkURLScheme?: string;
|
||||
/**
|
||||
* defualt ""
|
||||
* The Google Cloud storage bucket name
|
||||
*/
|
||||
storageBucket?: string;
|
||||
/**
|
||||
* default ""
|
||||
* The Android client ID used in Google AppInvite when an iOS app has it's android version
|
||||
*/
|
||||
androidClientID?: string;
|
||||
/**
|
||||
* default ""
|
||||
* The Project number from the Google Developer's console used to configure Google Cloud Messaging
|
||||
*/
|
||||
GCMSenderID?: string;
|
||||
/**
|
||||
* default ""
|
||||
* The tracking ID for Google Analytics
|
||||
*/
|
||||
trackingID?: string;
|
||||
/**
|
||||
* default ""
|
||||
* The OAuth2 client ID for iOS application used to authenticate Google Users for signing in with Google
|
||||
*/
|
||||
clientID?: string;
|
||||
/**
|
||||
* defualt ""
|
||||
* The secret iOS API key used for authenticating requests from our app
|
||||
*/
|
||||
APIKey?: string
|
||||
}
|
||||
|
||||
namespace storage {
|
||||
|
||||
interface StorageTask<T> extends Promise<T> {
|
||||
|
@ -67,12 +148,13 @@ declare module "react-native-firebase" {
|
|||
* @param {String} filePath Where to store the file
|
||||
* @return {Promise}
|
||||
* */
|
||||
downloadFile(filePath: string): any;
|
||||
downloadFile(filePath: string): StorageTask<any>;
|
||||
/**
|
||||
* Upload a file path
|
||||
* @returns {Promise}
|
||||
*/
|
||||
putFile(filePath: Object, metadata?: Object): StorageTask<Object>;
|
||||
putFile(filePath: string, metadata?: any): StorageTask<any>;
|
||||
setMaxDownloadRetryTime(time: number): void
|
||||
}
|
||||
|
||||
interface Storage {
|
||||
|
@ -280,74 +362,6 @@ declare module "react-native-firebase" {
|
|||
update(values: Object, onComplete?: (a: RnError | null) => any): Promise<any>;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* pass custom options by passing an object with configuration options.
|
||||
* The configuration object will be generated first by the native configuration object, if set and then will be overridden if passed in JS.
|
||||
* That is, all of the following key/value pairs are optional if the native configuration is set.
|
||||
*/
|
||||
interface configurationOptions {
|
||||
/**
|
||||
* default false
|
||||
* When set to true, RNFirebase will log messages to the console and fire debug events we can listen to in js
|
||||
* @usage
|
||||
* firebase.on('debug', msg => console.log('Received debug message', msg))
|
||||
*/
|
||||
debug?: boolean;
|
||||
/**
|
||||
* default false
|
||||
* When set to true, database persistence will be enabled.
|
||||
*/
|
||||
persistence?: boolean;
|
||||
/**
|
||||
* Default from app [NSBundle mainBundle] The bundle ID for the app to be bundled with
|
||||
*/
|
||||
bundleID?: string;
|
||||
/**
|
||||
* defualt ""
|
||||
* The Google App ID that is used to uniquely identify an instance of an app.
|
||||
*/
|
||||
googleAppID?: string;
|
||||
/**
|
||||
* deufalt ""
|
||||
* The database root (i.e. https://my-app.firebaseio.com)
|
||||
*/
|
||||
databaseURL?: string;
|
||||
/**
|
||||
* defualt ""
|
||||
* URL scheme to set up durable deep link service
|
||||
*/
|
||||
deepLinkURLScheme?: string;
|
||||
/**
|
||||
* defualt ""
|
||||
* The Google Cloud storage bucket name
|
||||
*/
|
||||
storageBucket?: string;
|
||||
/**
|
||||
* default ""
|
||||
* The Android client ID used in Google AppInvite when an iOS app has it's android version
|
||||
*/
|
||||
androidClientID?: string;
|
||||
/**
|
||||
* default ""
|
||||
* The Project number from the Google Developer's console used to configure Google Cloud Messaging
|
||||
*/
|
||||
GCMSenderID?: string;
|
||||
/**
|
||||
* default ""
|
||||
* The tracking ID for Google Analytics
|
||||
*/
|
||||
trackingID?: string;
|
||||
/**
|
||||
* default ""
|
||||
* The OAuth2 client ID for iOS application used to authenticate Google Users for signing in with Google
|
||||
*/
|
||||
clientID?: string;
|
||||
/**
|
||||
* defualt ""
|
||||
* The secret iOS API key used for authenticating requests from our app
|
||||
*/
|
||||
APIKey?: string
|
||||
}
|
||||
/**
|
||||
* firebase Analytics
|
||||
*/
|
||||
|
@ -411,7 +425,7 @@ declare module "react-native-firebase" {
|
|||
/**
|
||||
* - Additional provider-specific information about the user.
|
||||
*/
|
||||
providerData: Object | null
|
||||
providerData: any | null
|
||||
/**
|
||||
* - The authentication provider ID for the current user.
|
||||
* For example, 'facebook.com', or 'google.com'.
|
||||
|
@ -467,6 +481,7 @@ declare module "react-native-firebase" {
|
|||
token: string,
|
||||
secret: string
|
||||
}
|
||||
namespace auth {
|
||||
|
||||
interface Auth {
|
||||
/**
|
||||
|
@ -524,6 +539,9 @@ declare module "react-native-firebase" {
|
|||
*/
|
||||
signOut(): Promise<void>
|
||||
}
|
||||
}
|
||||
|
||||
namespace messaging {
|
||||
|
||||
interface Messaging {
|
||||
/**
|
||||
|
@ -539,12 +557,12 @@ declare module "react-native-firebase" {
|
|||
* getInitialNotification is called and the notification payload is returned.
|
||||
* Use onMessage for notifications when the app is running.
|
||||
*/
|
||||
getInitialNotification(): Promise<Object>
|
||||
getInitialNotification(): Promise<any>
|
||||
/**
|
||||
* Returns the devices FCM token.
|
||||
* This token can be used in the Firebase console to send messages to directly.
|
||||
*/
|
||||
getToken(): Promise<string>
|
||||
getToken(forceRefresh?: Boolean): Promise<string>
|
||||
/**
|
||||
* On the event a devices FCM token is refreshed by Google,
|
||||
* the new token is returned in a callback listener.
|
||||
|
@ -556,15 +574,15 @@ declare module "react-native-firebase" {
|
|||
* This method is only triggered when the app is running.
|
||||
* Use getInitialNotification for notifications which cause the app to open.
|
||||
*/
|
||||
onMessage(listener: (message: Object) => any): void
|
||||
onMessage(listener: (message: any) => any): void
|
||||
/**
|
||||
* Create a local notification from the device itself.
|
||||
*/
|
||||
createLocalNotification(notification: Object): any
|
||||
createLocalNotification(notification: any): any
|
||||
/**
|
||||
* Schedule a local notification to be shown on the device.
|
||||
*/
|
||||
scheduleLocalNotification(notification: Object): any
|
||||
scheduleLocalNotification(notification: any): any
|
||||
/**
|
||||
* Returns an array of all currently scheduled notifications.
|
||||
* ```
|
||||
|
@ -620,6 +638,8 @@ declare module "react-native-firebase" {
|
|||
collapseKey?: string,
|
||||
data: Object,
|
||||
}
|
||||
}
|
||||
namespace crash {
|
||||
|
||||
interface Crash {
|
||||
/** Logs a message that will appear in a subsequent crash report. */
|
||||
|
@ -637,3 +657,4 @@ declare module "react-native-firebase" {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue