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

feat: Long-press artwork context menu for Android #11359

Conversation

olerichter00
Copy link
Contributor

@olerichter00 olerichter00 commented Jan 9, 2025

This PR resolves ONYX-1474

Description

This implements the Artwork card long-press context menu for Android using a bottom sheet.

  • Feature Flag: AREnableArtworkCardContextMenuAndroid

Screenshots

Android

Screenshot_1737974340 Screenshot_1737974335

iOS

Simulator Screenshot - iPhone SE (3rd generation) - 2025-01-27 at 11 30 04 Simulator Screenshot - iPhone SE (3rd generation) - 2025-01-27 at 11 24 37

PR Checklist

  • I have tested my changes on iOS and Android.
  • I hid my changes behind a feature flag, or they don't need one.
  • I have included screenshots or videos, or I have not changed the UI.
  • I have added tests, or my changes don't require any.
  • I added an app state migration, or my changes do not require one.
  • I have documented any follow-up work that this PR will require, or it does not require any.
  • I have added a changelog entry below, or my changes do not require one.

To the reviewers 👀

  • I would like at least one of the reviewers to run this PR on the simulator or device.
Changelog updates

Changelog updates

Cross-platform user-facing changes

iOS user-facing changes

Android user-facing changes

  • Artwork card long-press context menu for Android - ole

Dev changes

Need help with something? Have a look at our docs, or get in touch with us.

@olerichter00 olerichter00 changed the title feat: Long-press artwork context menu for Android feat(WIP): Long-press artwork context menu for Android Jan 9, 2025
@olerichter00 olerichter00 marked this pull request as draft January 9, 2025 09:12
@olerichter00 olerichter00 self-assigned this Jan 9, 2025
@olerichter00 olerichter00 force-pushed the olerichter00/ONYX-1474/long-press-artwork-context-menu-for-android branch from 87895ca to c44814b Compare January 24, 2025 17:49
Comment on lines +95 to +96
<Box pr={2}>
<RouterLink
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moving ContextMenuArtwork inside RouterLink so RouterLink's onPress still works.

Copy link
Contributor

Choose a reason for hiding this comment

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

kind of surprised it interferes since I thought it only listened for long press, but if it is necessary it is necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've tried a few combinations, and having a TouchableHighlight for the long press within the Touchable component from palette-mobile for the normal press was the only combination that worked. 🤷

Copy link
Member

Choose a reason for hiding this comment

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

thanks for explaining

@olerichter00 olerichter00 changed the title feat(WIP): Long-press artwork context menu for Android feat: Long-press artwork context menu for Android Jan 24, 2025
@olerichter00 olerichter00 marked this pull request as ready for review January 24, 2025 17:53
@ArtsyOpenSource
Copy link
Contributor

ArtsyOpenSource commented Jan 24, 2025

This PR contains the following changes:

  • Android user-facing changes (Artwork card long-press context menu for Android - ole - olerichter00)

Generated by 🚫 dangerJS against f3ce05f

`,
})

describe("on Android", () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was not able to test the context menu on iOS with react-native-context-menu-view.

Copy link
Member

Choose a reason for hiding this comment

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

You can try to mock the module with returning a View as a ContextMenu

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I gave it a try, but it's not so easy to mock the ContextMenu component because it's not only rendering children but also taking an array of actions to render and managing the long press behavior. So simply mocking it with View, unfortunately, doesn't give us anything to test :/

@olerichter00 olerichter00 force-pushed the olerichter00/ONYX-1474/long-press-artwork-context-menu-for-android branch from ccd90a0 to 9aea512 Compare January 27, 2025 10:30
brainbicycle
brainbicycle previously approved these changes Jan 27, 2025
Copy link
Contributor

@brainbicycle brainbicycle left a comment

Choose a reason for hiding this comment

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

looks good to me!

MounirDhahri
MounirDhahri previously approved these changes Jan 27, 2025
Copy link
Member

@MounirDhahri MounirDhahri left a comment

Choose a reason for hiding this comment

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

small comment but nothing blocking 👏

Comment on lines +95 to +96
<Box pr={2}>
<RouterLink
Copy link
Member

Choose a reason for hiding this comment

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

thanks for explaining

}

const artworkFragment = graphql`
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: can we make this call when the context menu or the bottom sheet shows up to avoid calling this data when it's not required

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That could be something to try out! I will merge the PR as it is right now and give it a try to lazy load the data for the context menu on long press.

It might work but it could lead to issues with how the opening animation works for the context menu 🤔

`,
})

describe("on Android", () => {
Copy link
Member

Choose a reason for hiding this comment

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

You can try to mock the module with returning a View as a ContextMenu

@olerichter00 olerichter00 force-pushed the olerichter00/ONYX-1474/long-press-artwork-context-menu-for-android branch from 4e0d984 to f3ce05f Compare January 28, 2025 08:55
@olerichter00 olerichter00 added the Squash On Green A label to indicate that Peril should squash-merge this PR when all statuses are green label Jan 28, 2025
@artsy-peril artsy-peril bot merged commit 72dbe24 into main Jan 28, 2025
7 checks passed
@artsy-peril artsy-peril bot deleted the olerichter00/ONYX-1474/long-press-artwork-context-menu-for-android branch January 28, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Jira Synced Squash On Green A label to indicate that Peril should squash-merge this PR when all statuses are green
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants