Skip to content

Multi files attachments carousel#65316

Merged
lakchote merged 24 commits intoExpensify:mainfrom
callstack-internal:feat/59443-multi-files-attachments-carousel
Jul 8, 2025
Merged

Multi files attachments carousel#65316
lakchote merged 24 commits intoExpensify:mainfrom
callstack-internal:feat/59443-multi-files-attachments-carousel

Conversation

@koko57
Copy link
Contributor

@koko57 koko57 commented Jul 2, 2025

Explanation of Change

Because the AttachmentModal wasn't fully decoupled from the report attachment logic, but only AttachmentCarousel was I've decided to create a separate component for displaying files that are prepared to be sent in the composer.
I've moved all the logic that handles files validation to the new component and removed some code that because of creating a new component won't be used in AttachmentModal.

I also recommend creating a separate component for displaying receipts to handle only receipts' preview to simplify further AttachmentModal and make it only responsible for displaying report's attachments or previewing avatars. (Out of scope of this PR)

I haven't removed all the logic regarding files from AttachmentModal - I want to make testing simplier and I want to avoid having regressions. This can be done in a follow-up PR when the AttachmentComposerModal will be merged and tested thoroughly.

Fixed Issues

$ #59443
PROPOSAL: -

Tests

PREREQUISITES: all betas / newDotMultiFilesDragAndDrop beta enabled

[WEB / DESKTOP]

  1. Go to any chat
  2. Drag and drop several files onto the Add attachment dropzone
  3. Verify that the modal carousel arrows are shown when hovering over
  4. Verify that you can preview all the valid attachments clicking carousel arrows
  5. Click Send
  6. Verify that all the files you dropped are sent
  7. Now instead of dropping files click "+" in the composer
  8. Select Add Attachment
  9. Verify that you're able to select several attachments
  10. Repeat steps 3.-5.

[MOBILE]

  1. Go to any chat
  2. click "+" in the composer
  3. Select Add Attachment
  4. Choose either Photo Library (Choose from Gallery) / Choose Files (Choose file) option
  5. Verify that you're able to select several attachments
  6. Verify that the modal carousel arrows are shown
  7. Verify that you can preview all the valid attachments clicking carousel arrows
  8. Click Send
  9. Verify that all the files you dropped are sent

[CHECK THE ERROR HANDLING]

  1. Try to drag and drop or attach via composer several files with one that will throw an error (MAX_SIZE > 24 MB, MIN_SIZE < 240 bytes, corrupted image) or try to attach more than 30 files
  2. Verify that the error modal appears with the attachment modal underneath
  3. Verify that the modal has 2 options: Continue and Cancel
  4. Verify that after clicking Continue the modal is closed and attachment modal is shown
  5. Verify that you can preview all the valid attachments clicking carousel arrows
  6. Click Send in the attachment modal
  7. Verify that the valid attachments are sent
  8. Repeat steps 1.-3., this time click Cancel
  9. Verify that both modals - the error modal and the attachment modal close and the attachment flow is discontinued.

[CHECK THE SINGLE FILE FLOW]

  1. Verify that sending attachment via dropping or sending the attachment from the attachment menu works the same like before.
  • Verify that no errors appear in the JS console

Offline tests

n/a

QA Steps

// TODO: These must be filled out, or the issue title must include "[No QA]."

Same as Tests

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover 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 tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (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 not onIconClick)
    • 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
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • 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 either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • 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
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • 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.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • 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 that Avatar 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 UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design 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.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Screen.Recording.2025-07-02.at.10.16.01.mp4
Android: mWeb Chrome
Screen.Recording.2025-07-02.at.10.13.54.mp4
iOS: Native
Simulator.Screen.Recording.-.iPhone.15.-.2025-07-02.at.08.02.01.mp4
iOS: mWeb Safari
Simulator.Screen.Recording.-.iPhone.15.-.2025-07-02.at.10.25.13.mp4
MacOS: Chrome / Safari
Screen.Recording.2025-07-02.at.09.24.46.mp4
Screen.Recording.2025-07-02.at.09.23.48.mp4
Screen.Recording.2025-07-02.at.09.23.28.mp4
MacOS: Desktop
Screen.Recording.2025-07-02.at.10.32.26.mp4

@koko57 koko57 marked this pull request as ready for review July 2, 2025 08:55
@koko57 koko57 requested a review from a team as a code owner July 2, 2025 08:55
@melvin-bot melvin-bot bot requested a review from getusha July 2, 2025 08:55
@melvin-bot
Copy link

melvin-bot bot commented Jul 2, 2025

@getusha 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]

@koko57
Copy link
Contributor Author

koko57 commented Jul 2, 2025

@getusha will you have time to start the review today? We would like to merge it on Friday

cc @lakchote

@getusha
Copy link
Contributor

getusha commented Jul 2, 2025

@getusha will you have time to start the review today? We would like to merge it on Friday

Yes, will be on it in few hours.

@getusha
Copy link
Contributor

getusha commented Jul 2, 2025

Noticed the close transition is jolty on reports page for PDF files

  1. Search > Open a report
  2. Drop a file > Submit
Screen.Recording.2025-07-02.at.9.28.52.at.night.mov

@getusha
Copy link
Contributor

getusha commented Jul 2, 2025

File validation doesn't seem to be working properly, i can upload corrupt file.

Screen.Recording.2025-07-02.at.9.55.04.at.night.mov

@getusha
Copy link
Contributor

getusha commented Jul 2, 2025

We are showing error copy that's supposed to be for multi-file attachments when uploading an invalid file.

Screen.Recording.2025-07-02.at.9.58.04.at.night.mov

@koko57
Copy link
Contributor Author

koko57 commented Jul 2, 2025

File validation doesn't seem to be working properly, i can upload corrupt file.

Screen.Recording.2025-07-02.at.9.55.04.at.night.mov

For this one we already have a bug reported. I will be working on this soon #65319

@koko57
Copy link
Contributor Author

koko57 commented Jul 2, 2025

@getusha so far only these bugs?

@getusha
Copy link
Contributor

getusha commented Jul 2, 2025

Yes seems to work well on web. will finalize my review tomorrow.

@koko57
Copy link
Contributor Author

koko57 commented Jul 2, 2025

I guess the other two bugs are rather from the previous PR as I didn't change the logic of validation, validation texts or transitions, only moved it, so IMHO shouldn't be the blockers here

@dubielzyk-expensify
Copy link
Contributor

Any visual changes here as to need a @Expensify/design team review?

@getusha
Copy link
Contributor

getusha commented Jul 3, 2025

@koko57 first PR was reverted #65354
Let's fix the issue and maybe include the revert in this PR

@koko57
Copy link
Contributor Author

koko57 commented Jul 3, 2025

yep, I'm working on it - I will fix the issues and push the changes from the reverted PR to this one

@koko57
Copy link
Contributor Author

koko57 commented Jul 3, 2025

Any visual changes here as to need a @Expensify/design team review?

@dubielzyk-expensify only if the carousel looks ok - but I will ping you when I resolve conflicts and fix other issues

@koko57
Copy link
Contributor Author

koko57 commented Jul 3, 2025

@getusha I've resolved conflicts and added missing code from the previous PR. None of the bugs fixed yet, but can you retest current changes (if it works the same as before the revert)?

@koko57
Copy link
Contributor Author

koko57 commented Jul 3, 2025

Noticed the close transition is jolty on reports page for PDF files

  1. Search > Open a report
  2. Drop a file > Submit

Screen.Recording.2025-07-02.at.9.28.52.at.night.mov

TBH I cannot recreate, but I'll try a few more times

@getusha
Copy link
Contributor

getusha commented Jul 8, 2025

Since the crash is not reproducible, I'd say we can proceed with the merge either way, as we need to get this tested by different people with different devices. If the issue is reproducible by someone, we'll still have the beta, and it won't impact our customers. We will also be able to advance on the root cause of the issue.

That sounds reasonable 👍

@melvin-bot melvin-bot bot requested a review from grgia July 8, 2025 15:39
@lakchote
Copy link
Contributor

lakchote commented Jul 8, 2025

and @getusha can you check my last comment #65316 (comment) on the bug and check if it's a matter of long loading?

Yep, seems like the reason is the long delay. We should definitely explore other options instead of just showing a loading screen. it really doesn't look good and i wouldn't risk a case where the screen is stuck with full screen loading indicator.

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2025-07-08.at.18.09.11.mp4
@lakchote maybe this belongs in #quality, since I can see a delay on the production app as well, though processing multiple files made it worse.

I do agree @getusha this is an important matter. I'll raise a discussion tomorrow in the #quality channel and will tag you there.

@koko57
Copy link
Contributor Author

koko57 commented Jul 8, 2025

and @getusha can you check my last comment #65316 (comment) on the bug and check if it's a matter of long loading?

Yep, seems like the reason is the long delay. We should definitely explore other options instead of just showing a loading screen. it really doesn't look good and i wouldn't risk a case where the screen is stuck with full screen loading indicator.

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2025-07-08.at.18.09.11.mp4
@lakchote maybe this belongs in #quality, since I can see a delay on the production app as well, though processing multiple files made it worse.

I guess it's known issue for iOS that's why the loader was added here #59519 for request step scan.

As we do a ton of calculations - validation, resizing, converting heic to jpeg it makes sense to use this loader, even if any performance improvements can be done, as we still can accept up to 30 files

cc @lakchote

@koko57
Copy link
Contributor Author

koko57 commented Jul 8, 2025

so the issue with the delay was already been discussed #59347

@getusha
Copy link
Contributor

getusha commented Jul 8, 2025

One last thing, can we show the loading indicator only after we select a file?

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2025-07-08.at.18.54.47.mp4

@getusha
Copy link
Contributor

getusha commented Jul 8, 2025

so the issue with the delay was already been discussed #59347

We really should discuss again if there are better options, it's n times more noticeable.

@koko57
Copy link
Contributor Author

koko57 commented Jul 8, 2025

@getusha no - for 2 reasons: 1. I tried it but it doesn't work, 2. it should look consistent with the IOURequestStepScan flow

@lakchote
Copy link
Contributor

lakchote commented Jul 8, 2025

Yes, discussion can only be beneficial here. We might want to keep the loader and also make performance improvements, too. I kinda like to make the user aware that an action is processing

@lakchote lakchote removed the request for review from grgia July 8, 2025 16:00
@getusha
Copy link
Contributor

getusha commented Jul 8, 2025

Yeah maybe show a loader on the menu item, if that's possible? current one looks tacky.

@lakchote
Copy link
Contributor

lakchote commented Jul 8, 2025

Yeah maybe show a loader on the menu item, if that's possible? current one looks tacky.

It can always be done as a follow-up, I'm proceeding with the merge, and we'll adjust if needed

@lakchote lakchote merged commit e29b652 into Expensify:main Jul 8, 2025
20 checks passed
@koko57
Copy link
Contributor Author

koko57 commented Jul 8, 2025

Yeah maybe show a loader on the menu item, if that's possible? current one looks tacky.

but it won't be consistent with the Request step scan.

And how I am supposed to stop this loader? This context was deliberately introduced to be able to start/stop loader form any place of the app. I need to have access to this in the hook, in the attachment picker and in the Report action compose

@lakchote
Copy link
Contributor

lakchote commented Jul 8, 2025

Yeah maybe show a loader on the menu item, if that's possible? current one looks tacky.

but it won't be consistent with the Request step scan.

And how I am supposed to stop this loader? This context was deliberately introduced to be able to start/stop loader form any place of the app. I need to have access to this in the hook, in the attachment picker and in the Report action compose

cc @trjExpensify what do you think about this? In my opinion, we should be consistent with our flows.

@OSBotify
Copy link
Contributor

OSBotify commented Jul 8, 2025

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

@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2025

🚀 Deployed to staging by https://github.com/lakchote in version: 9.1.78-0 🚀

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

@github-actions
Copy link
Contributor

🚀 Deployed to production by https://github.com/mountiny in version: 9.1.78-4 🚀

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

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.

5 participants