-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 implement recently used currencies #41834
Conversation
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-08-14.at.12.54.00.in.the.afternoon.movAndroid: mWeb ChromeScreen.Recording.2024-08-14.at.12.34.04.in.the.afternoon.moviOS: NativeScreen.Recording.2024-08-14.at.12.45.25.in.the.afternoon.moviOS: mWeb SafariScreen.Recording.2024-08-14.at.12.41.35.in.the.afternoon.movMacOS: Chrome / SafariScreen.Recording.2024-09-06.at.12.33.16.in.the.afternoon.movScreen.Recording.2024-08-14.at.11.59.43.in.the.morning.movMacOS: DesktopScreen.Recording.2024-09-06.at.1.06.55.in.the.afternoon.mov |
@DylanDylann the currency is not showing in recents if i don't change the default one, could you check? Screen.Recording.2024-05-14.at.6.53.43.in.the.evening.mov |
@getusha The recentlyUsedCurrencies are stored for each policy. I see in your video, in the 2nd creating expense, we cannot define the policy so there is no recentlyUsedCurrencies. |
@DylanDylann could you please expand your statement? it means we can't have recently used currencies on a p2p requests? |
Yes, I think so |
@thienlnam i think we should handle this case too, wdyt? |
@thienlnam Do you have any feedback about comment? |
@thienlnam Can you help check this? |
Just came back from OOO, I also think we should support it for P2P payments - is there a specific reason we wouldn't? There are still some cases in the BE that need to be updated to actually update the recently used currency but we should support it in the FE |
Can you provide the structure of the recently used currencies that will be returned by the backend? This will allow me to make the necessary changes on the frontend accordingly. |
It will be the same as before as mentioned here #34874 (comment) |
@thienlnam I mean with the P2p request, which key do we use to get the recently used currencies? In case the workspace, we use policyID. |
@thienlnam Can you check my question? |
Ah good question, the current plan is to prefix the onyx key with the personal policy ID so it remains in that format for P2P requests |
@getusha I addressed this #41834 (comment), please help review the PR. |
@DylanDylann ts check is failing |
@DylanDylann it's not working for me, is there any pre-requisite could you check again? Screen.Recording.2024-06-13.at.11.10.44.in.the.morning.mov |
Bump @DylanDylann, we also have a conflict and ts check failing. |
Thanks for bump. I missed the notification. I will try to update asap |
@getusha I updated PR to fix the conflict and applied your suggestion codes.
Updated test steps.
This has already been handled and I updated test steps to cover this case. |
@getusha In case you miss it, PR is ready to review again. |
@DylanDylann i am not able to see the recents section when i submit from global action Screen.Recording.2024-08-25.at.1.58.29.in.the.afternoon.mov |
@getusha I noticed in your video that you created an expense from the global action, which was then sent to a workspace. As a result, the recently used currency applies to the target workspace, not the personal workspace. To apply the recently used currency to your personal workspace, you can create and submit the expense directly to an individual user instead of a workspace. |
@getusha PR is updated |
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, one minor comment
src/libs/actions/IOU.ts
Outdated
// Add currency to optimistic policy recently used currencies when a participant is a workspace | ||
const optimisticPolicyRecentlyUsedCurrencies = isPolicyExpenseChat ? Policy.buildOptimisticPolicyRecentlyUsedCurrencies(currency) : []; |
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.
do we need this condition? and i think it's better to rename the 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.
You are correct, I removed that condition and renamed the 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.
thanks!
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.
Small NAB comments
? [{data: filteredCurrencies.filter((currency) => currency.isSelected)}, {data: filteredCurrencies.filter((currency) => !currency.isSelected)}] | ||
: [{data: filteredCurrencies}]; | ||
if (shouldDisplayRecentlyOptions) { | ||
const cutPolicyRecentlyUsedCurrencyOptions = policyRecentlyUsedCurrencyOptions.slice(0, CONST.IOU.MAX_RECENT_REPORTS_TO_SHOW); |
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.
You can remove this - this is limited in the BE and will only grow to 5
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 think we still need this logic in case of offline mode.
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.
If that's the case, we should handle that in buildOptimisticRecentlyUsedCurrencies so we don't have to keep this logic so anywhere that uses / shows the recently used currency option can just use it directly
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 updated PR
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, 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/thienlnam in version: 9.0.34-0 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.0.34-3 🚀
|
Details
Fixed Issues
$ #34874
PROPOSAL: #34874 (comment)
Tests
Test 1
Test 2
Offline tests
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
Screen.Recording.2024-05-09.at.11.24.44.mov
Android: mWeb Chrome
Screen.Recording.2024-05-09.at.11.05.22.mov
iOS: Native
Screen.Recording.2024-05-09.at.11.16.32.mov
iOS: mWeb Safari
Screen.Recording.2024-05-09.at.11.02.21.mov
MacOS: Chrome / Safari
Screen.Recording.2024-05-09.at.10.50.39.mov
MacOS: Desktop
output.mp4