2017-03-22 22:43:20 +00:00
|
|
|
// Type definitions for React Native Firebase v1.0.0-alpha7
|
|
|
|
// Project: https://github.com/invertase/react-native-firebase
|
2017-03-23 10:06:07 +00:00
|
|
|
// Definitions by: Tal <https://github.com/taljacobson>
|
|
|
|
// TypeScript Version: 2.1
|
2017-03-22 22:43:20 +00:00
|
|
|
|
2017-03-23 10:06:07 +00:00
|
|
|
declare module "react-native-firebase" {
|
2017-03-22 22:43:20 +00:00
|
|
|
|
2017-11-08 08:31:24 +00:00
|
|
|
type AuthProvider = {
|
|
|
|
PROVIDER_ID: string,
|
|
|
|
credential: (token: string, secret?: string) => object,
|
|
|
|
};
|
|
|
|
|
2017-03-23 10:06:07 +00:00
|
|
|
export default class FireBase {
|
|
|
|
constructor(config?: RNFirebase.configurationOptions)
|
2017-07-05 13:56:18 +00:00
|
|
|
|
2017-09-29 10:35:20 +00:00
|
|
|
log: any;
|
2017-07-05 13:56:18 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
analytics(): RNFirebase.Analytics;
|
2017-07-05 13:56:18 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
on(type: string, handler: (msg: any) => void): any;
|
2017-07-05 13:56:18 +00:00
|
|
|
|
2017-06-25 03:46:56 +00:00
|
|
|
database: {
|
|
|
|
(): RNFirebase.database.Database
|
|
|
|
ServerValue: {
|
|
|
|
TIMESTAMP: number
|
|
|
|
}
|
2017-09-29 10:35:20 +00:00
|
|
|
};
|
2017-07-05 13:56:18 +00:00
|
|
|
|
2017-11-08 08:31:24 +00:00
|
|
|
auth: {
|
|
|
|
(): RNFirebase.auth.Auth
|
|
|
|
EmailAuthProvider: AuthProvider,
|
|
|
|
PhoneAuthProvider: AuthProvider,
|
|
|
|
GoogleAuthProvider: AuthProvider,
|
|
|
|
GithubAuthProvider: AuthProvider,
|
|
|
|
TwitterAuthProvider: AuthProvider,
|
|
|
|
FacebookAuthProvider: AuthProvider,
|
|
|
|
PhoneAuthState: {
|
|
|
|
CODE_SENT: string,
|
|
|
|
AUTO_VERIFY_TIMEOUT: string,
|
|
|
|
AUTO_VERIFIED: string,
|
|
|
|
ERROR: string,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2017-06-19 11:25:58 +00:00
|
|
|
/**RNFirebase mimics the Web Firebase SDK Storage,
|
|
|
|
* whilst providing some iOS and Android specific functionality.
|
2017-03-23 10:06:07 +00:00
|
|
|
*/
|
2017-03-23 12:58:03 +00:00
|
|
|
storage(): RNFirebase.storage.Storage;
|
2017-07-05 13:56:18 +00:00
|
|
|
|
2017-03-23 10:06:07 +00:00
|
|
|
/**
|
|
|
|
* Firebase Cloud Messaging (FCM) allows you to send push messages at no cost to both Android & iOS platforms.
|
|
|
|
* Assuming the installation instructions have been followed, FCM is ready to go.
|
2017-06-19 11:25:58 +00:00
|
|
|
* As the Firebase Web SDK has limited messaging functionality,
|
2017-03-23 10:06:07 +00:00
|
|
|
* the following methods within react-native-firebase have been created to handle FCM in the React Native environment.
|
|
|
|
*/
|
2017-03-30 14:09:48 +00:00
|
|
|
messaging(): RNFirebase.messaging.Messaging;
|
2017-07-05 13:56:18 +00:00
|
|
|
|
2017-03-23 10:06:07 +00:00
|
|
|
/**
|
|
|
|
* RNFirebase provides crash reporting for your app out of the box.
|
|
|
|
* Please note crashes do not appear in real-time on the console,
|
|
|
|
* they tend to take a number of hours to appear
|
|
|
|
* If you want to manually report a crash,
|
|
|
|
* such as a pre-caught exception this is possible by using the report method.
|
|
|
|
*/
|
2017-03-30 14:09:48 +00:00
|
|
|
crash(): RNFirebase.crash.Crash;
|
2017-07-05 13:56:18 +00:00
|
|
|
|
2018-01-04 02:39:10 +00:00
|
|
|
static fabric: {
|
|
|
|
crashlytics(): RNFirebase.crashlytics.Crashlytics;
|
|
|
|
};
|
|
|
|
|
2017-04-26 19:12:59 +00:00
|
|
|
apps: Array<string>;
|
2017-03-30 14:09:48 +00:00
|
|
|
googleApiAvailability: RNFirebase.GoogleApiAvailabilityType;
|
2017-07-05 13:56:18 +00:00
|
|
|
|
2017-04-26 19:12:59 +00:00
|
|
|
static initializeApp(options?: any | RNFirebase.configurationOptions, name?: string): FireBase;
|
2017-07-05 13:56:18 +00:00
|
|
|
|
2017-10-06 11:11:32 +00:00
|
|
|
static app(name?: string): FireBase;
|
|
|
|
|
2017-04-26 19:12:59 +00:00
|
|
|
[key: string]: any;
|
2017-03-22 22:43:20 +00:00
|
|
|
}
|
|
|
|
|
2017-03-23 10:06:07 +00:00
|
|
|
namespace RNFirebase {
|
2017-03-28 21:49:12 +00:00
|
|
|
interface RnError extends Error {
|
|
|
|
code?: string;
|
|
|
|
}
|
2017-03-30 14:09:48 +00:00
|
|
|
|
|
|
|
type GoogleApiAvailabilityType = {
|
|
|
|
status: number,
|
|
|
|
isAvailable: boolean,
|
|
|
|
isUserResolvableError?: boolean,
|
|
|
|
error?: string
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2017-07-05 13:56:18 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
2017-03-30 14:09:48 +00:00
|
|
|
interface configurationOptions {
|
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* default false
|
2017-03-30 14:09:48 +00:00
|
|
|
* When set to true, RNFirebase will log messages to the console and fire debug events we can listen to in js
|
2017-06-19 11:25:58 +00:00
|
|
|
* @usage
|
2017-03-30 14:09:48 +00:00
|
|
|
* firebase.on('debug', msg => console.log('Received debug message', msg))
|
|
|
|
*/
|
|
|
|
debug?: boolean;
|
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* default false
|
2017-03-30 14:09:48 +00:00
|
|
|
* When set to true, database persistence will be enabled.
|
|
|
|
*/
|
|
|
|
persistence?: boolean;
|
|
|
|
/**
|
2017-07-05 13:56:18 +00:00
|
|
|
* Default from app [NSBundle mainBundle] The bundle ID for the app to be bundled with
|
2017-03-30 14:09:48 +00:00
|
|
|
*/
|
|
|
|
bundleID?: string;
|
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* defualt ""
|
2017-03-30 14:09:48 +00:00
|
|
|
* The Google App ID that is used to uniquely identify an instance of an app.
|
|
|
|
*/
|
|
|
|
googleAppID?: string;
|
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* deufalt ""
|
2017-03-30 14:09:48 +00:00
|
|
|
* The database root (i.e. https://my-app.firebaseio.com)
|
|
|
|
*/
|
|
|
|
databaseURL?: string;
|
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* defualt ""
|
2017-03-30 14:09:48 +00:00
|
|
|
* URL scheme to set up durable deep link service
|
|
|
|
*/
|
|
|
|
deepLinkURLScheme?: string;
|
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* defualt ""
|
2017-03-30 14:09:48 +00:00
|
|
|
* The Google Cloud storage bucket name
|
|
|
|
*/
|
|
|
|
storageBucket?: string;
|
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* default ""
|
2017-03-30 14:09:48 +00:00
|
|
|
* The Android client ID used in Google AppInvite when an iOS app has it's android version
|
|
|
|
*/
|
|
|
|
androidClientID?: string;
|
|
|
|
/**
|
2017-07-05 13:56:18 +00:00
|
|
|
* default ""
|
2017-03-30 14:09:48 +00:00
|
|
|
* The Project number from the Google Developer's console used to configure Google Cloud Messaging
|
|
|
|
*/
|
|
|
|
GCMSenderID?: string;
|
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* default ""
|
2017-03-30 14:09:48 +00:00
|
|
|
* The tracking ID for Google Analytics
|
|
|
|
*/
|
|
|
|
trackingID?: string;
|
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* default ""
|
2017-03-30 14:09:48 +00:00
|
|
|
* The OAuth2 client ID for iOS application used to authenticate Google Users for signing in with Google
|
|
|
|
*/
|
|
|
|
clientID?: string;
|
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* defualt ""
|
2017-03-30 14:09:48 +00:00
|
|
|
* The secret iOS API key used for authenticating requests from our app
|
|
|
|
*/
|
|
|
|
APIKey?: string
|
|
|
|
}
|
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
namespace storage {
|
2017-03-23 10:06:07 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
interface StorageTask<T> extends Promise<T> {
|
2017-07-05 13:56:18 +00:00
|
|
|
on(event: TaskEvent,
|
|
|
|
nextOrObserver: (snapshot: any) => any,
|
|
|
|
error: (error: RnError) => any,
|
|
|
|
complete: (complete: any) => any): any
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
/**
|
|
|
|
* is not currently supported by react-native-firebase
|
|
|
|
*/
|
|
|
|
pause(): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
/**
|
|
|
|
* is not currently supported by react-native-firebase
|
|
|
|
*/
|
|
|
|
resume(): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
/**
|
|
|
|
* is not currently supported by react-native-firebase
|
|
|
|
*/
|
|
|
|
cancel(): void
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
interface RNStorage extends Reference {
|
|
|
|
/**
|
|
|
|
* Downloads a reference to the device
|
|
|
|
* @param {String} filePath Where to store the file
|
|
|
|
* @return {Promise}
|
|
|
|
* */
|
2017-03-30 14:09:48 +00:00
|
|
|
downloadFile(filePath: string): StorageTask<any>;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
/**
|
|
|
|
* Upload a file path
|
|
|
|
* @returns {Promise}
|
|
|
|
*/
|
2017-03-30 14:09:48 +00:00
|
|
|
putFile(filePath: string, metadata?: any): StorageTask<any>;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
setMaxDownloadRetryTime(time: number): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-04-26 19:12:59 +00:00
|
|
|
[key: string]: any;
|
2017-03-23 12:58:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface Storage {
|
|
|
|
maxOperationRetryTime: number;
|
|
|
|
maxUploadRetryTime: number;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
ref(path?: string): storage.RNStorage;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
refFromURL(url: string): storage.RNStorage;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
setMaxOperationRetryTime(time: number): any;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
setMaxUploadRetryTime(time: number): any;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface Reference {
|
|
|
|
bucket: string;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
child(path: string): storage.Reference;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
delete(): Promise<any>;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
fullPath: string;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
getDownloadURL(): Promise<any>;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
getMetadata(): Promise<any>;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
name: string;
|
|
|
|
parent: storage.Reference | null;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
put(data: any | Uint8Array | ArrayBuffer,
|
2017-07-05 13:56:18 +00:00
|
|
|
metadata?: storage.UploadMetadata): storage.UploadTask;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-07-05 13:56:18 +00:00
|
|
|
putString(data: string, format?: storage.StringFormat,
|
|
|
|
metadata?: storage.UploadMetadata): storage.UploadTask;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
root: storage.Reference;
|
|
|
|
storage: storage.Storage;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
toString(): string;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-07-05 13:56:18 +00:00
|
|
|
updateMetadata(metadata: storage.SettableMetadata): Promise<any>;
|
2017-03-23 12:58:03 +00:00
|
|
|
}
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
interface UploadMetadata extends storage.SettableMetadata {
|
|
|
|
md5Hash?: string | null;
|
|
|
|
}
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
interface SettableMetadata {
|
|
|
|
cacheControl?: string | null;
|
|
|
|
contentDisposition?: string | null;
|
|
|
|
contentEncoding?: string | null;
|
|
|
|
contentLanguage?: string | null;
|
|
|
|
contentType?: string | null;
|
|
|
|
customMetadata?: { [/* warning: coerced from ? */ key: string]: string } | null;
|
|
|
|
}
|
|
|
|
|
|
|
|
type StringFormat = string;
|
|
|
|
var StringFormat: {
|
|
|
|
BASE64: StringFormat,
|
|
|
|
BASE64URL: StringFormat,
|
|
|
|
DATA_URL: StringFormat,
|
|
|
|
RAW: StringFormat,
|
|
|
|
}
|
|
|
|
|
|
|
|
interface UploadTask {
|
|
|
|
cancel(): boolean;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-28 21:49:12 +00:00
|
|
|
catch(onRejected: (a: RnError) => any): Promise<any>;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
on(event: storage.TaskEvent, nextOrObserver?: null | Object,
|
2017-07-05 13:56:18 +00:00
|
|
|
error?: ((a: RnError) => any) | null, complete?: (() => any) | null): Function;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
pause(): boolean;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
resume(): boolean;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
snapshot: storage.UploadTaskSnapshot;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-07-05 13:56:18 +00:00
|
|
|
then(onFulfilled?: ((a: storage.UploadTaskSnapshot) => any) | null,
|
|
|
|
onRejected?: ((a: RnError) => any) | null): Promise<any>;
|
2017-03-23 12:58:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface UploadTaskSnapshot {
|
|
|
|
bytesTransferred: number;
|
|
|
|
downloadURL: string | null;
|
|
|
|
metadata: storage.FullMetadata;
|
|
|
|
ref: storage.Reference;
|
|
|
|
state: storage.TaskState;
|
|
|
|
task: storage.UploadTask;
|
|
|
|
totalBytes: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface FullMetadata extends storage.UploadMetadata {
|
|
|
|
bucket: string;
|
|
|
|
downloadURLs: string[];
|
|
|
|
fullPath: string;
|
|
|
|
generation: string;
|
|
|
|
metageneration: string;
|
|
|
|
name: string;
|
|
|
|
size: number;
|
|
|
|
timeCreated: string;
|
|
|
|
updated: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
type TaskEvent = string;
|
|
|
|
var TaskEvent: {
|
|
|
|
STATE_CHANGED: TaskEvent,
|
|
|
|
};
|
|
|
|
|
|
|
|
type TaskState = string;
|
|
|
|
var TaskState: {
|
|
|
|
CANCELED: TaskState,
|
|
|
|
ERROR: TaskState,
|
|
|
|
PAUSED: TaskState,
|
|
|
|
RUNNING: TaskState,
|
|
|
|
SUCCESS: TaskState,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace database {
|
|
|
|
|
|
|
|
|
|
|
|
interface Database {
|
|
|
|
/**
|
|
|
|
* Returns a new firebase reference instance
|
|
|
|
* */
|
2017-05-31 22:20:44 +00:00
|
|
|
ref(path?: string): RnReference
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* register listener
|
2017-03-23 12:58:03 +00:00
|
|
|
*/
|
|
|
|
on(path: string, modifiersString: string, modifiers: Array<string>, eventName: string, cb: () => void, errorCb: () => void): any
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* unregister listener
|
2017-03-23 12:58:03 +00:00
|
|
|
*/
|
|
|
|
off(path: string, modifiersString: string, eventName?: string, origCB?: () => void): any
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
/**
|
|
|
|
* Removes all event handlers and their native subscriptions
|
|
|
|
*/
|
|
|
|
cleanup(): Promise<any>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
/**
|
|
|
|
* connect to firebase backend
|
|
|
|
*/
|
|
|
|
goOnline(): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
/**
|
|
|
|
* disconnect to firebase backend
|
|
|
|
*/
|
|
|
|
goOffline(): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-04-26 19:12:59 +00:00
|
|
|
[key: string]: any;
|
2017-03-23 12:58:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface RnReference extends Reference {
|
|
|
|
keepSynced(bool: boolean): any
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-04-26 19:12:59 +00:00
|
|
|
filter(name: string, value: any, key?: string): any;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-04-26 19:12:59 +00:00
|
|
|
[key: string]: any;
|
2017-03-23 12:58:03 +00:00
|
|
|
}
|
|
|
|
|
2017-09-18 07:23:34 +00:00
|
|
|
type QueryEventType = "value" | "child_added" | "child_removed" | "child_changed" | "child_moved";
|
|
|
|
type QuerySuccessCallback = (snapshot: DataSnapshot, previousChildId?: string | null) => void;
|
|
|
|
type QueryErrorCallback = (e: Error) => void;
|
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
interface Query {
|
|
|
|
endAt(value: number | string | boolean | null, key?: string): database.Query;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
equalTo(value: number | string | boolean | null, key?: string): database.Query;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
isEqual(other: database.Query | null): boolean;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
limitToFirst(limit: number): database.Query;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
limitToLast(limit: number): database.Query;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-09-18 07:23:34 +00:00
|
|
|
off(eventType?: QueryEventType,
|
2017-11-08 08:31:24 +00:00
|
|
|
callback?: QuerySuccessCallback,
|
|
|
|
context?: Object): void;
|
|
|
|
|
2017-09-18 07:23:34 +00:00
|
|
|
on(eventType: QueryEventType,
|
2017-11-08 08:31:24 +00:00
|
|
|
callback: QuerySuccessCallback,
|
|
|
|
cancelCallbackOrContext?: QueryErrorCallback,
|
|
|
|
context?: Object): (a: database.DataSnapshot | null, b?: string) => QuerySuccessCallback;
|
|
|
|
|
2017-09-18 07:23:34 +00:00
|
|
|
once(eventType: QueryEventType,
|
2017-11-08 08:31:24 +00:00
|
|
|
successCallback?: QuerySuccessCallback,
|
|
|
|
failureCallbackOrContext?: QueryErrorCallback,
|
|
|
|
context?: Object): Promise<DataSnapshot>;
|
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
orderByChild(path: string): database.Query;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
orderByKey(): database.Query;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
orderByPriority(): database.Query;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
orderByValue(): database.Query;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
ref: database.Reference;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
startAt(value: number | string | boolean | null, key?: string): database.Query;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
toJSON(): Object;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
toString(): string;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface DataSnapshot {
|
|
|
|
child(path: string): database.DataSnapshot;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
exists(): boolean;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
exportVal(): any;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
forEach(action: (a: database.DataSnapshot) => boolean): boolean;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
getPriority(): string | number | null;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
hasChild(path: string): boolean;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
hasChildren(): boolean;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
key: string | null;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
numChildren(): number;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
ref: database.Reference;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
toJSON(): Object | null;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
val(): any;
|
|
|
|
}
|
2017-03-28 21:49:12 +00:00
|
|
|
|
2017-11-08 08:31:24 +00:00
|
|
|
interface ThenableReference<T> extends Promise<T> {
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ThenableReference<T> extends Reference {
|
|
|
|
}
|
2017-09-18 07:23:34 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
interface Reference extends database.Query {
|
|
|
|
child(path: string): database.Reference;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
key: string | null;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
onDisconnect(): any;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
parent: database.Reference | null;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-09-18 07:23:34 +00:00
|
|
|
push(value?: any, onComplete?: (a: RnError | null) => any): ThenableReference<any>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-28 21:49:12 +00:00
|
|
|
remove(onComplete?: (a: RnError | null) => any): Promise<any>;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 12:58:03 +00:00
|
|
|
root: database.Reference;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-28 21:49:12 +00:00
|
|
|
set(value: any, onComplete?: (a: RnError | null) => any): Promise<any>;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-07-05 13:56:18 +00:00
|
|
|
setPriority(priority: string | number | null,
|
|
|
|
onComplete: (a: RnError | null) => any): Promise<any>;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-07-05 13:56:18 +00:00
|
|
|
setWithPriority(newVal: any, newPriority: string | number | null,
|
|
|
|
onComplete?: (a: RnError | null) => any): Promise<any>;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-07-05 13:56:18 +00:00
|
|
|
transaction(transactionUpdate: (a: any) => any,
|
|
|
|
onComplete?: (a: RnError | null, b: boolean,
|
|
|
|
c: database.DataSnapshot | null) => any,
|
|
|
|
applyLocally?: boolean): Promise<any>;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-28 21:49:12 +00:00
|
|
|
update(values: Object, onComplete?: (a: RnError | null) => any): Promise<any>;
|
2017-03-23 12:58:03 +00:00
|
|
|
}
|
|
|
|
}
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-23 10:06:07 +00:00
|
|
|
/**
|
|
|
|
* firebase Analytics
|
|
|
|
*/
|
|
|
|
interface Analytics {
|
2017-03-22 22:43:20 +00:00
|
|
|
/**Log a custom event with optional params. */
|
|
|
|
logEvent(event: string, params?: Object): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-22 22:43:20 +00:00
|
|
|
/** Sets whether analytics collection is enabled for this app on this device. */
|
|
|
|
setAnalyticsCollectionEnabled(enabled: boolean): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-22 22:43:20 +00:00
|
|
|
/**
|
|
|
|
* Sets the current screen name, which specifies the current visual context in your app.
|
2017-06-19 11:25:58 +00:00
|
|
|
* Whilst screenClassOverride is optional,
|
|
|
|
* it is recommended it is always sent as your current class name,
|
2017-03-22 22:43:20 +00:00
|
|
|
* for example on Android it will always show as 'MainActivity' if not specified.
|
|
|
|
*/
|
2017-10-24 10:41:19 +00:00
|
|
|
setCurrentScreen(screenName: string | null, screenClassOverride?: string): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-22 22:43:20 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* Sets the minimum engagement time required before starting a session.
|
2017-03-22 22:43:20 +00:00
|
|
|
* The default value is 10000 (10 seconds)
|
|
|
|
*/
|
|
|
|
setMinimumSessionDuration(miliseconds: number): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-22 22:43:20 +00:00
|
|
|
/**
|
|
|
|
* Sets the duration of inactivity that terminates the current session.
|
|
|
|
* The default value is 1800000 (30 minutes).
|
|
|
|
*/
|
|
|
|
setSessionTimeoutDuration(miliseconds: number): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-22 22:43:20 +00:00
|
|
|
/**
|
|
|
|
* Gives a user a uniqiue identificaition.
|
2017-06-19 11:25:58 +00:00
|
|
|
* @example
|
2017-03-22 22:43:20 +00:00
|
|
|
* const id = firebase.auth().currentUser.uid;
|
2017-06-19 11:25:58 +00:00
|
|
|
*
|
2017-03-22 22:43:20 +00:00
|
|
|
* firebase.analytics().setUserId(id);
|
|
|
|
*/
|
2017-10-24 10:41:19 +00:00
|
|
|
setUserId(id: string | null): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-22 22:43:20 +00:00
|
|
|
/**
|
|
|
|
* Sets a key/value pair of data on the current user.
|
|
|
|
*/
|
2017-10-24 10:41:19 +00:00
|
|
|
setUserProperty(name: string, value: string | null): void;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-04-26 19:12:59 +00:00
|
|
|
[key: string]: any;
|
2017-03-23 10:06:07 +00:00
|
|
|
}
|
2017-03-22 22:43:20 +00:00
|
|
|
|
2017-03-23 10:06:07 +00:00
|
|
|
interface User {
|
2017-03-22 22:43:20 +00:00
|
|
|
/**
|
|
|
|
* The user's display name (if available).
|
|
|
|
*/
|
2017-03-28 21:49:12 +00:00
|
|
|
displayName: string | null
|
2017-03-22 22:43:20 +00:00
|
|
|
/**
|
|
|
|
* - The user's email address (if available).
|
|
|
|
*/
|
|
|
|
email: string | null
|
|
|
|
/**
|
|
|
|
* - True if the user's email address has been verified.
|
|
|
|
*/
|
|
|
|
emailVerified: boolean
|
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
*
|
2017-03-22 22:43:20 +00:00
|
|
|
*/
|
|
|
|
isAnonymous: boolean
|
|
|
|
/**
|
|
|
|
* - The URL of the user's profile picture (if available).
|
|
|
|
*/
|
|
|
|
photoURL: string | null
|
|
|
|
/**
|
|
|
|
* - Additional provider-specific information about the user.
|
|
|
|
*/
|
2017-03-30 14:09:48 +00:00
|
|
|
providerData: any | null
|
2017-03-22 22:43:20 +00:00
|
|
|
/**
|
|
|
|
* - The authentication provider ID for the current user.
|
|
|
|
* For example, 'facebook.com', or 'google.com'.
|
|
|
|
*/
|
|
|
|
providerId: string | null
|
|
|
|
/**
|
|
|
|
* - The user's unique ID.
|
|
|
|
*/
|
|
|
|
uid: string
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-22 22:43:20 +00:00
|
|
|
/**
|
|
|
|
* Delete the current user.
|
|
|
|
*/
|
|
|
|
delete(): Promise<void>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-22 22:43:20 +00:00
|
|
|
/**
|
|
|
|
* Returns the users authentication token.
|
|
|
|
*/
|
|
|
|
getToken(): Promise<string>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-22 22:43:20 +00:00
|
|
|
/**
|
|
|
|
* Reauthenticate the current user with credentials:
|
|
|
|
*/
|
|
|
|
reauthenticate(credential: Credential): Promise<void>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-09-01 07:47:42 +00:00
|
|
|
/**
|
|
|
|
* Link the user with a 3rd party credential provider.
|
|
|
|
*/
|
|
|
|
linkWithCredential(credential: Credential): Promise<User>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-22 22:43:20 +00:00
|
|
|
/**
|
|
|
|
* Refreshes the current user.
|
|
|
|
*/
|
|
|
|
reload(): Promise<void>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-22 22:43:20 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* Sends a verification email to a user.
|
2017-03-22 22:43:20 +00:00
|
|
|
* This will Promise reject is the user is anonymous.
|
|
|
|
*/
|
|
|
|
sendEmailVerification(): Promise<void>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-22 22:43:20 +00:00
|
|
|
/**
|
|
|
|
* Updates the user's email address.
|
2017-06-19 11:25:58 +00:00
|
|
|
* See Firebase docs for more information on security & email validation.
|
2017-03-22 22:43:20 +00:00
|
|
|
* This will Promise reject is the user is anonymous.
|
|
|
|
*/
|
|
|
|
updateEmail(email: string): Promise<void>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-22 22:43:20 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* Important: this is a security sensitive operation that requires the user to have recently signed in.
|
|
|
|
* If this requirement isn't met, ask the user to authenticate again and then call firebase.User#reauthenticate.
|
2017-03-22 22:43:20 +00:00
|
|
|
* This will Promise reject is the user is anonymous.
|
|
|
|
*/
|
|
|
|
updatePassword(password: string): Promise<void>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-22 22:43:20 +00:00
|
|
|
/**
|
|
|
|
* Updates a user's profile data.
|
|
|
|
* Profile data should be an object of fields to update:
|
|
|
|
*/
|
|
|
|
updateProfile(profile: Object): Promise<void>
|
2017-03-23 10:06:07 +00:00
|
|
|
}
|
2017-03-22 22:43:20 +00:00
|
|
|
|
2017-03-23 10:06:07 +00:00
|
|
|
/** 3rd party provider Credentials */
|
|
|
|
interface Credential {
|
2017-03-22 22:43:20 +00:00
|
|
|
provider: string,
|
|
|
|
token: string,
|
|
|
|
secret: string
|
2017-03-23 10:06:07 +00:00
|
|
|
}
|
2017-07-05 13:56:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
interface ActionCodeInfo {
|
|
|
|
email: string,
|
|
|
|
error: string,
|
|
|
|
fromEmail: string,
|
|
|
|
verifyEmail: string,
|
|
|
|
recoverEmail: string,
|
|
|
|
passwordReset: string
|
|
|
|
}
|
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
namespace auth {
|
2017-03-22 22:43:20 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
interface Auth {
|
|
|
|
/**
|
|
|
|
* Returns the current Firebase authentication state.
|
|
|
|
*/
|
|
|
|
authenticated: boolean;
|
|
|
|
/**
|
|
|
|
* Returns the currently signed-in user (or null). See the User class documentation for further usage.
|
|
|
|
*/
|
|
|
|
currentUser: User | null
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-11-30 12:56:28 +00:00
|
|
|
/**
|
|
|
|
* Gets/Sets the language for the app instance
|
|
|
|
*/
|
|
|
|
languageCode: string | null;
|
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* Listen for changes in the users auth state (logging in and out).
|
|
|
|
* This method returns a unsubscribe function to stop listening to events.
|
2017-03-30 14:09:48 +00:00
|
|
|
* Always ensure you unsubscribe from the listener when no longer needed to prevent updates to components no longer in use.
|
|
|
|
*/
|
2017-07-05 13:56:18 +00:00
|
|
|
onAuthStateChanged(nextOrObserver: Object, error?: (a: RnError) => any,
|
|
|
|
completed?: () => any): () => any;
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* We can create a user by calling the createUserWithEmailAndPassword() function.
|
2017-03-30 14:09:48 +00:00
|
|
|
* The method accepts two parameters, an email and a password.
|
|
|
|
*/
|
|
|
|
createUserWithEmailAndPassword(email: string, password: string): Promise<User>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* To sign a user in with their email and password, use the signInWithEmailAndPassword() function.
|
2017-03-30 14:09:48 +00:00
|
|
|
* It accepts two parameters, the user's email and password:
|
|
|
|
*/
|
|
|
|
signInWithEmailAndPassword(email: string, password: string): Promise<User>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* Sign an anonymous user.
|
2017-03-30 14:09:48 +00:00
|
|
|
* If the user has already signed in, that user will be returned
|
|
|
|
*/
|
|
|
|
signInAnonymously(): Promise<User>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* Sign in the user with a 3rd party credential provider.
|
2017-03-30 14:09:48 +00:00
|
|
|
* credential requires the following properties:
|
|
|
|
*/
|
|
|
|
signInWithCredential(credential: Credential): Promise<User>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* Sign a user in with a self-signed JWT token.
|
|
|
|
* To sign a user using a self-signed custom token,
|
|
|
|
* use the signInWithCustomToken() function.
|
2017-03-30 14:09:48 +00:00
|
|
|
* It accepts one parameter, the custom token:
|
|
|
|
*/
|
|
|
|
signInWithCustomToken(token: string): Promise<User>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* Sends a password reset email to the given email address.
|
|
|
|
* Unlike the web SDK,
|
2017-03-30 14:09:48 +00:00
|
|
|
* the email will contain a password reset link rather than a code.
|
|
|
|
*/
|
|
|
|
sendPasswordResetEmail(email: string): Promise<void>
|
2017-07-05 13:16:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Completes the password reset process, given a confirmation code and new password.
|
|
|
|
*/
|
2017-07-05 13:56:18 +00:00
|
|
|
confirmPasswordReset(code: string, newPassword: string): Promise<any>
|
2017-07-05 13:16:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Applies a verification code sent to the user by email or other out-of-band mechanism.
|
|
|
|
*/
|
2017-07-05 13:56:18 +00:00
|
|
|
applyActionCode(code: string): Promise<any>
|
2017-07-05 13:16:35 +00:00
|
|
|
|
2017-07-05 13:56:18 +00:00
|
|
|
/**
|
|
|
|
* Checks a verification code sent to the user by email or other out-of-band mechanism.
|
|
|
|
*/
|
|
|
|
checkActionCode(code: string): Promise<ActionCodeInfo>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* Completes the password reset process,
|
2017-03-30 14:09:48 +00:00
|
|
|
* given a confirmation code and new password.
|
|
|
|
*/
|
|
|
|
signOut(): Promise<void>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-04-26 19:12:59 +00:00
|
|
|
[key: string]: any;
|
2017-03-30 14:09:48 +00:00
|
|
|
}
|
2017-03-23 10:06:07 +00:00
|
|
|
}
|
2017-04-26 19:12:59 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
namespace messaging {
|
2017-03-22 22:43:20 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
interface Messaging {
|
|
|
|
/**
|
|
|
|
* Subscribes the device to a topic.
|
|
|
|
*/
|
|
|
|
subscribeToTopic(topic: string): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
|
|
|
* Unsubscribes the device from a topic.
|
|
|
|
*/
|
|
|
|
unsubscribeFromTopic(topic: string): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* When the application has been opened from a notification
|
|
|
|
* getInitialNotification is called and the notification payload is returned.
|
2017-03-30 14:09:48 +00:00
|
|
|
* Use onMessage for notifications when the app is running.
|
|
|
|
*/
|
|
|
|
getInitialNotification(): Promise<any>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* Returns the devices FCM token.
|
2017-03-30 14:09:48 +00:00
|
|
|
* This token can be used in the Firebase console to send messages to directly.
|
|
|
|
*/
|
|
|
|
getToken(forceRefresh?: Boolean): Promise<string>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-09-26 14:33:20 +00:00
|
|
|
/**
|
|
|
|
* Reset Instance ID and revokes all tokens.
|
|
|
|
*/
|
|
|
|
deleteInstanceId(): Promise<any>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
|
|
|
* On the event a devices FCM token is refreshed by Google,
|
|
|
|
* the new token is returned in a callback listener.
|
|
|
|
*/
|
2017-06-19 11:25:58 +00:00
|
|
|
onTokenRefresh(listener: (token: string) => any): () => any
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* On a new message,
|
|
|
|
* the payload object is passed to the listener callback.
|
2017-03-30 14:09:48 +00:00
|
|
|
* This method is only triggered when the app is running.
|
|
|
|
* Use getInitialNotification for notifications which cause the app to open.
|
|
|
|
*/
|
2017-06-19 11:25:58 +00:00
|
|
|
onMessage(listener: (message: any) => any): () => any
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
|
|
|
* Create a local notification from the device itself.
|
|
|
|
*/
|
|
|
|
createLocalNotification(notification: any): any
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
|
|
|
* Schedule a local notification to be shown on the device.
|
|
|
|
*/
|
|
|
|
scheduleLocalNotification(notification: any): any
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
|
|
|
* Returns an array of all currently scheduled notifications.
|
|
|
|
* ```
|
|
|
|
* firebase.messaging().getScheduledLocalNotifications()
|
|
|
|
* .then((notifications) => {
|
|
|
|
* console.log('Current scheduled notifications: ', notifications);
|
|
|
|
* });
|
|
|
|
* ```
|
|
|
|
*/
|
|
|
|
getScheduledLocalNotifications(): Promise<any[]>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* Cancels a location notification by ID,
|
2017-03-30 14:09:48 +00:00
|
|
|
* or all notifications by *.
|
|
|
|
*/
|
|
|
|
cancelLocalNotification(id: string): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* Removes all delivered notifications from device by ID,
|
2017-03-30 14:09:48 +00:00
|
|
|
* or all notifications by *.
|
|
|
|
*/
|
|
|
|
removeDeliveredNotification(id: string): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* IOS
|
2017-03-30 14:09:48 +00:00
|
|
|
* Requests app notification permissions in an Alert dialog.
|
|
|
|
*/
|
|
|
|
requestPermissions(): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
|
|
|
* Sets the badge number on the iOS app icon.
|
|
|
|
*/
|
|
|
|
setBadgeNumber(value: number): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
|
|
|
* Returns the current badge number on the app icon.
|
|
|
|
*/
|
2017-05-14 20:50:07 +00:00
|
|
|
getBadgeNumber(): Promise<number>
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
|
|
|
* Send an upstream message
|
|
|
|
* @param senderId
|
|
|
|
* @param payload
|
|
|
|
*/
|
|
|
|
send(senderId: string, payload: RemoteMessage): any
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
NOTIFICATION_TYPE: Object
|
|
|
|
REMOTE_NOTIFICATION_RESULT: Object
|
|
|
|
WILL_PRESENT_RESULT: Object
|
|
|
|
EVENT_TYPE: Object
|
|
|
|
}
|
2017-03-22 22:43:20 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
interface RemoteMessage {
|
|
|
|
id: string,
|
|
|
|
type: string,
|
|
|
|
ttl?: number,
|
|
|
|
sender: string,
|
|
|
|
collapseKey?: string,
|
|
|
|
data: Object,
|
|
|
|
}
|
2017-03-23 10:06:07 +00:00
|
|
|
}
|
2017-03-30 14:09:48 +00:00
|
|
|
namespace crash {
|
2017-03-22 22:43:20 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
interface Crash {
|
|
|
|
/** Logs a message that will appear in a subsequent crash report. */
|
|
|
|
log(message: string): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
|
|
|
* Android: Logs a message that will appear in a subsequent crash report as well as in logcat.
|
|
|
|
* iOS: Logs the message in the subsequest crash report only (same as log).
|
|
|
|
*/
|
|
|
|
logcat(level: number, tag: string, message: string): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-03-30 14:09:48 +00:00
|
|
|
/**
|
2017-06-19 11:25:58 +00:00
|
|
|
* Files a crash report, along with any previous logs to Firebase.
|
2017-03-30 14:09:48 +00:00
|
|
|
* An Error object must be passed into the report method.
|
|
|
|
*/
|
|
|
|
report(error: RnError, maxStackSize: Number): void
|
2017-11-08 08:31:24 +00:00
|
|
|
|
2017-04-26 19:12:59 +00:00
|
|
|
[key: string]: any;
|
2017-03-30 14:09:48 +00:00
|
|
|
}
|
2017-03-23 10:06:07 +00:00
|
|
|
}
|
2018-01-04 02:39:10 +00:00
|
|
|
|
|
|
|
namespace crashlytics {
|
|
|
|
|
|
|
|
interface Crashlytics {
|
|
|
|
/**
|
|
|
|
* Forces a crash. Useful for testing your application is set up correctly.
|
|
|
|
*/
|
|
|
|
crash(): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Logs a message that will appear in any subsequent crash reports.
|
|
|
|
*/
|
|
|
|
log(message: string): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Logs a non fatal exception.
|
|
|
|
*/
|
|
|
|
recordError(code: number, message: string): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a boolean value to show alongside any subsequent crash reports.
|
|
|
|
*/
|
|
|
|
setBoolValue(key: string, value: boolean): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a float value to show alongside any subsequent crash reports.
|
|
|
|
*/
|
|
|
|
setFloatValue(key: string, value: number): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set an integer value to show alongside any subsequent crash reports.
|
|
|
|
*/
|
|
|
|
setIntValue(key: string, value: number): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a string value to show alongside any subsequent crash reports.
|
|
|
|
*/
|
|
|
|
setStringValue(key: string, value: string): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the user ID to show alongside any subsequent crash reports.
|
|
|
|
*/
|
|
|
|
setUserIdentifier(userId: string): void;
|
|
|
|
}
|
|
|
|
}
|
2017-03-22 22:43:20 +00:00
|
|
|
}
|
2017-06-19 11:25:58 +00:00
|
|
|
}
|