[crashlytics] Move to top level crashlytics namespace
This commit is contained in:
parent
90d35ef6e9
commit
b21e7d0eab
8
lib/index.d.ts
vendored
8
lib/index.d.ts
vendored
@ -25,10 +25,8 @@ declare module "react-native-firebase" {
|
|||||||
auth: FirebaseModuleAndStatics<RNFirebase.auth.Auth, RNFirebase.auth.AuthStatics>;
|
auth: FirebaseModuleAndStatics<RNFirebase.auth.Auth, RNFirebase.auth.AuthStatics>;
|
||||||
// config: FirebaseModule<RNFirebase.config.Config>;
|
// config: FirebaseModule<RNFirebase.config.Config>;
|
||||||
crash: FirebaseModuleAndStatics<RNFirebase.crash.Crash>;
|
crash: FirebaseModuleAndStatics<RNFirebase.crash.Crash>;
|
||||||
|
crashlytics: FirebaseModuleAndStatics<RNFirebase.crashlytics.Crashlytics>;
|
||||||
database: FirebaseModuleAndStatics<RNFirebase.database.Database, RNFirebase.database.DatabaseStatics>;
|
database: FirebaseModuleAndStatics<RNFirebase.database.Database, RNFirebase.database.DatabaseStatics>;
|
||||||
fabric: {
|
|
||||||
crashlytics: FirebaseModuleAndStatics<RNFirebase.crashlytics.Crashlytics>;
|
|
||||||
};
|
|
||||||
firestore: FirebaseModuleAndStatics<RNFirebase.firestore.Firestore, RNFirebase.firestore.FirestoreStatics>;
|
firestore: FirebaseModuleAndStatics<RNFirebase.firestore.Firestore, RNFirebase.firestore.FirestoreStatics>;
|
||||||
iid: FirebaseModuleAndStatics<RNFirebase.iid.InstanceId>
|
iid: FirebaseModuleAndStatics<RNFirebase.iid.InstanceId>
|
||||||
// invites: FirebaseModuleAndStatics<RNFirebase.invites.Invites>
|
// invites: FirebaseModuleAndStatics<RNFirebase.invites.Invites>
|
||||||
@ -64,10 +62,8 @@ declare module "react-native-firebase" {
|
|||||||
auth(): RNFirebase.auth.Auth;
|
auth(): RNFirebase.auth.Auth;
|
||||||
// config(): RNFirebase.config.Config;
|
// config(): RNFirebase.config.Config;
|
||||||
crash(): RNFirebase.crash.Crash;
|
crash(): RNFirebase.crash.Crash;
|
||||||
|
crashlytics(): RNFirebase.crashlytics.Crashlytics;
|
||||||
database(): RNFirebase.database.Database;
|
database(): RNFirebase.database.Database;
|
||||||
fabric: {
|
|
||||||
crashlytics(): RNFirebase.crashlytics.Crashlytics,
|
|
||||||
};
|
|
||||||
firestore(): RNFirebase.firestore.Firestore;
|
firestore(): RNFirebase.firestore.Firestore;
|
||||||
iid(): RNFirebase.iid.InstanceId;
|
iid(): RNFirebase.iid.InstanceId;
|
||||||
// invites(): RNFirebase.invites.Invites;
|
// invites(): RNFirebase.invites.Invites;
|
||||||
|
@ -13,9 +13,7 @@ import Auth, { NAMESPACE as AuthNamespace } from '../auth';
|
|||||||
import Analytics, { NAMESPACE as AnalyticsNamespace } from '../analytics';
|
import Analytics, { NAMESPACE as AnalyticsNamespace } from '../analytics';
|
||||||
import Config, { NAMESPACE as ConfigNamespace } from '../config';
|
import Config, { NAMESPACE as ConfigNamespace } from '../config';
|
||||||
import Crash, { NAMESPACE as CrashNamespace } from '../crash';
|
import Crash, { NAMESPACE as CrashNamespace } from '../crash';
|
||||||
import Crashlytics, {
|
import Crashlytics, { NAMESPACE as CrashlyticsNamespace } from '../crashlytics';
|
||||||
NAMESPACE as CrashlyticsNamespace,
|
|
||||||
} from '../fabric/crashlytics';
|
|
||||||
import Database, { NAMESPACE as DatabaseNamespace } from '../database';
|
import Database, { NAMESPACE as DatabaseNamespace } from '../database';
|
||||||
import Firestore, { NAMESPACE as FirestoreNamespace } from '../firestore';
|
import Firestore, { NAMESPACE as FirestoreNamespace } from '../firestore';
|
||||||
import InstanceId, { NAMESPACE as InstanceIdNamespace } from '../iid';
|
import InstanceId, { NAMESPACE as InstanceIdNamespace } from '../iid';
|
||||||
@ -44,10 +42,8 @@ export default class App {
|
|||||||
auth: () => Auth;
|
auth: () => Auth;
|
||||||
config: () => Config;
|
config: () => Config;
|
||||||
crash: () => Crash;
|
crash: () => Crash;
|
||||||
|
crashlytics: () => Crashlytics;
|
||||||
database: () => Database;
|
database: () => Database;
|
||||||
fabric: {
|
|
||||||
crashlytics: () => Crashlytics,
|
|
||||||
};
|
|
||||||
firestore: () => Firestore;
|
firestore: () => Firestore;
|
||||||
iid: () => InstanceId;
|
iid: () => InstanceId;
|
||||||
invites: () => Invites;
|
invites: () => Invites;
|
||||||
@ -86,10 +82,8 @@ export default class App {
|
|||||||
this.auth = APPS.appModule(this, AuthNamespace, Auth);
|
this.auth = APPS.appModule(this, AuthNamespace, Auth);
|
||||||
this.config = APPS.appModule(this, ConfigNamespace, Config);
|
this.config = APPS.appModule(this, ConfigNamespace, Config);
|
||||||
this.crash = APPS.appModule(this, CrashNamespace, Crash);
|
this.crash = APPS.appModule(this, CrashNamespace, Crash);
|
||||||
|
this.crashlytics = APPS.appModule(this, CrashlyticsNamespace, Crashlytics);
|
||||||
this.database = APPS.appModule(this, DatabaseNamespace, Database);
|
this.database = APPS.appModule(this, DatabaseNamespace, Database);
|
||||||
this.fabric = {
|
|
||||||
crashlytics: APPS.appModule(this, CrashlyticsNamespace, Crashlytics),
|
|
||||||
};
|
|
||||||
this.firestore = APPS.appModule(this, FirestoreNamespace, Firestore);
|
this.firestore = APPS.appModule(this, FirestoreNamespace, Firestore);
|
||||||
this.iid = APPS.appModule(this, InstanceIdNamespace, InstanceId);
|
this.iid = APPS.appModule(this, InstanceIdNamespace, InstanceId);
|
||||||
this.invites = APPS.appModule(this, InvitesNamespace, Invites);
|
this.invites = APPS.appModule(this, InvitesNamespace, Invites);
|
||||||
|
@ -29,7 +29,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
statics as CrashlyticsStatics,
|
statics as CrashlyticsStatics,
|
||||||
MODULE_NAME as CrashlyticsModuleName,
|
MODULE_NAME as CrashlyticsModuleName,
|
||||||
} from '../fabric/crashlytics';
|
} from '../crashlytics';
|
||||||
import {
|
import {
|
||||||
statics as DatabaseStatics,
|
statics as DatabaseStatics,
|
||||||
MODULE_NAME as DatabaseModuleName,
|
MODULE_NAME as DatabaseModuleName,
|
||||||
@ -77,8 +77,8 @@ import type {
|
|||||||
AuthModule,
|
AuthModule,
|
||||||
ConfigModule,
|
ConfigModule,
|
||||||
CrashModule,
|
CrashModule,
|
||||||
|
CrashlyticsModule,
|
||||||
DatabaseModule,
|
DatabaseModule,
|
||||||
FabricModule,
|
|
||||||
FirebaseOptions,
|
FirebaseOptions,
|
||||||
FirestoreModule,
|
FirestoreModule,
|
||||||
InstanceIdModule,
|
InstanceIdModule,
|
||||||
@ -99,8 +99,8 @@ class Firebase {
|
|||||||
auth: AuthModule;
|
auth: AuthModule;
|
||||||
config: ConfigModule;
|
config: ConfigModule;
|
||||||
crash: CrashModule;
|
crash: CrashModule;
|
||||||
|
crashlytics: CrashlyticsModule;
|
||||||
database: DatabaseModule;
|
database: DatabaseModule;
|
||||||
fabric: FabricModule;
|
|
||||||
firestore: FirestoreModule;
|
firestore: FirestoreModule;
|
||||||
iid: InstanceIdModule;
|
iid: InstanceIdModule;
|
||||||
invites: InvitesModule;
|
invites: InvitesModule;
|
||||||
@ -131,18 +131,16 @@ class Firebase {
|
|||||||
ConfigModuleName
|
ConfigModuleName
|
||||||
);
|
);
|
||||||
this.crash = APPS.moduleAndStatics('crash', CrashStatics, CrashModuleName);
|
this.crash = APPS.moduleAndStatics('crash', CrashStatics, CrashModuleName);
|
||||||
|
this.crashlytics = APPS.moduleAndStatics(
|
||||||
|
'crashlytics',
|
||||||
|
CrashlyticsStatics,
|
||||||
|
CrashlyticsModuleName
|
||||||
|
);
|
||||||
this.database = APPS.moduleAndStatics(
|
this.database = APPS.moduleAndStatics(
|
||||||
'database',
|
'database',
|
||||||
DatabaseStatics,
|
DatabaseStatics,
|
||||||
DatabaseModuleName
|
DatabaseModuleName
|
||||||
);
|
);
|
||||||
this.fabric = {
|
|
||||||
crashlytics: APPS.moduleAndStatics(
|
|
||||||
'crashlytics',
|
|
||||||
CrashlyticsStatics,
|
|
||||||
CrashlyticsModuleName
|
|
||||||
),
|
|
||||||
};
|
|
||||||
this.firestore = APPS.moduleAndStatics(
|
this.firestore = APPS.moduleAndStatics(
|
||||||
'firestore',
|
'firestore',
|
||||||
FirestoreStatics,
|
FirestoreStatics,
|
||||||
|
@ -19,6 +19,9 @@ export default class Crash extends ModuleBase {
|
|||||||
hasShards: false,
|
hasShards: false,
|
||||||
namespace: NAMESPACE,
|
namespace: NAMESPACE,
|
||||||
});
|
});
|
||||||
|
console.warn(
|
||||||
|
'Crash Reporting is deprecated, consider switching to Crashlytics which is now the primary crash reporter for Firebase.'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
* @flow
|
* @flow
|
||||||
* Crash Reporting representation wrapper
|
* Crash Reporting representation wrapper
|
||||||
*/
|
*/
|
||||||
import ModuleBase from '../../../utils/ModuleBase';
|
import ModuleBase from '../../utils/ModuleBase';
|
||||||
import { getNativeModule } from '../../../utils/native';
|
import { getNativeModule } from '../../utils/native';
|
||||||
|
|
||||||
import type App from '../../core/app';
|
import type App from '../core/app';
|
||||||
|
|
||||||
export const MODULE_NAME = 'RNFirebaseCrashlytics';
|
export const MODULE_NAME = 'RNFirebaseCrashlytics';
|
||||||
export const NAMESPACE = 'crashlytics';
|
export const NAMESPACE = 'crashlytics';
|
@ -9,8 +9,8 @@ import type Config from '../modules/config';
|
|||||||
import { typeof statics as ConfigStatics } from '../modules/config';
|
import { typeof statics as ConfigStatics } from '../modules/config';
|
||||||
import type Crash from '../modules/crash';
|
import type Crash from '../modules/crash';
|
||||||
import { typeof statics as CrashStatics } from '../modules/crash';
|
import { typeof statics as CrashStatics } from '../modules/crash';
|
||||||
import type Crashlytics from '../modules/fabric/crashlytics';
|
import type Crashlytics from '../modules/crashlytics';
|
||||||
import { typeof statics as CrashlyticsStatics } from '../modules/fabric/crashlytics';
|
import { typeof statics as CrashlyticsStatics } from '../modules/crashlytics';
|
||||||
import type Database from '../modules/database';
|
import type Database from '../modules/database';
|
||||||
import { typeof statics as DatabaseStatics } from '../modules/database';
|
import { typeof statics as DatabaseStatics } from '../modules/database';
|
||||||
import type Firestore from '../modules/firestore';
|
import type Firestore from '../modules/firestore';
|
||||||
@ -141,6 +141,12 @@ export type CrashModule = {
|
|||||||
nativeModuleExists: boolean,
|
nativeModuleExists: boolean,
|
||||||
} & CrashStatics;
|
} & CrashStatics;
|
||||||
|
|
||||||
|
/* Crashlytics types */
|
||||||
|
export type CrashlyticsModule = {
|
||||||
|
(): Crashlytics,
|
||||||
|
nativeModuleExists: boolean,
|
||||||
|
} & CrashlyticsStatics;
|
||||||
|
|
||||||
/* Database types */
|
/* Database types */
|
||||||
|
|
||||||
export type DatabaseModule = {
|
export type DatabaseModule = {
|
||||||
@ -158,16 +164,6 @@ export type DatabaseModifier = {
|
|||||||
valueType?: string,
|
valueType?: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Fabric types */
|
|
||||||
export type CrashlyticsModule = {
|
|
||||||
(): Crashlytics,
|
|
||||||
nativeModuleExists: boolean,
|
|
||||||
} & CrashlyticsStatics;
|
|
||||||
|
|
||||||
export type FabricModule = {
|
|
||||||
crashlytics: CrashlyticsModule,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Firestore types */
|
/* Firestore types */
|
||||||
|
|
||||||
export type FirestoreModule = {
|
export type FirestoreModule = {
|
||||||
|
@ -188,9 +188,6 @@ export default {
|
|||||||
// default to the 'DEFAULT' app if no arg provided - will throw an error
|
// default to the 'DEFAULT' app if no arg provided - will throw an error
|
||||||
// if default app not initialized
|
// if default app not initialized
|
||||||
_app = this.app(DEFAULT_APP_NAME);
|
_app = this.app(DEFAULT_APP_NAME);
|
||||||
if (namespace === 'crashlytics') {
|
|
||||||
return _app.fabric[namespace]();
|
|
||||||
}
|
|
||||||
// $FlowExpectedError: Flow doesn't support indexable signatures on classes: https://github.com/facebook/flow/issues/1323
|
// $FlowExpectedError: Flow doesn't support indexable signatures on classes: https://github.com/facebook/flow/issues/1323
|
||||||
const module = _app[namespace];
|
const module = _app[namespace];
|
||||||
return module(_serviceUrl);
|
return module(_serviceUrl);
|
||||||
|
@ -2,45 +2,43 @@ export default function addTests({ describe, it, firebase }) {
|
|||||||
describe('Crashlytics', () => {
|
describe('Crashlytics', () => {
|
||||||
it('log: it should log without error', () =>
|
it('log: it should log without error', () =>
|
||||||
new Promise(resolve => {
|
new Promise(resolve => {
|
||||||
firebase.native.fabric.crashlytics().log('Test log');
|
firebase.native.crashlytics().log('Test log');
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('recordError: it should record an error without error', () =>
|
it('recordError: it should record an error without error', () =>
|
||||||
new Promise(resolve => {
|
new Promise(resolve => {
|
||||||
firebase.native.fabric.crashlytics().recordError(1234, 'Test error');
|
firebase.native.crashlytics().recordError(1234, 'Test error');
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('setBoolValue: it should set a boolean value without error', () =>
|
it('setBoolValue: it should set a boolean value without error', () =>
|
||||||
new Promise(resolve => {
|
new Promise(resolve => {
|
||||||
firebase.native.fabric.crashlytics().setBoolValue('boolKey', true);
|
firebase.native.crashlytics().setBoolValue('boolKey', true);
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('setFloatValue: it should set a float value without error', () =>
|
it('setFloatValue: it should set a float value without error', () =>
|
||||||
new Promise(resolve => {
|
new Promise(resolve => {
|
||||||
firebase.native.fabric.crashlytics().setFloatValue('floatKey', 1.23);
|
firebase.native.crashlytics().setFloatValue('floatKey', 1.23);
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('setIntValue: it should set an integer value without error', () =>
|
it('setIntValue: it should set an integer value without error', () =>
|
||||||
new Promise(resolve => {
|
new Promise(resolve => {
|
||||||
firebase.native.fabric.crashlytics().setIntValue('intKey', 123);
|
firebase.native.crashlytics().setIntValue('intKey', 123);
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('setStringValue: it should set a string value without error', () =>
|
it('setStringValue: it should set a string value without error', () =>
|
||||||
new Promise(resolve => {
|
new Promise(resolve => {
|
||||||
firebase.native.fabric
|
firebase.native.crashlytics().setStringValue('stringKey', 'test');
|
||||||
.crashlytics()
|
|
||||||
.setStringValue('stringKey', 'test');
|
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('setUserIdentifier: it should set the user ID without error', () =>
|
it('setUserIdentifier: it should set the user ID without error', () =>
|
||||||
new Promise(resolve => {
|
new Promise(resolve => {
|
||||||
firebase.native.fabric.crashlytics().setUserIdentifier('1234');
|
firebase.native.crashlytics().setUserIdentifier('1234');
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -2,11 +2,7 @@ import firebase from '../../firebase';
|
|||||||
import TestSuite from '../../../lib/TestSuite';
|
import TestSuite from '../../../lib/TestSuite';
|
||||||
import crashlyticsTests from './crashlyticsTests';
|
import crashlyticsTests from './crashlyticsTests';
|
||||||
|
|
||||||
const suite = new TestSuite(
|
const suite = new TestSuite('Crashlytics', 'firebase.crashlytics()', firebase);
|
||||||
'Crashlytics',
|
|
||||||
'firebase.fabric.crashlytics()',
|
|
||||||
firebase
|
|
||||||
);
|
|
||||||
|
|
||||||
// bootstrap tests
|
// bootstrap tests
|
||||||
suite.addTests(crashlyticsTests);
|
suite.addTests(crashlyticsTests);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user