From 7535f1613792131bea244ccff86e0da738dabbdb Mon Sep 17 00:00:00 2001 From: Hekmatullah Date: Sat, 28 Jun 2025 18:18:02 +0100 Subject: [PATCH] Fix TransferDetail deserialization error by updating transferDate type to String (#1875) --- .../org/mifospay/core/common/DateHelper.kt | 20 +++++++++++++++++++ .../model/savingsaccount/TransferDetail.kt | 2 +- .../org/mifospay/feature/home/HomeScreen.kt | 1 + mifospay-android/prodRelease-badging.txt | 2 +- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/core/common/src/commonMain/kotlin/org/mifospay/core/common/DateHelper.kt b/core/common/src/commonMain/kotlin/org/mifospay/core/common/DateHelper.kt index 8e7579c6..be4efc7c 100644 --- a/core/common/src/commonMain/kotlin/org/mifospay/core/common/DateHelper.kt +++ b/core/common/src/commonMain/kotlin/org/mifospay/core/common/DateHelper.kt @@ -68,6 +68,26 @@ object DateHelper { ) } + /** + * Parses a date string with an auto-detected delimiter and returns it in "dd MMM yyyy" format. + * + * @param dateString The input date string, e.g., "2016-04-14", "2016/04/14", "2016.04.14" + * @return A formatted date string like "14 Apr 2016" + */ + fun getDateAsString(dateString: String): String { + val delimiters = listOf("-", "/", ".") + val detectedDelimiter = delimiters.find { dateString.contains(it) } + ?: throw IllegalArgumentException("Unsupported date format: no recognized delimiter found.") + + val dateComponents = dateString.split(detectedDelimiter).mapNotNull { it.toIntOrNull() } + if (dateComponents.size != 3) { + throw IllegalArgumentException("Invalid date format: expected format like yyyy-MM-dd.") + } + + val (year, month, day) = dateComponents + return "$day ${getMonthName(month)} $year" + } + /** * This Method converting the dd-MM-yyyy format type date string into dd MMMM yyyy * diff --git a/core/model/src/commonMain/kotlin/org/mifospay/core/model/savingsaccount/TransferDetail.kt b/core/model/src/commonMain/kotlin/org/mifospay/core/model/savingsaccount/TransferDetail.kt index 3a45e963..b97c6aaf 100644 --- a/core/model/src/commonMain/kotlin/org/mifospay/core/model/savingsaccount/TransferDetail.kt +++ b/core/model/src/commonMain/kotlin/org/mifospay/core/model/savingsaccount/TransferDetail.kt @@ -17,7 +17,7 @@ data class TransferDetail( val reversed: Boolean = false, val currency: Currency = Currency(), val transferAmount: Double = 0.0, - val transferDate: List, + val transferDate: String = "", val transferDescription: String? = null, val fromOffice: FromOffice, val fromClient: FromClient, diff --git a/feature/home/src/commonMain/kotlin/org/mifospay/feature/home/HomeScreen.kt b/feature/home/src/commonMain/kotlin/org/mifospay/feature/home/HomeScreen.kt index 7f5c6f0f..77e5f3e4 100644 --- a/feature/home/src/commonMain/kotlin/org/mifospay/feature/home/HomeScreen.kt +++ b/feature/home/src/commonMain/kotlin/org/mifospay/feature/home/HomeScreen.kt @@ -298,6 +298,7 @@ private fun AccountList( HorizontalPager( state = pagerState, + pageSpacing = 5.dp, modifier = modifier, ) { AccountCard( diff --git a/mifospay-android/prodRelease-badging.txt b/mifospay-android/prodRelease-badging.txt index 3c3d92c2..1843fc9f 100644 --- a/mifospay-android/prodRelease-badging.txt +++ b/mifospay-android/prodRelease-badging.txt @@ -1,4 +1,4 @@ -package: name='org.mifospay' versionCode='1' versionName='2025.6.5-beta.0.1' platformBuildVersionName='15' platformBuildVersionCode='35' compileSdkVersion='35' compileSdkVersionCodename='15' +package: name='org.mifospay' versionCode='1' versionName='2025.6.5-beta.0.2' platformBuildVersionName='15' platformBuildVersionCode='35' compileSdkVersion='35' compileSdkVersionCodename='15' sdkVersion:'26' targetSdkVersion:'34' uses-permission: name='android.permission.INTERNET'