mirror of
https://github.com/zhigang1992/react-native-firebase.git
synced 2026-01-12 22:50:20 +08:00
[android][auth] signInWithPhoneNumber now provides a verificationId for confirmResult usage...
This commit is contained in:
@@ -183,7 +183,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
|
||||
/**
|
||||
* The phone number and SMS code here must have been configured in the
|
||||
* Firebase Console (Authentication > Sign In Method > Phone).
|
||||
*
|
||||
* <p>
|
||||
* Calling this method a second time will overwrite the previously passed parameters.
|
||||
* Only one number can be configured at a given time.
|
||||
*
|
||||
@@ -898,9 +898,12 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
|
||||
if (withData) {
|
||||
promiseWithAuthResult(task.getResult(), promise);
|
||||
} else {
|
||||
promiseWithUser(task
|
||||
.getResult()
|
||||
.getUser(), promise);
|
||||
promiseWithUser(
|
||||
task
|
||||
.getResult()
|
||||
.getUser(),
|
||||
promise
|
||||
);
|
||||
}
|
||||
} else {
|
||||
Exception exception = task.getException();
|
||||
@@ -960,7 +963,15 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
|
||||
// as calling ConfirmationResult.confirm(code) is invalid in this case anyway
|
||||
if (!promiseResolved) {
|
||||
WritableMap verificationMap = Arguments.createMap();
|
||||
verificationMap.putNull("verificationId");
|
||||
|
||||
Parcel parcel = Parcel.obtain();
|
||||
phoneAuthCredential.writeToParcel(parcel, 0);
|
||||
parcel.setDataPosition(16); // verificationId
|
||||
String verificationId = parcel.readString();
|
||||
mVerificationId = verificationId;
|
||||
parcel.recycle();
|
||||
|
||||
verificationMap.putString("verificationId", verificationId);
|
||||
promise.resolve(verificationMap);
|
||||
}
|
||||
} else {
|
||||
@@ -1062,9 +1073,12 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
|
||||
TAG,
|
||||
"_confirmVerificationCode:signInWithCredential:onComplete:success"
|
||||
);
|
||||
promiseWithUser(task
|
||||
.getResult()
|
||||
.getUser(), promise);
|
||||
promiseWithUser(
|
||||
task
|
||||
.getResult()
|
||||
.getUser(),
|
||||
promise
|
||||
);
|
||||
} else {
|
||||
Exception exception = task.getException();
|
||||
Log.e(
|
||||
|
||||
Reference in New Issue
Block a user