Merge branch 'master' into omer_links
This commit is contained in:
commit
6c2c11ebb2
@ -738,9 +738,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
|
|||||||
|
|
||||||
Log.d(TAG, "verifyPhoneNumber:" + phoneNumber);
|
Log.d(TAG, "verifyPhoneNumber:" + phoneNumber);
|
||||||
|
|
||||||
if (activity != null) {
|
PhoneAuthProvider.OnVerificationStateChangedCallbacks callbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
|
||||||
PhoneAuthProvider.getInstance(firebaseAuth).verifyPhoneNumber(phoneNumber, timeout, TimeUnit.SECONDS,
|
|
||||||
activity, new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onVerificationCompleted(final PhoneAuthCredential phoneAuthCredential) {
|
public void onVerificationCompleted(final PhoneAuthCredential phoneAuthCredential) {
|
||||||
@ -749,10 +747,18 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
|
|||||||
|
|
||||||
Parcel parcel = Parcel.obtain();
|
Parcel parcel = Parcel.obtain();
|
||||||
phoneAuthCredential.writeToParcel(parcel, 0);
|
phoneAuthCredential.writeToParcel(parcel, 0);
|
||||||
// TODO Read values - to get verification id
|
|
||||||
|
// verificationId
|
||||||
|
parcel.setDataPosition(16);
|
||||||
|
String verificationId = parcel.readString();
|
||||||
|
|
||||||
|
// sms Code
|
||||||
|
parcel.setDataPosition(parcel.dataPosition() + 8);
|
||||||
|
String code = parcel.readString();
|
||||||
|
|
||||||
|
state.putString("code", code);
|
||||||
|
state.putString("verificationId", verificationId);
|
||||||
parcel.recycle();
|
parcel.recycle();
|
||||||
state.putString("code", phoneAuthCredential.getSmsCode());
|
|
||||||
state.putString("verificationId", "");
|
|
||||||
sendPhoneStateEvent(appName, requestKey, "onVerificationComplete", state);
|
sendPhoneStateEvent(appName, requestKey, "onVerificationComplete", state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -769,9 +775,22 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCodeSent(String verificationId, PhoneAuthProvider.ForceResendingToken forceResendingToken) {
|
public void onCodeSent(String verificationId, PhoneAuthProvider.ForceResendingToken forceResendingToken) {
|
||||||
// todo forceResendingToken ?
|
|
||||||
Log.d(TAG, "verifyPhoneNumber:verification:onCodeSent");
|
Log.d(TAG, "verifyPhoneNumber:verification:onCodeSent");
|
||||||
WritableMap state = Arguments.createMap();
|
WritableMap state = Arguments.createMap();
|
||||||
|
state.putString("verificationId", verificationId);
|
||||||
|
|
||||||
|
// todo forceResendingToken - it's actually just an empty class ... no actual token >.>
|
||||||
|
// Parcel parcel = Parcel.obtain();
|
||||||
|
// forceResendingToken.writeToParcel(parcel, 0);
|
||||||
|
//
|
||||||
|
// // verificationId
|
||||||
|
// parcel.setDataPosition(0);
|
||||||
|
// int int1 = parcel.readInt();
|
||||||
|
// String token = parcel.readString();
|
||||||
|
//
|
||||||
|
// state.putString("refreshToken", token);
|
||||||
|
// parcel.recycle();
|
||||||
|
|
||||||
state.putString("verificationId", verificationId);
|
state.putString("verificationId", verificationId);
|
||||||
sendPhoneStateEvent(appName, requestKey, "onCodeSent", state);
|
sendPhoneStateEvent(appName, requestKey, "onCodeSent", state);
|
||||||
}
|
}
|
||||||
@ -784,7 +803,18 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
|
|||||||
state.putString("verificationId", verificationId);
|
state.putString("verificationId", verificationId);
|
||||||
sendPhoneStateEvent(appName, requestKey, "onCodeAutoRetrievalTimeout", state);
|
sendPhoneStateEvent(appName, requestKey, "onCodeAutoRetrievalTimeout", state);
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if (activity != null) {
|
||||||
|
PhoneAuthProvider.getInstance(firebaseAuth)
|
||||||
|
.verifyPhoneNumber(
|
||||||
|
phoneNumber,
|
||||||
|
timeout,
|
||||||
|
TimeUnit.SECONDS,
|
||||||
|
activity,
|
||||||
|
callbacks
|
||||||
|
// ,PhoneAuthProvider.ForceResendingToken.zzboe() // TODO FORCE RESENDING
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,12 +173,12 @@ export default class PhoneAuthListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal code sent event handler
|
* Internal code sent event handler
|
||||||
* @param verificationId
|
|
||||||
* @private
|
* @private
|
||||||
|
* @param credential
|
||||||
*/
|
*/
|
||||||
_codeSentHandler(verificationId) {
|
_codeSentHandler(credential) {
|
||||||
const snapshot: PhoneAuthSnapshot = {
|
const snapshot: PhoneAuthSnapshot = {
|
||||||
verificationId,
|
verificationId: credential.verificationId,
|
||||||
code: null,
|
code: null,
|
||||||
error: null,
|
error: null,
|
||||||
state: 'sent',
|
state: 'sent',
|
||||||
@ -198,12 +198,12 @@ export default class PhoneAuthListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal code auto retrieve timeout event handler
|
* Internal code auto retrieve timeout event handler
|
||||||
* @param verificationId
|
|
||||||
* @private
|
* @private
|
||||||
|
* @param credential
|
||||||
*/
|
*/
|
||||||
_codeAutoRetrievalTimeoutHandler(verificationId) {
|
_codeAutoRetrievalTimeoutHandler(credential) {
|
||||||
const snapshot: PhoneAuthSnapshot = {
|
const snapshot: PhoneAuthSnapshot = {
|
||||||
verificationId,
|
verificationId: credential.verificationId,
|
||||||
code: null,
|
code: null,
|
||||||
error: null,
|
error: null,
|
||||||
state: 'timeout',
|
state: 'timeout',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user