[auth][android] Add methods to set the auth language via code or device language

This commit is contained in:
Elliot Hesp 2017-11-30 10:02:01 +00:00
parent c81a786014
commit 8511705d8e
2 changed files with 43 additions and 0 deletions

View File

@ -1129,6 +1129,7 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
/** /**
* fetchProvidersForEmail * fetchProvidersForEmail
* *
* @param appName
* @param promise * @param promise
*/ */
@ReactMethod @ReactMethod
@ -1163,6 +1164,31 @@ class RNFirebaseAuth extends ReactContextBaseJavaModule {
}); });
} }
/**
* Set the language code for the auth module
* @param appName
* @param code
*/
@ReactMethod
public void setLanguageCode(String appName, String code) {
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp);
firebaseAuth.setLanguageCode(code);
}
/**
* Use the device language
* @param appName
*/
@ReactMethod
public void useDeviceLanguage(String appName) {
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp);
firebaseAuth.useAppLanguage();
}
/* ------------------ /* ------------------
* INTERNAL HELPERS * INTERNAL HELPERS
* ---------------- */ * ---------------- */

View File

@ -322,6 +322,23 @@ export default class Auth extends ModuleBase {
return this._native.fetchProvidersForEmail(email); return this._native.fetchProvidersForEmail(email);
} }
/**
* Sets the language for the auth module using the device language
* @returns {*}
*/
useDeviceLanguage() {
return this._native.useDeviceLanguage();
}
/**
* Sets the language for the auth module
* @param code
* @returns {*}
*/
set languageCode(code) {
return this._native.setLanguageCode(code);
}
/** /**
* Get the currently signed in user * Get the currently signed in user
* @return {Promise} * @return {Promise}