[android][ios][js] Detect missing native module rather than using empty function
This commit is contained in:
parent
dcd6321561
commit
a1cff881e1
|
@ -7,5 +7,4 @@ RCT_EXPORT_METHOD(log:(NSString *)message) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -34,7 +34,5 @@ RCT_EXPORT_METHOD(setSessionTimeoutDuration:(nonnull NSNumber *) milliseconds) {
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@implementation RNFirebaseAnalytics
|
@implementation RNFirebaseAnalytics
|
||||||
RCT_EXPORT_MODULE();
|
|
||||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -729,7 +729,5 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail:(NSString *)email resolver:(RCTPromiseR
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@implementation RNFirebaseAuth
|
@implementation RNFirebaseAuth
|
||||||
RCT_EXPORT_MODULE();
|
|
||||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,7 +23,5 @@ RCT_EXPORT_METHOD(report:(NSString *) message) {
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@implementation RNFirebaseCrash
|
@implementation RNFirebaseCrash
|
||||||
RCT_EXPORT_MODULE();
|
|
||||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
|
@ -511,7 +511,5 @@ RCT_EXPORT_METHOD(goOnline) {
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@implementation RNFirebaseDatabase
|
@implementation RNFirebaseDatabase
|
||||||
RCT_EXPORT_MODULE();
|
|
||||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -420,7 +420,5 @@ RCT_EXPORT_METHOD(finishNotificationResponse: (NSString *)completionHandlerId) {
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@implementation RNFirebaseMessaging
|
@implementation RNFirebaseMessaging
|
||||||
RCT_EXPORT_MODULE();
|
|
||||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -49,7 +49,5 @@ RCT_EXPORT_METHOD(incrementCounter:
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@implementation RNFirebasePerformance
|
@implementation RNFirebasePerformance
|
||||||
RCT_EXPORT_MODULE();
|
|
||||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -132,7 +132,5 @@ RCT_EXPORT_METHOD(setDefaultsFromResource:(NSString *)fileName) {
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@implementation RNFirebaseRemoteConfig
|
@implementation RNFirebaseRemoteConfig
|
||||||
RCT_EXPORT_MODULE();
|
|
||||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -450,7 +450,5 @@ RCT_EXPORT_METHOD(putFile:(NSString *) path localPath:(NSString *)localPath meta
|
||||||
|
|
||||||
#else
|
#else
|
||||||
@implementation RNFirebaseStorage
|
@implementation RNFirebaseStorage
|
||||||
RCT_EXPORT_MODULE();
|
|
||||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,13 +8,13 @@ import Banner from './Banner';
|
||||||
import { Base } from './../base';
|
import { Base } from './../base';
|
||||||
|
|
||||||
const FirebaseAdMob = NativeModules.RNFirebaseAdMob;
|
const FirebaseAdMob = NativeModules.RNFirebaseAdMob;
|
||||||
const FirebaseAdMobEvt = new NativeEventEmitter(FirebaseAdMob);
|
const FirebaseAdMobEvt = FirebaseAdMob && new NativeEventEmitter(FirebaseAdMob);
|
||||||
|
|
||||||
export default class Admob extends Base {
|
export default class Admob extends Base {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
if (FirebaseAdMob.nativeSDKMissing) {
|
if (!FirebaseAdMob) {
|
||||||
return nativeSDKMissing('admob');
|
return nativeSDKMissing('admob');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ const ReservedEventNames = [
|
||||||
|
|
||||||
export default class Analytics {
|
export default class Analytics {
|
||||||
constructor() {
|
constructor() {
|
||||||
if (FirebaseAnalytics.nativeSDKMissing) {
|
if (!FirebaseAnalytics) {
|
||||||
return nativeSDKMissing('analytics');
|
return nativeSDKMissing('analytics');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import TwitterAuthProvider from './providers/Twitter';
|
||||||
import GithubAuthProvider from './providers/Github';
|
import GithubAuthProvider from './providers/Github';
|
||||||
|
|
||||||
const FirebaseAuth = NativeModules.RNFirebaseAuth;
|
const FirebaseAuth = NativeModules.RNFirebaseAuth;
|
||||||
const FirebaseAuthEvt = new NativeEventEmitter(FirebaseAuth);
|
const FirebaseAuthEvt = FirebaseAuth && new NativeEventEmitter(FirebaseAuth);
|
||||||
|
|
||||||
export default class Auth extends Base {
|
export default class Auth extends Base {
|
||||||
_user: User | null;
|
_user: User | null;
|
||||||
|
@ -22,7 +22,7 @@ export default class Auth extends Base {
|
||||||
|
|
||||||
constructor(firebase: Object, options: Object = {}) {
|
constructor(firebase: Object, options: Object = {}) {
|
||||||
super(firebase, options);
|
super(firebase, options);
|
||||||
if (FirebaseAuth.nativeSDKMissing) {
|
if (!FirebaseAuth) {
|
||||||
return nativeSDKMissing('auth');
|
return nativeSDKMissing('auth');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ type RemoteConfigOptions = {}
|
||||||
export default class RemoteConfig extends Base {
|
export default class RemoteConfig extends Base {
|
||||||
constructor(firebase: Object, options: RemoteConfigOptions = {}) {
|
constructor(firebase: Object, options: RemoteConfigOptions = {}) {
|
||||||
super(firebase, options);
|
super(firebase, options);
|
||||||
if (FirebaseRemoteConfig.nativeSDKMissing) {
|
if (!FirebaseRemoteConfig) {
|
||||||
return nativeSDKMissing('remote config');
|
return nativeSDKMissing('remote config');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ const FirebaseCrash = NativeModules.RNFirebaseCrash;
|
||||||
|
|
||||||
export default class Crash {
|
export default class Crash {
|
||||||
constructor() {
|
constructor() {
|
||||||
if (FirebaseCrash.nativeSDKMissing) {
|
if (!FirebaseCrash) {
|
||||||
return nativeSDKMissing('crash');
|
return nativeSDKMissing('crash');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import TransactionHandler from './transaction';
|
||||||
import { promisify, nativeSDKMissing } from './../../utils';
|
import { promisify, nativeSDKMissing } from './../../utils';
|
||||||
|
|
||||||
const FirebaseDatabase = NativeModules.RNFirebaseDatabase;
|
const FirebaseDatabase = NativeModules.RNFirebaseDatabase;
|
||||||
const FirebaseDatabaseEvt = new NativeEventEmitter(FirebaseDatabase);
|
const FirebaseDatabaseEvt = FirebaseDatabase && new NativeEventEmitter(FirebaseDatabase);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Database
|
* @class Database
|
||||||
|
@ -19,7 +19,7 @@ const FirebaseDatabaseEvt = new NativeEventEmitter(FirebaseDatabase);
|
||||||
export default class Database extends Base {
|
export default class Database extends Base {
|
||||||
constructor(firebase: Object, options: Object = {}) {
|
constructor(firebase: Object, options: Object = {}) {
|
||||||
super(firebase, options);
|
super(firebase, options);
|
||||||
if (FirebaseDatabase.nativeSDKMissing) {
|
if (!FirebaseDatabase) {
|
||||||
return nativeSDKMissing('database');
|
return nativeSDKMissing('database');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { nativeSDKMissing } from './../../utils';
|
||||||
import RemoteMessage from './RemoteMessage';
|
import RemoteMessage from './RemoteMessage';
|
||||||
|
|
||||||
const FirebaseMessaging = NativeModules.RNFirebaseMessaging;
|
const FirebaseMessaging = NativeModules.RNFirebaseMessaging;
|
||||||
const FirebaseMessagingEvt = new NativeEventEmitter(FirebaseMessaging);
|
const FirebaseMessagingEvt = FirebaseMessaging && new NativeEventEmitter(FirebaseMessaging);
|
||||||
|
|
||||||
const EVENT_TYPE = {
|
const EVENT_TYPE = {
|
||||||
RefreshToken: 'messaging_token_refreshed',
|
RefreshToken: 'messaging_token_refreshed',
|
||||||
|
@ -77,7 +77,7 @@ function finish(data) {
|
||||||
export default class Messaging extends Base {
|
export default class Messaging extends Base {
|
||||||
constructor(firebase, options = {}) {
|
constructor(firebase, options = {}) {
|
||||||
super(firebase, options);
|
super(firebase, options);
|
||||||
if (FirebaseMessaging.nativeSDKMissing) {
|
if (!FirebaseMessaging) {
|
||||||
return nativeSDKMissing('messaging');
|
return nativeSDKMissing('messaging');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ const FirebasePerformance = NativeModules.RNFirebasePerformance;
|
||||||
|
|
||||||
export default class PerformanceMonitoring {
|
export default class PerformanceMonitoring {
|
||||||
constructor() {
|
constructor() {
|
||||||
if (FirebasePerformance.nativeSDKMissing) {
|
if (!FirebasePerformance) {
|
||||||
return nativeSDKMissing('perf');
|
return nativeSDKMissing('perf');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { nativeSDKMissing } from './../../utils';
|
||||||
import StorageRef from './reference';
|
import StorageRef from './reference';
|
||||||
|
|
||||||
const FirebaseStorage = NativeModules.RNFirebaseStorage;
|
const FirebaseStorage = NativeModules.RNFirebaseStorage;
|
||||||
const FirebaseStorageEvt = new NativeEventEmitter(FirebaseStorage);
|
const FirebaseStorageEvt = FirebaseStorage && new NativeEventEmitter(FirebaseStorage);
|
||||||
|
|
||||||
type StorageOptionsType = {
|
type StorageOptionsType = {
|
||||||
storageBucket?: ?string,
|
storageBucket?: ?string,
|
||||||
|
@ -20,7 +20,7 @@ export default class Storage extends Base {
|
||||||
*/
|
*/
|
||||||
constructor(firebase: Object, options: StorageOptionsType = {}) {
|
constructor(firebase: Object, options: StorageOptionsType = {}) {
|
||||||
super(firebase, options);
|
super(firebase, options);
|
||||||
if (FirebaseStorage.nativeSDKMissing) {
|
if (!FirebaseStorage) {
|
||||||
return nativeSDKMissing('storage');
|
return nativeSDKMissing('storage');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,4 +160,3 @@ export const statics = {
|
||||||
FILETYPE_DIRECTORY: FirebaseStorage.FILETYPE_DIRECTORY,
|
FILETYPE_DIRECTORY: FirebaseStorage.FILETYPE_DIRECTORY,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue