Skip to content
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

[HOLD for payment 2021-09-15] Language getting automatically set to English while signing in #4507

Closed
thesahindia opened this issue Aug 9, 2021 · 30 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@thesahindia
Copy link
Member

thesahindia commented Aug 9, 2021

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Your language should be set to Spanish
  2. Go to signin page
  3. Enter any email address or phone number
  4. Try to go back to the signin page by clicking on the link below
  5. Language will be set to English

Expected Result:

Language should not change

Actual Result:

Capture

image

Workaround:

No, Spanish Users might find it hard to navigate.

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Version Number:
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL:

View all open jobs on Upwork

@thesahindia thesahindia added AutoAssignerTriage Auto assign issues for triage to an available triage team member Daily KSv2 labels Aug 9, 2021
@MelvinBot
Copy link

Triggered auto assignment to @sonialiap (AutoAssignerTriage), see https://stackoverflow.com/c/expensify/questions/4749 for more details.

@MelvinBot MelvinBot removed the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Aug 9, 2021
@thesahindia
Copy link
Member Author

Proposal

We need to preserve the locale inside restartSignin function

I can do this by connecting to Onyx for current locale and use this block of code inside restartSignin function

const preferredLocale = currentPreferredLocale;
Onyx.clear().then(() => {
if (preferredLocale) {
Onyx.set(ONYXKEYS.NVP_PREFERRED_LOCALE, preferredLocale);
}
});

@sonialiap sonialiap removed their assignment Aug 10, 2021
@MelvinBot
Copy link

Triggered auto assignment to @deetergp (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@deetergp deetergp added the External Added to denote the issue can be worked on by a contributor label Aug 12, 2021
@MelvinBot
Copy link

Triggered auto assignment to @arielgreen (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@deetergp
Copy link
Contributor

Definitely something a external contributor can do, and @thesahindia's proposal sounds good.

@MelvinBot MelvinBot removed the Overdue label Aug 12, 2021
@arielgreen
Copy link
Contributor

https://www.upwork.com/jobs/~01f7d2db5bd805d8ca

@MelvinBot MelvinBot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 13, 2021
@MelvinBot
Copy link

Triggered auto assignment to @tgolen (Exported), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@arielgreen
Copy link
Contributor

@tgolen can you review @thesahindia's proposal?

@thesahindia please also be sure to apply to the Upwork job here.

@thesahindia
Copy link
Member Author

@arielgreen Submitted the proposal 😄

@tgolen
Copy link
Contributor

tgolen commented Aug 16, 2021

I would like to request some changes to your proposal to increase the quality of the code.

I would suggest refactoring this code slightly so that there is only one method in the entire codebase in actions/Session.js which calls Onyx.clear() and it would be a place to handle all of the "need to keep this after clearing Onyx". We are currently only doing this properly in redirectToSignIn() by saving the local and the active clients key.

@MelvinBot MelvinBot removed the Overdue label Aug 16, 2021
@thesahindia
Copy link
Member Author

@tgolen
Hi, I want to know if it'd be a bad idea to just use redirectToSignIn instead of restartSignin since redirectToSignIn is handling this situation in a better way.

/**
* Clears the Onyx store and redirects to the sign in page.
* Normally this method would live in Session.js, but that would cause a circular dependency with Network.js.
*
* @param {String} [errorMessage] error message to be displayed on the sign in page
*/
function redirectToSignIn(errorMessage) {

Here it says that If we move this function to Session.js then it can cause circular dependency. So, maybe moving the logic to Session.js is not a good idea. Let me know your thoughts.

@tgolen
Copy link
Contributor

tgolen commented Aug 18, 2021

Yeah, I'd be fine with getting rid of restartSignin completely. Good suggestion! I understand about the circular dependency. It is OK to stay in its own file like that.

With that then, I think it's a complete proposal and I give the 🟢 to be hired for this @arielgreen.

@arielgreen
Copy link
Contributor

@thesahindia just sent over an offer! I also raised the price to include the bonus you'll receive for proposing AND fixing this.

@thesahindia
Copy link
Member Author

Thanks @arielgreen, I have accepted the offer!

@thesahindia
Copy link
Member Author

thesahindia commented Aug 19, 2021

@tgolen
I have one last query about the use of currentURL inside src/libs/actions/SignInRedirect.js .
We are using it here only.

if (!currentURL) {
return;
}

And then there's no use case of it.
However, on the login screen the currentURL will not be set to any value and will fail this condition.
We can fix this by giving it a default value of "/" or we can just remove currentURL from the file as I don't see any other use case of it.

Let me know what should be done here. Thanks!

Correction: Using a default value will not fix it as it's being set to the value of null .

@tgolen
Copy link
Contributor

tgolen commented Aug 20, 2021

It's entirely possible that currentURL can be removed completely. It was added in this PR to fix this GH. I think we need to be a little bit careful here because exitTo is still used in the VALIDATE_CODE_URL but it's used as a query parameter now as opposed to be part of the path. However, the VALIDATE_CODE_URL isn't used to construct a "new expensify" URL, it's used to construct a URL pointing to expensify.com.

So, I still think we are pretty safe to remove currentURL from this file, but you might want to double-check my investigation.

@tgolen
Copy link
Contributor

tgolen commented Aug 20, 2021

In fact, I really don't like that VALIDATE_CODE_URL lives in ROUTES.js since it isn't related to a route for New Expensify. Since it's only referenced once, I would just move the logic from ROUTES.js into App.js where it was being referenced. Would you mind cleaning that up?

@thesahindia
Copy link
Member Author

Sure, openSignedInLink will look like this after the clean-up.

function openSignedInLink(url = '') {
     API.GetAccountValidateCode().then((response) => {
     const exitToURL = url ? `exitTo=${url}` : '';
     const validateCodeUrl = `v/${currentUserAccountID}/${response.validateCode}${exitToURL}`;
     Linking.openURL(CONFIG.EXPENSIFY.URL_EXPENSIFY_COM + validateCodeUrl);
     });
}

@parasharrajat
Copy link
Member

parasharrajat commented Aug 20, 2021

Sure, openSignedInLink will look like this after the clean-up.

function openSignedInLink(url = '') {
     API.GetAccountValidateCode().then((response) => {
     const exitToURL = url ? `exitTo=${url}` : '';
     const validateCodeUrl = `v/${currentUserAccountID}/${response.validateCode}${exitToURL}`;
     Linking.openURL(CONFIG.EXPENSIFY.URL_EXPENSIFY_COM + validateCodeUrl);
     });
}

Beware, This might be not working in Safari Mobile. Linking.openURL does not work here in the Async way. Please test it.

@thesahindia
Copy link
Member Author

thesahindia commented Aug 20, 2021

Oh, if this might break something then I think it's better to just leave it as it is?

@tgolen
Copy link
Contributor

tgolen commented Aug 20, 2021

I don't think we need to worry about Linking.openURL() in this issue. It was already there previously, so nothing is breaking worse than it was already broken before. @parasharrajat Is there an open issue yet for fixing openURL() for mobile safari? If not, let's get one created.

@thesahindia
Copy link
Member Author

Found this issue while testing the code.

For some reason, there's a delay in Android (but Web looks fine)

Android :

androidBug.mp4

Web :

video-2021-08-24_00.28.07.mp4

Not sure but it could be related to this issue #4513

@parasharrajat
Copy link
Member

It is not related to #4513

@arielgreen
Copy link
Contributor

@thesahindia can you please provide an update here?

@MelvinBot MelvinBot removed the Overdue label Sep 3, 2021
@thesahindia
Copy link
Member Author

thesahindia commented Sep 3, 2021

The PR is up. Just waiting for a reply here
Edit: Merged!

@botify
Copy link

botify commented Sep 3, 2021

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@botify
Copy link

botify commented Sep 4, 2021

🚀 Deployed to staging by @tgolen in version: 1.0.93-2 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@botify botify added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Sep 8, 2021
@botify botify changed the title Language getting automatically set to English while signing in [HOLD for payment 2021-09-15] Language getting automatically set to English while signing in Sep 8, 2021
@botify
Copy link

botify commented Sep 8, 2021

🚀 Deployed to production by @yuwenmemon in version: 1.0.94-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@tgolen
Copy link
Contributor

tgolen commented Sep 17, 2021

It's OK melvin. It's not overdue

@MelvinBot MelvinBot removed the Overdue label Sep 17, 2021
@arielgreen
Copy link
Contributor

Paid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Engineering External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
None yet
Development

No branches or pull requests

8 participants