diff --git a/RNFBAuth.podspec b/RNFBAuth.podspec index caeb2ddb90..f344482b0e 100644 --- a/RNFBAuth.podspec +++ b/RNFBAuth.podspec @@ -19,5 +19,5 @@ Pod::Spec.new do |s| s.dependency 'Firebase/Core', '~> 6.5.0' s.dependency 'Firebase/Auth', '~> 6.5.0' s.dependency 'RNFBApp' - s.static_framework = true + s.static_framework = false end diff --git a/android/build.gradle b/android/build.gradle index f0c01d1a19..e67dfa4c5c 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -4,7 +4,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.4.0' + classpath 'com.android.tools.build:gradle:3.4.2' } } @@ -24,12 +24,8 @@ project.ext { buildTools: "28.0.3" ], - googlePlayServices: [ - base: "16.1.0", - ], - firebase : [ - auth: "17.0.0" + bom : "21.1.0", ], ], ]) @@ -56,8 +52,8 @@ repositories { dependencies { api project(':@react-native-firebase_app') - implementation "com.google.firebase:firebase-auth:${ReactNative.ext.getVersion("firebase", "auth")}" - implementation "com.google.android.gms:play-services-base:${ReactNative.ext.getVersion("googlePlayServices", "base")}" + implementation platform("com.google.firebase:firebase-bom:${ReactNative.ext.getVersion("firebase", "bom")}") + implementation "com.google.firebase:firebase-auth" } ReactNative.shared.applyPackageVersion() diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index c877ea65b7..a10588d9dc 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip diff --git a/e2e/auth.e2e.js b/e2e/auth.e2e.js index f306afa260..0907bab76c 100644 --- a/e2e/auth.e2e.js +++ b/e2e/auth.e2e.js @@ -81,7 +81,7 @@ describe('auth()', () => { describe('signInWithCustomToken()', () => { // TODO(salakar) use new testing api to create a custom token xit('signs in with a admin sdk created custom auth token', async () => { - const customUID = `zdwHCjbpzraRoNK7d64FYWv5AH02`; + const customUID = 'zdwHCjbpzraRoNK7d64FYWv5AH02'; const token = await firebaseAdmin.auth().createCustomToken(customUID, { test: null, roles: [ @@ -762,17 +762,14 @@ describe('auth()', () => { describe('languageCode', () => { it('it should change the language code', () => { - // eslint-disable-next-line no-param-reassign firebase.auth().languageCode = 'en'; if (firebase.auth().languageCode !== 'en') { throw new Error('Expected language code to be "en".'); } - // eslint-disable-next-line no-param-reassign firebase.auth().languageCode = 'fr'; if (firebase.auth().languageCode !== 'fr') { throw new Error('Expected language code to be "fr".'); } - // eslint-disable-next-line no-param-reassign firebase.auth().languageCode = 'en'; }); }); @@ -811,9 +808,7 @@ describe('auth()', () => { it('should not error', async () => { const random = Utils.randString(12, '#aA'); const email = `${random}@${random}.com`; - const pass = random; - - await firebase.auth().createUserWithEmailAndPassword(email, pass); + await firebase.auth().createUserWithEmailAndPassword(email, random); try { await firebase.auth().sendPasswordResetEmail(email); diff --git a/ios/RNFBAuth.podspec b/ios/RNFBAuth.podspec index 0f9dac1ffc..fa9e25bd30 100644 --- a/ios/RNFBAuth.podspec +++ b/ios/RNFBAuth.podspec @@ -19,5 +19,5 @@ Pod::Spec.new do |s| s.dependency 'Firebase/Core', '~> 6.5.0' s.dependency 'Firebase/Auth', '~> 6.5.0' s.dependency 'RNFBApp' - s.static_framework = true + s.static_framework = false end diff --git a/lib/PhoneAuthListener.js b/lib/PhoneAuthListener.js index 4a0e3b2c3d..3260bb8acd 100644 --- a/lib/PhoneAuthListener.js +++ b/lib/PhoneAuthListener.js @@ -80,12 +80,16 @@ export default class PhoneAuthListener { _emitToErrorCb(snapshot) { const { error } = snapshot; - if (this._reject) this._reject(error); + if (this._reject) { + this._reject(error); + } this._auth.emitter.emit(this._publicEvents.error, error); } _emitToSuccessCb(snapshot) { - if (this._resolve) this._resolve(snapshot); + if (this._resolve) { + this._resolve(snapshot); + } this._auth.emitter.emit(this._publicEvents.success, snapshot); } @@ -105,7 +109,9 @@ export default class PhoneAuthListener { } _promiseDeferred() { - if (!this._promise) this._promise = promiseDefer(); + if (!this._promise) { + this._promise = promiseDefer(); + } } /* -------------------------- @@ -179,13 +185,13 @@ export default class PhoneAuthListener { on(event, observer, errorCb, successCb) { if (event !== 'state_changed') { throw new Error( - `firebase.auth.PhoneAuthListener.on(*, _, _, _) 'event' must equal 'state_changed'.`, + "firebase.auth.PhoneAuthListener.on(*, _, _, _) 'event' must equal 'state_changed'.", ); } if (!isFunction(observer)) { throw new Error( - `firebase.auth.PhoneAuthListener.on(_, *, _, _) 'observer' must be a function.`, + "firebase.auth.PhoneAuthListener.on(_, *, _, _) 'observer' must be a function.", ); } @@ -204,13 +210,17 @@ export default class PhoneAuthListener { then(fn) { this._promiseDeferred(); - if (this._promise) return this._promise.then.bind(this._promise)(fn); + if (this._promise) { + return this._promise.then.bind(this._promise)(fn); + } return undefined; } catch(fn) { this._promiseDeferred(); - if (this._promise) return this._promise.catch.bind(this._promise)(fn); + if (this._promise) { + return this._promise.catch.bind(this._promise)(fn); + } return undefined; } } diff --git a/lib/index.js b/lib/index.js index 46eee820ff..767381ca76 100644 --- a/lib/index.js +++ b/lib/index.js @@ -102,7 +102,9 @@ class FirebaseAuthModule extends FirebaseModule { } get settings() { - if (!this._settings) this._settings = new Settings(this); + if (!this._settings) { + this._settings = new Settings(this); + } return this._settings; } @@ -134,7 +136,9 @@ class FirebaseAuthModule extends FirebaseModule { listener, ); - if (this._authResult) listener(this._user || null); + if (this._authResult) { + listener(this._user || null); + } return () => subscription.remove(); } @@ -144,13 +148,17 @@ class FirebaseAuthModule extends FirebaseModule { listener, ); - if (this._authResult) listener(this._user || null); + if (this._authResult) { + listener(this._user || null); + } return () => subscription.remove(); } onUserChanged(listener) { const subscription = this.emitter.addListener(this.eventNameForApp('onUserChanged'), listener); - if (this._authResult) listener(this._user || null); + if (this._authResult) { + listener(this._user || null); + } return () => { subscription.remove();