mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-04-19 23:40:20 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
33
packages/admob/lib/index.d.ts
vendored
33
packages/admob/lib/index.d.ts
vendored
@@ -47,7 +47,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
*
|
||||
* @firebase admob
|
||||
*/
|
||||
export namespace Admob {
|
||||
export namespace FirebaseAdMobTypes {
|
||||
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
||||
|
||||
/**
|
||||
@@ -1164,24 +1164,27 @@ declare module '@react-native-firebase/admob' {
|
||||
import React from 'react';
|
||||
import ReactNativeFirebaseModule = ReactNativeFirebase.Module;
|
||||
import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
|
||||
import BannerAd = Admob.BannerAd;
|
||||
import BannerAd = FirebaseAdMobTypes.BannerAd;
|
||||
|
||||
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
|
||||
export const firebase = firebaseNamedExport;
|
||||
|
||||
export const AdsConsentDebugGeography: {} & Admob.AdsConsentDebugGeography;
|
||||
export const AdsConsentStatus: {} & Admob.AdsConsentStatus;
|
||||
export const MaxAdContentRating: {} & Admob.MaxAdContentRating;
|
||||
export const TestIds: {} & Admob.TestIds;
|
||||
export const AdEventType: {} & Admob.AdEventType;
|
||||
export const BannerAdSize: {} & Admob.BannerAdSize;
|
||||
export const RewardedAdEventType: {} & Admob.RewardedAdEventType;
|
||||
export const AdsConsent: {} & Admob.AdsConsent;
|
||||
export const InterstitialAd: typeof Admob.InterstitialAd;
|
||||
export const RewardedAd: typeof Admob.RewardedAd;
|
||||
export const AdsConsentDebugGeography: {} & FirebaseAdMobTypes.AdsConsentDebugGeography;
|
||||
export const AdsConsentStatus: {} & FirebaseAdMobTypes.AdsConsentStatus;
|
||||
export const MaxAdContentRating: {} & FirebaseAdMobTypes.MaxAdContentRating;
|
||||
export const TestIds: {} & FirebaseAdMobTypes.TestIds;
|
||||
export const AdEventType: {} & FirebaseAdMobTypes.AdEventType;
|
||||
export const BannerAdSize: {} & FirebaseAdMobTypes.BannerAdSize;
|
||||
export const RewardedAdEventType: {} & FirebaseAdMobTypes.RewardedAdEventType;
|
||||
export const AdsConsent: {} & FirebaseAdMobTypes.AdsConsent;
|
||||
export const InterstitialAd: typeof FirebaseAdMobTypes.InterstitialAd;
|
||||
export const RewardedAd: typeof FirebaseAdMobTypes.RewardedAd;
|
||||
export const BannerAd: React.SFC<BannerAd>;
|
||||
|
||||
const module: FirebaseModuleWithStaticsAndApp<Admob.Module, Admob.Statics>;
|
||||
const module: FirebaseModuleWithStaticsAndApp<
|
||||
FirebaseAdMobTypes.Module,
|
||||
FirebaseAdMobTypes.Statics
|
||||
>;
|
||||
export default module;
|
||||
}
|
||||
|
||||
@@ -1193,11 +1196,11 @@ declare module '@react-native-firebase/app' {
|
||||
import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
|
||||
|
||||
interface Module {
|
||||
admob: FirebaseModuleWithStaticsAndApp<Admob.Module, Admob.Statics>;
|
||||
admob: FirebaseModuleWithStaticsAndApp<FirebaseAdMobTypes.Module, FirebaseAdMobTypes.Statics>;
|
||||
}
|
||||
|
||||
interface FirebaseApp {
|
||||
admob(): Admob.Module;
|
||||
admob(): FirebaseAdMobTypes.Module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,35 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import * as admob from '@react-native-firebase/admob';
|
||||
|
||||
console.log(firebase.admob.AdsConsentDebugGeography.DISABLED);
|
||||
console.log(firebase.admob.AdsConsentDebugGeography.EEA);
|
||||
console.log(firebase.admob.AdsConsentDebugGeography.NOT_EEA);
|
||||
console.log(admob.AdsConsentDebugGeography.DISABLED);
|
||||
console.log(admob.AdsConsentDebugGeography.EEA);
|
||||
console.log(admob.AdsConsentDebugGeography.NOT_EEA);
|
||||
|
||||
console.log(firebase.admob.AdsConsentStatus.NON_PERSONALIZED);
|
||||
console.log(firebase.admob.AdsConsentStatus.PERSONALIZED);
|
||||
console.log(firebase.admob.AdsConsentStatus.UNKNOWN);
|
||||
console.log(admob.AdsConsentStatus.NON_PERSONALIZED);
|
||||
console.log(admob.AdsConsentStatus.PERSONALIZED);
|
||||
console.log(admob.AdsConsentStatus.UNKNOWN);
|
||||
|
||||
console.log(firebase.admob.MaxAdContentRating.G);
|
||||
console.log(firebase.admob.MaxAdContentRating.MA);
|
||||
console.log(firebase.admob.MaxAdContentRating.PG);
|
||||
console.log(firebase.admob.MaxAdContentRating.T);
|
||||
console.log(admob.MaxAdContentRating.G);
|
||||
console.log(admob.MaxAdContentRating.MA);
|
||||
console.log(admob.MaxAdContentRating.PG);
|
||||
console.log(admob.MaxAdContentRating.T);
|
||||
|
||||
console.log(firebase.admob.AdEventType.CLICKED);
|
||||
console.log(firebase.admob.AdEventType.CLOSED);
|
||||
console.log(firebase.admob.AdEventType.ERROR);
|
||||
console.log(firebase.admob.AdEventType.LEFT_APPLICATION);
|
||||
console.log(firebase.admob.AdEventType.LOADED);
|
||||
console.log(firebase.admob.AdEventType.OPENED);
|
||||
console.log(admob.AdEventType.CLICKED);
|
||||
console.log(admob.AdEventType.CLOSED);
|
||||
console.log(admob.AdEventType.ERROR);
|
||||
@@ -21,11 +37,22 @@ console.log(admob.AdEventType.LEFT_APPLICATION);
|
||||
console.log(admob.AdEventType.LOADED);
|
||||
console.log(admob.AdEventType.OPENED);
|
||||
|
||||
console.log(firebase.admob.RewardedAdEventType.LOADED);
|
||||
console.log(firebase.admob.RewardedAdEventType.EARNED_REWARD);
|
||||
console.log(admob.RewardedAdEventType.LOADED);
|
||||
console.log(admob.RewardedAdEventType.EARNED_REWARD);
|
||||
|
||||
console.log(firebase.admob.BannerAdSize.BANNER);
|
||||
console.log(firebase.admob.BannerAdSize.FLUID);
|
||||
console.log(firebase.admob.BannerAdSize.FULL_BANNER);
|
||||
console.log(admob.BannerAd);
|
||||
console.log(admob.BannerAdSize.BANNER);
|
||||
console.log(admob.BannerAdSize.FLUID);
|
||||
console.log(admob.BannerAdSize.FULL_BANNER);
|
||||
|
||||
console.log(firebase.admob.TestIds.BANNER);
|
||||
console.log(firebase.admob.TestIds.INTERSTITIAL);
|
||||
console.log(firebase.admob.TestIds.REWARDED);
|
||||
console.log(admob.TestIds.BANNER);
|
||||
console.log(admob.TestIds.INTERSTITIAL);
|
||||
console.log(admob.TestIds.REWARDED);
|
||||
|
||||
14
packages/analytics/lib/index.d.ts
vendored
14
packages/analytics/lib/index.d.ts
vendored
@@ -47,7 +47,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
*
|
||||
* @firebase analytics
|
||||
*/
|
||||
export namespace Analytics {
|
||||
export namespace FirebaseAnalyticsTypes {
|
||||
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
||||
|
||||
export interface AddToCartEventParameters {
|
||||
@@ -1352,7 +1352,10 @@ declare module '@react-native-firebase/analytics' {
|
||||
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
|
||||
export const firebase = firebaseNamedExport;
|
||||
|
||||
const module: FirebaseModuleWithStatics<Analytics.Module, Analytics.Statics>;
|
||||
const module: FirebaseModuleWithStatics<
|
||||
FirebaseAnalyticsTypes.Module,
|
||||
FirebaseAnalyticsTypes.Statics
|
||||
>;
|
||||
export default module;
|
||||
}
|
||||
|
||||
@@ -1363,11 +1366,14 @@ declare module '@react-native-firebase/app' {
|
||||
namespace ReactNativeFirebase {
|
||||
import FirebaseModuleWithStatics = ReactNativeFirebase.FirebaseModuleWithStatics;
|
||||
interface Module {
|
||||
analytics: FirebaseModuleWithStatics<Analytics.Module, Analytics.Statics>;
|
||||
analytics: FirebaseModuleWithStatics<
|
||||
FirebaseAnalyticsTypes.Module,
|
||||
FirebaseAnalyticsTypes.Statics
|
||||
>;
|
||||
}
|
||||
|
||||
interface FirebaseApp {
|
||||
analytics(): Analytics.Module;
|
||||
analytics(): FirebaseAnalyticsTypes.Module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import defaultExport, { firebase as firebaseFromModule } from '@react-native-firebase/analytics';
|
||||
import * as analytics from '@react-native-firebase/analytics';
|
||||
|
||||
// checks module exists at root
|
||||
console.log(firebase.analytics().app.name);
|
||||
@@ -11,16 +11,66 @@ console.log(firebase.app().analytics().app.name);
|
||||
console.log(firebase.analytics.SDK_VERSION);
|
||||
|
||||
// checks statics exist on defaultExport
|
||||
console.log(defaultExport.SDK_VERSION);
|
||||
console.log(analytics.firebase.SDK_VERSION);
|
||||
|
||||
// checks root exists
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks firebase named export exists on module
|
||||
console.log(firebaseFromModule.SDK_VERSION);
|
||||
console.log(analytics.firebase.SDK_VERSION);
|
||||
|
||||
// checks multi-app support exists
|
||||
// console.log(firebase.analytics(firebase.app()).app.name);
|
||||
firebase
|
||||
.analytics()
|
||||
.logAddPaymentInfo()
|
||||
.then();
|
||||
firebase
|
||||
.analytics()
|
||||
.logAddToCart({ item_id: '123', item_category: '123', item_name: '123', quantity: 3 })
|
||||
.then();
|
||||
firebase
|
||||
.analytics()
|
||||
.logLogin({ method: 'foo' })
|
||||
.then();
|
||||
firebase
|
||||
.analytics()
|
||||
.setUserProperties({ foo: 'bar' })
|
||||
.then();
|
||||
|
||||
// checks default export supports app arg
|
||||
// console.log(defaultExport(firebase.app()).app.name);
|
||||
console.log(firebase.analytics().logAddPaymentInfo);
|
||||
console.log(firebase.analytics().logAddToCart);
|
||||
console.log(firebase.analytics().logAddToWishlist);
|
||||
console.log(firebase.analytics().logAppOpen);
|
||||
console.log(firebase.analytics().logBeginCheckout);
|
||||
console.log(firebase.analytics().logCampaignDetails);
|
||||
console.log(firebase.analytics().logEarnVirtualCurrency);
|
||||
console.log(firebase.analytics().logEcommercePurchase);
|
||||
console.log(firebase.analytics().logEvent);
|
||||
console.log(firebase.analytics().logGenerateLead);
|
||||
console.log(firebase.analytics().logJoinGroup);
|
||||
console.log(firebase.analytics().logLevelEnd);
|
||||
console.log(firebase.analytics().logLevelStart);
|
||||
console.log(firebase.analytics().logLevelUp);
|
||||
console.log(firebase.analytics().logLogin);
|
||||
console.log(firebase.analytics().logPresentOffer);
|
||||
console.log(firebase.analytics().logPurchaseRefund);
|
||||
console.log(firebase.analytics().logRemoveFromCart);
|
||||
console.log(firebase.analytics().logSearch);
|
||||
console.log(firebase.analytics().logSelectContent);
|
||||
console.log(firebase.analytics().logSetCheckoutOption);
|
||||
console.log(firebase.analytics().logShare);
|
||||
console.log(firebase.analytics().logSignUp);
|
||||
console.log(firebase.analytics().logSpendVirtualCurrency);
|
||||
console.log(firebase.analytics().logTutorialBegin);
|
||||
console.log(firebase.analytics().logTutorialComplete);
|
||||
console.log(firebase.analytics().logUnlockAchievement);
|
||||
console.log(firebase.analytics().logViewItem);
|
||||
console.log(firebase.analytics().logViewItemList);
|
||||
console.log(firebase.analytics().logViewSearchResults);
|
||||
console.log(firebase.analytics().resetAnalyticsData);
|
||||
console.log(firebase.analytics().setAnalyticsCollectionEnabled);
|
||||
console.log(firebase.analytics().setCurrentScreen);
|
||||
console.log(firebase.analytics().setMinimumSessionDuration);
|
||||
console.log(firebase.analytics().setSessionTimeoutDuration);
|
||||
console.log(firebase.analytics().setUserId);
|
||||
console.log(firebase.analytics().setUserProperties);
|
||||
console.log(firebase.analytics().setUserProperty);
|
||||
|
||||
11
packages/auth/lib/index.d.ts
vendored
11
packages/auth/lib/index.d.ts
vendored
@@ -48,7 +48,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
*
|
||||
* @firebase auth
|
||||
*/
|
||||
export namespace Auth {
|
||||
export namespace FirebaseAuthTypes {
|
||||
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
||||
import NativeFirebaseError = ReactNativeFirebase.NativeFirebaseError;
|
||||
|
||||
@@ -1592,7 +1592,10 @@ declare module '@react-native-firebase/auth' {
|
||||
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
|
||||
export const firebase = firebaseNamedExport;
|
||||
|
||||
const module: FirebaseModuleWithStaticsAndApp<Auth.Module, Auth.Statics>;
|
||||
const module: FirebaseModuleWithStaticsAndApp<
|
||||
FirebaseAuthTypes.Module,
|
||||
FirebaseAuthTypes.Statics
|
||||
>;
|
||||
export default module;
|
||||
}
|
||||
|
||||
@@ -1603,10 +1606,10 @@ declare module '@react-native-firebase/app' {
|
||||
namespace ReactNativeFirebase {
|
||||
import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
|
||||
interface Module {
|
||||
auth: FirebaseModuleWithStaticsAndApp<Auth.Module, Auth.Statics>;
|
||||
auth: FirebaseModuleWithStaticsAndApp<FirebaseAuthTypes.Module, FirebaseAuthTypes.Statics>;
|
||||
}
|
||||
interface FirebaseApp {
|
||||
auth(): Auth.Module;
|
||||
auth(): FirebaseAuthTypes.Module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import defaultExport, { firebase as firebaseFromModule } from '@react-native-firebase/auth';
|
||||
import * as auth from '@react-native-firebase/auth';
|
||||
|
||||
// checks module exists at root
|
||||
console.log(firebase.auth().app.name);
|
||||
@@ -13,16 +13,48 @@ console.log(firebase.app().auth().currentUser);
|
||||
console.log(firebase.auth.SDK_VERSION);
|
||||
|
||||
// checks statics exist on defaultExport
|
||||
console.log(defaultExport.SDK_VERSION);
|
||||
console.log(auth.firebase.SDK_VERSION);
|
||||
|
||||
// checks root exists
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks firebase named export exists on module
|
||||
console.log(firebaseFromModule.SDK_VERSION);
|
||||
console.log(auth.firebase.SDK_VERSION);
|
||||
|
||||
// checks multi-app support exists
|
||||
console.log(firebase.auth(firebase.app()).app.name);
|
||||
|
||||
// checks default export supports app arg
|
||||
console.log(defaultExport(firebase.app()).app.name);
|
||||
console.log(firebase.auth(firebase.app('foo')).app.name);
|
||||
|
||||
// Statics
|
||||
console.log(firebase.auth.EmailAuthProvider.PROVIDER_ID);
|
||||
console.log(firebase.auth.PhoneAuthProvider.PROVIDER_ID);
|
||||
console.log(firebase.auth.GoogleAuthProvider.PROVIDER_ID);
|
||||
console.log(firebase.auth.GithubAuthProvider.PROVIDER_ID);
|
||||
console.log(firebase.auth.TwitterAuthProvider.PROVIDER_ID);
|
||||
console.log(firebase.auth.FacebookAuthProvider.PROVIDER_ID);
|
||||
console.log(firebase.auth.OAuthProvider.PROVIDER_ID);
|
||||
console.log(firebase.auth.PhoneAuthState.CODE_SENT);
|
||||
|
||||
firebase.auth().onAuthStateChanged(user => {
|
||||
if (user) {
|
||||
console.log(user.email);
|
||||
console.log(user.displayName);
|
||||
}
|
||||
});
|
||||
|
||||
const u = firebase.auth().currentUser;
|
||||
console.log(u ? u.displayName : '');
|
||||
console.log(u ? u.email : '');
|
||||
console.log(u ? u.toJSON() : '');
|
||||
|
||||
firebase
|
||||
.auth()
|
||||
.signInAnonymously()
|
||||
.then();
|
||||
|
||||
firebase
|
||||
.auth()
|
||||
.signInWithEmailAndPassword('', '')
|
||||
.then();
|
||||
|
||||
14
packages/crashlytics/lib/index.d.ts
vendored
14
packages/crashlytics/lib/index.d.ts
vendored
@@ -47,7 +47,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
*
|
||||
* @firebase crashlytics
|
||||
*/
|
||||
export namespace Crashlytics {
|
||||
export namespace FirebaseCrashlyticsTypes {
|
||||
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
||||
|
||||
export interface Statics {}
|
||||
@@ -227,7 +227,10 @@ declare module '@react-native-firebase/crashlytics' {
|
||||
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
|
||||
export const firebase = firebaseNamedExport;
|
||||
|
||||
const module: FirebaseModuleWithStatics<Crashlytics.Module, Crashlytics.Statics>;
|
||||
const module: FirebaseModuleWithStatics<
|
||||
FirebaseCrashlyticsTypes.Module,
|
||||
FirebaseCrashlyticsTypes.Statics
|
||||
>;
|
||||
export default module;
|
||||
}
|
||||
|
||||
@@ -238,10 +241,13 @@ declare module '@react-native-firebase/app' {
|
||||
namespace ReactNativeFirebase {
|
||||
import FirebaseModuleWithStatics = ReactNativeFirebase.FirebaseModuleWithStatics;
|
||||
interface Module {
|
||||
crashlytics: FirebaseModuleWithStatics<Crashlytics.Module, Crashlytics.Statics>;
|
||||
crashlytics: FirebaseModuleWithStatics<
|
||||
FirebaseCrashlyticsTypes.Module,
|
||||
FirebaseCrashlyticsTypes.Statics
|
||||
>;
|
||||
}
|
||||
interface FirebaseApp {
|
||||
crashlytics(): Crashlytics.Module;
|
||||
crashlytics(): FirebaseCrashlyticsTypes.Module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import defaultExport, { firebase as firebaseFromModule } from '@react-native-firebase/crashlytics';
|
||||
import * as crashlytics from '@react-native-firebase/crashlytics';
|
||||
|
||||
// checks module exists at root
|
||||
console.log(firebase.crashlytics().app.name);
|
||||
@@ -13,16 +13,23 @@ console.log(firebase.app().crashlytics().isCrashlyticsCollectionEnabled);
|
||||
console.log(firebase.crashlytics.SDK_VERSION);
|
||||
|
||||
// checks statics exist on defaultExport
|
||||
console.log(defaultExport.SDK_VERSION);
|
||||
console.log(crashlytics.firebase.SDK_VERSION);
|
||||
|
||||
// checks root exists
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks firebase named export exists on module
|
||||
console.log(firebaseFromModule.SDK_VERSION);
|
||||
console.log(crashlytics.firebase.SDK_VERSION);
|
||||
|
||||
// checks multi-app support exists
|
||||
// console.log(firebase.crashlytics(firebase.app()).app.name);
|
||||
|
||||
// checks default export supports app arg
|
||||
// console.log(defaultExport(firebase.app()).app.name);
|
||||
|
||||
console.log(firebase.crashlytics().isCrashlyticsCollectionEnabled);
|
||||
console.log(firebase.crashlytics().log('foo'));
|
||||
firebase
|
||||
.crashlytics()
|
||||
.setUserEmail('foo')
|
||||
.then();
|
||||
|
||||
18
packages/database/lib/index.d.ts
vendored
18
packages/database/lib/index.d.ts
vendored
@@ -53,7 +53,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
*
|
||||
* @firebase database
|
||||
*/
|
||||
export namespace Database {
|
||||
export namespace FirebaseDatabaseTypes {
|
||||
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
||||
|
||||
/**
|
||||
@@ -242,7 +242,7 @@ export namespace Database {
|
||||
* @param values Object containing multiple values.
|
||||
* @param onComplete Callback called when write to server is complete. Contains the parameters (Error | null).
|
||||
*/
|
||||
update(values: { [key]: value }, onComplete?: Function): Promise<void>;
|
||||
update(values: { [key: string]: value }, onComplete?: Function): Promise<void>;
|
||||
|
||||
/**
|
||||
* Sets a priority for the data at this Database location. Setting null removes any priority at this location.
|
||||
@@ -887,7 +887,7 @@ export namespace Database {
|
||||
* @param values Object containing multiple values.
|
||||
* @param onComplete An optional callback function that will be called when synchronization to the server has completed. The callback will be passed a single parameter: null for success, or an Error object indicating a failure.
|
||||
*/
|
||||
update(values: { [key]: value }, onComplete?: Function): Promise<void>;
|
||||
update(values: { [key: string]: value }, onComplete?: Function): Promise<void>;
|
||||
}
|
||||
|
||||
export type EventType =
|
||||
@@ -1227,7 +1227,10 @@ declare module '@react-native-firebase/database' {
|
||||
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
|
||||
export const firebase = firebaseNamedExport;
|
||||
|
||||
const module: FirebaseModuleWithStaticsAndApp<Database.Module, Database.Statics>;
|
||||
const module: FirebaseModuleWithStaticsAndApp<
|
||||
FirebaseDatabaseTypes.Module,
|
||||
FirebaseDatabaseTypes.Statics
|
||||
>;
|
||||
export default module;
|
||||
}
|
||||
|
||||
@@ -1238,11 +1241,14 @@ declare module '@react-native-firebase/app' {
|
||||
namespace ReactNativeFirebase {
|
||||
import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
|
||||
interface Module {
|
||||
database: FirebaseModuleWithStaticsAndApp<Database.Module, Database.Statics>;
|
||||
database: FirebaseModuleWithStaticsAndApp<
|
||||
FirebaseDatabaseTypes.Module,
|
||||
FirebaseDatabaseTypes.Statics
|
||||
>;
|
||||
}
|
||||
|
||||
interface FirebaseApp {
|
||||
database(databaseUrl?: string): Database.Module;
|
||||
database(databaseUrl?: string): FirebaseDatabaseTypes.Module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import defaultExport, { firebase as firebaseFromModule } from '@react-native-firebase/database';
|
||||
import * as database from '@react-native-firebase/database';
|
||||
|
||||
// checks module exists at root
|
||||
console.log(firebase.database().app.name);
|
||||
@@ -7,12 +7,6 @@ console.log(firebase.database().ref('foo/bar'));
|
||||
|
||||
// checks module exists at app level
|
||||
console.log(firebase.app().database().app.name);
|
||||
console.log(
|
||||
firebase
|
||||
.app()
|
||||
.database()
|
||||
.ref('foo/bar'),
|
||||
);
|
||||
|
||||
// check module accepts a string arg
|
||||
console.log(firebase.app().database('some-string').app.name);
|
||||
@@ -21,16 +15,51 @@ console.log(firebase.app().database('some-string').app.name);
|
||||
console.log(firebase.database.SDK_VERSION);
|
||||
|
||||
// checks statics exist on defaultExport
|
||||
console.log(defaultExport.SDK_VERSION);
|
||||
console.log(database.firebase.SDK_VERSION);
|
||||
|
||||
// checks root exists
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks firebase named export exists on module
|
||||
console.log(firebaseFromModule.SDK_VERSION);
|
||||
console.log(database.firebase.SDK_VERSION);
|
||||
|
||||
// checks multi-app support exists
|
||||
console.log(firebase.database(firebase.app()).app.name);
|
||||
|
||||
// checks default export supports app arg
|
||||
console.log(defaultExport(firebase.app()).app.name);
|
||||
console.log(database.firebase(firebase.app('foo')).app.name);
|
||||
|
||||
console.log(firebase.database.ServerValue.TIMESTAMP);
|
||||
|
||||
console.log(
|
||||
firebase
|
||||
.app()
|
||||
.database()
|
||||
.ref('foo/bar'),
|
||||
);
|
||||
|
||||
firebase
|
||||
.database()
|
||||
.ref('foo')
|
||||
.push({
|
||||
foo: 'bar',
|
||||
});
|
||||
|
||||
firebase
|
||||
.database()
|
||||
.goOnline()
|
||||
.then();
|
||||
|
||||
const r = firebase.database().ref('foo');
|
||||
r.child('foo')
|
||||
.update({ foo: 'bar' }, () => {})
|
||||
.then();
|
||||
|
||||
r.once('value').then(ds => {
|
||||
console.log(ds.exists());
|
||||
console.log(ds.forEach);
|
||||
console.log(ds.val());
|
||||
console.log(ds.hasChildren());
|
||||
console.log(ds.hasChild('foo'));
|
||||
console.log(ds.getPriority());
|
||||
});
|
||||
|
||||
14
packages/dynamic-links/lib/index.d.ts
vendored
14
packages/dynamic-links/lib/index.d.ts
vendored
@@ -22,7 +22,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
*
|
||||
* @firebase dynamic-links
|
||||
*/
|
||||
export namespace DynamicLinks {
|
||||
export namespace FirebaseDynamicLinksTypes {
|
||||
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
||||
|
||||
/**
|
||||
@@ -539,7 +539,10 @@ declare module '@react-native-firebase/dynamic-links' {
|
||||
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
|
||||
export const firebase = firebaseNamedExport;
|
||||
|
||||
const module: FirebaseModuleWithStatics<DynamicLinks.Module, DynamicLinks.Statics>;
|
||||
const module: FirebaseModuleWithStatics<
|
||||
FirebaseDynamicLinksTypes.Module,
|
||||
FirebaseDynamicLinksTypes.Statics
|
||||
>;
|
||||
export default module;
|
||||
}
|
||||
|
||||
@@ -551,11 +554,14 @@ declare module '@react-native-firebase/app' {
|
||||
import FirebaseModuleWithStatics = ReactNativeFirebase.FirebaseModuleWithStatics;
|
||||
|
||||
interface Module {
|
||||
dynamicLinks: FirebaseModuleWithStatics<DynamicLinks.Module, DynamicLinks.Statics>;
|
||||
dynamicLinks: FirebaseModuleWithStatics<
|
||||
FirebaseDynamicLinksTypes.Module,
|
||||
FirebaseDynamicLinksTypes.Statics
|
||||
>;
|
||||
}
|
||||
|
||||
interface FirebaseApp {
|
||||
dynamicLinks(): DynamicLinks.Module;
|
||||
dynamicLinks(): FirebaseDynamicLinksTypes.Module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import defaultExport, { firebase as firebaseFromModule } from '@react-native-firebase/dynamic-links';
|
||||
import * as dynamicLinks from '@react-native-firebase/dynamic-links';
|
||||
|
||||
// checks module exists at root
|
||||
console.log(firebase.dynamicLinks().app.name);
|
||||
@@ -11,13 +11,13 @@ console.log(firebase.app().dynamicLinks().app.name);
|
||||
console.log(firebase.dynamicLinks.SDK_VERSION);
|
||||
|
||||
// checks statics exist on defaultExport
|
||||
console.log(defaultExport.SDK_VERSION);
|
||||
console.log(dynamicLinks.firebase.SDK_VERSION);
|
||||
|
||||
// checks root exists
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks firebase named export exists on module
|
||||
console.log(firebaseFromModule.SDK_VERSION);
|
||||
console.log(dynamicLinks.firebase.SDK_VERSION);
|
||||
|
||||
// checks multi-app support exists
|
||||
// console.log(firebase.links(firebase.app()).app.name);
|
||||
@@ -26,3 +26,14 @@ console.log(firebaseFromModule.SDK_VERSION);
|
||||
// console.log(defaultExport(firebase.app()).app.name);
|
||||
|
||||
console.log(firebase.dynamicLinks().getInitialLink());
|
||||
console.log(
|
||||
firebase.dynamicLinks().buildLink({
|
||||
link: 'foo',
|
||||
domainUriPrefix: 'foo',
|
||||
analytics: {
|
||||
campaign: 'foo',
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
console.log(firebase.dynamicLinks.ShortLinkType.SHORT);
|
||||
|
||||
96
packages/firestore/lib/index.d.ts
vendored
96
packages/firestore/lib/index.d.ts
vendored
@@ -47,7 +47,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
*
|
||||
* @firebase firestore
|
||||
*/
|
||||
export namespace Firestore {
|
||||
export namespace FirebaseFirestoreTypes {
|
||||
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
||||
|
||||
/**
|
||||
@@ -121,7 +121,7 @@ export namespace Firestore {
|
||||
*
|
||||
* @param data An Object containing the data for the new document.
|
||||
*/
|
||||
add(data: { [key]: value }): Promise<DocumentReference>;
|
||||
add(data: { [key: string]: value }): Promise<DocumentReference>;
|
||||
|
||||
/**
|
||||
* Get a DocumentReference for the document within the collection at the specified path. If no
|
||||
@@ -285,7 +285,11 @@ export namespace Firestore {
|
||||
*
|
||||
* @param observer A single object containing `next` and `error` callbacks.
|
||||
*/
|
||||
onSnapshot(observer: FirestoreObserver): Function;
|
||||
onSnapshot(observer: {
|
||||
complete?: () => void;
|
||||
error?: (error: Error) => void;
|
||||
next?: (snapshot: DocumentSnapshot) => void;
|
||||
}): () => void;
|
||||
|
||||
/**
|
||||
* Attaches a listener for DocumentSnapshot events with snapshot listener options.
|
||||
@@ -311,7 +315,14 @@ export namespace Firestore {
|
||||
* @param options Options controlling the listen behavior.
|
||||
* @param observer A single object containing `next` and `error` callbacks.
|
||||
*/
|
||||
onSnapshot(options: SnapshotListenOptions, observer: FirestoreObserver): Function;
|
||||
onSnapshot(
|
||||
options: SnapshotListenOptions,
|
||||
observer: {
|
||||
complete?: () => void;
|
||||
error?: (error: Error) => void;
|
||||
next?: (snapshot: DocumentSnapshot) => void;
|
||||
},
|
||||
): () => void;
|
||||
|
||||
/**
|
||||
* Attaches a listener for DocumentSnapshot events.
|
||||
@@ -335,7 +346,11 @@ export namespace Firestore {
|
||||
* @param onError A callback to be called if the listen fails or is cancelled. No further callbacks will occur.
|
||||
* @param onCompletion An optional function which will never be called.
|
||||
*/
|
||||
onSnapshot(onNext: Function, onError?: Function, onCompletion?: Function): Function;
|
||||
onSnapshot(
|
||||
onNext: (snapshot: DocumentSnapshot) => void,
|
||||
onError?: (error: Error) => void,
|
||||
onCompletion?: () => void,
|
||||
): () => void;
|
||||
|
||||
/**
|
||||
* Attaches a listener for DocumentSnapshot events with snapshot listener options.
|
||||
@@ -363,10 +378,10 @@ export namespace Firestore {
|
||||
*/
|
||||
onSnapshot(
|
||||
options: SnapshotListenOptions,
|
||||
onNext: Function,
|
||||
onError?: Function,
|
||||
onCompletion?: Function,
|
||||
): Function;
|
||||
onNext: (snapshot: DocumentSnapshot) => void,
|
||||
onError?: (error: Error) => void,
|
||||
onCompletion?: () => void,
|
||||
): () => void;
|
||||
|
||||
/**
|
||||
* Writes to the document referred to by this DocumentReference. If the document does not yet
|
||||
@@ -389,7 +404,7 @@ export namespace Firestore {
|
||||
* @param data A map of the fields and values for the document.
|
||||
* @param options An object to configure the set behavior.
|
||||
*/
|
||||
set(data: { [key]: value }, options?: SetOptions): Promise<void>;
|
||||
set(data: { [key: string]: value }, options?: SetOptions): Promise<void>;
|
||||
|
||||
/**
|
||||
* Updates fields in the document referred to by this `DocumentReference`. The update will fail
|
||||
@@ -408,7 +423,7 @@ export namespace Firestore {
|
||||
*
|
||||
* @param data An object containing the fields and values with which to update the document. Fields can contain dots to reference nested fields within the document.
|
||||
*/
|
||||
update(data: { [key]: value }): Promise<void>;
|
||||
update(data: { [key: string]: value }): Promise<void>;
|
||||
|
||||
/**
|
||||
* Updates fields in the document referred to by this DocumentReference. The update will fail if
|
||||
@@ -469,7 +484,7 @@ export namespace Firestore {
|
||||
* console.log('User', user.data());
|
||||
* ```
|
||||
*/
|
||||
data(): { [key]: value } | undefined;
|
||||
data(): { [key: string]: value } | undefined;
|
||||
|
||||
/**
|
||||
* Retrieves the field specified by fieldPath. Returns undefined if the document or field doesn't exist.
|
||||
@@ -761,12 +776,6 @@ export namespace Firestore {
|
||||
source: 'default' | 'server' | 'cache';
|
||||
}
|
||||
|
||||
export interface FirestoreObserver {
|
||||
complete?: Function;
|
||||
error?: Function;
|
||||
next?: Function;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Query refers to a `Query` which you can read or listen to. You can also construct refined `Query` objects by
|
||||
* adding filters and ordering.
|
||||
@@ -937,7 +946,11 @@ export namespace Firestore {
|
||||
*
|
||||
* @param observer A single object containing `next` and `error` callbacks.
|
||||
*/
|
||||
onSnapshot(observer: FirestoreObserver): Function;
|
||||
onSnapshot(observer: {
|
||||
complete?: () => void;
|
||||
error?: (error: Error) => void;
|
||||
next?: (snapshot: QuerySnapshot) => void;
|
||||
}): () => void;
|
||||
|
||||
/**
|
||||
* Attaches a listener for `QuerySnapshot` events with snapshot listener options.
|
||||
@@ -963,7 +976,14 @@ export namespace Firestore {
|
||||
* @param options Options controlling the listen behavior.
|
||||
* @param observer A single object containing `next` and `error` callbacks.
|
||||
*/
|
||||
onSnapshot(options: SnapshotListenOptions, observer: FirestoreObserver): Function;
|
||||
onSnapshot(
|
||||
options: SnapshotListenOptions,
|
||||
observer: {
|
||||
complete?: () => void;
|
||||
error?: (error: Error) => void;
|
||||
next?: (snapshot: QuerySnapshot) => void;
|
||||
},
|
||||
): () => void;
|
||||
|
||||
/**
|
||||
* Attaches a listener for `QuerySnapshot` events.
|
||||
@@ -987,7 +1007,11 @@ export namespace Firestore {
|
||||
* @param onError A callback to be called if the listen fails or is cancelled. No further callbacks will occur.
|
||||
* @param onCompletion An optional function which will never be called.
|
||||
*/
|
||||
onSnapshot(onNext: Function, onError?: Function, onCompletion?: Function): Function;
|
||||
onSnapshot(
|
||||
onNext: (snapshot: QuerySnapshot) => void,
|
||||
onError?: (error: Error) => void,
|
||||
onCompletion?: () => void,
|
||||
): () => void;
|
||||
|
||||
/**
|
||||
* Attaches a listener for `QuerySnapshot` events with snapshot listener options.
|
||||
@@ -1018,7 +1042,7 @@ export namespace Firestore {
|
||||
onNext: Function,
|
||||
onError?: Function,
|
||||
onCompletion?: Function,
|
||||
): Function;
|
||||
): () => void;
|
||||
|
||||
/**
|
||||
* Creates and returns a new Query that's additionally sorted by the specified field, optionally in descending order instead of ascending.
|
||||
@@ -1488,7 +1512,11 @@ export namespace Firestore {
|
||||
* @param data An object of the fields and values for the document.
|
||||
* @param options An object to configure the set behavior.
|
||||
*/
|
||||
set(documentRef: DocumentReference, data: { [key]: value }, options?: SetOptions): Transaction;
|
||||
set(
|
||||
documentRef: DocumentReference,
|
||||
data: { [key: string]: value },
|
||||
options?: SetOptions,
|
||||
): Transaction;
|
||||
|
||||
/**
|
||||
* Updates fields in the document referred to by the provided `DocumentReference`. The update will fail if applied
|
||||
@@ -1511,7 +1539,7 @@ export namespace Firestore {
|
||||
* @param documentRef A reference to the document to be updated.
|
||||
* @param data An object containing the fields and values with which to update the document. Fields can contain dots to reference nested fields within the document.
|
||||
*/
|
||||
update(documentRef: DocumentReference, data: { [key]: value }): Transaction;
|
||||
update(documentRef: DocumentReference, data: { [key: string]: value }): Transaction;
|
||||
|
||||
/**
|
||||
* Updates fields in the document referred to by the provided DocumentReference. The update will fail if applied to
|
||||
@@ -1610,7 +1638,11 @@ export namespace Firestore {
|
||||
* @param data An object of the fields and values for the document.
|
||||
* @param options An object to configure the set behavior.
|
||||
*/
|
||||
set(documentRef: DocumentReference, data: { [key]: value }, options?: SetOptions): WriteBatch;
|
||||
set(
|
||||
documentRef: DocumentReference,
|
||||
data: { [key: string]: value },
|
||||
options?: SetOptions,
|
||||
): WriteBatch;
|
||||
|
||||
/**
|
||||
* Updates fields in the document referred to by the provided DocumentReference. The update will fail if applied to a document that does not exist.
|
||||
@@ -1629,7 +1661,7 @@ export namespace Firestore {
|
||||
* @param documentRef A reference to the document to be updated.
|
||||
* @param data An object containing the fields and values with which to update the document. Fields can contain dots to reference nested fields within the document.
|
||||
*/
|
||||
update(documentRef: DocumentReference, data: { [key]: value }): WriteBatch;
|
||||
update(documentRef: DocumentReference, data: { [key: string]: value }): WriteBatch;
|
||||
|
||||
/**
|
||||
* Updates fields in the document referred to by this DocumentReference. The update will fail if applied to a document that does not exist.
|
||||
@@ -1861,7 +1893,10 @@ declare module '@react-native-firebase/firestore' {
|
||||
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
|
||||
export const firebase = firebaseNamedExport;
|
||||
|
||||
const module: FirebaseModuleWithStaticsAndApp<Firestore.Module, Firestore.Statics>;
|
||||
const module: FirebaseModuleWithStaticsAndApp<
|
||||
FirebaseFirestoreTypes.Module,
|
||||
FirebaseFirestoreTypes.Statics
|
||||
>;
|
||||
export default module;
|
||||
}
|
||||
|
||||
@@ -1872,10 +1907,13 @@ declare module '@react-native-firebase/app' {
|
||||
namespace ReactNativeFirebase {
|
||||
import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
|
||||
interface Module {
|
||||
firestore: FirebaseModuleWithStaticsAndApp<Firestore.Module, Firestore.Statics>;
|
||||
firestore: FirebaseModuleWithStaticsAndApp<
|
||||
FirebaseFirestoreTypes.Module,
|
||||
FirebaseFirestoreTypes.Statics
|
||||
>;
|
||||
}
|
||||
interface FirebaseApp {
|
||||
firestore(): Firestore.Module;
|
||||
firestore(): FirebaseFirestoreTypes.Module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import defaultExport, { firebase as firebaseFromModule } from '@react-native-firebase/firestore';
|
||||
import * as firestore from '@react-native-firebase/firestore';
|
||||
|
||||
// checks module exists at root
|
||||
console.log(firebase.firestore().app.name);
|
||||
@@ -17,16 +17,118 @@ console.log(
|
||||
console.log(firebase.firestore.SDK_VERSION);
|
||||
|
||||
// checks statics exist on defaultExport
|
||||
console.log(defaultExport.SDK_VERSION);
|
||||
console.log(firestore.firebase.SDK_VERSION);
|
||||
|
||||
// checks root exists
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks firebase named export exists on module
|
||||
console.log(firebaseFromModule.SDK_VERSION);
|
||||
console.log(firestore.firebase.SDK_VERSION);
|
||||
|
||||
// checks multi-app support exists
|
||||
console.log(firebase.firestore(firebase.app()).app.name);
|
||||
console.log(firebase.firestore(firebase.app('foo')).app.name);
|
||||
|
||||
// checks default export supports app arg
|
||||
console.log(defaultExport(firebase.app()).app.name);
|
||||
console.log(firebase.firestore.Blob);
|
||||
console.log(firebase.firestore.FieldPath);
|
||||
console.log(firebase.firestore.FieldValue);
|
||||
console.log(firebase.firestore.GeoPoint);
|
||||
console.log(firebase.firestore.Timestamp);
|
||||
console.log(firebase.firestore.CACHE_SIZE_UNLIMITED);
|
||||
firebase.firestore.setLogLevel('debug');
|
||||
|
||||
firebase.firestore().collection('foo');
|
||||
firebase
|
||||
.firestore()
|
||||
.collection('foo')
|
||||
.doc('foo')
|
||||
.collection('foo');
|
||||
firebase
|
||||
.firestore()
|
||||
.collection('foo')
|
||||
.doc('foo');
|
||||
firebase
|
||||
.firestore()
|
||||
.collection('foo')
|
||||
.doc('foo')
|
||||
.collection('foo')
|
||||
.add({ foo: 'bar' })
|
||||
.then();
|
||||
firebase
|
||||
.firestore()
|
||||
.collection('foo')
|
||||
.doc('foo')
|
||||
.update({ foo: 'bar' })
|
||||
.then();
|
||||
firebase
|
||||
.firestore()
|
||||
.collectionGroup('foo')
|
||||
.endAt(123)
|
||||
.startAfter(123)
|
||||
.get({ source: 'cache' })
|
||||
.then();
|
||||
firebase
|
||||
.firestore()
|
||||
.collection('foo')
|
||||
.doc('foo')
|
||||
.onSnapshot(() => {});
|
||||
firebase
|
||||
.firestore()
|
||||
.collection('foo')
|
||||
.doc('foo')
|
||||
.onSnapshot({
|
||||
next: snapshot => {
|
||||
console.log(snapshot.get('foo'));
|
||||
},
|
||||
error: error => {
|
||||
console.log(error.message);
|
||||
},
|
||||
});
|
||||
firebase
|
||||
.firestore()
|
||||
.collection('foo')
|
||||
.doc('foo')
|
||||
.onSnapshot(
|
||||
{
|
||||
includeMetadataChanges: true,
|
||||
},
|
||||
{
|
||||
next: snapshot => {
|
||||
console.log(snapshot.get('foo'));
|
||||
},
|
||||
error: error => {
|
||||
console.log(error.message);
|
||||
},
|
||||
complete() {},
|
||||
},
|
||||
);
|
||||
firebase
|
||||
.firestore()
|
||||
.collection('foo')
|
||||
.doc('foo')
|
||||
.onSnapshot(
|
||||
snapshot => {
|
||||
console.log(snapshot.get('foo'));
|
||||
},
|
||||
error => {
|
||||
console.log(error.message);
|
||||
},
|
||||
() => {},
|
||||
);
|
||||
firebase
|
||||
.firestore()
|
||||
.collection('foo')
|
||||
.onSnapshot(
|
||||
{
|
||||
includeMetadataChanges: true,
|
||||
},
|
||||
{
|
||||
next: snapshot => {
|
||||
console.log(snapshot.docs);
|
||||
},
|
||||
error: error => {
|
||||
console.log(error.message);
|
||||
},
|
||||
complete() {},
|
||||
},
|
||||
);
|
||||
|
||||
18
packages/functions/lib/index.d.ts
vendored
18
packages/functions/lib/index.d.ts
vendored
@@ -53,7 +53,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
*
|
||||
* @firebase functions
|
||||
*/
|
||||
export namespace Functions {
|
||||
export namespace FirebaseFunctionsTypes {
|
||||
/**
|
||||
* The set of Firebase Functions status codes.
|
||||
*
|
||||
@@ -94,6 +94,7 @@ export namespace Functions {
|
||||
* credentials for the operation.
|
||||
*/
|
||||
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
||||
|
||||
export type FunctionsErrorCode =
|
||||
| 'ok'
|
||||
| 'cancelled'
|
||||
@@ -338,13 +339,13 @@ declare module '@react-native-firebase/functions' {
|
||||
import ReactNativeFirebaseModule = ReactNativeFirebase.Module;
|
||||
import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
|
||||
|
||||
// tslint:disable-next-line:variable-name
|
||||
export const HttpsErrorCode: {} & Functions.HttpsErrorCode;
|
||||
|
||||
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
|
||||
export const firebase = firebaseNamedExport;
|
||||
|
||||
const module: FirebaseModuleWithStaticsAndApp<Functions.Module, Functions.Statics>;
|
||||
const module: FirebaseModuleWithStaticsAndApp<
|
||||
FirebaseFunctionsTypes.Module,
|
||||
FirebaseFunctionsTypes.Statics
|
||||
>;
|
||||
export default module;
|
||||
}
|
||||
|
||||
@@ -355,10 +356,13 @@ declare module '@react-native-firebase/app' {
|
||||
namespace ReactNativeFirebase {
|
||||
import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
|
||||
interface Module {
|
||||
functions: FirebaseModuleWithStaticsAndApp<Functions.Module, Functions.Statics>;
|
||||
functions: FirebaseModuleWithStaticsAndApp<
|
||||
FirebaseFunctionsTypes.Module,
|
||||
FirebaseFunctionsTypes.Statics
|
||||
>;
|
||||
}
|
||||
interface FirebaseApp {
|
||||
functions(region?: string): Functions.Module;
|
||||
functions(region?: string): FirebaseFunctionsTypes.Module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import defaultExport, { firebase as firebaseFromModule } from '@react-native-firebase/functions';
|
||||
import * as functions from '@react-native-firebase/functions';
|
||||
|
||||
// checks module exists at root
|
||||
console.log(firebase.functions().app.name);
|
||||
@@ -20,16 +20,28 @@ console.log(
|
||||
console.log(firebase.functions.SDK_VERSION);
|
||||
|
||||
// checks statics exist on defaultExport
|
||||
console.log(defaultExport.SDK_VERSION);
|
||||
console.log(functions.firebase.SDK_VERSION);
|
||||
|
||||
// checks root exists
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks firebase named export exists on module
|
||||
console.log(firebaseFromModule.SDK_VERSION);
|
||||
|
||||
// checks multi-app support exists
|
||||
console.log(firebase.functions(firebase.app()).app.name);
|
||||
|
||||
// checks default export supports app arg
|
||||
console.log(defaultExport(firebase.app()).app.name);
|
||||
console.log(firebase.functions(firebase.app('foo')).app.name);
|
||||
|
||||
console.log(firebase.functions.HttpsErrorCode.ABORTED);
|
||||
|
||||
firebase
|
||||
.functions()
|
||||
.httpsCallable('foo')(123)
|
||||
.then(result => {
|
||||
console.log(result.data);
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error.code);
|
||||
console.log(error.details);
|
||||
});
|
||||
|
||||
firebase.functions().useFunctionsEmulator('123');
|
||||
|
||||
8
packages/iid/lib/index.d.ts
vendored
8
packages/iid/lib/index.d.ts
vendored
@@ -53,7 +53,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
*
|
||||
* @firebase iid
|
||||
*/
|
||||
export namespace Iid {
|
||||
export namespace FirebaseIidTypes {
|
||||
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
||||
|
||||
export interface Statics {}
|
||||
@@ -137,7 +137,7 @@ declare module '@react-native-firebase/iid' {
|
||||
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
|
||||
export const firebase = firebaseNamedExport;
|
||||
|
||||
const module: FirebaseModuleWithStaticsAndApp<Iid.Module, Iid.Statics>;
|
||||
const module: FirebaseModuleWithStaticsAndApp<FirebaseIidTypes.Module, FirebaseIidTypes.Statics>;
|
||||
export default module;
|
||||
}
|
||||
|
||||
@@ -148,10 +148,10 @@ declare module '@react-native-firebase/app' {
|
||||
namespace ReactNativeFirebase {
|
||||
import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
|
||||
interface Module {
|
||||
iid: FirebaseModuleWithStaticsAndApp<Iid.Module, Iid.Statics>;
|
||||
iid: FirebaseModuleWithStaticsAndApp<FirebaseIidTypes.Module, FirebaseIidTypes.Statics>;
|
||||
}
|
||||
interface FirebaseApp {
|
||||
iid(): Iid.Module;
|
||||
iid(): FirebaseIidTypes.Module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import defaultExport, { firebase as firebaseFromModule } from '@react-native-firebase/iid';
|
||||
import * as iid from '@react-native-firebase/iid';
|
||||
|
||||
// checks module exists at root
|
||||
console.log(firebase.iid().app.name);
|
||||
@@ -11,16 +11,18 @@ console.log(firebase.app().iid().app.name);
|
||||
console.log(firebase.iid.SDK_VERSION);
|
||||
|
||||
// checks statics exist on defaultExport
|
||||
console.log(defaultExport.SDK_VERSION);
|
||||
console.log(iid.firebase.SDK_VERSION);
|
||||
|
||||
// checks root exists
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks firebase named export exists on module
|
||||
console.log(firebaseFromModule.SDK_VERSION);
|
||||
|
||||
// checks multi-app support exists
|
||||
console.log(firebase.iid(firebase.app()).app.name);
|
||||
|
||||
// checks default export supports app arg
|
||||
console.log(defaultExport(firebase.app()).app.name);
|
||||
firebase
|
||||
.iid()
|
||||
.get()
|
||||
.then(str => str.length);
|
||||
firebase
|
||||
.iid()
|
||||
.getToken('foo', 'bar')
|
||||
.then(str => str.length);
|
||||
|
||||
14
packages/in-app-messaging/lib/index.d.ts
vendored
14
packages/in-app-messaging/lib/index.d.ts
vendored
@@ -53,7 +53,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
*
|
||||
* @firebase in-app-messaging
|
||||
*/
|
||||
export namespace InAppMessaging {
|
||||
export namespace FirebaseInAppMessagingTypes {
|
||||
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
||||
|
||||
export interface Statics {}
|
||||
@@ -139,7 +139,10 @@ declare module '@react-native-firebase/in-app-messaging' {
|
||||
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
|
||||
export const firebase = firebaseNamedExport;
|
||||
|
||||
const module: FirebaseModuleWithStatics<InAppMessaging.Module, InAppMessaging.Statics>;
|
||||
const module: FirebaseModuleWithStatics<
|
||||
FirebaseInAppMessagingTypes.Module,
|
||||
FirebaseInAppMessagingTypes.Statics
|
||||
>;
|
||||
export default module;
|
||||
}
|
||||
|
||||
@@ -150,11 +153,14 @@ declare module '@react-native-firebase/app' {
|
||||
namespace ReactNativeFirebase {
|
||||
import FirebaseModuleWithStatics = ReactNativeFirebase.FirebaseModuleWithStatics;
|
||||
interface Module {
|
||||
inAppMessaging: FirebaseModuleWithStatics<InAppMessaging.Module, InAppMessaging.Statics>;
|
||||
inAppMessaging: FirebaseModuleWithStatics<
|
||||
FirebaseInAppMessagingTypes.Module,
|
||||
FirebaseInAppMessagingTypes.Statics
|
||||
>;
|
||||
}
|
||||
|
||||
interface FirebaseApp {
|
||||
inAppMessaging(): InAppMessaging.Module;
|
||||
inAppMessaging(): FirebaseInAppMessagingTypes.Module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import defaultExport, { firebase as firebaseFromModule } from '@react-native-firebase/in-app-messaging';
|
||||
import * as inAppMessaging from '@react-native-firebase/in-app-messaging';
|
||||
|
||||
// checks module exists at root
|
||||
console.log(firebase.inAppMessaging().app.name);
|
||||
@@ -13,19 +13,18 @@ console.log(firebase.app().inAppMessaging().isMessagesDisplaySuppressed);
|
||||
console.log(firebase.inAppMessaging.SDK_VERSION);
|
||||
|
||||
// checks statics exist on defaultExport
|
||||
console.log(defaultExport.SDK_VERSION);
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// check module correctly exported
|
||||
console.log(defaultExport().isMessagesDisplaySuppressed);
|
||||
console.log(inAppMessaging.firebase().isMessagesDisplaySuppressed);
|
||||
|
||||
// checks root exists
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks firebase named export exists on module
|
||||
console.log(firebaseFromModule.SDK_VERSION);
|
||||
console.log(inAppMessaging.firebase.SDK_VERSION);
|
||||
|
||||
// checks multi-app support exists
|
||||
// console.log(firebase.inAppMessaging(firebase.app()).app.name);
|
||||
|
||||
// checks default export supports app arg
|
||||
// console.log(defaultExport(firebase.app()).app.name);
|
||||
firebase
|
||||
.inAppMessaging()
|
||||
.setAutomaticDataCollectionEnabled(false)
|
||||
.then();
|
||||
|
||||
24
packages/messaging/lib/index.d.ts
vendored
24
packages/messaging/lib/index.d.ts
vendored
@@ -53,7 +53,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
*
|
||||
* @firebase messaging
|
||||
*/
|
||||
export namespace Messaging {
|
||||
export namespace FirebaseMessagingTypes {
|
||||
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
||||
import NativeFirebaseError = ReactNativeFirebase.NativeFirebaseError;
|
||||
|
||||
@@ -256,7 +256,7 @@ export namespace Messaging {
|
||||
*
|
||||
* @param listener Called with a `RemoteMessage` when a new FCM payload is received from the server.
|
||||
*/
|
||||
onMessage(listener: (message: RemoteMessage) => any): Function;
|
||||
onMessage(listener: (message: RemoteMessage) => any): () => void;
|
||||
|
||||
/**
|
||||
* Called when a new registration token is generated for the device. For example, this event can happen when a
|
||||
@@ -287,7 +287,7 @@ export namespace Messaging {
|
||||
*
|
||||
* @param listener Called with a FCM token when the token is refreshed.
|
||||
*/
|
||||
onTokenRefresh(listener: (token: string) => any): Function;
|
||||
onTokenRefresh(listener: (token: string) => any): () => void;
|
||||
|
||||
/**
|
||||
* On iOS, messaging permission must be requested by the current application before messages can
|
||||
@@ -422,7 +422,7 @@ export namespace Messaging {
|
||||
*
|
||||
* @param listener Called when the FCM deletes pending messages.
|
||||
*/
|
||||
onDeletedMessages(listener: Function): Function;
|
||||
onDeletedMessages(listener: () => void): () => void;
|
||||
|
||||
/**
|
||||
* When sending a `RemoteMessage`, this listener is called when the message has been sent to FCM.
|
||||
@@ -442,7 +442,7 @@ export namespace Messaging {
|
||||
*
|
||||
* @param listener Called when the FCM sends the remote message to FCM.
|
||||
*/
|
||||
onMessageSent(listener: (messageId: string) => any): Function;
|
||||
onMessageSent(listener: (messageId: string) => any): () => void;
|
||||
|
||||
/**
|
||||
* When sending a `RemoteMessage`, this listener is called when an error is thrown and the
|
||||
@@ -463,7 +463,7 @@ export namespace Messaging {
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
onSendError(listener: (evt: SendErrorEvent) => any): Function;
|
||||
onSendError(listener: (evt: SendErrorEvent) => any): () => void;
|
||||
|
||||
/**
|
||||
* On Android, set a message handler function which is called when the app is in the background
|
||||
@@ -548,7 +548,10 @@ declare module '@react-native-firebase/messaging' {
|
||||
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
|
||||
export const firebase = firebaseNamedExport;
|
||||
|
||||
const module: FirebaseModuleWithStatics<Messaging.Module, Messaging.Statics>;
|
||||
const module: FirebaseModuleWithStatics<
|
||||
FirebaseMessagingTypes.Module,
|
||||
FirebaseMessagingTypes.Statics
|
||||
>;
|
||||
export default module;
|
||||
}
|
||||
|
||||
@@ -559,11 +562,14 @@ declare module '@react-native-firebase/app' {
|
||||
namespace ReactNativeFirebase {
|
||||
import FirebaseModuleWithStatics = ReactNativeFirebase.FirebaseModuleWithStatics;
|
||||
interface Module {
|
||||
messaging: FirebaseModuleWithStatics<Messaging.Module, Messaging.Statics>;
|
||||
messaging: FirebaseModuleWithStatics<
|
||||
FirebaseMessagingTypes.Module,
|
||||
FirebaseMessagingTypes.Statics
|
||||
>;
|
||||
}
|
||||
|
||||
interface FirebaseApp {
|
||||
messaging(): Messaging.Module;
|
||||
messaging(): FirebaseMessagingTypes.Module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import defaultExport, { firebase as firebaseFromModule } from '@react-native-firebase/messaging';
|
||||
import * as messaging from '@react-native-firebase/messaging';
|
||||
|
||||
// checks module exists at root
|
||||
console.log(firebase.messaging().app.name);
|
||||
@@ -11,16 +11,33 @@ console.log(firebase.app().messaging().app.name);
|
||||
console.log(firebase.messaging.SDK_VERSION);
|
||||
|
||||
// checks statics exist on defaultExport
|
||||
console.log(defaultExport.SDK_VERSION);
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks root exists
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks firebase named export exists on module
|
||||
console.log(firebaseFromModule.SDK_VERSION);
|
||||
console.log(messaging.firebase.SDK_VERSION);
|
||||
|
||||
// checks multi-app support exists
|
||||
// console.log(firebase.messaging(firebase.app()).app.name);
|
||||
//
|
||||
// checks default export supports app arg
|
||||
// console.log(defaultExport(firebase.app()).app.name);
|
||||
|
||||
console.log(firebase.messaging().isRegisteredForRemoteNotifications);
|
||||
firebase
|
||||
.messaging()
|
||||
.subscribeToTopic('foo')
|
||||
.then();
|
||||
firebase
|
||||
.messaging()
|
||||
.unsubscribeFromTopic('foo')
|
||||
.then();
|
||||
firebase
|
||||
.messaging()
|
||||
.getAPNSToken()
|
||||
.then();
|
||||
firebase.messaging().setBackgroundMessageHandler(msg => {
|
||||
console.log(msg.data);
|
||||
});
|
||||
|
||||
21
packages/ml-natural-language/lib/index.d.ts
vendored
21
packages/ml-natural-language/lib/index.d.ts
vendored
@@ -53,7 +53,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
*
|
||||
* @firebase ml-natural-language
|
||||
*/
|
||||
export namespace MLKitLanguage {
|
||||
export namespace FirebaseLanguageTypes {
|
||||
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
||||
|
||||
export interface Statics {}
|
||||
@@ -214,7 +214,10 @@ declare module '@react-native-firebase/ml-natural-language' {
|
||||
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
|
||||
export const firebase = firebaseNamedExport;
|
||||
|
||||
const module: FirebaseModuleWithStaticsAndApp<MLKitLanguage.Module, MLKitLanguage.Statics>;
|
||||
const module: FirebaseModuleWithStaticsAndApp<
|
||||
FirebaseLanguageTypes.Module,
|
||||
FirebaseLanguageTypes.Statics
|
||||
>;
|
||||
export default module;
|
||||
}
|
||||
|
||||
@@ -226,18 +229,28 @@ declare module '@react-native-firebase/app' {
|
||||
import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
|
||||
|
||||
interface Module {
|
||||
naturalLanguage: FirebaseModuleWithStaticsAndApp<MLKitLanguage.Module, MLKitLanguage.Statics>;
|
||||
naturalLanguage: FirebaseModuleWithStaticsAndApp<
|
||||
FirebaseLanguageTypes.Module,
|
||||
FirebaseLanguageTypes.Statics
|
||||
>;
|
||||
}
|
||||
|
||||
interface FirebaseApp {
|
||||
naturalLanguage(): MLKitLanguage.Module;
|
||||
naturalLanguage(): FirebaseLanguageTypes.Module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace ReactNativeFirebase {
|
||||
interface FirebaseJsonConfig {
|
||||
/**
|
||||
* If `true`, the Language ID Model will be installed onto the device.
|
||||
*/
|
||||
ml_natural_language_language_id_model: boolean;
|
||||
|
||||
/**
|
||||
* If `true`, the Smart Reply Model will be installed onto the device.
|
||||
*/
|
||||
ml_natural_language_smart_reply_model: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import defaultExport, {
|
||||
firebase as firebaseFromModule,
|
||||
} from '@react-native-firebase/ml-natural-language';
|
||||
import * as language from '@react-native-firebase/ml-natural-language';
|
||||
|
||||
// checks module exists at root
|
||||
console.log(firebase.naturalLanguage().app.name);
|
||||
@@ -13,16 +11,41 @@ console.log(firebase.app().naturalLanguage().app.name);
|
||||
console.log(firebase.naturalLanguage.SDK_VERSION);
|
||||
|
||||
// checks statics exist on defaultExport
|
||||
console.log(defaultExport.SDK_VERSION);
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks root exists
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks firebase named export exists on module
|
||||
console.log(firebaseFromModule.SDK_VERSION);
|
||||
console.log(language.firebase.SDK_VERSION);
|
||||
|
||||
// checks multi-app support exists
|
||||
console.log(firebase.naturalLanguage(firebase.app()).app.name);
|
||||
|
||||
// checks default export supports app arg
|
||||
console.log(defaultExport(firebase.app()).app.name);
|
||||
firebase
|
||||
.naturalLanguage()
|
||||
.identifyLanguage('foo', {
|
||||
confidenceThreshold: 0.3,
|
||||
})
|
||||
.then(str => str.replace);
|
||||
|
||||
firebase
|
||||
.naturalLanguage()
|
||||
.identifyPossibleLanguages('foo', {
|
||||
confidenceThreshold: 0.3,
|
||||
})
|
||||
.then(languages => languages.forEach($ => $.confidence));
|
||||
|
||||
firebase
|
||||
.naturalLanguage()
|
||||
.suggestReplies([
|
||||
{
|
||||
text: 'foo',
|
||||
isLocalUser: true,
|
||||
userId: '123',
|
||||
timestamp: 123,
|
||||
},
|
||||
])
|
||||
.then(replies => {
|
||||
replies.forEach($ => $.text);
|
||||
});
|
||||
|
||||
96
packages/ml-vision/lib/index.d.ts
vendored
96
packages/ml-vision/lib/index.d.ts
vendored
@@ -53,25 +53,25 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
*
|
||||
* @firebase ml-vision
|
||||
*/
|
||||
export namespace MLKitVision {
|
||||
export namespace FirebaseVisionTypes {
|
||||
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
||||
|
||||
export interface Statics {
|
||||
VisionCloudTextRecognizerModelType: VisionCloudTextRecognizerModelType;
|
||||
VisionFaceDetectorClassificationMode: VisionFaceDetectorClassificationMode;
|
||||
VisionFaceDetectorContourMode: VisionFaceDetectorContourMode;
|
||||
VisionFaceDetectorLandmarkMode: VisionFaceDetectorLandmarkMode;
|
||||
VisionFaceDetectorPerformanceMode: VisionFaceDetectorPerformanceMode;
|
||||
VisionFaceLandmarkType: VisionFaceLandmarkType;
|
||||
VisionFaceContourType: VisionFaceContourType;
|
||||
VisionCloudLandmarkRecognizerModelType: VisionCloudLandmarkRecognizerModelType;
|
||||
VisionDocumentTextRecognizedBreakType: VisionDocumentTextRecognizedBreakType;
|
||||
VisionBarcodeFormat: VisionBarcodeFormat;
|
||||
VisionBarcodeValueType: VisionBarcodeValueType;
|
||||
VisionBarcodeAddressType: VisionBarcodeAddressType;
|
||||
VisionBarcodeEmailType: VisionBarcodeEmailType;
|
||||
VisionBarcodePhoneType: VisionBarcodePhoneType;
|
||||
VisionBarcodeWifiEncryptionType: VisionBarcodeWifiEncryptionType;
|
||||
VisionCloudTextRecognizerModelType: typeof VisionCloudTextRecognizerModelType;
|
||||
VisionFaceDetectorClassificationMode: typeof VisionFaceDetectorClassificationMode;
|
||||
VisionFaceDetectorContourMode: typeof VisionFaceDetectorContourMode;
|
||||
VisionFaceDetectorLandmarkMode: typeof VisionFaceDetectorLandmarkMode;
|
||||
VisionFaceDetectorPerformanceMode: typeof VisionFaceDetectorPerformanceMode;
|
||||
VisionFaceLandmarkType: typeof VisionFaceLandmarkType;
|
||||
VisionFaceContourType: typeof VisionFaceContourType;
|
||||
VisionCloudLandmarkRecognizerModelType: typeof VisionCloudLandmarkRecognizerModelType;
|
||||
VisionDocumentTextRecognizedBreakType: typeof VisionDocumentTextRecognizedBreakType;
|
||||
VisionBarcodeFormat: typeof VisionBarcodeFormat;
|
||||
VisionBarcodeValueType: typeof VisionBarcodeValueType;
|
||||
VisionBarcodeAddressType: typeof VisionBarcodeAddressType;
|
||||
VisionBarcodeEmailType: typeof VisionBarcodeEmailType;
|
||||
VisionBarcodePhoneType: typeof VisionBarcodePhoneType;
|
||||
VisionBarcodeWifiEncryptionType: typeof VisionBarcodeWifiEncryptionType;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1179,42 +1179,6 @@ export namespace MLKitVision {
|
||||
}
|
||||
}
|
||||
|
||||
export const VisionPoint = MLKitVision.VisionPoint;
|
||||
export const VisionRectangle = MLKitVision.VisionRectangle;
|
||||
export const VisionFaceDetectorOptions = MLKitVision.VisionFaceDetectorOptions;
|
||||
export const VisionFaceLandmarkType = MLKitVision.VisionFaceLandmarkType;
|
||||
export const VisionFaceContourType = MLKitVision.VisionFaceContourType;
|
||||
|
||||
export const VisionImageLabelerOptions = MLKitVision.VisionImageLabelerOptions;
|
||||
export const VisionBarcodeDetectorOptions = VisionBarcodeDetectorOptions;
|
||||
export const VisionCloudImageLabelerOptions = MLKitVision.VisionCloudImageLabelerOptions;
|
||||
export const VisionCloudTextRecognizerOptions = MLKitVision.VisionCloudTextRecognizerOptions;
|
||||
|
||||
export const VisionCloudTextRecognizerModelType = MLKitVision.VisionCloudTextRecognizerModelType;
|
||||
export const VisionCloudLandmarkRecognizerOptions =
|
||||
MLKitVision.VisionCloudLandmarkRecognizerOptions;
|
||||
export const VisionCloudDocumentTextRecognizerOptions =
|
||||
MLKitVision.VisionCloudDocumentTextRecognizerOptions;
|
||||
|
||||
export const VisionFaceDetectorClassificationMode =
|
||||
MLKitVision.VisionFaceDetectorClassificationMode;
|
||||
export const VisionFaceDetectorContourMode = MLKitVision.VisionFaceDetectorContourMode;
|
||||
export const VisionFaceDetectorLandmarkMode = MLKitVision.VisionFaceDetectorLandmarkMode;
|
||||
export const VisionFaceDetectorPerformanceMode = MLKitVision.VisionFaceDetectorPerformanceMode;
|
||||
|
||||
export const VisionDocumentTextRecognizedBreakType =
|
||||
MLKitVision.VisionDocumentTextRecognizedBreakType;
|
||||
export const VisionCloudLandmarkRecognizerModelType =
|
||||
MLKitVision.VisionCloudLandmarkRecognizerModelType;
|
||||
|
||||
export const VisionBarcodeFormat = MLKITVision.VisionBarcodeFormat;
|
||||
export const VisionBarcodeValueType = MLKITVision.VisionBarcodeValueType;
|
||||
export const VisionBarcodeAddressType = MLKITVision.VisionBarcodeAddressType;
|
||||
export const VisionBarcodeEmailType = MLKITVision.VisionBarcodeEmailType;
|
||||
export const VisionBarcodePhoneType = MLKITVision.VisionBarcodePhoneType;
|
||||
export const VisionBarcodeWifiEncryptionType = MLKITVision.VisionBarcodeWifiEncryptionType;
|
||||
export const VisionBarcodeDetectorOptions = MLKITVision.VisionBarcodeDetectorOptions;
|
||||
|
||||
declare module '@react-native-firebase/ml-vision' {
|
||||
import ReactNativeFirebaseModule = ReactNativeFirebase.Module;
|
||||
import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
|
||||
@@ -1222,7 +1186,26 @@ declare module '@react-native-firebase/ml-vision' {
|
||||
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
|
||||
export const firebase = firebaseNamedExport;
|
||||
|
||||
const module: FirebaseModuleWithStaticsAndApp<MLKitVision.Module, MLKitVision.Statics>;
|
||||
export const VisionBarcodeFormat: {} & typeof FirebaseVisionTypes.VisionBarcodeFormat;
|
||||
export const VisionFaceContourType: {} & typeof FirebaseVisionTypes.VisionFaceContourType;
|
||||
export const VisionFaceLandmarkType: {} & typeof FirebaseVisionTypes.VisionFaceLandmarkType;
|
||||
export const VisionBarcodeValueType: {} & typeof FirebaseVisionTypes.VisionBarcodeValueType;
|
||||
export const VisionBarcodeEmailType: {} & typeof FirebaseVisionTypes.VisionBarcodeEmailType;
|
||||
export const VisionBarcodePhoneType: {} & typeof FirebaseVisionTypes.VisionBarcodePhoneType;
|
||||
export const VisionBarcodeAddressType: {} & typeof FirebaseVisionTypes.VisionBarcodeAddressType;
|
||||
export const VisionFaceDetectorContourMode: {} & typeof FirebaseVisionTypes.VisionFaceDetectorContourMode;
|
||||
export const VisionFaceDetectorLandmarkMode: {} & typeof FirebaseVisionTypes.VisionFaceDetectorLandmarkMode;
|
||||
export const VisionBarcodeWifiEncryptionType: {} & FirebaseVisionTypes.VisionBarcodeWifiEncryptionType;
|
||||
export const VisionFaceDetectorPerformanceMode: {} & typeof FirebaseVisionTypes.VisionFaceDetectorPerformanceMode;
|
||||
export const VisionCloudTextRecognizerModelType: {} & typeof FirebaseVisionTypes.VisionCloudTextRecognizerModelType;
|
||||
export const VisionFaceDetectorClassificationMode: {} & typeof FirebaseVisionTypes.VisionFaceDetectorClassificationMode;
|
||||
export const VisionDocumentTextRecognizedBreakType: {} & typeof FirebaseVisionTypes.VisionDocumentTextRecognizedBreakType;
|
||||
export const VisionCloudLandmarkRecognizerModelType: {} & typeof FirebaseVisionTypes.VisionCloudLandmarkRecognizerModelType;
|
||||
|
||||
const module: FirebaseModuleWithStaticsAndApp<
|
||||
FirebaseVisionTypes.Module,
|
||||
FirebaseVisionTypes.Statics
|
||||
>;
|
||||
export default module;
|
||||
}
|
||||
|
||||
@@ -1233,11 +1216,14 @@ declare module '@react-native-firebase/app' {
|
||||
namespace ReactNativeFirebase {
|
||||
import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
|
||||
interface Module {
|
||||
vision: FirebaseModuleWithStaticsAndApp<MLKitVision.Module, MLKitVision.Statics>;
|
||||
vision: FirebaseModuleWithStaticsAndApp<
|
||||
FirebaseVisionTypes.Module,
|
||||
FirebaseVisionTypes.Statics
|
||||
>;
|
||||
}
|
||||
|
||||
interface FirebaseApp {
|
||||
vision(): MLKitVision.Module;
|
||||
vision(): FirebaseVisionTypes.Module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import defaultExport, { firebase as firebaseFromModule } from '@react-native-firebase/ml-vision';
|
||||
import * as vision from '@react-native-firebase/ml-vision';
|
||||
|
||||
// checks module exists at root
|
||||
console.log(firebase.vision().app.name);
|
||||
@@ -11,16 +11,52 @@ console.log(firebase.app().vision().app.name);
|
||||
console.log(firebase.vision.SDK_VERSION);
|
||||
|
||||
// checks statics exist on defaultExport
|
||||
console.log(defaultExport.SDK_VERSION);
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks root exists
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks firebase named export exists on module
|
||||
console.log(firebaseFromModule.SDK_VERSION);
|
||||
console.log(vision.firebase.SDK_VERSION);
|
||||
|
||||
// checks multi-app support exists
|
||||
console.log(firebase.vision(firebase.app()).app.name);
|
||||
|
||||
// checks default export supports app arg
|
||||
console.log(defaultExport(firebase.app()).app.name);
|
||||
console.log(firebase.vision(firebase.app('foo')).app.name);
|
||||
|
||||
console.log(firebase.vision.VisionBarcodeFormat.ALL_POINTS);
|
||||
console.log(vision.VisionBarcodeFormat);
|
||||
|
||||
console.log(firebase.vision.VisionFaceContourType.ALL_POINTS);
|
||||
console.log(vision.VisionFaceContourType.ALL_POINTS);
|
||||
|
||||
console.log(firebase.vision.VisionFaceLandmarkType.LEFT_CHEEK);
|
||||
console.log(vision.VisionFaceLandmarkType.LEFT_EAR);
|
||||
|
||||
console.log(firebase.vision.VisionBarcodeValueType.CALENDAR_EVENT);
|
||||
// console.log(vision.VisionBarcodeValueType.);
|
||||
|
||||
console.log(firebase.vision.VisionFaceDetectorContourMode.ALL_CONTOURS);
|
||||
console.log(vision.VisionFaceDetectorContourMode.ALL_CONTOURS);
|
||||
|
||||
console.log(firebase.vision.VisionFaceDetectorLandmarkMode.ALL_LANDMARKS);
|
||||
console.log(vision.VisionFaceDetectorLandmarkMode.ALL_LANDMARKS);
|
||||
|
||||
console.log(firebase.vision.VisionBarcodeWifiEncryptionType.WEP);
|
||||
// console.log(vision.VisionBarcodeWifiEncryptionType.WEP);
|
||||
|
||||
console.log(firebase.vision.VisionFaceDetectorPerformanceMode.ACCURATE);
|
||||
console.log(vision.VisionFaceDetectorPerformanceMode.FAST);
|
||||
|
||||
console.log(firebase.vision.VisionCloudTextRecognizerModelType.DENSE_MODEL);
|
||||
console.log(vision.VisionCloudTextRecognizerModelType.SPARSE_MODEL);
|
||||
|
||||
console.log(firebase.vision.VisionFaceDetectorClassificationMode.ALL_CLASSIFICATIONS);
|
||||
console.log(vision.VisionFaceDetectorClassificationMode.ALL_CLASSIFICATIONS);
|
||||
|
||||
console.log(firebase.vision.VisionDocumentTextRecognizedBreakType.EOL_SURE_SPACE);
|
||||
console.log(vision.VisionDocumentTextRecognizedBreakType.HYPHEN);
|
||||
|
||||
console.log(firebase.vision.VisionCloudLandmarkRecognizerModelType.LATEST_MODEL);
|
||||
console.log(vision.VisionCloudLandmarkRecognizerModelType.STABLE_MODEL);
|
||||
|
||||
18
packages/perf/lib/index.d.ts
vendored
18
packages/perf/lib/index.d.ts
vendored
@@ -53,7 +53,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
*
|
||||
* @firebase perf
|
||||
*/
|
||||
export namespace Perf {
|
||||
export namespace FirebasePerformanceTypes {
|
||||
/**
|
||||
* Type alias describing the valid HTTP methods accepted when creating a new {@link perf.HttpMetric} instance.
|
||||
*
|
||||
@@ -64,6 +64,10 @@ export namespace Perf {
|
||||
* ```
|
||||
*/
|
||||
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
||||
|
||||
/**
|
||||
* Valid HTTP methods.
|
||||
*/
|
||||
export type HttpMethod =
|
||||
| 'GET'
|
||||
| 'HEAD'
|
||||
@@ -445,7 +449,10 @@ declare module '@react-native-firebase/perf' {
|
||||
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
|
||||
export const firebase = firebaseNamedExport;
|
||||
|
||||
const module: FirebaseModuleWithStatics<Perf.Module, Perf.Statics>;
|
||||
const module: FirebaseModuleWithStatics<
|
||||
FirebasePerformanceTypes.Module,
|
||||
FirebasePerformanceTypes.Statics
|
||||
>;
|
||||
export default module;
|
||||
}
|
||||
|
||||
@@ -456,10 +463,13 @@ declare module '@react-native-firebase/app' {
|
||||
namespace ReactNativeFirebase {
|
||||
import FirebaseModuleWithStatics = ReactNativeFirebase.FirebaseModuleWithStatics;
|
||||
interface Module {
|
||||
perf: FirebaseModuleWithStatics<Perf.Module, Perf.Statics>;
|
||||
perf: FirebaseModuleWithStatics<
|
||||
FirebasePerformanceTypes.Module,
|
||||
FirebasePerformanceTypes.Statics
|
||||
>;
|
||||
}
|
||||
interface FirebaseApp {
|
||||
perf(): Perf.Module;
|
||||
perf(): FirebasePerformanceTypes.Module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import defaultExport, { firebase as firebaseFromModule } from '@react-native-firebase/perf';
|
||||
import * as perf from '@react-native-firebase/perf';
|
||||
|
||||
// checks module exists at root
|
||||
console.log(firebase.perf().app.name);
|
||||
@@ -11,16 +11,39 @@ console.log(firebase.app().perf().app.name);
|
||||
console.log(firebase.perf.SDK_VERSION);
|
||||
|
||||
// checks statics exist on defaultExport
|
||||
console.log(defaultExport.SDK_VERSION);
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks root exists
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks firebase named export exists on module
|
||||
console.log(firebaseFromModule.SDK_VERSION);
|
||||
console.log(perf.firebase.SDK_VERSION);
|
||||
|
||||
// checks multi-app support exists
|
||||
// console.log(firebase.perf(firebase.app()).app.name);
|
||||
|
||||
// checks default export supports app arg
|
||||
// console.log(defaultExport(firebase.app()).app.name);
|
||||
|
||||
console.log(firebase.perf().setPerformanceCollectionEnabled);
|
||||
firebase
|
||||
.perf()
|
||||
.setPerformanceCollectionEnabled(false)
|
||||
.then();
|
||||
|
||||
const trace = firebase.perf().newTrace('foo');
|
||||
trace.putAttribute('foo', 'bar');
|
||||
trace.putMetric('foo', 123);
|
||||
console.log(trace.getAttribute('foo'));
|
||||
console.log(trace.getMetric('foo'));
|
||||
trace.incrementMetric('foo', 2);
|
||||
trace.removeMetric('foo');
|
||||
trace.start().then();
|
||||
trace.stop().then();
|
||||
|
||||
const metric = firebase.perf().newHttpMetric('foo', 'GET');
|
||||
metric.putAttribute('foo', 'bar');
|
||||
metric.setHttpResponseCode(123);
|
||||
metric.setResponseContentType('foo');
|
||||
metric.start().then();
|
||||
metric.stop().then();
|
||||
|
||||
14
packages/remote-config/lib/index.d.ts
vendored
14
packages/remote-config/lib/index.d.ts
vendored
@@ -53,7 +53,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
*
|
||||
* @firebase remote-config
|
||||
*/
|
||||
export namespace RemoteConfig {
|
||||
export namespace FirebaseRemoteConfigTypes {
|
||||
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
||||
|
||||
/**
|
||||
@@ -429,7 +429,10 @@ declare module '@react-native-firebase/remote-config' {
|
||||
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
|
||||
export const firebase = firebaseNamedExport;
|
||||
|
||||
const module: FirebaseModuleWithStatics<RemoteConfig.Module, RemoteConfig.Statics>;
|
||||
const module: FirebaseModuleWithStatics<
|
||||
FirebaseRemoteConfigTypes.Module,
|
||||
FirebaseRemoteConfigTypes.Statics
|
||||
>;
|
||||
export default module;
|
||||
}
|
||||
|
||||
@@ -440,10 +443,13 @@ declare module '@react-native-firebase/app' {
|
||||
namespace ReactNativeFirebase {
|
||||
import FirebaseModuleWithStatics = ReactNativeFirebase.FirebaseModuleWithStatics;
|
||||
interface Module {
|
||||
remoteConfig: FirebaseModuleWithStatics<RemoteConfig.Module, RemoteConfig.Statics>;
|
||||
remoteConfig: FirebaseModuleWithStatics<
|
||||
FirebaseRemoteConfigTypes.Module,
|
||||
FirebaseRemoteConfigTypes.Statics
|
||||
>;
|
||||
}
|
||||
interface FirebaseApp {
|
||||
remoteConfig(): RemoteConfig.Module;
|
||||
remoteConfig(): FirebaseRemoteConfigTypes.Module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import defaultExport, { firebase as firebaseFromModule } from '@react-native-firebase/remote-config';
|
||||
import * as config from '@react-native-firebase/remote-config';
|
||||
|
||||
// checks module exists at root
|
||||
console.log(firebase.remoteConfig().app.name);
|
||||
@@ -11,16 +11,27 @@ console.log(firebase.app().remoteConfig().app.name);
|
||||
console.log(firebase.remoteConfig.SDK_VERSION);
|
||||
|
||||
// checks statics exist on defaultExport
|
||||
console.log(defaultExport.SDK_VERSION);
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks root exists
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks firebase named export exists on module
|
||||
console.log(firebaseFromModule.SDK_VERSION);
|
||||
console.log(config.firebase.SDK_VERSION);
|
||||
|
||||
// checks multi-app support exists
|
||||
// console.log(firebase.config(firebase.app()).app.name);
|
||||
console.log(firebase.remoteConfig().lastFetchStatus);
|
||||
console.log(firebase.remoteConfig().lastFetchTime);
|
||||
|
||||
// checks default export supports app arg
|
||||
// console.log(defaultExport(firebase.app()).app.name);
|
||||
firebase
|
||||
.remoteConfig()
|
||||
.fetch()
|
||||
.then();
|
||||
firebase
|
||||
.remoteConfig()
|
||||
.fetch(123)
|
||||
.then();
|
||||
firebase.remoteConfig().getAll();
|
||||
firebase
|
||||
.remoteConfig()
|
||||
.setConfigSettings({ isDeveloperModeEnabled: true })
|
||||
.then();
|
||||
|
||||
16
packages/storage/lib/index.d.ts
vendored
16
packages/storage/lib/index.d.ts
vendored
@@ -53,7 +53,7 @@ import { ReactNativeFirebase } from '@react-native-firebase/app';
|
||||
*
|
||||
* @firebase storage
|
||||
*/
|
||||
export namespace Storage {
|
||||
export namespace FirebaseStorageTypes {
|
||||
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
||||
import NativeFirebaseError = ReactNativeFirebase.NativeFirebaseError;
|
||||
|
||||
@@ -827,7 +827,7 @@ export namespace Storage {
|
||||
nextOrObserver?: TaskSnapshotObserver | null | ((a: TaskSnapshot) => any),
|
||||
error?: ((a: NativeFirebaseError) => any) | null,
|
||||
complete?: (() => void) | null,
|
||||
): Function;
|
||||
): () => void;
|
||||
|
||||
// /**
|
||||
// * @ignore May not exist in RN JS Environment yet so we'll hide from docs.
|
||||
@@ -1098,7 +1098,10 @@ declare module '@react-native-firebase/storage' {
|
||||
const firebaseNamedExport: {} & ReactNativeFirebaseModule;
|
||||
export const firebase = firebaseNamedExport;
|
||||
|
||||
const module: FirebaseModuleWithStaticsAndApp<Storage.Module, Storage.Statics>;
|
||||
const module: FirebaseModuleWithStaticsAndApp<
|
||||
FirebaseStorageTypes.Module,
|
||||
FirebaseStorageTypes.Statics
|
||||
>;
|
||||
export default module;
|
||||
}
|
||||
|
||||
@@ -1109,10 +1112,13 @@ declare module '@react-native-firebase/app' {
|
||||
namespace ReactNativeFirebase {
|
||||
import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
|
||||
interface Module {
|
||||
storage: FirebaseModuleWithStaticsAndApp<Storage.Module, Storage.Statics>;
|
||||
storage: FirebaseModuleWithStaticsAndApp<
|
||||
FirebaseStorageTypes.Module,
|
||||
FirebaseStorageTypes.Statics
|
||||
>;
|
||||
}
|
||||
interface FirebaseApp {
|
||||
storage(bucket?: string): Storage.Module;
|
||||
storage(bucket?: string): FirebaseStorageTypes.Module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import firebase from '@react-native-firebase/app';
|
||||
import defaultExport, { firebase as firebaseFromModule } from '@react-native-firebase/storage';
|
||||
import * as storage from '@react-native-firebase/storage';
|
||||
|
||||
// checks module exists at root
|
||||
console.log(firebase.storage().app.name);
|
||||
@@ -11,16 +11,67 @@ console.log(firebase.app().storage().app.name);
|
||||
console.log(firebase.storage.SDK_VERSION);
|
||||
|
||||
// checks statics exist on defaultExport
|
||||
console.log(defaultExport.SDK_VERSION);
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks root exists
|
||||
console.log(firebase.SDK_VERSION);
|
||||
|
||||
// checks firebase named export exists on module
|
||||
console.log(firebaseFromModule.SDK_VERSION);
|
||||
console.log(storage.firebase.SDK_VERSION);
|
||||
|
||||
// checks multi-app support exists
|
||||
console.log(firebase.storage(firebase.app()).app.name);
|
||||
|
||||
// checks default export supports app arg
|
||||
console.log(defaultExport(firebase.app()).app.name);
|
||||
console.log(firebase.storage(firebase.app('foo')).app.name);
|
||||
|
||||
console.log(firebase.storage.StringFormat.BASE64);
|
||||
console.log(firebase.storage.TaskState.ERROR);
|
||||
console.log(firebase.storage.TaskEvent.STATE_CHANGED);
|
||||
|
||||
console.log(firebase.storage().maxDownloadRetryTime);
|
||||
console.log(firebase.storage().maxDownloadRetryTime);
|
||||
console.log(firebase.storage().maxOperationRetryTime);
|
||||
|
||||
const ref = firebase.storage().ref('foo');
|
||||
ref
|
||||
.child('foo')
|
||||
.delete()
|
||||
.then();
|
||||
ref.listAll().then(result => {
|
||||
console.log(result.items);
|
||||
console.log(result.nextPageToken);
|
||||
console.log(result.prefixes);
|
||||
console.log(result.items[0].bucket);
|
||||
console.log(result.prefixes[0].parent);
|
||||
});
|
||||
|
||||
const task = firebase
|
||||
.storage()
|
||||
.ref('foo')
|
||||
.putString('foo');
|
||||
task.pause().then();
|
||||
task.resume().then(bool => console.log(bool));
|
||||
task.cancel().then(bool => console.log(bool));
|
||||
task.on(
|
||||
'state_changed',
|
||||
sn => {
|
||||
console.log(sn.bytesTransferred);
|
||||
},
|
||||
error => {
|
||||
console.log(error.message);
|
||||
},
|
||||
() => {},
|
||||
);
|
||||
task.then(
|
||||
ts => {
|
||||
console.log(ts.bytesTransferred);
|
||||
},
|
||||
error => {
|
||||
console.log(error.message);
|
||||
},
|
||||
);
|
||||
|
||||
task.catch(error => {
|
||||
console.log(error.message);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user