Skip to content

Commit

Permalink
Add Export TXS in Koinly Format (#31)
Browse files Browse the repository at this point in the history
* Add Koinly format

* Update ExportTransactionsViewModel.kt

* Update ExportTransactionsScreen.kt
  • Loading branch information
ajs-xmr authored Jan 18, 2025
1 parent c6669d8 commit 674f06f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fun ExportTransactionsScreen(
Spacer(modifier = Modifier.height(16.dp))
Text("Press the button below to export all transactions to a CSV file.")
FilledTonalButton(onClick = {createDocumentLauncher.launch("database_export.csv")}) {
Text("Export as CSV")
Text("Export as CSV in Koinly format")
}
Spacer(modifier = Modifier.height(32.dp))
Text("Delete all the transactions saved on this device.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ class ExportTransactionsViewModel @Inject constructor(
context.contentResolver.openOutputStream(uri)?.use { outputStream ->
OutputStreamWriter(outputStream).use { writer ->
// Write CSV headers
writer.append("txId,xmrAmount,fiatValue,timestamp\n")
writer.append("Koinly Date,Amount,Currency,Label,TxHash\n")

// Write CSV rows
data.forEach { entity ->
writer.append("${entity.txId},${entity.xmrAmount},${entity.fiatValue},${entity.timestamp}\n")
writer.append("${entity.timestamp},${entity.xmrAmount},XMR,income,${entity.txId}\n")
}
}
}
Expand Down

0 comments on commit 674f06f

Please sign in to comment.