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

Deep link to add secondary login in OldDot #6319

Merged
merged 4 commits into from
Nov 19, 2021

Conversation

luacmartins
Copy link
Contributor

@luacmartins luacmartins commented Nov 16, 2021

This PR is a copy of #6176. I forgot to add a hold on the previous PR and it was merged before it should have been and we reverted it.

cc @mountiny

Details

Copy changes to Issue corporate cards and Connect bank account page and deep-linking to Add secondary login in OldDot.

Fixed Issues

https://github.com/Expensify/Expensify/issues/182071 (partial)

Tests

  1. Create an account using a public domain, e.g @gmail.com
  2. Follow the steps in this SO to add an "OPEN" bank account.
  3. When you reach the last step, verify the following:
  • Copy

This bank account will be used to reimburse expenses, collect invoices, and pay bills all from the same account. Please add a work email address as a secondary login to enable the Expensify Card.

  • Button

Add work email address

  1. Click the button and verify that it opens new browser tab on OldDot and directs user to Settings > Account Details > Add secondary login with the secondary login modal open.
  2. Go back to NewDot and navigate to Settings > Select Workspace > Issue corporate cards.
  3. Verify that the following:
  • Copy

Add a work email address to issue unlimited Expensify Cards for your workspace members, as well as all of these incredible benefits:

Up to 2% cash back
Digital and physical cards
No personal liability
Customizable limits

  • Button

Add work email address

  1. Click the button and verify that it opens new browser tab on OldDot and directs user to Settings > Account Details > Add secondary login with the secondary login modal open.

QA Steps

Steps above.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

web-1

web-2

Mobile Web

mweb-1

mweb-2

Desktop

desktop-1

desktop-2

iOS

ios-1

ios-2

Android

android-1

andorid-2

@luacmartins luacmartins self-assigned this Nov 16, 2021
@luacmartins luacmartins marked this pull request as ready for review November 16, 2021 03:34
@luacmartins luacmartins requested a review from a team as a code owner November 16, 2021 03:34
@MelvinBot MelvinBot requested review from Jag96 and removed request for a team November 16, 2021 03:34
mountiny
mountiny previously approved these changes Nov 16, 2021
Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved it once, gonna approve it again 😅

Copy link
Contributor

@Jag96 Jag96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of questions, otherwise looks good!

* Subscribes to Expensify Card updates when checking loginList for private domains
*/
function subscribeToExpensifyCardUpdates() {
const pusherChannelName = `private-user-accountID-${currentUserAccountID}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we use the same in subscribeToUserEvents, can we consolidate those somehow? Also, is there a reason we don't need to check if currentUserAccountID exists in this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a one-time only subscription that happens when the user clicks the Add work email address link. Adding it to subscribeToUserEvents would subscribe users prematurely and unnecessarily.

I didn't add the check because when the user subscribes to this event we should have a currentUserAccountID. That is different from subscribeToUserEvents because subscribeToUserEvents is called upon login and race conditions could cause currentUserAccountID to be undefined. With that being said, I'll add the check just to be safe.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, thanks for the explanation!

// Handle Expensify Card approval flow updates
Pusher.subscribe(pusherChannelName, Pusher.TYPE.EXPENSIFY_CARD_UPDATE, (pushJSON) => {
if (pushJSON.isUsingExpensifyCard) {
Onyx.merge(ONYXKEYS.USER, {isUsingExpensifyCard: pushJSON.isUsingExpensifyCard, isCheckingDomain: null});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we set isCheckingDomain to null instead of false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting it to null should delete the key from Onyx. Since this is a one-time only event, I felt like it was better to remove the key than leave it set as false.

@mountiny mountiny self-requested a review November 16, 2021 23:03
@luacmartins luacmartins changed the title [Hold Web-E #32333] Deep link to add secondary login in OldDot Deep link to add secondary login in OldDot Nov 19, 2021
@luacmartins
Copy link
Contributor Author

No longer on hold! Self-merging since it was approved.

@luacmartins luacmartins merged commit ceba16f into main Nov 19, 2021
@luacmartins luacmartins deleted the cmartins-autoApproveTriggerCleanUp branch November 19, 2021 17:12
@OSBotify
Copy link
Contributor

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

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @luacmartins in version: 1.1.15-18 🚀

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

github-actions bot pushed a commit that referenced this pull request Nov 23, 2021
…eanUp

Deep link to add secondary login in OldDot

(cherry picked from commit ceba16f)
luacmartins added a commit that referenced this pull request Nov 23, 2021
…ng-6319

🍒 Cherry pick PR #6319 to staging 🍒
@OSBotify
Copy link
Contributor

🚀 Cherry-picked to staging by @roryabraham in version: 1.1.16-6 🚀

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

@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes.

@isagoico
Copy link

isagoico commented Nov 24, 2021

We found this issue when retesting this on Android #6457. I don't think this PR is the culprit do so checking it off. Tested this on Android via adding the bank account through web and then logging into that same account in Android.

@isagoico
Copy link

@luacmartins @Jag96 Question about the OldDot redirection. This is expected to open this mWeb page right? I ask because OldDot is messy sometimes in mWeb (in this case it looks ok but I wanted to confirm if this was the expected behaviour)

@luacmartins
Copy link
Contributor Author

Hi @isagoico! Yes, that is the expected behavior as of now. Thanks for confirming!

@isagoico
Copy link

isagoico commented Nov 25, 2021

@luacmartins Hello! This issue was found while executing this PR in iOS #6475 and it's currently failing QA for iOS - It's a different behaviour from what we have in Android. Can you give it a look 🙇‍♀️

@luacmartins
Copy link
Contributor Author

Hi @isagoico! I put up a fix for it #6479. Thanks for bringing this up to my attention!

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @roryabraham in version: 1.1.16-10 🚀

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

1 similar comment
@OSBotify
Copy link
Contributor

🚀 Deployed to production by @roryabraham in version: 1.1.16-10 🚀

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

@mananjadhav
Copy link
Collaborator

I am tagging this PR to highlight an issue fixed here. All conditions in ternary expressions or left-hand operands on conditional renders, should be boolean. This PR is one of the PRs that uses conditional render with string operands, hence I am tagging it here for the contributors to check.

We've also updated the item in the checklist with this PR to avoid this issue in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants