Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
fix: Fix missing references for export (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
shottah authored Sep 16, 2022
1 parent c85ef11 commit 72ac72a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/app/ErrorMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,4 @@ export enum ErrorMessages {
CREATE_PDF_FAILED = 'createPdfFailure',
FAILED_OPEN_DIRECTION = 'failedOpeningDirections',
CREATE_PDF_FAILED = 'createPdfFailure',

}
23 changes: 19 additions & 4 deletions src/pdf/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,27 @@ const TAG = 'pdf/saga'

export function* generatePdf(): any {
try {
Logger.info(TAG, '@generatePDF', 'PDF requested')
const payload = yield select(pdfDataSelector)
const file: Pdf = yield call(createTransactionSummary, payload as FeedTokenTransaction[])

const account = yield select(accountAddressSelector)
const tokenUsdPrices: TokenBalanceWithUsdPrice[] = yield select(tokensListSelector)
const localCurrencyCode = yield select(getLocalCurrencyCode)
const localCurrencyExchangeRate = yield select(localCurrencyToUsdSelector)
const transactions = yield transactionsWithUsdPrice(
payload,
tokenUsdPrices,
localCurrencyCode,
localCurrencyExchangeRate
)
const file: Pdf = yield call(createTransactionSummary, {
account,
transactions,
localCurrencyCode,
tokenUsdPrices,
})
if (!file.filePath) throw new Error('Unable to generate Pdf')

put(savePdf(file.filePath))
yield put(savePdf(file.filePath))
Logger.info(TAG, '@generatePDF', 'PDF created')
} catch (error: any) {
Logger.error(TAG, 'Error while saving document', error)
yield put(showError(ErrorMessages.CREATE_PDF_FAILED))
Expand Down
2 changes: 1 addition & 1 deletion src/transactions/TransactionHistoryFiltered.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function TransactionHistory({ navigation, route }: Props) {
const handleExport = () => {
dispatch(generatePdf(content))
}

return (
<SafeAreaView style={styles.container}>
<StaticTransactionFeed
Expand Down

0 comments on commit 72ac72a

Please sign in to comment.