-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Set auth language #654 #655
Conversation
lib/modules/auth/index.js
Outdated
* @returns {*} | ||
*/ | ||
useDeviceLanguage() { | ||
return this._native.useDeviceLanguage(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to return here or on languageCode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes!
lib/modules/auth/index.js
Outdated
* Sets the language for the auth module using the device language | ||
* @returns {*} | ||
*/ | ||
useDeviceLanguage() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some flow typings?
/** | ||
* Gets/Sets the language for the app instance | ||
*/ | ||
languageCode: string | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @chrisbianca not sure how to do a getter/setter in TypeScript...? This works for the getter but not sure if it's moan when trying to set it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ehesp it is ok, languageCode
is a read/write property, the implementation is hidden.
@ecirish - I said this on discord, but I'll note it here as well. Using auth.languageCode = 'en' - would sent a firebase email in english. But using auth().useDeviceLanguage() would default to firebase's project default and not the device language. On Android this seems to behave correctly. It would be good if someone else tests useDeviceLanguage() on iOS as well before we merge this. |
If that is the case, it seems as though it's a Firebase issue? The code on our end is quite simple:
I'll try and confirm this, but if it is different to Android then we have another discepancy. |
I know it seems to be a firebase issue and if it really is - then we can add it to the notes and also submit a bug report to firebase. If we just ship it as it is and it doesn't work, then other people will waste time on this as well :( |
@compojoom We discussed this yesterday internally, for the time being we're just going to support A workaround would be to use another lib to grab the device language and set it via |
Ok, so when is 3.2.1 coming out :) |
* @param appName | ||
*/ | ||
@ReactMethod | ||
public void useDeviceLanguage(String appName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Salakar @chrisbianca should I leave the native ones here for the time being? JS currently flags as unsupported due to Firebase issue, but no harm in them being here?
@compojoom can confirm the iOS issue! Just need to sort one last thing and should be ready to get merged. |
cc @chrisbianca @Salakar All good to merge is you chaps are happy |
lib/utils/index.js
Outdated
@@ -340,6 +340,30 @@ export function nativeToJSError(code: string, message: string, additionalProps?: | |||
return error; | |||
} | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has moved to lib/utils/native.js so doesn't need to be here anymore - I assume this was from a merge?
lib/modules/auth/index.js
Outdated
@@ -342,6 +353,14 @@ export default class Auth extends ModuleBase { | |||
return this._user; | |||
} | |||
|
|||
get namespace(): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed that this is no longer required either.
This PR gives the ability to set the language for the auth module, or use the device language. Usage is the same as the web sdk:
https://firebase.google.com/docs/auth/web/manage-users#send_a_password_reset_email