Align Android history handling with iOS and bump app version

This commit is contained in:
2026-04-29 11:22:19 +07:00
parent 7cc3d1ceb3
commit 648584f133
5 changed files with 46 additions and 7 deletions

View File

@ -44,6 +44,18 @@ data class TransactionItem(
append(locationName)
}
}
fun historyKey(): String = buildString {
append(date.time / 1000)
append('|')
append(amount)
append('|')
append(if (isCredit) 1 else 0)
append('|')
append(locationName.trim())
append('|')
append(title)
}
}
data class EmoneyUiState(
@ -63,6 +75,16 @@ data class EmoneyUiState(
}
fun hasCardData(): Boolean = cardType != CardType.UNKNOWN || cardNumber.isNotBlank() || balance > 0 || transactions.isNotEmpty()
fun clearingHistory(scanMessage: String): EmoneyUiState = copy(
transactions = emptyList(),
scanMessage = scanMessage
)
fun deduplicatingHistory(): EmoneyUiState {
val deduplicated = transactions.distinctBy { it.historyKey() }
return if (deduplicated.size == transactions.size) this else copy(transactions = deduplicated)
}
}
fun String.formatCardNumber(): String {