Open m-natarajan opened 1 week ago
Triggered auto assignment to @johncschuster (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989
Edited by proposal-police: This proposal was edited at 2024-10-21 15:15:22 UTC.
We need to press download twice to download the wallet statement.
In the wallet statement page, we first checks whether the file name of the specific year-month is available or not. If not, the app will request it first with generateStatementPDF
request.
https://github.com/Expensify/App/blob/ce23fb55b1f8412d609cbd2c1f25690f7c5845a9/src/pages/wallet/WalletStatementPage.tsx#L52-L68
The user then need to press the download button again when the data is available.
We can make the process simpler by downloading the file automatically when the request is completed.
const isWalletStatementGenerating = walletStatement?.isGenerating ?? false;
const prevIsWalletStatementGenerating = usePrevious(isWalletStatementGenerating);
useEffect(() => {
if (prevIsWalletStatementGenerating && !isWalletStatementGenerating && walletStatement?.[yearMonth]) {
processDownload();
}
}, [prevIsWalletStatementGenerating, isWalletStatementGenerating, processDownload, walletStatement, yearMonth]);
The useEffect
will check if it was previously loading and the data is now available, then we trigger the download logic.
Based on this comment, we want to remove the Growl and instead show loading while generating. There is currently no way to show the loading in HeaderWithBackButton, so, we can add a new props called isDownloading
.
isDownloading={isWalletStatementGenerating}
Then, in HeaderWithBackButton, if isDownloading
is true, then show the loading, otherwise, show the download button.
{shouldShowDownloadButton && (
!isDownloading ? (
<Tooltip text={translate('common.download')}>
<PressableWithoutFeedback ...
accessibilityLabel={translate('common.download')}
>
<Icon
src={Expensicons.Download}
fill={iconFill ?? StyleUtils.getIconFillColor(getButtonState(false, false, !isDownloadButtonActive))}
/>
</PressableWithoutFeedback>
</Tooltip>
) : (
<ActivityIndicator style={[styles.touchableButtonImage]} size='small' color={theme.spinner} />
)
)}
Job added to Upwork: https://www.upwork.com/jobs/~021847035521933253796
Triggered auto assignment to Contributor-plus team member for initial proposal review - @fedirjh (External
)
@bernhardoj I believe there are opportunities for a better UI/UX approach. Instead of downloading the statement by default, we can enhance the user experience by introducing a more intuitive flow:
Loading Feedback: We can leverage useEffect
to handle the statement generation process. Initially, display a loading state or a loading button (instead of the download button) while the statement is being generated. Once the file is ready, we can replace the loading indicator with the download icon, signaling to the user that the file is available.
Generate Button: Alternatively, we could show a "Generate" button (instead of the download button). When the user clicks on it, the statement file generation process begins. During this time, a loading indicator is shown, and once the file is ready, the download icon will appear, prompting the user to download the file.
cc @Expensify/design Would love to get your feedback as well.
I think we can keep this simple - I think we should just replace the download icon with a spinner until the download starts. No need for a growl or anything like that.
Also TIL: I believe this is the last place left in the app where we have a growl?!
Also TIL: I believe this is the last place left in the app where we have a growl?!
If I knew it was possible to show these in ND I would've been sprinkling them all around the product this whole time 😆
Lmao 😂
I believe this is the last place left in the app where we have a growl?!
Based on the code, we still have 4 Growl usages.
https://github.com/Expensify/App/blob/36a8b13b88a20a086b5c14e1f2129ac52024ebb7/src/pages/EnablePayments/OnfidoStep.tsx#L43-L45 https://github.com/Expensify/App/blob/36a8b13b88a20a086b5c14e1f2129ac52024ebb7/src/pages/EnablePayments/VerifyIdentity/VerifyIdentity.tsx#L51-L53 https://github.com/Expensify/App/blob/36a8b13b88a20a086b5c14e1f2129ac52024ebb7/src/pages/ReimbursementAccount/RequestorOnfidoStep.tsx#L49-L51 https://github.com/Expensify/App/blob/36a8b13b88a20a086b5c14e1f2129ac52024ebb7/src/pages/ReimbursementAccount/VerifyIdentity/VerifyIdentity.tsx#L51-L53
I think we can keep this simple - I think we should just replace the download icon with a spinner until the download starts. No need for a growl or anything like that.
Updated my proposal to include this.
@bernhardoj With your proposal, we will automatically download the file when the component is mounted, correct?
No, it will only download if it's previously generating and currently it's done.
It's possible though that the statement will be downloaded without the user press any button.
In a slow connection,
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: Reproducible in staging?: needs reproduction no statement with test account Reproducible in production?: needs reproduction If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @coleaeason Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1728668916480749
Action Performed:
Expected Result:
In step 3 itself statement should be downloaded
Actual Result:
Weird snackbar notification appears and gets downloaded after clicking download button second time
Workaround:
unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @fedirjh