[auth][android] misc cleanup/todo notes on verifyPhoneNumber

This commit is contained in:
Salakar 2017-09-30 20:08:02 +01:00
parent d7a832b7c7
commit c9b49d4b7a
1 changed files with 76 additions and 54 deletions

View File

@ -738,9 +738,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
Log.d(TAG, "verifyPhoneNumber:" + phoneNumber);
if (activity != null) {
PhoneAuthProvider.getInstance(firebaseAuth).verifyPhoneNumber(phoneNumber, timeout, TimeUnit.SECONDS,
activity, new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
PhoneAuthProvider.OnVerificationStateChangedCallbacks callbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
@Override
public void onVerificationCompleted(final PhoneAuthCredential phoneAuthCredential) {
@ -777,9 +775,22 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
@Override
public void onCodeSent(String verificationId, PhoneAuthProvider.ForceResendingToken forceResendingToken) {
// todo forceResendingToken ?
Log.d(TAG, "verifyPhoneNumber:verification:onCodeSent");
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);
sendPhoneStateEvent(appName, requestKey, "onCodeSent", state);
}
@ -792,7 +803,18 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
state.putString("verificationId", verificationId);
sendPhoneStateEvent(appName, requestKey, "onCodeAutoRetrievalTimeout", state);
}
});
};
if (activity != null) {
PhoneAuthProvider.getInstance(firebaseAuth)
.verifyPhoneNumber(
phoneNumber,
timeout,
TimeUnit.SECONDS,
activity,
callbacks
// ,PhoneAuthProvider.ForceResendingToken.zzboe() // TODO FORCE RESENDING
);
}
}