-
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
fix: long press app download links on mweb Safari to open the Copy to Clipboard menu #17310
Conversation
@mountiny @eVoloshchak One of you needs to 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] |
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.
Great job, and great comments from @eVoloshchak! I would really make sure we cover testing of all the platforms for where the MenuItem components is used since its quite often used component
Thanks for the feedback. I manually tested the component on both (Android / iOS) native mobile and mobile web platforms, as well as desktop and regular web browsers. |
@akinwale, besides one small change, the code looks good to me. |
@eVoloshchak I am unable to determine one of the links for |
I think it's possible to determine the link. If we move buildOldDotURL into the upper scope (so it can be called using Link.buildOldDotURL), we can then add the following here: link: Link.buildOldDotURL('domain_companycards') |
I don't think this will work. The |
It's optional:
I'm not too sure about that, the original requirement was: any menu item which is a link should have this behaviour |
The It is out of scope because it's a refactor of business logic for building old URLs. The logic for the handling of links to display the Copy to Clipboard menu has already been implemented in the |
@eVoloshchak |
It also contains current email, so we can't define it as a constant I'm investigating how we can get the result of buildOldDotURL, hold on |
@akinwale, we can add the following here: link: () => Link.buildOldDotURL('domain_companycards') And then in const onSecondaryInteraction = (link, e) => {
if (typeof link === 'function') {
link().then(url => ReportActionContextMenu.showContextMenu(CONTEXT_MENU_TYPES.LINK, e, url, popoverAnchor));
} else if (!_.isEmpty(link)) {
ReportActionContextMenu.showContextMenu(CONTEXT_MENU_TYPES.LINK, e, link, popoverAnchor);
}
}; |
a7829b6
to
206bf05
Compare
src/components/MenuItemList.js
Outdated
{_.map(props.menuItems, menuItemProps => ( | ||
<MenuItem | ||
key={menuItemProps.title} | ||
onSecondaryInteraction={_.isEmpty(menuItemProps.link) ? e => secondaryInteraction(menuItemProps.link, e) : undefined} |
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 works but I don't understand why.
Why are we calling secondaryInteraction if link is empty? Shouldn't it be the other way around?
UPD: It doesn't work properly, it opens the context menu only if link is a function
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.
It shoud be !_.isEmpty
. Let me double-check.
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.
Yeah, I'll have to explicitly check if it's a function first before isEmpty. eslint complains about explicitly converting to Boolean.
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.
I haven't tested, but maybe _.isUndefined
will be of help
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.
That's a better option, thanks.
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-04-13.at.23.20.32.movMobile Web - ChromeScreen_Recording_20230413-231250_Chrome.mp4Mobile Web - SafariIMG_0016.MP4DesktopScreen.Recording.2023-04-13.at.23.18.59.moviOSIMG_0015.MP4AndroidScreen_Recording_20230413-231203_New.Expensify.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.
Looks good and tests well!
cc: @mountiny
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.
Not super involved in initial proposal, but code looks good to me. Leaving merge for @mountiny
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.
Great job on this one both @akinwale and @eVoloshchak thanks!
✋ 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/mountiny in version: 1.3.1-0 🚀
|
1 similar comment
🚀 Deployed to staging by https://github.com/mountiny in version: 1.3.1-0 🚀
|
Revert "Merge pull request #17310 from akinwale/task-16946"
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.1-3 🚀
|
🚀 Deployed to staging by https://github.com/mountiny in version: 1.3.2-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.2-5 🚀
|
Details
Allow the app download links and other external links to display the Copy to Clipboard menu when a user long-presses the item. Refactor MenuItem to get rid of nested Pressables.
Fixed Issues
$ #16946
PROPOSAL: #16946 (comment)
Tests
Offline tests
Same as tests.
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)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
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
Web
Mobile Web - Chrome
16946-android-chrome.webm
Mobile Web - Safari
16946-ios-safari.mov
Desktop
iOS
16946-ios-native.mov
Android
16946-android-native.webm