diff --git a/README.md b/README.md
index 6c656b44..be579985 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
-
- 
+
+ 
-
React Native Firebase
+ React Native Firebase
diff --git a/android/build.gradle b/android/build.gradle
index 6cf3b4d7..5ae2e217 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -104,12 +104,12 @@ dependencies {
compileOnly "com.google.firebase:firebase-auth:16.0.3"
compileOnly "com.google.firebase:firebase-config:16.0.0"
compileOnly "com.google.firebase:firebase-crash:16.2.0"
- compileOnly "com.google.firebase:firebase-database:16.0.1"
+ compileOnly "com.google.firebase:firebase-database:16.0.2"
compileOnly "com.google.firebase:firebase-firestore:17.1.0"
compileOnly "com.google.firebase:firebase-functions:16.1.0"
compileOnly "com.google.firebase:firebase-invites:16.0.3"
- compileOnly "com.google.firebase:firebase-storage:16.0.1"
- compileOnly "com.google.firebase:firebase-messaging:17.3.0"
+ compileOnly "com.google.firebase:firebase-storage:16.0.2"
+ compileOnly "com.google.firebase:firebase-messaging:17.3.2"
compileOnly "com.google.firebase:firebase-perf:16.1.0"
compileOnly 'me.leolin:ShortcutBadger:1.1.21@aar'
}
diff --git a/android/src/main/java/io/invertase/firebase/Utils.java b/android/src/main/java/io/invertase/firebase/Utils.java
index 78373bb2..f71eebcc 100644
--- a/android/src/main/java/io/invertase/firebase/Utils.java
+++ b/android/src/main/java/io/invertase/firebase/Utils.java
@@ -152,7 +152,15 @@ public class Utils {
appProcess.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND
&& appProcess.processName.equals(packageName)
) {
- ReactContext reactContext = (ReactContext) context;
+ ReactContext reactContext;
+
+ try {
+ reactContext = (ReactContext) context;
+ } catch(ClassCastException exception) {
+ // Not react context so default to true
+ return true;
+ }
+
return reactContext.getLifecycleState() == LifecycleState.RESUMED;
}
}
diff --git a/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java b/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java
index a3f7af72..712c6bd9 100644
--- a/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java
+++ b/android/src/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java
@@ -222,16 +222,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
}
@ReactMethod
- public void signInAnonymously(String appName, final Promise promise) {
- signInAnonymously(appName, promise, false);
- }
-
- @ReactMethod
- public void signInAnonymouslyAndRetrieveData(String appName, final Promise promise) {
- signInAnonymously(appName, promise, true);
- }
-
- private void signInAnonymously(String appName, final Promise promise, final boolean withData) {
+ private void signInAnonymously(String appName, final Promise promise) {
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp);
@@ -242,11 +233,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
@Override
public void onSuccess(AuthResult authResult) {
Log.d(TAG, "signInAnonymously:onComplete:success");
- if (withData) {
- promiseWithAuthResult(authResult, promise);
- } else {
- promiseWithUser(authResult.getUser(), promise);
- }
+ promiseWithAuthResult(authResult, promise);
}
})
.addOnFailureListener(new OnFailureListener() {
@@ -266,31 +253,11 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
* @param promise
*/
@ReactMethod
- public void createUserWithEmailAndPassword(
- String appName,
- final String email,
- final String password,
- final Promise promise
- ) {
- createUserWithEmailAndPassword(appName, email, password, promise, false);
- }
-
- @ReactMethod
- public void createUserAndRetrieveDataWithEmailAndPassword(
- String appName,
- final String email,
- final String password,
- final Promise promise
- ) {
- createUserWithEmailAndPassword(appName, email, password, promise, true);
- }
-
private void createUserWithEmailAndPassword(
String appName,
final String email,
final String password,
- final Promise promise,
- final boolean withData
+ final Promise promise
) {
Log.d(TAG, "createUserWithEmailAndPassword");
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
@@ -302,11 +269,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
@Override
public void onSuccess(AuthResult authResult) {
Log.d(TAG, "createUserWithEmailAndPassword:onComplete:success");
- if (withData) {
- promiseWithAuthResult(authResult, promise);
- } else {
- promiseWithUser(authResult.getUser(), promise);
- }
+ promiseWithAuthResult(authResult, promise);
}
})
.addOnFailureListener(new OnFailureListener() {
@@ -326,31 +289,11 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
* @param promise
*/
@ReactMethod
- public void signInWithEmailAndPassword(
- String appName,
- final String email,
- final String password,
- final Promise promise
- ) {
- signInWithEmailAndPassword(appName, email, password, promise, false);
- }
-
- @ReactMethod
- public void signInAndRetrieveDataWithEmailAndPassword(
- String appName,
- final String email,
- final String password,
- final Promise promise
- ) {
- signInWithEmailAndPassword(appName, email, password, promise, true);
- }
-
private void signInWithEmailAndPassword(
String appName,
final String email,
final String password,
- final Promise promise,
- final boolean withData
+ final Promise promise
) {
Log.d(TAG, "signInWithEmailAndPassword");
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
@@ -362,11 +305,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
@Override
public void onSuccess(AuthResult authResult) {
Log.d(TAG, "signInWithEmailAndPassword:onComplete:success");
- if (withData) {
- promiseWithAuthResult(authResult, promise);
- } else {
- promiseWithUser(authResult.getUser(), promise);
- }
+ promiseWithAuthResult(authResult, promise);
}
})
.addOnFailureListener(new OnFailureListener() {
@@ -415,27 +354,11 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
});
}
-
@ReactMethod
- public void signInWithCustomToken(String appName, final String token, final Promise promise) {
- signInWithCustomToken(appName, token, promise, false);
- }
-
-
- @ReactMethod
- public void signInAndRetrieveDataWithCustomToken(
- String appName,
- final String token,
- final Promise promise
- ) {
- signInWithCustomToken(appName, token, promise, true);
- }
-
private void signInWithCustomToken(
String appName,
final String token,
- final Promise promise,
- final boolean withData
+ final Promise promise
) {
Log.d(TAG, "signInWithCustomToken");
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
@@ -447,11 +370,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
@Override
public void onSuccess(AuthResult authResult) {
Log.d(TAG, "signInWithCustomToken:onComplete:success");
- if (withData) {
- promiseWithAuthResult(authResult, promise);
- } else {
- promiseWithUser(authResult.getUser(), promise);
- }
+ promiseWithAuthResult(authResult, promise);
}
})
.addOnFailureListener(new OnFailureListener() {
@@ -847,34 +766,12 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
}
@ReactMethod
- public void signInWithCredential(
- String appName,
- String provider,
- String authToken,
- String authSecret,
- final Promise promise
- ) {
- signInWithCredential(appName, provider, authToken, authSecret, promise, false);
- }
-
- @ReactMethod
- public void signInAndRetrieveDataWithCredential(
- String appName,
- String provider,
- String authToken,
- String authSecret,
- final Promise promise
- ) {
- signInWithCredential(appName, provider, authToken, authSecret, promise, true);
- }
-
private void signInWithCredential(
String appName,
String provider,
String authToken,
String authSecret,
- final Promise promise,
- final boolean withData
+ final Promise promise
) {
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp);
@@ -895,16 +792,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
public void onComplete(@NonNull Task task) {
if (task.isSuccessful()) {
Log.d(TAG, "signInWithCredential:onComplete:success");
- if (withData) {
- promiseWithAuthResult(task.getResult(), promise);
- } else {
- promiseWithUser(
- task
- .getResult()
- .getUser(),
- promise
- );
- }
+ promiseWithAuthResult(task.getResult(), promise);
} else {
Exception exception = task.getException();
Log.e(TAG, "signInWithCredential:onComplete:failure", exception);
@@ -1358,34 +1246,12 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
* @param promise
*/
@ReactMethod
- public void linkWithCredential(
+ private void linkWithCredential(
String appName,
String provider,
String authToken,
String authSecret,
final Promise promise
- ) {
- link(appName, provider, authToken, authSecret, promise, false);
- }
-
- @ReactMethod
- public void linkAndRetrieveDataWithCredential(
- String appName,
- String provider,
- String authToken,
- String authSecret,
- final Promise promise
- ) {
- link(appName, provider, authToken, authSecret, promise, true);
- }
-
- private void link(
- String appName,
- String provider,
- String authToken,
- String authSecret,
- final Promise promise,
- final boolean withData
) {
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp);
@@ -1409,13 +1275,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
public void onComplete(@NonNull Task task) {
if (task.isSuccessful()) {
Log.d(TAG, "link:onComplete:success");
- if (withData) {
- promiseWithAuthResult(task.getResult(), promise);
- } else {
- promiseWithUser(task
- .getResult()
- .getUser(), promise);
- }
+ promiseWithAuthResult(task.getResult(), promise);
} else {
Exception exception = task.getException();
Log.e(TAG, "link:onComplete:failure", exception);
@@ -1460,34 +1320,12 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
}
@ReactMethod
- public void reauthenticateWithCredential(
+ private void reauthenticateWithCredential(
String appName,
String provider,
String authToken,
String authSecret,
final Promise promise
- ) {
- reauthenticate(appName, provider, authToken, authSecret, promise, false);
- }
-
- @ReactMethod
- public void reauthenticateAndRetrieveDataWithCredential(
- String appName,
- String provider,
- String authToken,
- String authSecret,
- final Promise promise
- ) {
- reauthenticate(appName, provider, authToken, authSecret, promise, true);
- }
-
- private void reauthenticate(
- String appName,
- String provider,
- String authToken,
- String authSecret,
- final Promise promise,
- final boolean withData
) {
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
final FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp);
@@ -1511,13 +1349,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
public void onComplete(@NonNull Task task) {
if (task.isSuccessful()) {
Log.d(TAG, "reauthenticate:onComplete:success");
- if (withData) {
- promiseWithAuthResult(task.getResult(), promise);
- } else {
- promiseWithUser(task
- .getResult()
- .getUser(), promise);
- }
+ promiseWithAuthResult(task.getResult(), promise);
} else {
Exception exception = task.getException();
Log.e(TAG, "reauthenticate:onComplete:failure", exception);
@@ -1581,9 +1413,21 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
mCredential = null;
return credential;
}
- return PhoneAuthProvider.getCredential(authToken, authSecret);
+
+ if (authToken != null) {
+ return PhoneAuthProvider.getCredential(authToken, authSecret);
+ }
+
+ return null;
}
+ /**
+ * getToken
+ *
+ * @param appName
+ * @param forceRefresh
+ * @param promise
+ */
@ReactMethod
public void getToken(String appName, Boolean forceRefresh, final Promise promise) {
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
@@ -1615,6 +1459,13 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
}
}
+ /**
+ * fetchSignInMethodsForEmail
+ *
+ * @param appName
+ * @param email
+ * @param promise
+ */
@ReactMethod
public void fetchSignInMethodsForEmail(String appName, String email, final Promise promise) {
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
@@ -1650,6 +1501,12 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
});
}
+ /**
+ * setLanguageCode
+ *
+ * @param appName
+ * @param code
+ */
@ReactMethod
public void setLanguageCode(String appName, String code) {
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
@@ -1658,6 +1515,11 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
firebaseAuth.setLanguageCode(code);
}
+ /**
+ * useDeviceLanguage
+ *
+ * @param appName
+ */
@ReactMethod
public void useDeviceLanguage(String appName) {
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
@@ -1731,16 +1593,19 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
*/
private void promiseWithAuthResult(AuthResult authResult, Promise promise) {
if (authResult != null && authResult.getUser() != null) {
- WritableMap userMap = firebaseUserToMap(authResult.getUser());
WritableMap authResultMap = Arguments.createMap();
+ WritableMap userMap = firebaseUserToMap(authResult.getUser());
+
if (authResult.getAdditionalUserInfo() != null) {
WritableMap additionalUserInfoMap = Arguments.createMap();
+
additionalUserInfoMap.putBoolean(
"isNewUser",
authResult
.getAdditionalUserInfo()
.isNewUser()
);
+
if (authResult
.getAdditionalUserInfo()
.getProfile() != null) {
@@ -1752,6 +1617,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
additionalUserInfoMap
);
}
+
if (authResult
.getAdditionalUserInfo()
.getProviderId() != null) {
@@ -1762,6 +1628,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
.getProviderId()
);
}
+
if (authResult
.getAdditionalUserInfo()
.getUsername() != null) {
@@ -1772,6 +1639,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
.getUsername()
);
}
+
authResultMap.putMap("additionalUserInfo", additionalUserInfoMap);
}
authResultMap.putMap("user", userMap);
@@ -1911,7 +1779,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
final Uri photoUrl = userInfo.getPhotoUrl();
- if (photoUrl != null && !"".equals(photoUrl)) {
+ if (photoUrl != null && !"".equals(photoUrl.toString())) {
userInfoMap.putString("photoURL", photoUrl.toString());
} else {
userInfoMap.putNull("photoURL");
@@ -1981,7 +1849,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
userMap.putNull("displayName");
}
- if (photoUrl != null && !"".equals(photoUrl)) {
+ if (photoUrl != null && !"".equals(photoUrl.toString())) {
userMap.putString("photoURL", photoUrl.toString());
} else {
userMap.putNull("photoURL");
diff --git a/ios/RNFirebase/auth/RNFirebaseAuth.m b/ios/RNFirebase/auth/RNFirebaseAuth.m
index dfe97608..41b8a6cd 100644
--- a/ios/RNFirebase/auth/RNFirebaseAuth.m
+++ b/ios/RNFirebase/auth/RNFirebaseAuth.m
@@ -1,10 +1,30 @@
#import "RNFirebaseAuth.h"
#import "RNFirebaseEvents.h"
#import "RNFirebaseUtil.h"
-#import "RCTDefines.h"
#if __has_include()
+static NSString *const keyIOS = @"iOS";
+static NSString *const keyUrl = @"url";
+static NSString *const keyUid = @"uid";
+static NSString *const keyUser = @"user";
+static NSString *const keyEmail = @"email";
+static NSString *const keyAndroid = @"android";
+static NSString *const keyProfile = @"profile";
+static NSString *const keyNewUser = @"isNewUser";
+static NSString *const keyUsername = @"username";
+static NSString *const keyPhotoUrl = @"photoURL";
+static NSString *const keyBundleId = @"bundleId";
+static NSString *const keyInstallApp = @"installApp";
+static NSString *const keyProviderId = @"providerId";
+static NSString *const keyPhoneNumber = @"phoneNumber";
+static NSString *const keyDisplayName = @"displayName";
+static NSString *const keyPackageName = @"packageName";
+static NSString *const keyMinVersion = @"minimumVersion";
+static NSString *const constAppLanguage = @"APP_LANGUAGE";
+static NSString *const keyHandleCodeInApp = @"handleCodeInApp";
+static NSString *const keyAdditionalUserInfo = @"additionalUserInfo";
+
@implementation RNFirebaseAuth
RCT_EXPORT_MODULE();
@@ -18,8 +38,8 @@ RCT_EXPORT_MODULE();
}
/**
- addAuthStateListener
-
+ * addAuthStateListener
+ *
*/
RCT_EXPORT_METHOD(addAuthStateListener:
(NSString *) appDisplayName) {
@@ -30,7 +50,7 @@ RCT_EXPORT_METHOD(addAuthStateListener:
[[FIRAuth authWithApp:firApp] addAuthStateDidChangeListener:^(FIRAuth *_Nonnull auth, FIRUser *_Nullable user) {
if (user != nil) {
[RNFirebaseUtil sendJSEventWithAppName:self app:firApp name:AUTH_STATE_CHANGED_EVENT body:@{
- @"user": [self firebaseUserToDict:user]}];
+ keyUser: [self firebaseUserToDict:user]}];
} else {
[RNFirebaseUtil sendJSEventWithAppName:self app:firApp name:AUTH_STATE_CHANGED_EVENT body:@{}];
}
@@ -41,8 +61,8 @@ RCT_EXPORT_METHOD(addAuthStateListener:
}
/**
- removeAuthStateListener
-
+ * removeAuthStateListener
+ *
*/
RCT_EXPORT_METHOD(removeAuthStateListener:
(NSString *) appDisplayName) {
@@ -55,8 +75,8 @@ RCT_EXPORT_METHOD(removeAuthStateListener:
}
/**
- addIdTokenListener
-
+ * addIdTokenListener
+ *
*/
RCT_EXPORT_METHOD(addIdTokenListener:
(NSString *) appDisplayName) {
@@ -67,7 +87,7 @@ RCT_EXPORT_METHOD(addIdTokenListener:
[[FIRAuth authWithApp:firApp] addIDTokenDidChangeListener:^(FIRAuth *_Nonnull auth, FIRUser *_Nullable user) {
if (user != nil) {
[RNFirebaseUtil sendJSEventWithAppName:self app:firApp name:AUTH_ID_TOKEN_CHANGED_EVENT body:@{
- @"user": [self firebaseUserToDict:user]}];
+ keyUser: [self firebaseUserToDict:user]}];
} else {
[RNFirebaseUtil sendJSEventWithAppName:self app:firApp name:AUTH_ID_TOKEN_CHANGED_EVENT body:@{}];
}
@@ -148,38 +168,13 @@ RCT_EXPORT_METHOD(signInAnonymously:
(RCTPromiseResolveBlock) resolve
rejecter:
(RCTPromiseRejectBlock) reject) {
- [self signInAnonymously:appDisplayName withData:false resolver:resolve rejecter:reject];
-}
-
-/**
- signInAnonymouslyAndRetrieveData
-
- @param RCTPromiseResolveBlock resolve
- @param RCTPromiseRejectBlock reject
- @return
- */
-RCT_EXPORT_METHOD(signInAnonymouslyAndRetrieveData:
- (NSString *) appDisplayName
- resolver:
- (RCTPromiseResolveBlock) resolve
- rejecter:
- (RCTPromiseRejectBlock) reject) {
- [self signInAnonymously:appDisplayName withData:true resolver:resolve rejecter:reject];
-}
-
-- (void)signInAnonymously:(NSString *)appDisplayName
- withData:(BOOL)withData
- resolver:(RCTPromiseResolveBlock)resolve
- rejecter:(RCTPromiseRejectBlock)reject {
FIRApp *firApp = [RNFirebaseUtil getApp:appDisplayName];
[[FIRAuth authWithApp:firApp] signInAnonymouslyWithCompletion:^(FIRAuthDataResult *authResult, NSError *error) {
if (error) {
[self promiseRejectAuthException:reject error:error];
- } else if (withData) {
- [self promiseWithAuthResult:resolve rejecter:reject authResult:authResult];
} else {
- [self promiseWithUser:resolve rejecter:reject user:authResult.user];
+ [self promiseWithAuthResult:resolve rejecter:reject authResult:authResult];
}
}];
}
@@ -194,28 +189,6 @@ RCT_EXPORT_METHOD(signInAnonymouslyAndRetrieveData:
@return return
*/
RCT_EXPORT_METHOD(signInWithEmailAndPassword:
- (NSString *) appDisplayName
- email:
- (NSString *) email
- pass:
- (NSString *) password
- resolver:
- (RCTPromiseResolveBlock) resolve
- rejecter:
- (RCTPromiseRejectBlock) reject) {
- [self signInWithEmail:appDisplayName email:email password:password withData:false resolver:resolve rejecter:reject];
-}
-
-/**
- signInAndRetrieveDataWithEmailAndPassword
-
- @param NSString NSString email
- @param NSString NSString password
- @param RCTPromiseResolveBlock resolve
- @param RCTPromiseRejectBlock reject
- @return return
- */
-RCT_EXPORT_METHOD(signInAndRetrieveDataWithEmailAndPassword:
(NSString *) appDisplayName
email:
(NSString *) email
@@ -225,25 +198,14 @@ RCT_EXPORT_METHOD(signInAndRetrieveDataWithEmailAndPassword:
(RCTPromiseResolveBlock) resolve
rejecter:
(RCTPromiseRejectBlock) reject) {
- [self signInWithEmail:appDisplayName email:email password:password withData:true resolver:resolve rejecter:reject];
-}
-
-- (void)signInWithEmail:(NSString *)appDisplayName
- email:(NSString *)email
- password:(NSString *)password
- withData:(BOOL)withData
- resolver:(RCTPromiseResolveBlock)resolve
- rejecter:(RCTPromiseRejectBlock)reject {
FIRApp *firApp = [RNFirebaseUtil getApp:appDisplayName];
[[FIRAuth authWithApp:firApp] signInWithEmail:email password:password completion:^(FIRAuthDataResult *authResult,
NSError *error) {
if (error) {
[self promiseRejectAuthException:reject error:error];
- } else if (withData) {
- [self promiseWithAuthResult:resolve rejecter:reject authResult:authResult];
} else {
- [self promiseWithUser:resolve rejecter:reject user:authResult.user];
+ [self promiseWithAuthResult:resolve rejecter:reject authResult:authResult];
}
}];
}
@@ -288,29 +250,8 @@ RCT_EXPORT_METHOD(signInWithEmailLink:
@param RCTPromiseRejectBlock reject
@return return
*/
-RCT_EXPORT_METHOD(createUserWithEmailAndPassword:
- (NSString *) appDisplayName
- email:
- (NSString *) email
- pass:
- (NSString *) password
- resolver:
- (RCTPromiseResolveBlock) resolve
- rejecter:
- (RCTPromiseRejectBlock) reject) {
- [self createUserWithEmail:appDisplayName email:email password:password withData:false resolver:resolve rejecter:reject];
-}
-/**
- createUserAndRetrieveDataWithEmailAndPassword
-
- @param NSString NSString email
- @param NSString NSString password
- @param RCTPromiseResolveBlock resolve
- @param RCTPromiseRejectBlock reject
- @return return
- */
-RCT_EXPORT_METHOD(createUserAndRetrieveDataWithEmailAndPassword:
+RCT_EXPORT_METHOD(createUserWithEmailAndPassword:
(NSString *) appDisplayName
email:
(NSString *) email
@@ -320,25 +261,14 @@ RCT_EXPORT_METHOD(createUserAndRetrieveDataWithEmailAndPassword:
(RCTPromiseResolveBlock) resolve
rejecter:
(RCTPromiseRejectBlock) reject) {
- [self createUserWithEmail:appDisplayName email:email password:password withData:true resolver:resolve rejecter:reject];
-}
-
-- (void)createUserWithEmail:(NSString *)appDisplayName
- email:(NSString *)email
- password:(NSString *)password
- withData:(BOOL)withData
- resolver:(RCTPromiseResolveBlock)resolve
- rejecter:(RCTPromiseRejectBlock)reject {
FIRApp *firApp = [RNFirebaseUtil getApp:appDisplayName];
[[FIRAuth authWithApp:firApp] createUserWithEmail:email password:password completion:^(FIRAuthDataResult *authResult,
NSError *error) {
if (error) {
[self promiseRejectAuthException:reject error:error];
- } else if (withData) {
- [self promiseWithAuthResult:resolve rejecter:reject authResult:authResult];
} else {
- [self promiseWithUser:resolve rejecter:reject user:authResult.user];
+ [self promiseWithAuthResult:resolve rejecter:reject authResult:authResult];
}
}];
}
@@ -529,7 +459,8 @@ RCT_EXPORT_METHOD(updatePhoneNumber:
FIRUser *user = [FIRAuth authWithApp:firApp].currentUser;
if (user) {
- FIRAuthCredential *credential = [self getCredentialForProvider:provider token:authToken secret:authSecret];
+ FIRPhoneAuthCredential *credential =
+ (FIRPhoneAuthCredential *) [self getCredentialForProvider:provider token:authToken secret:authSecret];
if (credential == nil) {
return reject(@"auth/invalid-credential",
@@ -576,7 +507,7 @@ RCT_EXPORT_METHOD(updateProfile:
for (NSString *key in allKeys) {
@try {
- if ([key isEqualToString:@"photoURL"]) {
+ if ([key isEqualToString:keyPhotoUrl]) {
NSURL *url = [NSURL URLWithString:[props valueForKey:key]];
[changeRequest setValue:url forKey:key];
} else {
@@ -653,41 +584,6 @@ RCT_EXPORT_METHOD(signInWithCredential:
(RCTPromiseResolveBlock) resolve
rejecter:
(RCTPromiseRejectBlock) reject) {
- [self signInWithCredential:appDisplayName provider:provider token:authToken secret:authSecret withData:false resolver:resolve rejecter:reject];
-}
-
-/**
- signInAndRetrieveDataWithCredential
-
- @param NSString provider
- @param NSString authToken
- @param NSString authSecret
- @param RCTPromiseResolveBlock resolve
- @param RCTPromiseRejectBlock reject
- @return
- */
-RCT_EXPORT_METHOD(signInAndRetrieveDataWithCredential:
- (NSString *) appDisplayName
- provider:
- (NSString *) provider
- token:
- (NSString *) authToken
- secret:
- (NSString *) authSecret
- resolver:
- (RCTPromiseResolveBlock) resolve
- rejecter:
- (RCTPromiseRejectBlock) reject) {
- [self signInWithCredential:appDisplayName provider:provider token:authToken secret:authSecret withData:true resolver:resolve rejecter:reject];
-}
-
-- (void)signInWithCredential:(NSString *)appDisplayName
- provider:(NSString *)provider
- token:(NSString *)authToken
- secret:(NSString *)authSecret
- withData:(BOOL)withData
- resolver:(RCTPromiseResolveBlock)resolve
- rejecter:(RCTPromiseRejectBlock)reject {
FIRApp *firApp = [RNFirebaseUtil getApp:appDisplayName];
FIRAuthCredential *credential = [self getCredentialForProvider:provider token:authToken secret:authSecret];
@@ -702,10 +598,8 @@ RCT_EXPORT_METHOD(signInAndRetrieveDataWithCredential:
NSError *error) {
if (error) {
[self promiseRejectAuthException:reject error:error];
- } else if (withData) {
- [self promiseWithAuthResult:resolve rejecter:reject authResult:authResult];
} else {
- [self promiseWithUser:resolve rejecter:reject user:authResult.user];
+ [self promiseWithAuthResult:resolve rejecter:reject authResult:authResult];
}
}];
}
@@ -808,9 +702,9 @@ RCT_EXPORT_METHOD(checkActionCode:
NSMutableDictionary *data = [NSMutableDictionary dictionary];
if ([info dataForKey:FIRActionCodeEmailKey] != nil) {
- [data setValue:[info dataForKey:FIRActionCodeEmailKey] forKey:@"email"];
+ [data setValue:[info dataForKey:FIRActionCodeEmailKey] forKey:keyEmail];
} else {
- [data setValue:[NSNull null] forKey:@"email"];
+ [data setValue:[NSNull null] forKey:keyEmail];
}
if ([info dataForKey:FIRActionCodeFromEmailKey] != nil) {
@@ -896,24 +790,6 @@ RCT_EXPORT_METHOD(sendSignInLinkToEmail:
}
-/**
- signInAndRetrieveDataWithCustomToken
-
- @param RCTPromiseResolveBlock resolve
- @param RCTPromiseRejectBlock reject
- @return
- */
-RCT_EXPORT_METHOD(signInAndRetrieveDataWithCustomToken:
- (NSString *) appDisplayName
- customToken:
- (NSString *) customToken
- resolver:
- (RCTPromiseResolveBlock) resolve
- rejecter:
- (RCTPromiseRejectBlock) reject) {
- [self signInWithCustomToken:appDisplayName customToken:customToken withData:true resolver:resolve rejecter:reject];
-}
-
/**
signInWithCustomToken
@@ -929,24 +805,14 @@ RCT_EXPORT_METHOD(signInWithCustomToken:
(RCTPromiseResolveBlock) resolve
rejecter:
(RCTPromiseRejectBlock) reject) {
- [self signInWithCustomToken:appDisplayName customToken:customToken withData:false resolver:resolve rejecter:reject];
-}
-
-- (void)signInWithCustomToken:(NSString *)appDisplayName
- customToken:(NSString *)customToken
- withData:(BOOL)withData
- resolver:(RCTPromiseResolveBlock)resolve
- rejecter:(RCTPromiseRejectBlock)reject {
FIRApp *firApp = [RNFirebaseUtil getApp:appDisplayName];
[[FIRAuth authWithApp:firApp] signInWithCustomToken:customToken completion:^(FIRAuthDataResult *authResult,
NSError *error) {
if (error) {
[self promiseRejectAuthException:reject error:error];
- } else if (withData) {
- [self promiseWithAuthResult:resolve rejecter:reject authResult:authResult];
} else {
- [self promiseWithUser:resolve rejecter:reject user:authResult.user];
+ [self promiseWithAuthResult:resolve rejecter:reject authResult:authResult];
}
}];
}
@@ -1035,6 +901,7 @@ RCT_EXPORT_METHOD(_confirmVerificationCode:
FIRApp *firApp = [RNFirebaseUtil getApp:appDisplayName];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *verificationId = [defaults stringForKey:@"authVerificationID"];
+
FIRAuthCredential *credential =
[[FIRPhoneAuthProvider provider] credentialWithVerificationID:verificationId verificationCode:verificationCode];
@@ -1070,41 +937,6 @@ RCT_EXPORT_METHOD(linkWithCredential:
(RCTPromiseResolveBlock) resolve
rejecter:
(RCTPromiseRejectBlock) reject) {
- [self linkWithCredential:appDisplayName provider:provider authToken:authToken authSecret:authSecret withData:false resolver:resolve rejecter:reject];
-}
-
-/**
- linkAndRetrieveDataWithCredential
-
- @param NSString provider
- @param NSString authToken
- @param NSString authSecret
- @param RCTPromiseResolveBlock resolve
- @param RCTPromiseRejectBlock reject
- @return
- */
-RCT_EXPORT_METHOD(linkAndRetrieveDataWithCredential:
- (NSString *) appDisplayName
- provider:
- (NSString *) provider
- authToken:
- (NSString *) authToken
- authSecret:
- (NSString *) authSecret
- resolver:
- (RCTPromiseResolveBlock) resolve
- rejecter:
- (RCTPromiseRejectBlock) reject) {
- [self linkWithCredential:appDisplayName provider:provider authToken:authToken authSecret:authSecret withData:true resolver:resolve rejecter:reject];
-}
-
-- (void)linkWithCredential:(NSString *)appDisplayName
- provider:(NSString *)provider
- authToken:(NSString *)authToken
- authSecret:(NSString *)authSecret
- withData:(BOOL)withData
- resolver:(RCTPromiseResolveBlock)resolve
- rejecter:(RCTPromiseRejectBlock)reject {
FIRApp *firApp = [RNFirebaseUtil getApp:appDisplayName];
FIRAuthCredential *credential = [self getCredentialForProvider:provider token:authToken secret:authSecret];
@@ -1120,10 +952,8 @@ RCT_EXPORT_METHOD(linkAndRetrieveDataWithCredential:
completion:^(FIRAuthDataResult *_Nullable authResult, NSError *_Nullable error) {
if (error) {
[self promiseRejectAuthException:reject error:error];
- } else if (withData) {
- [self promiseWithAuthResult:resolve rejecter:reject authResult:authResult];
} else {
- [self promiseWithUser:resolve rejecter:reject user:authResult.user];
+ [self promiseWithAuthResult:resolve rejecter:reject authResult:authResult];
}
}];
} else {
@@ -1187,41 +1017,6 @@ RCT_EXPORT_METHOD(reauthenticateWithCredential:
(RCTPromiseResolveBlock) resolve
rejecter:
(RCTPromiseRejectBlock) reject) {
- [self reauthenticateWithCredential:appDisplayName provider:provider authToken:authToken authSecret:authSecret withData:false resolver:resolve rejecter:reject];
-}
-
-/**
- reauthenticateAndRetrieveDataWithCredential
-
- @param NSString provider
- @param NSString authToken
- @param NSString authSecret
- @param RCTPromiseResolveBlock resolve
- @param RCTPromiseRejectBlock reject
- @return
- */
-RCT_EXPORT_METHOD(reauthenticateAndRetrieveDataWithCredential:
- (NSString *) appDisplayName
- provider:
- (NSString *) provider
- authToken:
- (NSString *) authToken
- authSecret:
- (NSString *) authSecret
- resolver:
- (RCTPromiseResolveBlock) resolve
- rejecter:
- (RCTPromiseRejectBlock) reject) {
- [self reauthenticateWithCredential:appDisplayName provider:provider authToken:authToken authSecret:authSecret withData:true resolver:resolve rejecter:reject];
-}
-
-- (void)reauthenticateWithCredential:(NSString *)appDisplayName
- provider:(NSString *)provider
- authToken:(NSString *)authToken
- authSecret:(NSString *)authSecret
- withData:(BOOL)withData
- resolver:(RCTPromiseResolveBlock)resolve
- rejecter:(RCTPromiseRejectBlock)reject {
FIRApp *firApp = [RNFirebaseUtil getApp:appDisplayName];
FIRAuthCredential *credential = [self getCredentialForProvider:provider token:authToken secret:authSecret];
@@ -1239,10 +1034,8 @@ RCT_EXPORT_METHOD(reauthenticateAndRetrieveDataWithCredential:
NSError *_Nullable error) {
if (error) {
[self promiseRejectAuthException:reject error:error];
- } else if (withData) {
- [self promiseWithAuthResult:resolve rejecter:reject authResult:authResult];
} else {
- [self promiseWithUser:resolve rejecter:reject user:authResult.user];
+ [self promiseWithAuthResult:resolve rejecter:reject authResult:authResult];
}
}];
} else {
@@ -1327,7 +1120,6 @@ RCT_EXPORT_METHOD(setLanguageCode:
code:
(NSString *) code) {
FIRApp *firApp = [RNFirebaseUtil getApp:appDisplayName];
-
[FIRAuth authWithApp:firApp].languageCode = code;
}
@@ -1340,7 +1132,6 @@ RCT_EXPORT_METHOD(setLanguageCode:
RCT_EXPORT_METHOD(useDeviceLanguage:
(NSString *) appDisplayName) {
FIRApp *firApp = [RNFirebaseUtil getApp:appDisplayName];
-
[[FIRAuth authWithApp:firApp] useAppLanguage];
}
@@ -1503,11 +1294,11 @@ RCT_EXPORT_METHOD(verifyPasswordResetCode:
}
/**
- Resolve or reject a promise based on FIRUser value existance
-
- @param resolve RCTPromiseResolveBlock
- @param reject RCTPromiseRejectBlock
- @param user FIRUser
+ * Resolve or reject a promise based on FIRUser value existence
+ *
+ * @param resolve RCTPromiseResolveBlock
+ * @param reject RCTPromiseRejectBlock
+ * @param user FIRUser
*/
- (void)promiseWithUser:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject user:(FIRUser *)user {
if (user) {
@@ -1520,24 +1311,51 @@ RCT_EXPORT_METHOD(verifyPasswordResetCode:
}
/**
- Resolve or reject a promise based on FIRAuthResult value existance
-
- @param resolve RCTPromiseResolveBlock
- @param reject RCTPromiseRejectBlock
- @param authResult FIRAuthDataResult
+ * Resolve or reject a promise based on FIRAuthResult value existence
+ *
+ * @param resolve RCTPromiseResolveBlock
+ * @param reject RCTPromiseRejectBlock
+ * @param authResult FIRAuthDataResult
*/
- (void)promiseWithAuthResult:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject authResult:(FIRAuthDataResult *)authResult {
if (authResult && authResult.user) {
- NSDictionary *userDict = [self firebaseUserToDict:authResult.user];
- NSDictionary *authResultDict = @{
- @"additionalUserInfo": authResult.additionalUserInfo ? @{
- @"isNewUser": @(authResult.additionalUserInfo.isNewUser),
- @"profile": authResult.additionalUserInfo.profile ? authResult.additionalUserInfo.profile : [NSNull null],
- @"providerId": authResult.additionalUserInfo.providerID ? authResult.additionalUserInfo.providerID : [NSNull null],
- @"username": authResult.additionalUserInfo.username ? authResult.additionalUserInfo.username : [NSNull null]
- } : [NSNull null],
- @"user": userDict
- };
+ NSMutableDictionary *authResultDict = [NSMutableDictionary dictionary];
+
+ // additionalUserInfo
+ if (authResult.additionalUserInfo) {
+ NSMutableDictionary *additionalUserInfo = [NSMutableDictionary dictionary];
+
+ // isNewUser
+ [additionalUserInfo setValue:@(authResult.additionalUserInfo.isNewUser) forKey:keyNewUser];
+
+ // profile
+ if (authResult.additionalUserInfo.profile) {
+ [additionalUserInfo setValue:authResult.additionalUserInfo.profile forKey:keyProfile];
+ } else {
+ [additionalUserInfo setValue:[NSNull null] forKey:keyProfile];
+ }
+
+ // providerId
+ if (authResult.additionalUserInfo.providerID) {
+ [additionalUserInfo setValue:authResult.additionalUserInfo.providerID forKey:keyProviderId];
+ } else {
+ [additionalUserInfo setValue:[NSNull null] forKey:keyProviderId];
+ }
+
+ // username
+ if (authResult.additionalUserInfo.username) {
+ [additionalUserInfo setValue:authResult.additionalUserInfo.username forKey:keyUsername];
+ } else {
+ [additionalUserInfo setValue:[NSNull null] forKey:keyUsername];
+ }
+
+ [authResultDict setValue:additionalUserInfo forKey:keyAdditionalUserInfo];
+ } else {
+ [authResultDict setValue:[NSNull null] forKey:keyAdditionalUserInfo];
+ }
+
+ // user
+ [authResultDict setValue:[self firebaseUserToDict:authResult.user] forKey:keyUser];
resolve(authResultDict);
} else {
[self promiseNoUser:resolve rejecter:reject isError:YES];
@@ -1546,10 +1364,10 @@ RCT_EXPORT_METHOD(verifyPasswordResetCode:
}
/**
- Converts an array of FIRUserInfo instances into the correct format to match the web sdk
-
- @param providerData FIRUser.providerData
- @return NSArray
+ * Converts an array of FIRUserInfo instances into a web sdk compatible format
+ *
+ * @param providerData NSArray
+ * @return NSArray
*/
- (NSArray *)convertProviderData:(NSArray > *)providerData {
NSMutableArray *output = [NSMutableArray array];
@@ -1558,27 +1376,27 @@ RCT_EXPORT_METHOD(verifyPasswordResetCode:
NSMutableDictionary *pData = [NSMutableDictionary dictionary];
if (userInfo.providerID != nil) {
- [pData setValue:userInfo.providerID forKey:@"providerId"];
+ [pData setValue:userInfo.providerID forKey:keyProviderId];
}
if (userInfo.uid != nil) {
- [pData setValue:userInfo.uid forKey:@"uid"];
+ [pData setValue:userInfo.uid forKey:keyUid];
}
if (userInfo.displayName != nil) {
- [pData setValue:userInfo.displayName forKey:@"displayName"];
+ [pData setValue:userInfo.displayName forKey:keyDisplayName];
}
if (userInfo.photoURL != nil) {
- [pData setValue:[userInfo.photoURL absoluteString] forKey:@"photoURL"];
+ [pData setValue:[userInfo.photoURL absoluteString] forKey:keyPhotoUrl];
}
if (userInfo.email != nil) {
- [pData setValue:userInfo.email forKey:@"email"];
+ [pData setValue:userInfo.email forKey:keyEmail];
}
if (userInfo.phoneNumber != nil) {
- [pData setValue:userInfo.phoneNumber forKey:@"phoneNumber"];
+ [pData setValue:userInfo.phoneNumber forKey:keyPhoneNumber];
}
[output addObject:pData];
@@ -1589,33 +1407,33 @@ RCT_EXPORT_METHOD(verifyPasswordResetCode:
/**
* React native constant exports - exports native firebase apps mainly
+ *
* @return NSDictionary
*/
- (NSDictionary *)constantsToExport {
- NSMutableDictionary *constants = [NSMutableDictionary new];
NSDictionary *firApps = [FIRApp allApps];
+ NSMutableDictionary *constants = [NSMutableDictionary new];
NSMutableDictionary *appLanguage = [NSMutableDictionary new];
for (id key in firApps) {
FIRApp *firApp = firApps[key];
-
appLanguage[firApp.name] = [FIRAuth authWithApp:firApp].languageCode;
}
- constants[@"APP_LANGUAGE"] = appLanguage;
+ constants[constAppLanguage] = appLanguage;
return constants;
}
/**
- Converts a FIRUser instance into a dictionary to send via RNBridge
-
- @param user FIRUser
- @return NSDictionary
+ * Converts a FIRUser instance into a dictionary to send via RNBridge
+ *
+ * @param user FIRUser
+ * @return NSDictionary
*/
- (NSDictionary *)firebaseUserToDict:(FIRUser *)user {
return @{
- @"displayName": user.displayName ? user.displayName : [NSNull null],
- @"email": user.email ? user.email : [NSNull null],
+ keyDisplayName: user.displayName ? user.displayName : [NSNull null],
+ keyEmail: user.email ? user.email : [NSNull null],
@"emailVerified": @(user.emailVerified),
@"isAnonymous": @(user.anonymous),
@"metadata": @{
@@ -1624,36 +1442,49 @@ RCT_EXPORT_METHOD(verifyPasswordResetCode:
@"lastSignInTime": user.metadata.lastSignInDate ? @(round(
[user.metadata.lastSignInDate timeIntervalSince1970] * 1000.0)) : [NSNull null],
},
- @"phoneNumber": user.phoneNumber ? user.phoneNumber : [NSNull null],
- @"photoURL": user.photoURL ? [user.photoURL absoluteString] : [NSNull null],
+ keyPhoneNumber: user.phoneNumber ? user.phoneNumber : [NSNull null],
+ keyPhotoUrl: user.photoURL ? [user.photoURL absoluteString] : [NSNull null],
@"providerData": [self convertProviderData:user.providerData],
- @"providerId": [user.providerID lowercaseString],
+ keyProviderId: [user.providerID lowercaseString],
@"refreshToken": user.refreshToken,
- @"uid": user.uid
+ keyUid: user.uid
};
}
+/**
+ * Create a FIRActionCodeSettings instance from JS args
+ *
+ * @param actionCodeSettings NSDictionary
+ * @return FIRActionCodeSettings
+ */
- (FIRActionCodeSettings *)buildActionCodeSettings:(NSDictionary *)actionCodeSettings {
+ NSString *url = actionCodeSettings[keyUrl];
+ NSDictionary *ios = actionCodeSettings[keyIOS];
+ NSDictionary *android = actionCodeSettings[keyAndroid];
+ BOOL handleCodeInApp = [actionCodeSettings[keyHandleCodeInApp] boolValue];
+
FIRActionCodeSettings *settings = [[FIRActionCodeSettings alloc] init];
- NSDictionary *android = actionCodeSettings[@"android"];
- BOOL handleCodeInApp = actionCodeSettings[@"handleCodeInApp"];
- NSDictionary *ios = actionCodeSettings[@"iOS"];
- NSString *url = actionCodeSettings[@"url"];
+
if (android) {
- BOOL installApp = android[@"installApp"];
- NSString *minimumVersion = android[@"minimumVersion"];
- NSString *packageName = android[@"packageName"];
+ NSString *packageName = android[keyPackageName];
+ NSString *minimumVersion = android[keyMinVersion];
+ BOOL installApp = [android[keyInstallApp] boolValue];
+
[settings setAndroidPackageName:packageName installIfNotAvailable:installApp minimumVersion:minimumVersion];
}
+
if (handleCodeInApp) {
[settings setHandleCodeInApp:handleCodeInApp];
}
- if (ios && ios[@"bundleId"]) {
- [settings setIOSBundleID:ios[@"bundleId"]];
+
+ if (ios && ios[keyBundleId]) {
+ [settings setIOSBundleID:ios[keyBundleId]];
}
+
if (url) {
[settings setURL:[NSURL URLWithString:url]];
}
+
return settings;
}
diff --git a/src/index.d.ts b/src/index.d.ts
index df9ddd54..3866f096 100644
--- a/src/index.d.ts
+++ b/src/index.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for React Native Firebase v4.2.0
+// Type definitions for React Native Firebase v5.0.0
// Project: https://github.com/invertase/react-native-firebase
// Definitions by: React Native Firebase Contributors
// TypeScript Version: 2.1
@@ -188,22 +188,22 @@ declare module 'react-native-firebase' {
*/
bundleID?: string;
/**
- * defualt ""
+ * default ""
* The Google App ID that is used to uniquely identify an instance of an app.
*/
googleAppID?: string;
/**
- * deufalt ""
+ * default ""
* The database root (i.e. https://my-app.firebaseio.com)
*/
databaseURL?: string;
/**
- * defualt ""
+ * default ""
* URL scheme to set up durable deep link service
*/
deepLinkURLScheme?: string;
/**
- * defualt ""
+ * default ""
* The Google Cloud storage bucket name
*/
storageBucket?: string;
@@ -228,7 +228,7 @@ declare module 'react-native-firebase' {
*/
clientID?: string;
/**
- * defualt ""
+ * default ""
* The secret iOS API key used for authenticating requests from our app
*/
APIKey?: string;
@@ -682,16 +682,16 @@ declare module 'react-native-firebase' {
* Sets the minimum engagement time required before starting a session.
* The default value is 10000 (10 seconds)
*/
- setMinimumSessionDuration(miliseconds: number): void;
+ setMinimumSessionDuration(milliseconds: number): void;
/**
* Sets the duration of inactivity that terminates the current session.
* The default value is 1800000 (30 minutes).
*/
- setSessionTimeoutDuration(miliseconds: number): void;
+ setSessionTimeoutDuration(milliseconds: number): void;
/**
- * Gives a user a uniqiue identificaition.
+ * Gives a user a unique identification.
* @example
* const id = firebase.auth().currentUser.uid;
*
@@ -791,6 +791,10 @@ declare module 'react-native-firebase' {
getToken(forceRefresh?: boolean): Promise;
+ /**
+ * @deprecated
+ * @param credential
+ */
linkAndRetrieveDataWithCredential(
credential: AuthCredential
): Promise;
@@ -798,8 +802,12 @@ declare module 'react-native-firebase' {
/**
* Link the user with a 3rd party credential provider.
*/
- linkWithCredential(credential: AuthCredential): Promise;
+ linkWithCredential(credential: AuthCredential): Promise;
+ /**
+ * @deprecated
+ * @param credential
+ */
reauthenticateAndRetrieveDataWithCredential(
credential: AuthCredential
): Promise;
@@ -807,7 +815,7 @@ declare module 'react-native-firebase' {
/**
* Re-authenticate a user with a third-party authentication provider
*/
- reauthenticateWithCredential(credential: AuthCredential): Promise;
+ reauthenticateWithCredential(credential: AuthCredential): Promise;
/**
* Refreshes the current user.
@@ -998,14 +1006,22 @@ declare module 'react-native-firebase' {
signOut(): Promise;
+ /**
+ * @deprecated
+ */
signInAnonymouslyAndRetrieveData(): Promise;
/**
* Sign an anonymous user.
* If the user has already signed in, that user will be returned
*/
- signInAnonymously(): Promise;
+ signInAnonymously(): Promise;
+ /**
+ * @deprecated
+ * @param email
+ * @param password
+ */
createUserAndRetrieveDataWithEmailAndPassword(
email: string,
password: string
@@ -1025,8 +1041,13 @@ declare module 'react-native-firebase' {
createUserWithEmailAndPassword(
email: string,
password: string
- ): Promise;
+ ): Promise;
+ /**
+ * @deprecated
+ * @param email
+ * @param password
+ */
signInAndRetrieveDataWithEmailAndPassword(
email: string,
password: string
@@ -1039,8 +1060,12 @@ declare module 'react-native-firebase' {
signInWithEmailAndPassword(
email: string,
password: string
- ): Promise;
+ ): Promise;
+ /**
+ * @deprecated
+ * @param token
+ */
signInAndRetrieveDataWithCustomToken(
token: string
): Promise;
@@ -1051,8 +1076,12 @@ declare module 'react-native-firebase' {
* use the signInWithCustomToken() function.
* It accepts one parameter, the custom token:
*/
- signInWithCustomToken(token: string): Promise;
+ signInWithCustomToken(token: string): Promise;
+ /**
+ * @deprecated
+ * @param credential
+ */
signInAndRetrieveDataWithCredential(
credential: AuthCredential
): Promise;
@@ -1061,7 +1090,7 @@ declare module 'react-native-firebase' {
* Sign in the user with a 3rd party credential provider.
* credential requires the following properties:
*/
- signInWithCredential(credential: AuthCredential): Promise;
+ signInWithCredential(credential: AuthCredential): Promise;
/**
* Asynchronously signs in using a phone number.
@@ -1182,7 +1211,7 @@ declare module 'react-native-firebase' {
subscribeToTopic(topic: string): void;
/**
- * Unsubscribes the device from a topic.
+ * Unsubscribe the device from a topic.
*/
unsubscribeFromTopic(topic: string): void;
}
@@ -2792,7 +2821,7 @@ declare module 'react-native-firebase/functions' {
export type HttpsErrorCode = RNFirebase.functions.HttpsErrorCode;
export type FunctionsErrorCode = RNFirebase.functions.FunctionsErrorCode;
export type HttpsCallableResult = RNFirebase.functions.HttpsCallableResult;
- export type Funtions = RNFirebase.functions.Functions;
+ export type Functions = RNFirebase.functions.Functions;
export type HttpsError = RNFirebase.functions.HttpsError;
}
diff --git a/src/modules/auth/User.js b/src/modules/auth/User.js
index 7f2dc520..3188f6ed 100644
--- a/src/modules/auth/User.js
+++ b/src/modules/auth/User.js
@@ -116,31 +116,30 @@ export default class User {
// }
/**
- * @deprecated Deprecated linkWithCredential in favor of linkAndRetrieveDataWithCredential.
* @param credential
*/
- linkWithCredential(credential: AuthCredential): Promise {
- console.warn(
- 'Deprecated firebase.User.prototype.linkWithCredential in favor of firebase.User.prototype.linkAndRetrieveDataWithCredential.'
- );
+ linkWithCredential(credential: AuthCredential): Promise {
return getNativeModule(this._auth)
.linkWithCredential(
credential.providerId,
credential.token,
credential.secret
)
- .then(user => this._auth._setUser(user));
+ .then(userCredential => this._auth._setUserCredential(userCredential));
}
/**
- *
+ * @deprecated Deprecated linkAndRetrieveDataWithCredential in favor of linkWithCredential.
* @param credential
*/
linkAndRetrieveDataWithCredential(
credential: AuthCredential
): Promise {
+ console.warn(
+ 'Deprecated linkAndRetrieveDataWithCredential in favor of linkWithCredential.'
+ );
return getNativeModule(this._auth)
- .linkAndRetrieveDataWithCredential(
+ .linkWithCredential(
credential.providerId,
credential.token,
credential.secret
@@ -152,30 +151,32 @@ export default class User {
* Re-authenticate a user with a third-party authentication provider
* @return {Promise} A promise resolved upon completion
*/
- reauthenticateWithCredential(credential: AuthCredential): Promise {
- console.warn(
- 'Deprecated firebase.User.prototype.reauthenticateWithCredential in favor of firebase.User.prototype.reauthenticateAndRetrieveDataWithCredential.'
- );
+ reauthenticateWithCredential(
+ credential: AuthCredential
+ ): Promise {
return getNativeModule(this._auth)
.reauthenticateWithCredential(
credential.providerId,
credential.token,
credential.secret
)
- .then(user => {
- this._auth._setUser(user);
- });
+ .then(userCredential => this._auth._setUserCredential(userCredential));
}
/**
* Re-authenticate a user with a third-party authentication provider
+ *
+ * @deprecated Deprecated reauthenticateAndRetrieveDataWithCredential in favor of reauthenticateWithCredential.
* @return {Promise} A promise resolved upon completion
*/
reauthenticateAndRetrieveDataWithCredential(
credential: AuthCredential
): Promise {
+ console.warn(
+ 'Deprecated reauthenticateAndRetrieveDataWithCredential in favor of reauthenticateWithCredential.'
+ );
return getNativeModule(this._auth)
- .reauthenticateAndRetrieveDataWithCredential(
+ .reauthenticateWithCredential(
credential.providerId,
credential.token,
credential.secret
diff --git a/src/modules/auth/index.js b/src/modules/auth/index.js
index bbbb0f8a..6ae3ed2c 100644
--- a/src/modules/auth/index.js
+++ b/src/modules/auth/index.js
@@ -209,31 +209,33 @@ export default class Auth extends ModuleBase {
/**
* Sign a user in anonymously
- * @deprecated Deprecated signInAnonymously in favor of signInAnonymouslyAndRetrieveData.
+ *
* @return {Promise} A promise resolved upon completion
*/
- signInAnonymously(): Promise {
- console.warn(
- 'Deprecated firebase.User.prototype.signInAnonymously in favor of firebase.User.prototype.signInAnonymouslyAndRetrieveData.'
- );
+ signInAnonymously(): Promise {
return getNativeModule(this)
.signInAnonymously()
- .then(user => this._setUser(user));
+ .then(userCredential => this._setUserCredential(userCredential));
}
/**
* Sign a user in anonymously
+ *
+ * @deprecated Deprecated signInAnonymouslyAndRetrieveData in favor of signInAnonymously.
* @return {Promise} A promise resolved upon completion
*/
signInAnonymouslyAndRetrieveData(): Promise {
+ console.warn(
+ 'Deprecated signInAnonymouslyAndRetrieveData in favor of signInAnonymously.'
+ );
return getNativeModule(this)
- .signInAnonymouslyAndRetrieveData()
+ .signInAnonymously()
.then(userCredential => this._setUserCredential(userCredential));
}
/**
* Create a user with the email/password functionality
- * @deprecated Deprecated createUserWithEmailAndPassword in favor of createUserAndRetrieveDataWithEmailAndPassword.
+ *
* @param {string} email The user's email
* @param {string} password The user's password
* @return {Promise} A promise indicating the completion
@@ -241,17 +243,16 @@ export default class Auth extends ModuleBase {
createUserWithEmailAndPassword(
email: string,
password: string
- ): Promise {
- console.warn(
- 'Deprecated firebase.User.prototype.createUserWithEmailAndPassword in favor of firebase.User.prototype.createUserAndRetrieveDataWithEmailAndPassword.'
- );
+ ): Promise {
return getNativeModule(this)
.createUserWithEmailAndPassword(email, password)
- .then(user => this._setUser(user));
+ .then(userCredential => this._setUserCredential(userCredential));
}
/**
* Create a user with the email/password functionality
+ *
+ * @deprecated Deprecated createUserAndRetrieveDataWithEmailAndPassword in favor of createUserWithEmailAndPassword.
* @param {string} email The user's email
* @param {string} password The user's password
* @return {Promise} A promise indicating the completion
@@ -260,29 +261,34 @@ export default class Auth extends ModuleBase {
email: string,
password: string
): Promise {
+ console.warn(
+ 'Deprecated createUserAndRetrieveDataWithEmailAndPassword in favor of createUserWithEmailAndPassword.'
+ );
return getNativeModule(this)
- .createUserAndRetrieveDataWithEmailAndPassword(email, password)
+ .createUserWithEmailAndPassword(email, password)
.then(userCredential => this._setUserCredential(userCredential));
}
/**
* Sign a user in with email/password
- * @deprecated Deprecated signInWithEmailAndPassword in favor of signInAndRetrieveDataWithEmailAndPassword
+ *
* @param {string} email The user's email
* @param {string} password The user's password
* @return {Promise} A promise that is resolved upon completion
*/
- signInWithEmailAndPassword(email: string, password: string): Promise {
- console.warn(
- 'Deprecated firebase.User.prototype.signInWithEmailAndPassword in favor of firebase.User.prototype.signInAndRetrieveDataWithEmailAndPassword.'
- );
+ signInWithEmailAndPassword(
+ email: string,
+ password: string
+ ): Promise {
return getNativeModule(this)
.signInWithEmailAndPassword(email, password)
- .then(user => this._setUser(user));
+ .then(userCredential => this._setUserCredential(userCredential));
}
/**
* Sign a user in with email/password
+ *
+ * @deprecated Deprecated signInAndRetrieveDataWithEmailAndPassword in favor of signInWithEmailAndPassword
* @param {string} email The user's email
* @param {string} password The user's password
* @return {Promise} A promise that is resolved upon completion
@@ -291,66 +297,73 @@ export default class Auth extends ModuleBase {
email: string,
password: string
): Promise {
+ console.warn(
+ 'Deprecated signInAndRetrieveDataWithEmailAndPassword in favor of signInWithEmailAndPassword.'
+ );
return getNativeModule(this)
- .signInAndRetrieveDataWithEmailAndPassword(email, password)
+ .signInWithEmailAndPassword(email, password)
.then(userCredential => this._setUserCredential(userCredential));
}
/**
* Sign the user in with a custom auth token
- * @deprecated Deprecated signInWithCustomToken in favor of signInAndRetrieveDataWithCustomToken
+ *
* @param {string} customToken A self-signed custom auth token.
* @return {Promise} A promise resolved upon completion
*/
- signInWithCustomToken(customToken: string): Promise {
- console.warn(
- 'Deprecated firebase.User.prototype.signInWithCustomToken in favor of firebase.User.prototype.signInAndRetrieveDataWithCustomToken.'
- );
+ signInWithCustomToken(customToken: string): Promise {
return getNativeModule(this)
.signInWithCustomToken(customToken)
- .then(user => this._setUser(user));
+ .then(userCredential => this._setUserCredential(userCredential));
}
/**
* Sign the user in with a custom auth token
+ *
+ * @deprecated Deprecated signInAndRetrieveDataWithCustomToken in favor of signInWithCustomToken
* @param {string} customToken A self-signed custom auth token.
* @return {Promise} A promise resolved upon completion
*/
signInAndRetrieveDataWithCustomToken(
customToken: string
): Promise {
+ console.warn(
+ 'Deprecated signInAndRetrieveDataWithCustomToken in favor of signInWithCustomToken.'
+ );
return getNativeModule(this)
- .signInAndRetrieveDataWithCustomToken(customToken)
+ .signInWithCustomToken(customToken)
.then(userCredential => this._setUserCredential(userCredential));
}
/**
* Sign the user in with a third-party authentication provider
- * @deprecated Deprecated signInWithCredential in favor of signInAndRetrieveDataWithCredential.
+ *
* @return {Promise} A promise resolved upon completion
*/
- signInWithCredential(credential: AuthCredential): Promise {
- console.warn(
- 'Deprecated firebase.User.prototype.signInWithCredential in favor of firebase.User.prototype.signInAndRetrieveDataWithCredential.'
- );
+ signInWithCredential(credential: AuthCredential): Promise {
return getNativeModule(this)
.signInWithCredential(
credential.providerId,
credential.token,
credential.secret
)
- .then(user => this._setUser(user));
+ .then(userCredential => this._setUserCredential(userCredential));
}
/**
* Sign the user in with a third-party authentication provider
+ *
+ * @deprecated Deprecated signInAndRetrieveDataWithCredential in favor of signInWithCredential.
* @return {Promise} A promise resolved upon completion
*/
signInAndRetrieveDataWithCredential(
credential: AuthCredential
): Promise {
+ console.warn(
+ 'Deprecated signInAndRetrieveDataWithCredential in favor of signInWithCredential.'
+ );
return getNativeModule(this)
- .signInAndRetrieveDataWithCredential(
+ .signInWithCredential(
credential.providerId,
credential.token,
credential.secret
diff --git a/tests/android/app/build.gradle b/tests/android/app/build.gradle
index 54ba3693..526708c4 100755
--- a/tests/android/app/build.gradle
+++ b/tests/android/app/build.gradle
@@ -122,7 +122,7 @@ dependencies {
// Cloud Firestore
implementation "com.google.firebase:firebase-firestore:17.1.0"
// Cloud Messaging / FCM
- implementation "com.google.firebase:firebase-messaging:17.3.3"
+ implementation "com.google.firebase:firebase-messaging:17.3.2"
// Crashlytics
implementation('com.crashlytics.sdk.android:crashlytics:2.9.3@aar') {
transitive = true
diff --git a/tests/e2e/auth/auth.e2e.js b/tests/e2e/auth/auth.e2e.js
index 87675cdf..2fb9c9b1 100644
--- a/tests/e2e/auth/auth.e2e.js
+++ b/tests/e2e/auth/auth.e2e.js
@@ -67,15 +67,16 @@ describe('auth()', () => {
});
});
- xdescribe('signInWithCustomToken()', () => {
+ describe('signInWithCustomToken()', () => {
it('signs in with a admin sdk created custom auth token', async () => {
const customUID = `custom${randomString(12, '#aA')}`;
const token = await firebaseAdmin.auth().createCustomToken(customUID);
- const user = await firebase.auth().signInWithCustomToken(token);
+ const { user } = await firebase.auth().signInWithCustomToken(token);
user.uid.should.equal(customUID);
firebase.auth().currentUser.uid.should.equal(customUID);
await firebase.auth().signOut();
+
const {
user: user2,
} = await firebase.auth().signInAndRetrieveDataWithCustomToken(token);
@@ -87,7 +88,7 @@ describe('auth()', () => {
describe('onAuthStateChanged()', () => {
it('calls callback with the current user and when auth state changes', async () => {
- await firebase.auth().signInAnonymouslyAndRetrieveData();
+ await firebase.auth().signInAnonymously();
await sleep(50);
@@ -122,7 +123,7 @@ describe('auth()', () => {
});
it('stops listening when unsubscribed', async () => {
- await firebase.auth().signInAnonymouslyAndRetrieveData();
+ await firebase.auth().signInAnonymously();
// Test
const callback = sinon.spy();
@@ -169,7 +170,7 @@ describe('auth()', () => {
describe('onIdTokenChanged()', () => {
it('calls callback with the current user and when auth state changes', async () => {
- await firebase.auth().signInAnonymouslyAndRetrieveData();
+ await firebase.auth().signInAnonymously();
// Test
const callback = sinon.spy();
@@ -201,7 +202,7 @@ describe('auth()', () => {
});
it('stops listening when unsubscribed', async () => {
- await firebase.auth().signInAnonymouslyAndRetrieveData();
+ await firebase.auth().signInAnonymously();
// Test
const callback = sinon.spy();
@@ -247,7 +248,7 @@ describe('auth()', () => {
describe('onUserChanged()', () => {
it('calls callback with the current user and when auth state changes', async () => {
- await firebase.auth().signInAnonymouslyAndRetrieveData();
+ await firebase.auth().signInAnonymously();
// Test
const callback = sinon.spy();
@@ -283,7 +284,7 @@ describe('auth()', () => {
});
it('stops listening when unsubscribed', async () => {
- await firebase.auth().signInAnonymouslyAndRetrieveData();
+ await firebase.auth().signInAnonymously();
// Test
const callback = sinon.spy();
@@ -332,16 +333,19 @@ describe('auth()', () => {
describe('signInAnonymously()', () => {
it('it should sign in anonymously', () => {
- const successCb = currentUser => {
+ const successCb = currentUserCredential => {
+ const currentUser = currentUserCredential.user;
currentUser.should.be.an.Object();
currentUser.uid.should.be.a.String();
currentUser.toJSON().should.be.an.Object();
should.equal(currentUser.toJSON().email, null);
currentUser.isAnonymous.should.equal(true);
currentUser.providerId.should.equal('firebase');
-
currentUser.should.equal(firebase.auth().currentUser);
+ const { additionalUserInfo } = currentUserCredential;
+ additionalUserInfo.should.be.an.Object();
+
return firebase.auth().signOut();
};
@@ -382,15 +386,20 @@ describe('auth()', () => {
const email = 'test@test.com';
const pass = 'test1234';
- const successCb = currentUser => {
+ const successCb = currentUserCredential => {
+ const currentUser = currentUserCredential.user;
currentUser.should.be.an.Object();
currentUser.uid.should.be.a.String();
currentUser.toJSON().should.be.an.Object();
- currentUser.toJSON().email.should.eql('test@test.com');
+ currentUser.toJSON().email.should.eql(email);
currentUser.isAnonymous.should.equal(false);
currentUser.providerId.should.equal('firebase');
currentUser.should.equal(firebase.auth().currentUser);
+ const { additionalUserInfo } = currentUserCredential;
+ additionalUserInfo.should.be.an.Object();
+ additionalUserInfo.isNewUser.should.equal(false);
+
return firebase.auth().signOut();
};
@@ -563,7 +572,8 @@ describe('auth()', () => {
'test1234'
);
- const successCb = currentUser => {
+ const successCb = currentUserCredential => {
+ const currentUser = currentUserCredential.user;
currentUser.should.be.an.Object();
currentUser.uid.should.be.a.String();
currentUser.toJSON().should.be.an.Object();
@@ -572,6 +582,10 @@ describe('auth()', () => {
currentUser.providerId.should.equal('firebase');
currentUser.should.equal(firebase.auth().currentUser);
+ const { additionalUserInfo } = currentUserCredential;
+ additionalUserInfo.should.be.an.Object();
+ additionalUserInfo.isNewUser.should.equal(false);
+
return firebase.auth().signOut();
};
@@ -757,15 +771,17 @@ describe('auth()', () => {
const email = `${random}@${random}.com`;
const pass = random;
- const successCb = newUser => {
+ const successCb = newUserCredential => {
+ const newUser = newUserCredential.user;
newUser.uid.should.be.a.String();
newUser.email.should.equal(email.toLowerCase());
newUser.emailVerified.should.equal(false);
newUser.isAnonymous.should.equal(false);
newUser.providerId.should.equal('firebase');
newUser.should.equal(firebase.auth().currentUser);
- newUser.metadata.should.be.an.Object();
- should.equal(newUser.phoneNumber, null);
+ const { additionalUserInfo } = newUserCredential;
+ additionalUserInfo.should.be.an.Object();
+ additionalUserInfo.isNewUser.should.equal(true);
return newUser.delete();
};
@@ -1023,7 +1039,8 @@ describe('auth()', () => {
const email = `${random}@${random}.com`;
const pass = random;
- const successCb = newUser => {
+ const successCb = authResult => {
+ const newUser = authResult.user;
newUser.uid.should.be.a.String();
newUser.email.should.equal(email.toLowerCase());
newUser.emailVerified.should.equal(false);
@@ -1094,7 +1111,7 @@ describe('auth()', () => {
await firebase
.auth()
- .createUserAndRetrieveDataWithEmailAndPassword(email, pass);
+ .createUserWithEmailAndPassword(email, pass);
try {
await firebase.auth().sendPasswordResetEmail(email);
diff --git a/tests/e2e/auth/user.e2e.js b/tests/e2e/auth/user.e2e.js
index 4af59efb..09aac0c7 100644
--- a/tests/e2e/auth/user.e2e.js
+++ b/tests/e2e/auth/user.e2e.js
@@ -12,12 +12,12 @@ describe('auth().currentUser', () => {
const email = `${random}@${random}.com`;
const pass = random;
- const newUser = await firebase
+ const { user } = await firebase
.auth()
.createUserWithEmailAndPassword(email, pass);
// Test
- const token = await newUser.getIdToken();
+ const token = await user.getIdToken();
// Assertions
token.should.be.a.String();
@@ -34,12 +34,12 @@ describe('auth().currentUser', () => {
const email = `${random}@${random}.com`;
const pass = random;
- const newUser = await firebase
+ const { user } = await firebase
.auth()
.createUserWithEmailAndPassword(email, pass);
// Test
- const token = await newUser.getToken();
+ const token = await user.getToken();
// Assertions
token.should.be.a.String();
@@ -56,7 +56,7 @@ describe('auth().currentUser', () => {
const email = `${random}@${random}.com`;
const pass = random;
- await firebase.auth().signInAnonymouslyAndRetrieveData();
+ await firebase.auth().signInAnonymously();
const currentUser = firebase.auth().currentUser;
// Test
@@ -65,9 +65,12 @@ describe('auth().currentUser', () => {
pass
);
- const linkedUser = await currentUser.linkWithCredential(credential);
+ const linkedUserCredential = await currentUser.linkWithCredential(
+ credential
+ );
// Assertions
+ const linkedUser = linkedUserCredential.user;
linkedUser.should.be.an.Object();
linkedUser.should.equal(firebase.auth().currentUser);
linkedUser.email.toLowerCase().should.equal(email.toLowerCase());
@@ -84,7 +87,7 @@ describe('auth().currentUser', () => {
const email = 'test@test.com';
const pass = 'test1234';
- await firebase.auth().signInAnonymouslyAndRetrieveData();
+ await firebase.auth().signInAnonymously();
const currentUser = firebase.auth().currentUser;
// Test
@@ -99,7 +102,7 @@ describe('auth().currentUser', () => {
await firebase.auth().signOut();
// Reject
- Promise.reject(new Error('Did not error on link'));
+ return Promise.reject(new Error('Did not error on link'));
} catch (error) {
// Assertions
error.code.should.equal('auth/email-already-in-use');
@@ -119,7 +122,7 @@ describe('auth().currentUser', () => {
const email = `${random}@${random}.com`;
const pass = random;
- await firebase.auth().signInAnonymouslyAndRetrieveData();
+ await firebase.auth().signInAnonymously();
const currentUser = firebase.auth().currentUser;
// Test
@@ -150,7 +153,7 @@ describe('auth().currentUser', () => {
const email = 'test@test.com';
const pass = 'test1234';
- await firebase.auth().signInAnonymouslyAndRetrieveData();
+ await firebase.auth().signInAnonymously();
const currentUser = firebase.auth().currentUser;
// Test
@@ -165,7 +168,7 @@ describe('auth().currentUser', () => {
await firebase.auth().signOut();
// Reject
- Promise.reject(new Error('Did not error on link'));
+ return Promise.reject(new Error('Did not error on link'));
} catch (error) {
// Assertions
error.code.should.equal('auth/email-already-in-use');
@@ -185,15 +188,14 @@ describe('auth().currentUser', () => {
const email = `${random}@${random}.com`;
const pass = random;
- await firebase
- .auth()
- .createUserAndRetrieveDataWithEmailAndPassword(email, pass);
+ await firebase.auth().createUserWithEmailAndPassword(email, pass);
// Test
const credential = firebase.auth.EmailAuthProvider.credential(
email,
pass
);
+
await firebase
.auth()
.currentUser.reauthenticateWithCredential(credential);
@@ -222,6 +224,7 @@ describe('auth().currentUser', () => {
email,
pass
);
+
await firebase
.auth()
.currentUser.reauthenticateAndRetrieveDataWithCredential(credential);
@@ -237,7 +240,7 @@ describe('auth().currentUser', () => {
describe('reload()', () => {
it('should not error', async () => {
- await firebase.auth().signInAnonymouslyAndRetrieveData();
+ await firebase.auth().signInAnonymously();
try {
await firebase.auth().currentUser.reload();
@@ -245,7 +248,7 @@ describe('auth().currentUser', () => {
} catch (error) {
// Reject
await firebase.auth().signOut();
- Promise.reject(new Error('reload() caused an error', error));
+ return Promise.reject(new Error('reload() caused an error', error));
}
});
});
@@ -266,7 +269,7 @@ describe('auth().currentUser', () => {
} catch (error) {
// Reject
await firebase.auth().currentUser.delete();
- Promise.reject(
+ return Promise.reject(
new Error('sendEmailVerification() caused an error', error)
);
}
diff --git a/tests/package.json b/tests/package.json
index 4e8ede16..c1baa5f0 100755
--- a/tests/package.json
+++ b/tests/package.json
@@ -61,6 +61,7 @@
"exclude": [
"node_modules",
"src/modules/admob**",
+ "src/modules/auth/phone**",
"src/modules/messaging**",
"src/modules/notifications**",
"src/types**",