[android][auth] add support for `ForceResendingToken`, closes #721

This commit is contained in:
Salakar 2018-07-08 16:31:41 +01:00
parent 91a9c4744c
commit 3668f15244
2 changed files with 15 additions and 6 deletions

2
lib/index.d.ts vendored
View File

@ -953,7 +953,7 @@ declare module 'react-native-firebase' {
*/
verifyPhoneNumber(
phoneNumber: string,
autoVerifyTimeout?: number,
autoVerifyTimeoutOrForceResend?: number | boolean,
forceResend?: boolean,
): PhoneAuthListener;

View File

@ -5,7 +5,7 @@
import User from './User';
import ModuleBase from '../../utils/ModuleBase';
import { getAppEventName, SharedEventEmitter } from '../../utils/events';
import { isAndroid } from '../../utils';
import { isAndroid, isBoolean } from '../../utils';
import { getLogger } from '../../utils/log';
import { getNativeModule } from '../../utils/native';
import INTERNALS from '../../utils/internals';
@ -376,20 +376,29 @@ export default class Auth extends ModuleBase {
* authentication purposes.
*
* @param phoneNumber
* @param autoVerifyTimeout Android Only
* @param autoVerifyTimeoutOrForceResend Android Only
* @param forceResend Android Only
* @returns {PhoneAuthListener}
*/
verifyPhoneNumber(
phoneNumber: string,
autoVerifyTimeout?: number,
autoVerifyTimeoutOrForceResend?: number | boolean,
forceResend?: boolean
): PhoneAuthListener {
let _forceResend = forceResend;
let _autoVerifyTimeout = 60;
if (isBoolean(autoVerifyTimeoutOrForceResend)) {
_forceResend = autoVerifyTimeoutOrForceResend;
} else {
_autoVerifyTimeout = autoVerifyTimeoutOrForceResend;
}
return new PhoneAuthListener(
this,
phoneNumber,
autoVerifyTimeout,
forceResend
_autoVerifyTimeout,
_forceResend
);
}