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

fix: navigation for exisiting report screen #5131

Merged
merged 7 commits into from
Oct 18, 2021

Conversation

parasharrajat
Copy link
Member

@parasharrajat parasharrajat commented Sep 8, 2021

Details

Fixed Issues

$ #4545

Tests | QA Steps

  1. Open New Dot on Mobile.
  2. Go to Settings -> About.
  3. Click on Report a bug.
  4. Concierge chat will be opened now.
  5. Now repeat steps 1 & 2.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web | Desktop

report-wd.mp4

Mobile Web

report-m.mp4

iOS

Android

report-a.mp4

@parasharrajat parasharrajat requested a review from a team as a code owner September 8, 2021 08:18
@MelvinBot MelvinBot requested review from marcaaron and removed request for a team September 8, 2021 08:18
@@ -24,7 +24,19 @@ function pushDrawerRoute(screenName, params, navigationRef) {

if (activeReportID === params.reportID) {
if (state.type !== 'drawer') {
navigationRef.current.dispatch(StackActions.pop());
navigationRef.current.dispatch(() => {
// If there are multiple routes then we can pop back to the first route
Copy link
Contributor

Choose a reason for hiding this comment

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

This code looks familiar... 😄

Are you OK with just copying and pasting things from other places?
Or should we think of a better way to handle this duplication?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry about that. I just found this to be straight to start with this. I can definitely refactor it into a function. 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure the best way to dry this up. I can basically call the DismissModal here instead. It does basically the same thing. What do you suggest?

Copy link
Contributor

Choose a reason for hiding this comment

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

Please take some time to look into it and propose some options?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. Thanks.

Copy link
Member Author

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

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

Code Updated. Please review.

Comment on lines -142 to -172
// Navigate back to where we were before we launched the modal
goBack(shouldOpenDrawer);

if (!normalizedShouldOpenDrawer) {
return;
}

openDrawer();
Copy link
Member Author

Choose a reason for hiding this comment

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

@marcaaron I didn't understand this part. Why were this code opening Drawer two times?

  1. via goback when shouldOpenDrawer is true.
  2. Then OpenDrawer call which happens when shouldOpenDrawer is true.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you rephrase this question? I'm not really sure what you are asking.

Copy link
Member Author

@parasharrajat parasharrajat Sep 14, 2021

Choose a reason for hiding this comment

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

I looked at the code. It seems to me that this piece of code was calling openDrawer two times.

  1. Via goback when shouldOpenDrawer is true.
  2. Then OpenDrawer call which happens when shouldOpenDrawer is true.

Or am I wrong?

@marcaaron
Copy link
Contributor

Just a heads up this is very far down my list of priorities and will take some time to review.
Most likely I will be able to get to it within 2 weeks.

@kadiealexander
Copy link
Contributor

Hi @parasharrajat, I've placed this issue on hold as per this update, as we are prioritising issues related to a feature release scheduled for 9/24. As an apology for the delay, we will add a $100 bonus as a thank you for waiting.

@parasharrajat
Copy link
Member Author

@marcaaron Ready for review.

Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

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

Really like the clean up here and eliminating the need to explicitly call Navigation.dismissModal() in some places. But I have some thoughts and suggestions about how to make the code clearer.

* Go back to the Main Drawer
* @param {Object} navigationRef
*/
function navigateBackToDrawer(navigationRef) {
Copy link
Contributor

@marcaaron marcaaron Oct 18, 2021

Choose a reason for hiding this comment

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

I'm having trouble with this name because it implies we are calling this when the drawer is not active. It looks like something I would call if I was not on the drawer to take me back to the drawer. However, if you look we also have logic for handling when a nested drawer is active.

Ultimately, I find handling both responsibilities confusing and would love to figure out an alternative.

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't find any good name for this method. To me, it seems to do multiple things. But I just removed the duplicate behaviour from our navigation and put it into one method. I found it difficult to break this into two and still abstract away the duplicates.

I will try to find something cleaner.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok no worries. I think with the better naming this is acceptable now.

@@ -24,7 +60,7 @@ function pushDrawerRoute(screenName, params, navigationRef) {

if (activeReportID === params.reportID) {
if (state.type !== 'drawer') {
navigationRef.current.dispatch(StackActions.pop());
navigateBackToDrawer(navigationRef);
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing that sticks out to me is that we are checking state.type !== 'drawer' and then again checking in navigateBackToDrawer(). So it seems the method has more responsibility than it needs.

Copy link
Member Author

@parasharrajat parasharrajat Oct 18, 2021

Choose a reason for hiding this comment

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

Yeah. I think its more cleaner if we change the name to navigateBackToRootDrawer or navigateBackToReportDrawer.

if (state.type === 'drawer') {
isLeavingDrawerNavigator = true;
return StackActions.pop();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still have nested drawer navigators in use? I think we got rid of the one case. In any case, I think if we want to keep this logic we should make a distinction between a "nested drawer navigator" and a "main" or "root" drawer navigator.

Otherwise, these variable names are confusing. I understand this code but someone might have a thought like, "Why do we have isLeavingDrawerNavigator in a method called navigateBackToDrawer()? Shouldn't isLeavingDrawerNavigator always be false?" Maybe it should be isLeavingNestedDrawerNavigator instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I agree.

@marcaaron marcaaron removed the n6-hold label Oct 18, 2021
@marcaaron marcaaron self-requested a review October 18, 2021 21:46
Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

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

Thanks for the updates 👍

@marcaaron marcaaron merged commit e5fd8d4 into Expensify:main Oct 18, 2021
@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.

@@ -52,4 +88,5 @@ function pushDrawerRoute(screenName, params, navigationRef) {

export default {
pushDrawerRoute,
navigateBackToDrawer: navigateBackToRootDrawer,
Copy link
Member Author

@parasharrajat parasharrajat Oct 18, 2021

Choose a reason for hiding this comment

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

@marcaaron Oh, my editor messed it up. Should I send another PR now?

Copy link
Member Author

Choose a reason for hiding this comment

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

Follow up #5937

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @marcaaron in version: 1.1.8-10 🚀

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

@nazam100
Copy link

Accessibility issue: There is an color contrast issue in the chats page.
Color Contrast: Many Pages: Grey icons against white background fail contrast requirements #5506
The visual presentation of meaningful graphical objects or interactive components should have a contrast ratio of at least 3.00:1 with the surrounding background color.
The grey icons (#C6C9CA) on white background (#FFFFFF) have a color contrast ratio of 1.66:1.

Color Contrast- Grey icon fails color contrast issue against white background

@nazam100
Copy link

nazam100 commented Oct 28, 2021

Accessibility issue: WACG failure 1.3.1 info and relationship.
Actual Result: The screen reader is announcing the 'concierge button' name twice.
Expected Result: The screen reader should announce 'concierge button' name only once.

concierge.announces.twice.mp4

@nazam100
Copy link

nazam100 commented Oct 28, 2021

Accessibility issue: WACG failure 2.4.9 Link purpose
Actual Result: The screen reader is announcing the 'Phone button' as clickable
Expected Result: The screen reader should announce the 'Phone button' as phone button

2.4.9.phone.button.and.pin.button.is.not.descriptive.mp4

Other occurrences:

2.4.9.phone.button.and.pin.button.is.not.descriptive.emoji.and.send.button.mp4

@nazam100
Copy link

nazam100 commented Oct 28, 2021

Accessibility issue: WACG failure 2.4.3 Focus order meaning.
Actual Result: The focus is not in the meaningful sequence.
Expected Result: The focus should be in the meaningful sequences

2.4.3.focus.moving.to.the.hidden.content.mp4

Other Occurrences:

2.4.3.focus.is.moving.to.the.dectrative.content.mp4
focus.moves.to.the.hidden.content.mp4

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @roryabraham in version: 1.1.10-2 🚀

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

@@ -83,7 +83,6 @@ class EnableStep extends React.Component {
title: translate('workspace.bankAccount.chatWithConcierge'),
icon: ChatBubble,
onPress: () => {
Navigation.dismissModal();
Copy link
Contributor

Choose a reason for hiding this comment

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

Comming from #34456, remove dismiss modal here potential causes that bug.

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