Skip to content

feat(core/ui) : allow user to change transaction page into local language#3132

Open
Aditya002500 wants to merge 14 commits into
openMF:devfrom
Aditya002500:api_local_av2
Open

feat(core/ui) : allow user to change transaction page into local language#3132
Aditya002500 wants to merge 14 commits into
openMF:devfrom
Aditya002500:api_local_av2

Conversation

@Aditya002500

@Aditya002500 Aditya002500 commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Fixes - Jira-#506


🎥 Demo Video

trasaction_history.mp4

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the static analysis check ./gradlew check or ci-prepush.sh to make sure you didn't break anything
  • If you have multiple commits please combine them into one commit by squashing them.

Summary by CodeRabbit

  • New Features

    • Transaction UI localized in 24+ languages: date labels, month names, transaction type names and digit glyphs.
    • Transaction types are now localized for clearer titles across the app.
    • Dates show friendly localized formats (including “Today”/“Yesterday”), improved parsing/formatting and locale-aware digit rendering.
    • Amounts rendered with localized digits.
  • Chores

    • App version bumped to 0.0.4-beta.

@coderabbitai

coderabbitai Bot commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Added optional typeCode to transaction models and mappers, introduced TransactionDateFormatter composables for localized date/amount/type rendering, added transaction localization strings across many locales, and updated screens/viewmodels to use ISO date keys and the new formatting utilities.

Changes

Cohort / File(s) Summary
Core model & mappers
core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/TransactionDetails.kt, core/data/src/commonMain/kotlin/org/mifos/mobile/core/data/mapper/transactions/LoanTransactionMapper.kt, core/data/src/commonMain/kotlin/org/mifos/mobile/core/data/mapper/transactions/SavingsTransactionMapper.kt
Added typeCode: String? to TransactionDetails and populated it from loanType.code / savingsType.code in DTO→model mappers.
UI utility
core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt
New composables and helpers: parse ISO/list dates, toIsoDateString, localized month lookup, digit substitution, localized amount/type formatting, and "today"/"yesterday" prefix formatters.
Core UI string resources (many locales)
core/ui/src/commonMain/composeResources/values/strings.xml, core/ui/src/commonMain/composeResources/values-*/strings.xml
(values-ar, values-bn, values-de, values-es, values-fa, values-fr, values-gu, values-hi, values-hu, values-in, values-km, values-kn, values-ml, values-mr, values-ms, values-my, values-pl, values-pt, values-ru, values-si, values-sw, values-te, values-ur)
Appended relative date strings, month abbreviations, ~30+ tx_type_* keys, and tx_digits to default and many locale resource files (new entries only).
Account screens
feature/accounts/.../TransactionScreen.kt, feature/accounts/.../TransactionDetailsScreen.kt
Replaced DateHelper with parseIsoDate/formatTransactionDate*, derive localized title via localizeTransactionType(Type(code,value)), and apply localizeAmount(...) around currency-formatted strings.
Account viewmodels / UI models
feature/accounts/.../TransactionViewModel.kt, feature/accounts/.../TransactionDetailsViewModel.kt
Added typeCode to UiTransaction/UiTransactionDetails, populated it in mappings, and switched date grouping to UiTransaction.toIsoDateKey() producing YYYY-MM-DD keys.
Recent-transaction feature
feature/recent-transaction/.../RecentTransactionScreen.kt, feature/recent-transaction/.../RecentTransactionViewModel.kt
Updated grouping to toIsoDateKey(), propagated typeCode, and switched to new formatting/localization utilities for date/type/amount rendering.
Build metadata
cmp-android/prodRelease-badging.txt
Bumped versionName from 0.0.1-beta.0.1810 to 0.0.4-beta.0.2 (versionCode unchanged).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Screen
    participant ViewModel
    participant Mapper
    participant Formatter

    User->>Screen: open transactions UI
    Screen->>ViewModel: request grouped transactions
    ViewModel->>Mapper: map domain -> UiTransaction (include typeCode, date list)
    Mapper-->>ViewModel: UiTransaction list
    ViewModel->>ViewModel: group by toIsoDateKey()
    ViewModel-->>Screen: grouped UiTransaction sections
    Screen->>Formatter: formatTransactionDateWithPrefix(parseIsoDate(sectionKey))
    Screen->>Formatter: localizeTransactionType(Type(code,value))
    Screen->>Formatter: localizeAmount(CurrencyFormatter.format(...))
    Formatter-->>Screen: localized strings
    Screen-->>User: render localized date, title, amount
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • niyajali
  • revanthkumarJ
  • biplab1
  • mena-rizkalla

Poem

🐰 I hopped through dates and codes with glee,

Numbers, months, and names for all to see.
From DTO to screen I carried the tune,
Now transactions sing from noon to moon.
Hop, hop — locales bloom in tune!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.61% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: adding localized language support for the transaction page, which aligns with the substantive changes across mappers, models, UI resources, and formatters.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Aditya002500 Aditya002500 marked this pull request as ready for review March 25, 2026 15:27
@Aditya002500 Aditya002500 requested a review from a team March 25, 2026 15:27

@revanthkumarJ revanthkumarJ left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the pr name it should be the feature you implemented

@Aditya002500 Aditya002500 changed the title feat(feature) : added functionality feat(core/ui) : Added local translation strings Mar 25, 2026
@revanthkumarJ

Copy link
Copy Markdown
Contributor

For proper naming convention have a look at https://github.com/openMF/mifos-pay/wiki/Commit-style-guide

Comment thread cmp-android/build.gradle.kts Outdated
Comment thread cmp-shared/cmp_shared.podspec
id = this.id ?: -1L,
transactionName = type?.value ?: "Loan Transaction",
typeCode = type?.code,
isCredit = isCreditResolved,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here also this pr scope should not other other things than adding translation strings .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The strings were missing so I simply added those

@Aditya002500 Aditya002500 changed the title feat(core/ui) : Added local translation strings feat(core/ui) : Allow user to change transaction page into local language Mar 25, 2026
@Aditya002500 Aditya002500 changed the title feat(core/ui) : Allow user to change transaction page into local language feat(core/ui) : allow user to change transaction page into local language Mar 25, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
core/ui/src/commonMain/composeResources/values-in/strings.xml (1)

1-174: ⚠️ Potential issue | 🟠 Major

Indonesian locale folder should be values-id, not values-in in KMP.

In Kotlin Multiplatform projects, Indonesian locale resources must be placed under a values-id folder. The values-in naming is a legacy Android-only convention and will not resolve correctly in KMP shared/multiplatform sources. Rename this folder from values-in to values-id to ensure proper locale resolution.

Based on learnings: "In Kotlin Multiplatform (KMP) projects, Indonesian locale resources should be placed under a values-id folder. The legacy values-in naming is only used for native Android and should not be used in KMP shared/ multiplatform sources."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/ui/src/commonMain/composeResources/values-in/strings.xml` around lines 1
- 174, The resource folder is incorrectly named "values-in" which is the
Android-only legacy code; rename the locale resource folder to "values-id" and
move the provided strings.xml (the file containing keys like "no_internet",
"password_checker_min_length_feedback", "validation_email_empty", etc.) into
that "values-id" folder so Kotlin Multiplatform can resolve the Indonesian
locale correctly; ensure any build/Gradle/KMP resource references are updated if
they explicitly reference "values-in" and run a resource sync to verify the
locale loads.
🧹 Nitpick comments (1)
feature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/accountTransactions/TransactionViewModel.kt (1)

926-931: Extract toIsoDateKey() into a shared helper.

This exact extension now exists here and in feature/recent-transaction/src/commonMain/kotlin/org/mifos/mobile/feature/recent/transaction/viewmodel/RecentTransactionViewModel.kt:490-495. Keeping the grouping key duplicated in two viewmodels makes the date bucket format easy to drift from the shared parsing/formatting utilities.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@feature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/accountTransactions/TransactionViewModel.kt`
around lines 926 - 931, The duplicate extension UiTransaction.toIsoDateKey() in
TransactionViewModel and RecentTransactionViewModel should be extracted into a
shared helper to avoid format drift; create a single function (e.g., a top-level
function or extension named toIsoDateKey on UiTransaction) in a common/shared
utilities file and replace both local implementations by calling that shared
helper from TransactionViewModel and RecentTransactionViewModel so both
viewmodels use the same ISO date key logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmp-android/build.gradle.kts`:
- Around line 104-124: The attributesSchema + PreferJarRule is declared
module-wide and can unintentionally affect all dependency resolution; restrict
its scope by moving the attributesSchema and PreferJarRule usage out of the
global dependencies block and apply it only to the configuration that consumes
the KMP library (for example use configurations.named("androidRuntimeClasspath")
or the specific KMP-consumer configuration), or extract the rule into a
convention plugin in build-logic and apply that plugin only where needed; keep
the PreferJarRule and its execute(details: MultipleCandidatesDetails<String>)
implementation but attach the attributesSchema call to the specific
configuration or the targeted convention plugin instead of the top-level
dependencies block.

In `@cmp-android/prodRelease-badging.txt`:
- Line 1: The package metadata shows versionName was updated to '0.0.4-beta.0.1'
but versionCode remains '1'; update the numeric versionCode to a new,
incremented integer (e.g., >1) wherever the package metadata is set (the
versionCode attribute in the package line) so it matches the new release and
avoids install/publish conflicts with previous builds that used versionCode=1.

In `@core/ui/src/commonMain/composeResources/values-es/strings.xml`:
- Around line 161-176: Replace the ambiguous Spanish label so repayments differ
from refunds: change tx_type_repayment from "Reembolso" to a repayment-specific
term (e.g., "Pago de préstamo"), and update the related keys
tx_type_repayment_at_disbursement and tx_type_recover_repayment to use the same
term (for example "Pago de préstamo al desembolso" and "Recuperar pago de
préstamo"), leaving tx_type_refund as "Reembolso".

In `@core/ui/src/commonMain/composeResources/values/strings.xml`:
- Around line 159-187: Transaction types for approve/withdraw are being
collapsed to the generic tx_type_initiate_transfer in
TransactionDateFormatter.localizeTransactionType; update that function to map
approve-transfer and withdraw-transfer codes to their own resources
(Res.string.tx_type_approve_transfer and Res.string.tx_type_withdraw_transfer)
instead of falling back to tx_type_initiate_transfer, i.e., add branches for
code == "approvetransfer" / rawCode.contains("approvetransfer") and code ==
"withdrawtransfer" / rawCode.contains("withdrawtransfer") that return
stringResource(Res.string.tx_type_approve_transfer) and
stringResource(Res.string.tx_type_withdraw_transfer) respectively.

In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`:
- Around line 138-154: The localizedMonth function currently maps any non-1..11
input to December, hiding invalid month values; change localizedMonth to
validate monthNumber first (e.g., require(monthNumber in 1..12) or throw
IllegalArgumentException) and handle only the 12 valid cases in the when
expression (keep Res.string.tx_month_dec for 12), so invalid inputs fail fast
instead of silently returning December; refer to the localizedMonth function and
its when branches to implement the validation and adjust the else branch
accordingly.
- Around line 222-223: The mapping branch in TransactionDateFormatter.kt that
matches code == "approvetransfer" || rawCode.contains("approvetransfer")
currently returns stringResource(Res.string.tx_type_initiate_transfer); change
that to stringResource(Res.string.tx_type_approve_transfer) so "approvetransfer"
displays correctly, and add the missing import for the Res symbols used (import
the resource holder used for string keys) so the new reference resolves.

In
`@feature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/transactionDetail/TransactionDetailsScreen.kt`:
- Around line 183-189: The DetailItem currently calls
localizeTransactionType(Type(code = transaction.typeCode, value =
transaction.typeValue)) inline, which can return an empty string and render a
blank subtitle; compute val localizedType = localizeTransactionType(Type(code =
transaction.typeCode, value = transaction.typeValue)) once, then only call
DetailItem if localizedType.isNotBlank(), otherwise leave the existing header
label unchanged (do not render or pass an empty subtitle). Apply the same
pattern where localizeTransactionType is used (the other occurrence around lines
243–245) to guard rendering on localizedType.isNotBlank().

---

Outside diff comments:
In `@core/ui/src/commonMain/composeResources/values-in/strings.xml`:
- Around line 1-174: The resource folder is incorrectly named "values-in" which
is the Android-only legacy code; rename the locale resource folder to
"values-id" and move the provided strings.xml (the file containing keys like
"no_internet", "password_checker_min_length_feedback", "validation_email_empty",
etc.) into that "values-id" folder so Kotlin Multiplatform can resolve the
Indonesian locale correctly; ensure any build/Gradle/KMP resource references are
updated if they explicitly reference "values-in" and run a resource sync to
verify the locale loads.

---

Nitpick comments:
In
`@feature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/accountTransactions/TransactionViewModel.kt`:
- Around line 926-931: The duplicate extension UiTransaction.toIsoDateKey() in
TransactionViewModel and RecentTransactionViewModel should be extracted into a
shared helper to avoid format drift; create a single function (e.g., a top-level
function or extension named toIsoDateKey on UiTransaction) in a common/shared
utilities file and replace both local implementations by calling that shared
helper from TransactionViewModel and RecentTransactionViewModel so both
viewmodels use the same ISO date key logic.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cc72ab4e-7ce2-49e4-bd03-dc235aa18bd0

📥 Commits

Reviewing files that changed from the base of the PR and between f638e19 and c2faf6b.

📒 Files selected for processing (37)
  • cmp-android/build.gradle.kts
  • cmp-android/prodRelease-badging.txt
  • cmp-shared/cmp_shared.podspec
  • core/data/src/commonMain/kotlin/org/mifos/mobile/core/data/mapper/transactions/LoanTransactionMapper.kt
  • core/data/src/commonMain/kotlin/org/mifos/mobile/core/data/mapper/transactions/SavingsTransactionMapper.kt
  • core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/TransactionDetails.kt
  • core/ui/src/commonMain/composeResources/values-ar/strings.xml
  • core/ui/src/commonMain/composeResources/values-bn/strings.xml
  • core/ui/src/commonMain/composeResources/values-de/strings.xml
  • core/ui/src/commonMain/composeResources/values-es/strings.xml
  • core/ui/src/commonMain/composeResources/values-fa/strings.xml
  • core/ui/src/commonMain/composeResources/values-fr/strings.xml
  • core/ui/src/commonMain/composeResources/values-gu/strings.xml
  • core/ui/src/commonMain/composeResources/values-hi/strings.xml
  • core/ui/src/commonMain/composeResources/values-hu/strings.xml
  • core/ui/src/commonMain/composeResources/values-in/strings.xml
  • core/ui/src/commonMain/composeResources/values-km/strings.xml
  • core/ui/src/commonMain/composeResources/values-kn/strings.xml
  • core/ui/src/commonMain/composeResources/values-ml/strings.xml
  • core/ui/src/commonMain/composeResources/values-mr/strings.xml
  • core/ui/src/commonMain/composeResources/values-ms/strings.xml
  • core/ui/src/commonMain/composeResources/values-my/strings.xml
  • core/ui/src/commonMain/composeResources/values-pl/strings.xml
  • core/ui/src/commonMain/composeResources/values-pt/strings.xml
  • core/ui/src/commonMain/composeResources/values-ru/strings.xml
  • core/ui/src/commonMain/composeResources/values-si/strings.xml
  • core/ui/src/commonMain/composeResources/values-sw/strings.xml
  • core/ui/src/commonMain/composeResources/values-te/strings.xml
  • core/ui/src/commonMain/composeResources/values-ur/strings.xml
  • core/ui/src/commonMain/composeResources/values/strings.xml
  • core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt
  • feature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/accountTransactions/TransactionScreen.kt
  • feature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/accountTransactions/TransactionViewModel.kt
  • feature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/transactionDetail/TransactionDetailsScreen.kt
  • feature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/transactionDetail/TransactionDetailsViewModel.kt
  • feature/recent-transaction/src/commonMain/kotlin/org/mifos/mobile/feature/recent/transaction/screen/RecentTransactionScreen.kt
  • feature/recent-transaction/src/commonMain/kotlin/org/mifos/mobile/feature/recent/transaction/viewmodel/RecentTransactionViewModel.kt

Comment thread cmp-android/build.gradle.kts Outdated
Comment thread cmp-android/prodRelease-badging.txt Outdated
Comment thread core/ui/src/commonMain/composeResources/values-es/strings.xml Outdated
Comment thread core/ui/src/commonMain/composeResources/values/strings.xml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt (1)

193-198: Operator precedence may cause unexpected matching behavior.

Line 197 mixes || and && without parentheses. Due to && having higher precedence than ||, the condition is evaluated as:

code in setOf(...) || (rawCode.contains("deposit") && !rawCode.contains("repayment"))

This is likely the intended behavior, but explicit parentheses would improve readability. Also, there's a duplicate "interestposting" entry in the set on line 193.

♻️ Suggested cleanup
-        code in setOf("savingsaccountinterestposting", "loaninterestposting", "interestposting", "interestposting") ||
+        code in setOf("savingsaccountinterestposting", "loaninterestposting", "interestposting") ||
             rawCode.contains("interestposting") ->
             stringResource(Res.string.tx_type_interest_posting)

-        code in setOf("deposit", "savingsdeposit") || rawCode.contains("deposit") && !rawCode.contains("repayment") ->
+        code in setOf("deposit", "savingsdeposit") || (rawCode.contains("deposit") && !rawCode.contains("repayment")) ->
             stringResource(Res.string.tx_type_deposit)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`
around lines 193 - 198, The conditional mixing || and && in the
TransactionDateFormatter branch using variables code and rawCode is ambiguous;
wrap the deposit check in explicit parentheses—e.g. (code in
setOf("deposit","savingsdeposit")) || (rawCode.contains("deposit") &&
!rawCode.contains("repayment"))—to make precedence explicit, and remove the
duplicate "interestposting" entry from the setOf(...) used for the
interest-posting branch so the set contains unique values.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmp-shared/cmp_shared.podspec`:
- Line 53: The spec.resources entry uses Windows backslashes which will break
resource loading on macOS/iOS; update the spec.resources value (the string
currently assigned to spec.resources) to use POSIX forward slashes (e.g.,
replace backslashes in 'build\compose\cocoapods\compose-resources' with '/') so
CocoaPods can locate the compose resources at runtime.
- Line 3: The podspec's spec.version = '0.0.4' is out of sync with the project's
actual version (referenced as project.version in build.gradle.kts and seen as
1.0 in cmp-ios/Podfile.lock); update spec.version in cmp_shared.podspec to match
the canonical project version (use the value from project.version in
build.gradle.kts or bump project.version to the intended release) so the
podspec, Podfile.lock, and project.version are all identical.

In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`:
- Line 251: The branch in TransactionDateFormatter.kt that maps
setOf("disbursement") to stringResource(Res.string.tx_type_repayment) is
incorrect; either remove that branch so disbursement falls back to type.value
(server label) or change it to use a proper disbursement resource (e.g.,
stringResource(Res.string.tx_type_disbursement)) after adding that translation;
locate the when/branch handling transaction type (the setOf("disbursement")
case) and update it accordingly.

---

Nitpick comments:
In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`:
- Around line 193-198: The conditional mixing || and && in the
TransactionDateFormatter branch using variables code and rawCode is ambiguous;
wrap the deposit check in explicit parentheses—e.g. (code in
setOf("deposit","savingsdeposit")) || (rawCode.contains("deposit") &&
!rawCode.contains("repayment"))—to make precedence explicit, and remove the
duplicate "interestposting" entry from the setOf(...) used for the
interest-posting branch so the set contains unique values.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ae56b74a-237a-4580-96d7-3e459b6dfbbd

📥 Commits

Reviewing files that changed from the base of the PR and between c2faf6b and 2f3e82e.

📒 Files selected for processing (6)
  • cmp-android/prodRelease-badging.txt
  • cmp-shared/cmp_shared.podspec
  • core/ui/src/commonMain/composeResources/values-es/strings.xml
  • core/ui/src/commonMain/composeResources/values/strings.xml
  • core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt
  • feature/accounts/src/commonMain/kotlin/org/mifos/mobile/feature/accounts/transactionDetail/TransactionDetailsScreen.kt
✅ Files skipped from review due to trivial changes (3)
  • cmp-android/prodRelease-badging.txt
  • core/ui/src/commonMain/composeResources/values-es/strings.xml
  • core/ui/src/commonMain/composeResources/values/strings.xml

Comment thread cmp-shared/cmp_shared.podspec Outdated
Comment thread cmp-shared/cmp_shared.podspec Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt (1)

206-207: Avoid runtime lowercase() on string literal.

The expression "repaymentAtDisbursement".lowercase() computes the same result every time. Use the lowercase string directly.

-        code in setOf("repaymentAtDisbursement".lowercase(), "repaymentatdisbursement") ->
+        code in setOf("repaymentatdisbursement") ->
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`
around lines 206 - 207, The when-branch in TransactionDateFormatter.kt is using
a runtime call `"repaymentAtDisbursement".lowercase()` inside setOf; replace
that call with the precomputed lowercase literal "repaymentatdisbursement" so
the set becomes setOf("repaymentatdisbursement", "repaymentatdisbursement") (or
better, remove the duplicate and keep a single lowercase literal) in the branch
that returns stringResource(Res.string.tx_type_repayment_at_disbursement).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`:
- Around line 193-194: The set used in the when branch inside
TransactionDateFormatter (the setOf(...) containing
"savingsaccountinterestposting", "loaninterestposting", "interestposting",
"interestposting") has a duplicated "interestposting" entry; remove the
duplicated "interestposting" so the set reads only once (e.g.,
setOf("savingsaccountinterestposting", "loaninterestposting",
"interestposting")) to clean up the copy-paste error while preserving behavior.

---

Nitpick comments:
In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`:
- Around line 206-207: The when-branch in TransactionDateFormatter.kt is using a
runtime call `"repaymentAtDisbursement".lowercase()` inside setOf; replace that
call with the precomputed lowercase literal "repaymentatdisbursement" so the set
becomes setOf("repaymentatdisbursement", "repaymentatdisbursement") (or better,
remove the duplicate and keep a single lowercase literal) in the branch that
returns stringResource(Res.string.tx_type_repayment_at_disbursement).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 98b28e95-f09c-4da7-9864-ade0c2004c09

📥 Commits

Reviewing files that changed from the base of the PR and between 2f3e82e and 97228af.

📒 Files selected for processing (1)
  • core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt

Aditya002500 and others added 2 commits March 25, 2026 22:07
…ransactionDateFormatter.kt

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt (1)

206-207: Minor: Redundant set entry.

"repaymentAtDisbursement".lowercase() evaluates to "repaymentatdisbursement", making the two entries in the set identical.

♻️ Simplify the set
-        code in setOf("repaymentAtDisbursement".lowercase(), "repaymentatdisbursement") ->
+        code == "repaymentatdisbursement" ->
             stringResource(Res.string.tx_type_repayment_at_disbursement)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`
around lines 206 - 207, The set in TransactionDateFormatter (the branch matching
code in the function that maps transaction type keys) contains both
"repaymentAtDisbursement".lowercase() and the literal "repaymentatdisbursement",
which are identical; remove the redundant entry so the set has only one of them
(either keep the lowercase() expression or the literal) to simplify the match
and avoid duplication in the branch that returns
stringResource(Res.string.tx_type_repayment_at_disbursement).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`:
- Around line 185-190: The prefix-stripping chain on the variable `code`
(derived from `rawCode`) currently calls `.removePrefix("loan")`, which
transforms values like `"loanchargeadded"` into `"chargeadded"` and makes the
later equality check that expects `"loanchargeadded"` unreachable; fix this by
either removing the `.removePrefix("loan")` call from the chain that builds
`code` so original transaction codes remain intact, or update the downstream
comparison that currently checks for `"loanchargeadded"` to instead check for
the transformed value `"chargeadded"` (apply the chosen change in the code that
constructs `code` and/or the equality branch that references `"loanchargeadded"`
in the TransactionDateFormatter logic).

---

Nitpick comments:
In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`:
- Around line 206-207: The set in TransactionDateFormatter (the branch matching
code in the function that maps transaction type keys) contains both
"repaymentAtDisbursement".lowercase() and the literal "repaymentatdisbursement",
which are identical; remove the redundant entry so the set has only one of them
(either keep the lowercase() expression or the literal) to simplify the match
and avoid duplication in the branch that returns
stringResource(Res.string.tx_type_repayment_at_disbursement).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0490e625-7567-415d-b763-a3c2e33b35a5

📥 Commits

Reviewing files that changed from the base of the PR and between 97228af and 341d683.

📒 Files selected for processing (1)
  • core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt

…ransactionDateFormatter.kt

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt`:
- Around line 183-187: The branch logic expects a normalized variable named
"code" but it was never defined after computing "rawCode" from "type.code";
restore it by introducing a val code computed from rawCode (inside
TransactionDateFormatter.kt) that strips the common Mifos prefixes and
whitespace (e.g., remove prefixes like "mifos", "mifosx", etc.) so both short
and full codes match, then use that "code" value in the subsequent when branches
(the existing branches reference code and should remain unchanged).
- Around line 110-118: The else branch in formatTransactionDate still hardcodes
"day month year"; replace it with a translatable pattern: fetch a new string
resource tx_date_format and pass localized components (localizeNumber(date.day),
localizedMonth(date.monthNumber), localizeNumber(date.year)) as positional
parameters so locales can reorder them; update the Compose resources
(composeResources/values*) to add tx_date_format with placeholders (%1$s, %2$s,
%3$s) and include localized variants (use values-id for Indonesian, not
values-in). Ensure the code uses stringResource(Res.string.tx_date_format, ...)
in formatTransactionDate and keep localizeNumber and localizedMonth calls as the
parameters.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c844035b-986d-4b43-a257-a87ac23f77f5

📥 Commits

Reviewing files that changed from the base of the PR and between 341d683 and 521b080.

📒 Files selected for processing (1)
  • core/ui/src/commonMain/kotlin/org/mifos/mobile/core/ui/utils/TransactionDateFormatter.kt

* Falls back to the API-provided [Type.value] string if no translation is found.
*/
@Suppress("CyclomaticComplexMethod")
@Composable

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this..no need to localize server side data

@Aditya002500 Aditya002500 Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@niyajali Then the strings like withdrawal and deposit present in the screen is by default ENGLISH no matter what the local language is selected, kindly let me know if I should remove this and let it be in English.

@niyajali niyajali left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aditya002500 revert the non-translation related changes and let us know

@Aditya002500

Copy link
Copy Markdown
Contributor Author

@Aditya002500 revert the non-translation related changes and let us know

Hey @niyajali I have reverted those changes kindly review it once again and let me know any changes I should further proceed with

@biplab1 biplab1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert non-translation related changes as previously mentioned by @niyajali.


val id: Long,
val transactionName: String,
val typeCode: String? = null,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be removed as well? Please review.

<string name="tx_date_yesterday">أمس</string>
<string name="tx_month_jan">يناير</string>
<string name="tx_month_feb">فبراير</string>
<string name="tx_month_mar">مارس</string>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow proper naming of string resources.

Comment on lines 721 to 763
@@ -732,6 +733,7 @@ internal class AccountsTransactionViewModel(
date = date,
amount = amount,
typeValue = type.value,
typeCode = type.code,
isCredit = when (type.value?.lowercase()) {
"disbursement", "repayment" -> false
else -> true
@@ -757,6 +759,7 @@ data class UiTransaction(
val amount: Double?,
val type: TransactionType? = null,
val typeValue: String? = null,
val typeCode: String? = null,
val isCredit: Boolean?,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, please review.

Comment on lines +927 to +930
val y = date.getOrElse(0) { 0 }
val m = date.getOrElse(1) { 1 }.toString().padStart(2, '0')
val d = date.getOrElse(2) { 1 }.toString().padStart(2, '0')
return "$y-$m-$d"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use proper naming for values.

Comment on lines +490 to +495
private fun UiTransaction.toIsoDateKey(): String {
val y = date.getOrElse(0) { 0 }
val m = date.getOrElse(1) { 1 }.toString().padStart(2, '0')
val d = date.getOrElse(2) { 1 }.toString().padStart(2, '0')
return "$y-$m-$d"
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, please review.

Comment on lines 360 to 407
@@ -403,6 +403,7 @@ internal data class UiTransaction(
val amount: Double?,
val type: TransactionType? = null,
val typeValue: String? = null,
val typeCode: String? = null,
val isCredit: Boolean,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, please review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants