diff --git a/packages/auth/android/src/main/java/io/invertase/firebase/auth/ReactNativeFirebaseAuthModule.java b/packages/auth/android/src/main/java/io/invertase/firebase/auth/ReactNativeFirebaseAuthModule.java index d9e75fdf7a..c88af12ed2 100644 --- a/packages/auth/android/src/main/java/io/invertase/firebase/auth/ReactNativeFirebaseAuthModule.java +++ b/packages/auth/android/src/main/java/io/invertase/firebase/auth/ReactNativeFirebaseAuthModule.java @@ -243,6 +243,23 @@ public void setAutoRetrievedSmsCodeForPhoneNumber( promise.resolve(null); } + /** + * Disable app verification for the running of tests + * @param appName + * @param disabled + * @param promise + */ + @ReactMethod + public void setAppVerificationDisabledForTesting( + String appName, boolean disabled, Promise promise) { + Log.d(TAG, "setAppVerificationDisabledForTesting"); + FirebaseApp firebaseApp = FirebaseApp.getInstance(appName); + FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp); + FirebaseAuthSettings firebaseAuthSettings = firebaseAuth.getFirebaseAuthSettings(); + firebaseAuthSettings.setAppVerificationDisabledForTesting(disabled); + promise.resolve(null); + } + @ReactMethod public void signOut(String appName, Promise promise) { FirebaseApp firebaseApp = FirebaseApp.getInstance(appName); diff --git a/packages/auth/lib/Settings.js b/packages/auth/lib/Settings.js index 47177fc19a..67616872e3 100644 --- a/packages/auth/lib/Settings.js +++ b/packages/auth/lib/Settings.js @@ -15,7 +15,7 @@ * */ -import { isAndroid, isIOS } from '@react-native-firebase/app/lib/common'; +import { isAndroid } from '@react-native-firebase/app/lib/common'; export default class Settings { constructor(auth) { @@ -28,10 +28,8 @@ export default class Settings { } set appVerificationDisabledForTesting(disabled) { - if (isIOS) { - this._appVerificationDisabledForTesting = disabled; - this._auth.native.setAppVerificationDisabledForTesting(disabled); - } + this._appVerificationDisabledForTesting = disabled; + this._auth.native.setAppVerificationDisabledForTesting(disabled); } setAutoRetrievedSmsCodeForPhoneNumber(phoneNumber, smsCode) { diff --git a/packages/auth/lib/index.d.ts b/packages/auth/lib/index.d.ts index e08461cd21..1a7df09981 100644 --- a/packages/auth/lib/index.d.ts +++ b/packages/auth/lib/index.d.ts @@ -826,11 +826,10 @@ export namespace FirebaseAuthTypes { */ export interface AuthSettings { /** - * iOS only flag to disable app verification for the purpose of testing phone authentication. For this property to take effect, it needs to be set before rendering a reCAPTCHA app verifier. When this is disabled, a mock reCAPTCHA is rendered instead. This is useful for manual testing during development or for automated integration tests. + * Flag to disable app verification for the purpose of testing phone authentication. For this property to take effect, it needs to be set before rendering a reCAPTCHA app verifier. When this is disabled, a mock reCAPTCHA is rendered instead. This is useful for manual testing during development or for automated integration tests. * * > In order to use this feature, you will need to [whitelist your phone number](https://firebase.google.com/docs/auth/web/phone-auth#test-with-whitelisted-phone-numbers) via the Firebase Console. * - * @ios * @param disabled Boolean value representing whether app verification should be disabled for testing. */ appVerificationDisabledForTesting: boolean;