[android][ios][js] Detect missing native module rather than using empty function
This commit is contained in:
parent
dcd6321561
commit
a1cff881e1
|
@ -4,8 +4,7 @@
|
|||
RCT_EXPORT_MODULE();
|
||||
|
||||
RCT_EXPORT_METHOD(log:(NSString *)message) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
||||
@end
|
||||
|
|
|
@ -34,7 +34,5 @@ RCT_EXPORT_METHOD(setSessionTimeoutDuration:(nonnull NSNumber *) milliseconds) {
|
|||
|
||||
#else
|
||||
@implementation RNFirebaseAnalytics
|
||||
RCT_EXPORT_MODULE();
|
||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
||||
@end
|
||||
#endif
|
||||
|
|
|
@ -8,7 +8,7 @@ RCT_EXPORT_MODULE();
|
|||
|
||||
/**
|
||||
addAuthStateListener
|
||||
|
||||
|
||||
*/
|
||||
RCT_EXPORT_METHOD(addAuthStateListener) {
|
||||
self->listening = true;
|
||||
|
@ -23,7 +23,7 @@ RCT_EXPORT_METHOD(addAuthStateListener) {
|
|||
|
||||
/**
|
||||
removeAuthStateListener
|
||||
|
||||
|
||||
*/
|
||||
RCT_EXPORT_METHOD(removeAuthStateListener) {
|
||||
if (self->authListenerHandle != nil) {
|
||||
|
@ -34,14 +34,14 @@ RCT_EXPORT_METHOD(removeAuthStateListener) {
|
|||
|
||||
/**
|
||||
signOut
|
||||
|
||||
|
||||
@param RCTPromiseResolveBlock resolve
|
||||
@param RCTPromiseRejectBlock reject
|
||||
@return
|
||||
*/
|
||||
RCT_EXPORT_METHOD(signOut:(RCTPromiseResolveBlock) resolve rejecter:(RCTPromiseRejectBlock) reject) {
|
||||
FIRUser *user = [FIRAuth auth].currentUser;
|
||||
|
||||
|
||||
if (user) {
|
||||
NSError *error;
|
||||
[[FIRAuth auth] signOut:&error];
|
||||
|
@ -55,7 +55,7 @@ RCT_EXPORT_METHOD(signOut:(RCTPromiseResolveBlock) resolve rejecter:(RCTPromiseR
|
|||
|
||||
/**
|
||||
signInAnonymously
|
||||
|
||||
|
||||
@param RCTPromiseResolveBlock resolve
|
||||
@param RCTPromiseRejectBlock reject
|
||||
@return
|
||||
|
@ -68,12 +68,12 @@ RCT_EXPORT_METHOD(signInAnonymously:(RCTPromiseResolveBlock) resolve rejecter:(R
|
|||
[self promiseWithUser:resolve rejecter:reject user:user];
|
||||
}
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
signInWithEmailAndPassword
|
||||
|
||||
|
||||
@param NSString NSString email
|
||||
@param NSString NSString password
|
||||
@param RCTPromiseResolveBlock resolve
|
||||
|
@ -92,7 +92,7 @@ RCT_EXPORT_METHOD(signInWithEmailAndPassword:(NSString *)email pass:(NSString *)
|
|||
|
||||
/**
|
||||
createUserWithEmailAndPassword
|
||||
|
||||
|
||||
@param NSString NSString email
|
||||
@param NSString NSString password
|
||||
@param RCTPromiseResolveBlock resolve
|
||||
|
@ -111,14 +111,14 @@ RCT_EXPORT_METHOD(createUserWithEmailAndPassword:(NSString *)email pass:(NSStrin
|
|||
|
||||
/**
|
||||
deleteUser
|
||||
|
||||
|
||||
@param RCTPromiseResolveBlock resolve
|
||||
@param RCTPromiseRejectBlock reject
|
||||
@return return
|
||||
*/
|
||||
RCT_EXPORT_METHOD(delete:(RCTPromiseResolveBlock) resolve rejecter:(RCTPromiseRejectBlock) reject) {
|
||||
FIRUser *user = [FIRAuth auth].currentUser;
|
||||
|
||||
|
||||
if (user) {
|
||||
[user deleteWithCompletion:^(NSError *_Nullable error) {
|
||||
if (error) {
|
||||
|
@ -134,14 +134,14 @@ RCT_EXPORT_METHOD(delete:(RCTPromiseResolveBlock) resolve rejecter:(RCTPromiseRe
|
|||
|
||||
/**
|
||||
reload
|
||||
|
||||
|
||||
@param RCTPromiseResolveBlock resolve
|
||||
@param RCTPromiseRejectBlock reject
|
||||
@return return
|
||||
*/
|
||||
RCT_EXPORT_METHOD(reload:(RCTPromiseResolveBlock) resolve rejecter:(RCTPromiseRejectBlock) reject) {
|
||||
FIRUser *user = [FIRAuth auth].currentUser;
|
||||
|
||||
|
||||
if (user) {
|
||||
[user reloadWithCompletion:^(NSError *_Nullable error) {
|
||||
if (error) {
|
||||
|
@ -158,14 +158,14 @@ RCT_EXPORT_METHOD(reload:(RCTPromiseResolveBlock) resolve rejecter:(RCTPromiseRe
|
|||
|
||||
/**
|
||||
sendEmailVerification
|
||||
|
||||
|
||||
@param RCTPromiseResolveBlock resolve
|
||||
@param RCTPromiseRejectBlock reject
|
||||
@return return
|
||||
*/
|
||||
RCT_EXPORT_METHOD(sendEmailVerification:(RCTPromiseResolveBlock) resolve rejecter:(RCTPromiseRejectBlock) reject) {
|
||||
FIRUser *user = [FIRAuth auth].currentUser;
|
||||
|
||||
|
||||
if (user) {
|
||||
[user sendEmailVerificationWithCompletion:^(NSError *_Nullable error) {
|
||||
if (error) {
|
||||
|
@ -181,7 +181,7 @@ RCT_EXPORT_METHOD(sendEmailVerification:(RCTPromiseResolveBlock) resolve rejecte
|
|||
|
||||
/**
|
||||
updateEmail
|
||||
|
||||
|
||||
@param NSString email
|
||||
@param RCTPromiseResolveBlock resolve
|
||||
@param RCTPromiseRejectBlock reject
|
||||
|
@ -189,7 +189,7 @@ RCT_EXPORT_METHOD(sendEmailVerification:(RCTPromiseResolveBlock) resolve rejecte
|
|||
*/
|
||||
RCT_EXPORT_METHOD(updateEmail:(NSString *) email resolver:(RCTPromiseResolveBlock) resolve rejecter:(RCTPromiseRejectBlock) reject) {
|
||||
FIRUser *user = [FIRAuth auth].currentUser;
|
||||
|
||||
|
||||
if (user) {
|
||||
[user updateEmail:email completion:^(NSError *_Nullable error) {
|
||||
if (error) {
|
||||
|
@ -206,7 +206,7 @@ RCT_EXPORT_METHOD(updateEmail:(NSString *) email resolver:(RCTPromiseResolveBloc
|
|||
|
||||
/**
|
||||
updatePassword
|
||||
|
||||
|
||||
@param NSString password
|
||||
@param RCTPromiseResolveBlock resolve
|
||||
@param RCTPromiseRejectBlock reject
|
||||
|
@ -214,7 +214,7 @@ RCT_EXPORT_METHOD(updateEmail:(NSString *) email resolver:(RCTPromiseResolveBloc
|
|||
*/
|
||||
RCT_EXPORT_METHOD(updatePassword:(NSString *) password resolver:(RCTPromiseResolveBlock) resolve rejecter:(RCTPromiseRejectBlock) reject) {
|
||||
FIRUser *user = [FIRAuth auth].currentUser;
|
||||
|
||||
|
||||
if (user) {
|
||||
[user updatePassword:password completion:^(NSError *_Nullable error) {
|
||||
if (error) {
|
||||
|
@ -231,7 +231,7 @@ RCT_EXPORT_METHOD(updatePassword:(NSString *) password resolver:(RCTPromiseResol
|
|||
|
||||
/**
|
||||
updateProfile
|
||||
|
||||
|
||||
@param NSDictionary props
|
||||
@param RCTPromiseResolveBlock resolve
|
||||
@param RCTPromiseRejectBlock reject
|
||||
|
@ -239,11 +239,11 @@ RCT_EXPORT_METHOD(updatePassword:(NSString *) password resolver:(RCTPromiseResol
|
|||
*/
|
||||
RCT_EXPORT_METHOD(updateProfile:(NSDictionary *) props resolver:(RCTPromiseResolveBlock) resolve rejecter:(RCTPromiseRejectBlock) reject) {
|
||||
FIRUser *user = [FIRAuth auth].currentUser;
|
||||
|
||||
|
||||
if (user) {
|
||||
FIRUserProfileChangeRequest *changeRequest = [user profileChangeRequest];
|
||||
NSMutableArray *allKeys = [[props allKeys] mutableCopy];
|
||||
|
||||
|
||||
for (NSString *key in allKeys) {
|
||||
@try {
|
||||
if ([key isEqualToString:@"photoURL"]) {
|
||||
|
@ -256,7 +256,7 @@ RCT_EXPORT_METHOD(updateProfile:(NSDictionary *) props resolver:(RCTPromiseResol
|
|||
NSLog(@"Exception occurred while configuring: %@", exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[changeRequest commitChangesWithCompletion:^(NSError *_Nullable error) {
|
||||
if (error) {
|
||||
[self promiseRejectAuthException:reject error:error];
|
||||
|
@ -273,14 +273,14 @@ RCT_EXPORT_METHOD(updateProfile:(NSDictionary *) props resolver:(RCTPromiseResol
|
|||
|
||||
/**
|
||||
getToken
|
||||
|
||||
|
||||
@param RCTPromiseResolveBlock resolve
|
||||
@param RCTPromiseRejectBlock reject
|
||||
@return
|
||||
*/
|
||||
RCT_EXPORT_METHOD(getToken:(BOOL)forceRefresh resolver:(RCTPromiseResolveBlock) resolve rejecter:(RCTPromiseRejectBlock) reject) {
|
||||
FIRUser *user = [FIRAuth auth].currentUser;
|
||||
|
||||
|
||||
if (user) {
|
||||
[user getIDTokenForcingRefresh:(BOOL) forceRefresh completion:^(NSString *token, NSError *_Nullable error) {
|
||||
if (error) {
|
||||
|
@ -296,7 +296,7 @@ RCT_EXPORT_METHOD(getToken:(BOOL)forceRefresh resolver:(RCTPromiseResolveBlock)
|
|||
|
||||
/**
|
||||
signInWithCredential
|
||||
|
||||
|
||||
@param NSString provider
|
||||
@param NSString authToken
|
||||
@param NSString authSecret
|
||||
|
@ -306,11 +306,11 @@ RCT_EXPORT_METHOD(getToken:(BOOL)forceRefresh resolver:(RCTPromiseResolveBlock)
|
|||
*/
|
||||
RCT_EXPORT_METHOD(signInWithCredential:(NSString *)provider token:(NSString *)authToken secret:(NSString *)authSecret resolver:(RCTPromiseResolveBlock) resolve rejecter:(RCTPromiseRejectBlock) reject) {
|
||||
FIRAuthCredential *credential = [self getCredentialForProvider:provider token:authToken secret:authSecret];
|
||||
|
||||
|
||||
if (credential == nil) {
|
||||
return reject(@"auth/invalid-credential", @"The supplied auth credential is malformed, has expired or is not currently supported.", nil);
|
||||
}
|
||||
|
||||
|
||||
[[FIRAuth auth] signInWithCredential:credential completion:^(FIRUser *user, NSError *error) {
|
||||
if (error) {
|
||||
[self promiseRejectAuthException:reject error:error];
|
||||
|
@ -322,7 +322,7 @@ RCT_EXPORT_METHOD(signInWithCredential:(NSString *)provider token:(NSString *)au
|
|||
|
||||
/**
|
||||
sendPasswordResetEmail
|
||||
|
||||
|
||||
@param NSString email
|
||||
@param RCTPromiseResolveBlock resolve
|
||||
@param RCTPromiseRejectBlock reject
|
||||
|
@ -340,7 +340,7 @@ RCT_EXPORT_METHOD(sendPasswordResetEmail:(NSString *)email resolver:(RCTPromiseR
|
|||
|
||||
/**
|
||||
getCurrentUser
|
||||
|
||||
|
||||
@param RCTPromiseResolveBlock resolve
|
||||
@param RCTPromiseRejectBlock reject
|
||||
@return
|
||||
|
@ -353,7 +353,7 @@ RCT_EXPORT_METHOD(getCurrentUser:(RCTPromiseResolveBlock) resolve rejecter:(RCTP
|
|||
|
||||
/**
|
||||
signInWithCustomToken
|
||||
|
||||
|
||||
@param RCTPromiseResolveBlock resolve
|
||||
@param RCTPromiseRejectBlock reject
|
||||
@return
|
||||
|
@ -370,7 +370,7 @@ RCT_EXPORT_METHOD(signInWithCustomToken: (NSString *)customToken resolver:(RCTPr
|
|||
|
||||
/**
|
||||
link - *insert zelda joke here*
|
||||
|
||||
|
||||
@param NSString provider
|
||||
@param NSString authToken
|
||||
@param NSString authSecret
|
||||
|
@ -380,13 +380,13 @@ RCT_EXPORT_METHOD(signInWithCustomToken: (NSString *)customToken resolver:(RCTPr
|
|||
*/
|
||||
RCT_EXPORT_METHOD(link:(NSString *)provider authToken:(NSString *)authToken authSecret:(NSString *)authSecret resolver:(RCTPromiseResolveBlock) resolve rejecter:(RCTPromiseRejectBlock) reject) {
|
||||
FIRAuthCredential *credential = [self getCredentialForProvider:provider token:authToken secret:authSecret];
|
||||
|
||||
|
||||
if (credential == nil) {
|
||||
return reject(@"auth/invalid-credential", @"The supplied auth credential is malformed, has expired or is not currently supported.", nil);
|
||||
}
|
||||
|
||||
|
||||
FIRUser *user = [FIRAuth auth].currentUser;
|
||||
|
||||
|
||||
if (user) {
|
||||
[user linkWithCredential:credential completion:^(FIRUser *_Nullable _user, NSError *_Nullable error) {
|
||||
if (error) {
|
||||
|
@ -402,7 +402,7 @@ RCT_EXPORT_METHOD(link:(NSString *)provider authToken:(NSString *)authToken auth
|
|||
|
||||
/**
|
||||
reauthenticate
|
||||
|
||||
|
||||
@param NSString provider
|
||||
@param NSString authToken
|
||||
@param NSString authSecret
|
||||
|
@ -412,13 +412,13 @@ RCT_EXPORT_METHOD(link:(NSString *)provider authToken:(NSString *)authToken auth
|
|||
*/
|
||||
RCT_EXPORT_METHOD(reauthenticate:(NSString *)provider authToken:(NSString *)authToken authSecret:(NSString *)authSecret resolver:(RCTPromiseResolveBlock) resolve rejecter:(RCTPromiseRejectBlock) reject) {
|
||||
FIRAuthCredential *credential = [self getCredentialForProvider:provider token:authToken secret:authSecret];
|
||||
|
||||
|
||||
if (credential == nil) {
|
||||
return reject(@"auth/invalid-credential", @"The supplied auth credential is malformed, has expired or is not currently supported.", nil);
|
||||
}
|
||||
|
||||
|
||||
FIRUser *user = [FIRAuth auth].currentUser;
|
||||
|
||||
|
||||
if (user) {
|
||||
[user reauthenticateWithCredential:credential completion:^(NSError *_Nullable error) {
|
||||
if (error) {
|
||||
|
@ -456,7 +456,7 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail:(NSString *)email resolver:(RCTPromiseR
|
|||
|
||||
/**
|
||||
getCredentialForProvider
|
||||
|
||||
|
||||
@param provider
|
||||
@param authToken
|
||||
@param authTokenSecret
|
||||
|
@ -464,7 +464,7 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail:(NSString *)email resolver:(RCTPromiseR
|
|||
*/
|
||||
- (FIRAuthCredential *)getCredentialForProvider:(NSString *)provider token:(NSString *)authToken secret:(NSString *)authTokenSecret {
|
||||
FIRAuthCredential *credential;
|
||||
|
||||
|
||||
if ([provider compare:@"twitter" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
|
||||
credential = [FIRTwitterAuthProvider credentialWithToken:authToken secret:authTokenSecret];
|
||||
} else if ([provider compare:@"facebook" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
|
||||
|
@ -478,7 +478,7 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail:(NSString *)email resolver:(RCTPromiseR
|
|||
} else {
|
||||
NSLog(@"Provider not yet handled: %@", provider);
|
||||
}
|
||||
|
||||
|
||||
return credential;
|
||||
}
|
||||
|
||||
|
@ -486,7 +486,7 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail:(NSString *)email resolver:(RCTPromiseR
|
|||
|
||||
/**
|
||||
Resolve or reject a promise based on isError value
|
||||
|
||||
|
||||
@param resolve RCTPromiseResolveBlock
|
||||
@param reject RCTPromiseRejectBlock
|
||||
@param isError BOOL
|
||||
|
@ -501,14 +501,14 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail:(NSString *)email resolver:(RCTPromiseR
|
|||
|
||||
/**
|
||||
Reject a promise with an auth exception
|
||||
|
||||
|
||||
@param reject RCTPromiseRejectBlock
|
||||
@param error NSError
|
||||
*/
|
||||
- (void) promiseRejectAuthException:(RCTPromiseRejectBlock) reject error:(NSError *)error {
|
||||
NSString *code = @"auth/unknown";
|
||||
NSString *message = [error localizedDescription];
|
||||
|
||||
|
||||
switch (error.code) {
|
||||
case FIRAuthErrorCodeInvalidCustomToken:
|
||||
code = @"auth/invalid-custom-token";
|
||||
|
@ -582,7 +582,7 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail:(NSString *)email resolver:(RCTPromiseR
|
|||
code = @"auth/internal-error";
|
||||
message = @"An internal error has occurred, please try again.";
|
||||
break;
|
||||
|
||||
|
||||
// unsure of the below codes so leaving them as the default error message
|
||||
case FIRAuthErrorCodeTooManyRequests:
|
||||
code = @"auth/too-many-requests";
|
||||
|
@ -617,13 +617,13 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail:(NSString *)email resolver:(RCTPromiseR
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
reject(code, message, error);
|
||||
}
|
||||
|
||||
/**
|
||||
Resolve or reject a promise based on FIRUser value existance
|
||||
|
||||
|
||||
@param resolve RCTPromiseResolveBlock
|
||||
@param reject RCTPromiseRejectBlock
|
||||
@param user FIRUser
|
||||
|
@ -635,13 +635,13 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail:(NSString *)email resolver:(RCTPromiseR
|
|||
} else {
|
||||
[self promiseNoUser:resolve rejecter:reject isError:YES];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
wrapper for sendEventWithName for auth events
|
||||
|
||||
|
||||
@param title sendEventWithName
|
||||
@param props <#props description#>
|
||||
*/
|
||||
|
@ -659,45 +659,45 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail:(NSString *)email resolver:(RCTPromiseR
|
|||
|
||||
/**
|
||||
Converts an array of FIRUserInfo instances into the correct format to match the web sdk
|
||||
|
||||
|
||||
@param providerData FIRUser.providerData
|
||||
@return NSArray
|
||||
*/
|
||||
- (NSArray <NSObject *> *) convertProviderData:(NSArray <id<FIRUserInfo>> *) providerData {
|
||||
NSMutableArray *output = [NSMutableArray array];
|
||||
|
||||
|
||||
for (id<FIRUserInfo> userInfo in providerData) {
|
||||
NSMutableDictionary *pData = [NSMutableDictionary dictionary];
|
||||
|
||||
|
||||
if (userInfo.providerID != nil) {
|
||||
[pData setValue: userInfo.providerID forKey:@"providerId"];
|
||||
}
|
||||
|
||||
|
||||
if (userInfo.uid != nil) {
|
||||
[pData setValue: userInfo.uid forKey:@"uid"];
|
||||
}
|
||||
|
||||
|
||||
if (userInfo.displayName != nil) {
|
||||
[pData setValue: userInfo.displayName forKey:@"displayName"];
|
||||
}
|
||||
|
||||
|
||||
if (userInfo.photoURL != nil) {
|
||||
[pData setValue: [userInfo.photoURL absoluteString] forKey:@"photoURL"];
|
||||
}
|
||||
|
||||
|
||||
if (userInfo.email != nil) {
|
||||
[pData setValue: userInfo.email forKey:@"email"];
|
||||
}
|
||||
|
||||
|
||||
[output addObject:pData];
|
||||
}
|
||||
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
Converts a FIRUser instance into a dictionary to send via RNBridge
|
||||
|
||||
|
||||
@param user FIRUser
|
||||
@return NSDictionary
|
||||
*/
|
||||
|
@ -713,11 +713,11 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail:(NSString *)email resolver:(RCTPromiseR
|
|||
@"providerData": [self convertProviderData: user.providerData]
|
||||
} mutableCopy
|
||||
];
|
||||
|
||||
|
||||
if ([user valueForKey:@"photoURL"] != nil) {
|
||||
[userDict setValue: [user.photoURL absoluteString] forKey:@"photoURL"];
|
||||
}
|
||||
|
||||
|
||||
return userDict;
|
||||
}
|
||||
|
||||
|
@ -729,7 +729,5 @@ RCT_EXPORT_METHOD(fetchProvidersForEmail:(NSString *)email resolver:(RCTPromiseR
|
|||
|
||||
#else
|
||||
@implementation RNFirebaseAuth
|
||||
RCT_EXPORT_MODULE();
|
||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
||||
@end
|
||||
#endif
|
||||
|
|
|
@ -23,7 +23,5 @@ RCT_EXPORT_METHOD(report:(NSString *) message) {
|
|||
|
||||
#else
|
||||
@implementation RNFirebaseCrash
|
||||
RCT_EXPORT_MODULE();
|
||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
||||
@end
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -511,7 +511,5 @@ RCT_EXPORT_METHOD(goOnline) {
|
|||
|
||||
#else
|
||||
@implementation RNFirebaseDatabase
|
||||
RCT_EXPORT_MODULE();
|
||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
||||
@end
|
||||
#endif
|
||||
|
|
|
@ -420,7 +420,5 @@ RCT_EXPORT_METHOD(finishNotificationResponse: (NSString *)completionHandlerId) {
|
|||
|
||||
#else
|
||||
@implementation RNFirebaseMessaging
|
||||
RCT_EXPORT_MODULE();
|
||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
||||
@end
|
||||
#endif
|
||||
|
|
|
@ -49,7 +49,5 @@ RCT_EXPORT_METHOD(incrementCounter:
|
|||
|
||||
#else
|
||||
@implementation RNFirebasePerformance
|
||||
RCT_EXPORT_MODULE();
|
||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
||||
@end
|
||||
#endif
|
||||
|
|
|
@ -132,7 +132,5 @@ RCT_EXPORT_METHOD(setDefaultsFromResource:(NSString *)fileName) {
|
|||
|
||||
#else
|
||||
@implementation RNFirebaseRemoteConfig
|
||||
RCT_EXPORT_MODULE();
|
||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
||||
@end
|
||||
#endif
|
||||
|
|
|
@ -16,7 +16,7 @@ RCT_EXPORT_MODULE(RNFirebaseStorage);
|
|||
|
||||
/**
|
||||
Reject a promise with a storage exception
|
||||
|
||||
|
||||
@param reject RCTPromiseRejectBlock
|
||||
@param error NSError
|
||||
*/
|
||||
|
@ -93,7 +93,7 @@ RCT_EXPORT_MODULE(RNFirebaseStorage);
|
|||
|
||||
/**
|
||||
delete
|
||||
|
||||
|
||||
@url https://firebase.google.com/docs/reference/js/firebase.storage.Reference#delete
|
||||
@param NSString path
|
||||
*/
|
||||
|
@ -111,7 +111,7 @@ RCT_EXPORT_METHOD(delete: (NSString *) path resolver:(RCTPromiseResolveBlock)res
|
|||
|
||||
/**
|
||||
getDownloadURL
|
||||
|
||||
|
||||
@url https://firebase.google.com/docs/reference/js/firebase.storage.Reference#getDownloadURL
|
||||
@param NSString path
|
||||
*/
|
||||
|
@ -129,7 +129,7 @@ RCT_EXPORT_METHOD(getDownloadURL: (NSString *) path resolver:(RCTPromiseResolveB
|
|||
|
||||
/**
|
||||
getMetadata
|
||||
|
||||
|
||||
@url https://firebase.google.com/docs/reference/js/firebase.storage.Reference#getMetadata
|
||||
@param NSString path
|
||||
*/
|
||||
|
@ -147,7 +147,7 @@ RCT_EXPORT_METHOD(getMetadata: (NSString *) path resolver:(RCTPromiseResolveBloc
|
|||
|
||||
/**
|
||||
updateMetadata
|
||||
|
||||
|
||||
@url https://firebase.google.com/docs/reference/js/firebase.storage.Reference#updateMetadata
|
||||
@param NSString path
|
||||
@param NSDictionary metadata
|
||||
|
@ -167,7 +167,7 @@ RCT_EXPORT_METHOD(updateMetadata: (NSString *) path metadata:(NSDictionary *) me
|
|||
|
||||
/**
|
||||
downloadFile
|
||||
|
||||
|
||||
@url https://firebase.google.com/docs/reference/js/firebase.storage.Reference#downloadFile
|
||||
@param NSString path
|
||||
@param NSString localPath
|
||||
|
@ -214,7 +214,7 @@ RCT_EXPORT_METHOD(downloadFile: (NSString *) path localPath:(NSString *) localPa
|
|||
|
||||
/**
|
||||
setMaxDownloadRetryTime
|
||||
|
||||
|
||||
@url https://firebase.google.com/docs/reference/js/firebase.storage.Storage#setMaxDownloadRetryTime
|
||||
@param NSNumber milliseconds
|
||||
*/
|
||||
|
@ -224,7 +224,7 @@ RCT_EXPORT_METHOD(setMaxDownloadRetryTime:(NSNumber *) milliseconds) {
|
|||
|
||||
/**
|
||||
setMaxOperationRetryTime
|
||||
|
||||
|
||||
@url https://firebase.google.com/docs/reference/js/firebase.storage.Storage#setMaxOperationRetryTime
|
||||
@param NSNumber milliseconds
|
||||
*/
|
||||
|
@ -234,7 +234,7 @@ RCT_EXPORT_METHOD(setMaxOperationRetryTime:(NSNumber *) milliseconds) {
|
|||
|
||||
/**
|
||||
setMaxUploadRetryTime
|
||||
|
||||
|
||||
@url https://firebase.google.com/docs/reference/js/firebase.storage.Storage#setMaxUploadRetryTime
|
||||
*/
|
||||
RCT_EXPORT_METHOD(setMaxUploadRetryTime:(NSNumber *) milliseconds) {
|
||||
|
@ -243,7 +243,7 @@ RCT_EXPORT_METHOD(setMaxUploadRetryTime:(NSNumber *) milliseconds) {
|
|||
|
||||
/**
|
||||
putFile
|
||||
|
||||
|
||||
@url https://firebase.google.com/docs/reference/js/firebase.storage.Reference#putFile
|
||||
@param NSString path
|
||||
@param NSString localPath
|
||||
|
@ -450,7 +450,5 @@ RCT_EXPORT_METHOD(putFile:(NSString *) path localPath:(NSString *)localPath meta
|
|||
|
||||
#else
|
||||
@implementation RNFirebaseStorage
|
||||
RCT_EXPORT_MODULE();
|
||||
RCT_EXPORT_METHOD(nativeSDKMissing) {}
|
||||
@end
|
||||
#endif
|
||||
|
|
|
@ -8,13 +8,13 @@ import Banner from './Banner';
|
|||
import { Base } from './../base';
|
||||
|
||||
const FirebaseAdMob = NativeModules.RNFirebaseAdMob;
|
||||
const FirebaseAdMobEvt = new NativeEventEmitter(FirebaseAdMob);
|
||||
const FirebaseAdMobEvt = FirebaseAdMob && new NativeEventEmitter(FirebaseAdMob);
|
||||
|
||||
export default class Admob extends Base {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
if (FirebaseAdMob.nativeSDKMissing) {
|
||||
if (!FirebaseAdMob) {
|
||||
return nativeSDKMissing('admob');
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ const ReservedEventNames = [
|
|||
|
||||
export default class Analytics {
|
||||
constructor() {
|
||||
if (FirebaseAnalytics.nativeSDKMissing) {
|
||||
if (!FirebaseAnalytics) {
|
||||
return nativeSDKMissing('analytics');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import TwitterAuthProvider from './providers/Twitter';
|
|||
import GithubAuthProvider from './providers/Github';
|
||||
|
||||
const FirebaseAuth = NativeModules.RNFirebaseAuth;
|
||||
const FirebaseAuthEvt = new NativeEventEmitter(FirebaseAuth);
|
||||
const FirebaseAuthEvt = FirebaseAuth && new NativeEventEmitter(FirebaseAuth);
|
||||
|
||||
export default class Auth extends Base {
|
||||
_user: User | null;
|
||||
|
@ -22,7 +22,7 @@ export default class Auth extends Base {
|
|||
|
||||
constructor(firebase: Object, options: Object = {}) {
|
||||
super(firebase, options);
|
||||
if (FirebaseAuth.nativeSDKMissing) {
|
||||
if (!FirebaseAuth) {
|
||||
return nativeSDKMissing('auth');
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ type RemoteConfigOptions = {}
|
|||
export default class RemoteConfig extends Base {
|
||||
constructor(firebase: Object, options: RemoteConfigOptions = {}) {
|
||||
super(firebase, options);
|
||||
if (FirebaseRemoteConfig.nativeSDKMissing) {
|
||||
if (!FirebaseRemoteConfig) {
|
||||
return nativeSDKMissing('remote config');
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ const FirebaseCrash = NativeModules.RNFirebaseCrash;
|
|||
|
||||
export default class Crash {
|
||||
constructor() {
|
||||
if (FirebaseCrash.nativeSDKMissing) {
|
||||
if (!FirebaseCrash) {
|
||||
return nativeSDKMissing('crash');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import TransactionHandler from './transaction';
|
|||
import { promisify, nativeSDKMissing } from './../../utils';
|
||||
|
||||
const FirebaseDatabase = NativeModules.RNFirebaseDatabase;
|
||||
const FirebaseDatabaseEvt = new NativeEventEmitter(FirebaseDatabase);
|
||||
const FirebaseDatabaseEvt = FirebaseDatabase && new NativeEventEmitter(FirebaseDatabase);
|
||||
|
||||
/**
|
||||
* @class Database
|
||||
|
@ -19,7 +19,7 @@ const FirebaseDatabaseEvt = new NativeEventEmitter(FirebaseDatabase);
|
|||
export default class Database extends Base {
|
||||
constructor(firebase: Object, options: Object = {}) {
|
||||
super(firebase, options);
|
||||
if (FirebaseDatabase.nativeSDKMissing) {
|
||||
if (!FirebaseDatabase) {
|
||||
return nativeSDKMissing('database');
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import { nativeSDKMissing } from './../../utils';
|
|||
import RemoteMessage from './RemoteMessage';
|
||||
|
||||
const FirebaseMessaging = NativeModules.RNFirebaseMessaging;
|
||||
const FirebaseMessagingEvt = new NativeEventEmitter(FirebaseMessaging);
|
||||
const FirebaseMessagingEvt = FirebaseMessaging && new NativeEventEmitter(FirebaseMessaging);
|
||||
|
||||
const EVENT_TYPE = {
|
||||
RefreshToken: 'messaging_token_refreshed',
|
||||
|
@ -77,7 +77,7 @@ function finish(data) {
|
|||
export default class Messaging extends Base {
|
||||
constructor(firebase, options = {}) {
|
||||
super(firebase, options);
|
||||
if (FirebaseMessaging.nativeSDKMissing) {
|
||||
if (!FirebaseMessaging) {
|
||||
return nativeSDKMissing('messaging');
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ const FirebasePerformance = NativeModules.RNFirebasePerformance;
|
|||
|
||||
export default class PerformanceMonitoring {
|
||||
constructor() {
|
||||
if (FirebasePerformance.nativeSDKMissing) {
|
||||
if (!FirebasePerformance) {
|
||||
return nativeSDKMissing('perf');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import { nativeSDKMissing } from './../../utils';
|
|||
import StorageRef from './reference';
|
||||
|
||||
const FirebaseStorage = NativeModules.RNFirebaseStorage;
|
||||
const FirebaseStorageEvt = new NativeEventEmitter(FirebaseStorage);
|
||||
const FirebaseStorageEvt = FirebaseStorage && new NativeEventEmitter(FirebaseStorage);
|
||||
|
||||
type StorageOptionsType = {
|
||||
storageBucket?: ?string,
|
||||
|
@ -20,7 +20,7 @@ export default class Storage extends Base {
|
|||
*/
|
||||
constructor(firebase: Object, options: StorageOptionsType = {}) {
|
||||
super(firebase, options);
|
||||
if (FirebaseStorage.nativeSDKMissing) {
|
||||
if (!FirebaseStorage) {
|
||||
return nativeSDKMissing('storage');
|
||||
}
|
||||
|
||||
|
@ -160,4 +160,3 @@ export const statics = {
|
|||
FILETYPE_DIRECTORY: FirebaseStorage.FILETYPE_DIRECTORY,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue