Skip to content

Commit

Permalink
Merge pull request #153 from ILIYANGERMANOV/import-from-bluecoins
Browse files Browse the repository at this point in the history
Closes #144; Implement import CSV from Bluecoins
  • Loading branch information
ILIYANGERMANOV committed Nov 18, 2021
2 parents 3ab8b6c + a95269c commit 7a13d72
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 18 deletions.
1 change: 1 addition & 0 deletions app/src/main/java/com/ivy/wallet/logic/csv/CSVImporter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ class CSVImporter(
"dd/MM/yyyy HH:mm",
"dd/MM/yyyy HH:mm:ss",
"yyyy-MM-dd HH:mm:ss",
"yyyy-dd-MM HH:mm:ss",
"yyyy/MM/dd HH:mm:ss",
"MM/dd/yyyy HH:mm:ss",
"dd/MM/yyyy h:mm a",
Expand Down
27 changes: 21 additions & 6 deletions app/src/main/java/com/ivy/wallet/logic/csv/CSVMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ class CSVMapper {
ivyMappingV1()
}
}
ImportType.MONEY_MANAGER_PRASE -> moneyManagerPraseMapping()
ImportType.MONEY_MANAGER_PRASE -> moneyManagerPrase()
ImportType.WALLET_BY_BUDGET_BAKERS -> walletByBudgetBakers()
ImportType.SPENDEE -> spendee()
ImportType.ONE_MONEY -> oneMoney()
ImportType.KTW_MONEY_MANAGER -> ktwRowMapping()
ImportType.FORTUNE_CITY -> fortuneCityRowMapping()
ImportType.BLUE_COINS -> blueCoins()
ImportType.KTW_MONEY_MANAGER -> ktwMoneyManager()
ImportType.FORTUNE_CITY -> fortuneCity()
}

private fun ivyMappingV1() = RowMapping(
Expand Down Expand Up @@ -69,7 +70,7 @@ class CSVMapper {
)

//Praseto - https://play.google.com/store/apps/details?id=com.realbyteapps.moneymanagerfree&hl=en&gl=US
private fun moneyManagerPraseMapping() = RowMapping(
private fun moneyManagerPrase() = RowMapping(
type = 6,
amount = 8,
account = 1,
Expand Down Expand Up @@ -128,7 +129,7 @@ class CSVMapper {
title = 9
)

private fun ktwRowMapping() = RowMapping(
private fun ktwMoneyManager() = RowMapping(
date = 0,
type = 1,
category = 2,
Expand All @@ -139,7 +140,7 @@ class CSVMapper {
)


private fun fortuneCityRowMapping() = RowMapping(
private fun fortuneCity() = RowMapping(
account = 0,
category = 1,
amount = 2,
Expand All @@ -154,4 +155,18 @@ class CSVMapper {
)
}
)

private fun blueCoins() = RowMapping(
type = 0,
date = 1,
//set time = 2
title = 3,
amount = 4,
accountCurrency = 5,
//exchangeRate = 6
//category group = 7
category = 8,
account = 9,
description = 10
)
}
7 changes: 1 addition & 6 deletions app/src/main/java/com/ivy/wallet/logic/csv/CSVNormalizer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ class CSVNormalizer {

fun normalize(rawCSV: String, importType: ImportType): String {
return when (importType) {
ImportType.IVY -> rawCSV
ImportType.MONEY_MANAGER_PRASE -> rawCSV
ImportType.WALLET_BY_BUDGET_BAKERS -> walletByBudgetBakers(rawCSV)
ImportType.SPENDEE -> rawCSV
ImportType.ONE_MONEY -> rawCSV
ImportType.KTW_MONEY_MANAGER -> rawCSV
ImportType.FORTUNE_CITY -> rawCSV
else -> rawCSV
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ enum class ImportType {
WALLET_BY_BUDGET_BAKERS,
SPENDEE,
ONE_MONEY,
BLUE_COINS,
KTW_MONEY_MANAGER,
FORTUNE_CITY;

Expand All @@ -22,6 +23,7 @@ enum class ImportType {
WALLET_BY_BUDGET_BAKERS -> Green
SPENDEE -> RedLight
ONE_MONEY -> Red3
BLUE_COINS -> Blue
KTW_MONEY_MANAGER -> Yellow
FORTUNE_CITY -> Green2Light
}
Expand All @@ -32,6 +34,7 @@ enum class ImportType {
WALLET_BY_BUDGET_BAKERS -> "com.droid4you.application.wallet"
SPENDEE -> "com.cleevio.spendee"
ONE_MONEY -> "org.pixelrush.moneyiq"
BLUE_COINS -> "com.rammigsoftware.bluecoins"
KTW_MONEY_MANAGER -> "com.ktwapps.walletmanager"
FORTUNE_CITY -> "com.fourdesire.fortunecity"
}
Expand All @@ -43,6 +46,7 @@ enum class ImportType {
WALLET_BY_BUDGET_BAKERS -> R.drawable.wallet_by_budgetbakers_logo
SPENDEE -> R.drawable.speende_logo_png
ONE_MONEY -> R.drawable.one_money_logo
BLUE_COINS -> R.drawable.bluecoins
KTW_MONEY_MANAGER -> R.drawable.ktw_money_manager_logo
FORTUNE_CITY -> R.drawable.fortune_city_app_logo
}
Expand All @@ -53,6 +57,7 @@ enum class ImportType {
WALLET_BY_BUDGET_BAKERS -> "Wallet by BudgetBakers"
SPENDEE -> "Spendee"
ONE_MONEY -> "1Money"
BLUE_COINS -> "Bluecoins Finance"
KTW_MONEY_MANAGER -> "Money Manager (KTW)"
FORTUNE_CITY -> "Fortune City"
}
Expand All @@ -63,6 +68,7 @@ enum class ImportType {
WALLET_BY_BUDGET_BAKERS -> "Wallet by BudgetBakers"
SPENDEE -> "Spendee"
ONE_MONEY -> "1Money"
BLUE_COINS -> "Bluecoins Finance"
KTW_MONEY_MANAGER -> "Money Manager (KTW)"
FORTUNE_CITY -> "Fortune City"
}
Expand Down Expand Up @@ -93,6 +99,9 @@ enum class ImportType {
ONE_MONEY -> OneMoneySteps(
onUploadClick = onUploadClick
)
BLUE_COINS -> DefaultImportSteps(
onUploadClick = onUploadClick
)
KTW_MONEY_MANAGER -> KTWMoneyManagerSteps(
onUploadClick = onUploadClick
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,7 @@ class ImportViewModel @Inject constructor(
uri = fileUri,
charset = when (importType) {
ImportType.IVY -> Charsets.UTF_16
ImportType.MONEY_MANAGER_PRASE -> Charsets.UTF_8
ImportType.WALLET_BY_BUDGET_BAKERS -> Charsets.UTF_8
ImportType.SPENDEE -> Charsets.UTF_8
ImportType.ONE_MONEY -> Charsets.UTF_8
ImportType.KTW_MONEY_MANAGER -> Charsets.UTF_8
ImportType.FORTUNE_CITY -> Charsets.UTF_8
else -> Charsets.UTF_8
}
)
if (rawCSV == null || rawCSV.isBlank()) {
Expand Down
Binary file added app/src/main/res/drawable/bluecoins.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7a13d72

Please sign in to comment.