-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add feature to delete unverified contact methods #54784
Conversation
@parasharrajat Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
src/pages/settings/Profile/Contacts/ContactMethodDetailsPage.tsx
Outdated
Show resolved
Hide resolved
@Shahidullah-Muffakir Let's fix the keyboard showing up when the remove modal is open. 08.01.2025_18.27.31_REC.mp4 |
@parasharrajat, Added the changes. |
@@ -273,6 +277,16 @@ function ContactMethodDetailsPage({route}: ContactMethodDetailsPageProps) { | |||
}} | |||
sendValidateCode={() => User.requestContactMethodValidateCode(contactMethod)} | |||
descriptionPrimary={translate('contacts.enterMagicCode', {contactMethod: formattedContactMethod})} | |||
shouldShowThreeDotsButton={isValidateCodeActionModalVisible} | |||
onThreeDotsButtonPress={() => blurActiveElement()} |
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.
Did you test it? There is no logic on native for this method.
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.
Yes, I tested it. The keyboard hides automatically on native when the user clicks the three-dot menu, so there's no need to use Keyboard.dismiss
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.
OK
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.
Sorry, I overlooked that after clicking the remove button. I applied blurActiveElement()
for web and Keyboard.dismiss()
for native. Retested on all platforms and added new screen recordings.
@Shahidullah-Muffakir There is app freezing issue on iOS. When I click the remove button, the second modal does not show but the app freezes. |
Oh, okay. Looking into it now. |
@parasharrajat Weird issue, keyboard is not showing at all in the Android emulator, not just in the Expensify app. Do you have any idea how to fix this? I've tried Cmd+Shift+K and Cmd+K, but nothing happens. |
Never mind, I found it. |
onThreeDotsButtonPress={() => { | ||
if (Platform.OS === 'web') { | ||
blurActiveElement(); | ||
} else { | ||
Keyboard.dismiss(); | ||
} | ||
}} |
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 please explain this change?
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 change hides the keyboard when the user clicks the three-dot menu:
blurActiveElement()
is used to hide the keyboard for mobile web.Keyboard.dismiss()
is used to hide the keyboard for native apps.
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.
Oh, did you mean I should add this as a comment in the code?
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, I wanted to understand the change. I noticed that there is a Keyboard lib in our codebase. It was created to handle Keyboard Avoidance view behavior. we should use that instead. There is a web implementation but I am not sure how that is working as keyboard.dismiss
is a mock function on the web.
blurActiveElement()
was created to blur the UI elements and remove focus from them so that also not very best suited for this keyboard dismissal. We should add a comment to this lib to clarify the purpose otherwise, incorrect use can cause issues.
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.
Remove the Platform === web check. We don't need it. we can call both methods together but add a comment explaining why both are used.
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.
Here
Keyboard
will be from our lib to support native. I think it will not cause any issue for web. Correct?
You mean
import { Keyboard} from 'react-native';
Keyboard.dismiss()
right?
Because using this works well in native, and not causing any issue in web.
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.
Nope,
import {Keyboard} from '@lib/util/Keyboard';
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.
Oh, is there any specific reason for using that? It returns a promise, which we don't need it in this scenario.
Also, we're using {Keyboard} from 'react-native'
across the app, and it works well in this case too
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.
Anyway, I've used the local lib 😄.
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.
Oh, is there any specific reason for using that?
As I mentioned, due the keyboard avoiding behaviour functionality.
…ent for web and KeyboardUtils.dismiss for native
Ok so the freezing issue is still not solved on iOS. Can you please check that again? |
Weird, I just retested it, and it's working well for me. Screen.Recording.2025-01-12.at.6.00.08.PM.mov |
Maybe merging main will help |
@Shahidullah-Muffakir Nope, I removed the node_modules, cleared react-native cache and fresh build the app. I still see free issue and remove modal does not show to me. Try to clean the cache and do a fresh build. |
Ok, let me try this |
Okay, Now I am also facing this issue after the rebuild, Any idea what might be causing this? I’m looking into it. |
…onfirmation modal
@parasharrajat, It works now, I used |
@Shahidullah-Muffakir Can you please share the vid? |
Sure Screen.Recording.2025-01-12.at.11.44.57.PM.mov |
Here is the iOS video: Screen.Recording.2025-01-12.at.11.51.15.PM.mov |
Screenshots🔲 iOS / native13.01.2025_01.41.27_REC.mp4🔲 iOS / Safari08.01.2025_17.45.32_REC.mp4🔲 MacOS / Desktop08.01.2025_17.35.37_REC.mp4🔲 MacOS / Chrome08.01.2025_17.27.56_REC.mp4🔲 Android / Chrome13.01.2025_01.50.02_REC.mp4🔲 Android / native13.01.2025_02.26.31_REC.mp4 |
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.
Reviewer Checklist
- I have verified the author checklist is complete (all boxes are checked off).
- I verified the correct issue is linked in the
### Fixed Issues
section above - I verified testing steps are clear and they cover the changes made in this PR
- I verified the steps for local testing are in the
Tests
section - I verified the steps for Staging and/or Production testing are in the
QA steps
section - I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
- I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
- I verified the steps for local testing are in the
- I checked that screenshots or videos are included for tests on all platforms
- I included screenshots or videos for tests on all platforms
- I verified tests pass on all platforms & I tested again on:
- Android: Native
- Android: mWeb Chrome
- iOS: Native
- iOS: mWeb Safari
- MacOS: Chrome / Safari
- MacOS: Desktop
- If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
- I verified proper code patterns were followed (see Reviewing the code)
- I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e.
toggleReport
and notonIconClick
). - I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g.
myBool && <MyComponent />
. - I verified that comments were added to code that is not self explanatory
- I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
- I verified any copy / text shown in the product is localized by adding it to
src/languages/*
files and using the translation method - I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
- I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the
Waiting for Copy
label for a copy review on the original GH to get the correct copy. - I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
- I verified the JSDocs style guidelines (in
STYLE.md
) were followed
- I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e.
- If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
- I verified that this PR follows the guidelines as stated in the Review Guidelines
- I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like
Avatar
, I verified the components usingAvatar
have been tested & I retested again) - I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
- I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
- If a new component is created I verified that:
- A similar component doesn't exist in the codebase
- All props are defined accurately and each prop has a
/** comment above it */
- The file is named correctly
- The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
- The only data being stored in the state is data necessary for rendering and nothing else
- For Class Components, any internal methods passed to components event handlers are bound to
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor) - Any internal methods bound to
this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
) - All JSX used for rendering exists in the render method
- The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
- If any new file was added I verified that:
- The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
- If a new CSS style is added I verified that:
- A similar style doesn't already exist
- The style can't be created with an existing StyleUtils function (i.e.
StyleUtils.getBackgroundAndBorderStyle(theme.componentBG
)
- If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
- If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like
Avatar
is modified, I verified thatAvatar
is working as expected in all cases) - If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
- If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
- If the PR modifies the form input styles:
- I verified that all the inputs inside a form are aligned with each other.
- I added
Design
label so the design team can review the changes.
- If a new page is added, I verified it's using the
ScrollView
component to make it scrollable when more elements are added to the page. - If the
main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps. - I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.
🎀 👀 🎀 C+ reviewed
@@ -29,10 +30,15 @@ function ValidateCodeActionModal({ | |||
hasMagicCodeBeenSent, | |||
isLoading, | |||
shouldHandleNavigationBack, | |||
shouldShowThreeDotsButton = false, |
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 the value of this prop be determined by the length of threeDotsMenuItems
? ie. it should be TRUE when there are items in the array and FALSE when there are no items in the array? It seems unnecessary to have the shouldShowThreeDotsButton
prop.
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.
Got it, I’ll update it based on threeDotsMenuItems.length as
shouldShowThreeDotsButton={threeDotsMenuItems.length>0}
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.
@tgolen , after looking at it again, I realized that the three-dot menu only shows when the contact is not primary and not verified. If I use the threeDotsMenuItems.length>0
, it would always show the button, so I guess we need this prop.
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.
OK. If I follow that logic though, if the menu is not shown, why would it need to have any menu items at all? I would say, remove the menu items based on the contact is not primary and not verified
and it should still work the same. Right?
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.
Right, we can do that as well.
I added the shouldShowThreeDotsButton
prop because it was already available in the props for the ThreeDotsMenu
and HeaderWithBackButton
It seems we could use the same logic there as well, but that would need to update the threeDotsMenuItems
in different pages
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.
Thank you!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/tgolen in version: 9.0.85-0 🚀
|
2 similar comments
🚀 Deployed to staging by https://github.com/tgolen in version: 9.0.85-0 🚀
|
🚀 Deployed to staging by https://github.com/tgolen in version: 9.0.85-0 🚀
|
🚀 Deployed to staging by https://github.com/tgolen in version: 9.0.85-0 🚀
|
🚀 Deployed to staging by https://github.com/tgolen in version: 9.0.85-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.0.85-4 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.0.85-4 🚀
|
Explanation of Change
Fixed Issues
$ #54626
PROPOSAL: #54626 (comment)
Tests
Offline tests
This feature requires internet connection
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android.native.mov
Android: mWeb Chrome
android.web.mov
iOS: Native
ios.native.mov
iOS: mWeb Safari
ios.safari.mov
MacOS: Chrome / Safari
macos.chrome.mov
MacOS: Desktop
desktop.mov