[crash][both] Add support for isCrashCollectionEnabled & setCrashCollectionEnabled
This commit is contained in:
parent
400a0ffbe0
commit
4c87131328
|
@ -19,6 +19,15 @@ RCT_EXPORT_METHOD(report:(NSString *) message) {
|
|||
assert(NO);
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(setCrashCollectionEnabled:(BOOL *) enabled) {
|
||||
// Not available yet
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(isCrashCollectionEnabled:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
|
||||
// Not available yet
|
||||
resolve(@YES);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#else
|
||||
|
|
|
@ -11,6 +11,22 @@ export default class Crash {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables/Disables crash reporting
|
||||
* @param enabled
|
||||
*/
|
||||
setCrashCollectionEnabled(enabled: boolean): void {
|
||||
FirebaseCrash.setCrashCollectionEnabled(enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether or not crash reporting is currently enabled
|
||||
* @returns {Promise.<boolean>}
|
||||
*/
|
||||
isCrashCollectionEnabled(): Promise<boolean> {
|
||||
return FirebaseCrash.isCrashCollectionEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a message that will appear in a subsequent crash report.
|
||||
* @param {string} message
|
||||
|
|
|
@ -1,4 +1,25 @@
|
|||
export default function addTests({ describe, it, firebase }) {
|
||||
export default function addTests({ describe, fdescribe, it, firebase }) {
|
||||
|
||||
fdescribe('API', () => {
|
||||
it('it should set collection enabled/disabled', () => {
|
||||
return new Promise((resolve) => {
|
||||
firebase.native.crash().setCrashCollectionEnabled(false);
|
||||
firebase.native.crash().setCrashCollectionEnabled(true);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
it('it should return whether crash reporting is enabled', () => {
|
||||
return new Promise((resolve) => {
|
||||
firebase.native.crash().isCrashCollectionEnabled()
|
||||
.then((enabled) => {
|
||||
enabled.should.be.a.Boolean();
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Log', () => {
|
||||
it('log: it should log without error', () => {
|
||||
return new Promise((resolve) => {
|
||||
|
|
Loading…
Reference in New Issue