Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,20 @@ class SettingsViewModel(
}

private fun handleDisableAccount() {
val accountId = userPreferencesRepository.defaultAccountId.value
if (accountId == null) {
mutableStateFlow.update {
it.copy(dialogState = DialogState.Error("Default account not available"))

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Replace hardcoded error text with a string resource.

"Default account not available" is user-facing and currently hardcoded, while this ViewModel otherwise uses localized Res.string.*/getString(...) messages. Please move this to resources for i18n consistency.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@feature/settings/src/commonMain/kotlin/org/mifospay/feature/settings/SettingsViewModel.kt`
at line 231, The hardcoded user-facing message in SettingsViewModel (the
expression it.copy(dialogState = DialogState.Error("Default account not
available"))) should be replaced with the localized string resource used
elsewhere (e.g., Res.string.* or the existing getString(...) helper); update the
DialogState.Error call to pass the resource-backed string (fetching the
appropriate "default_account_not_available" resource) so the ViewModel uses
i18n-consistent messaging.

}
return
}

mutableStateFlow.update {
it.copy(dialogState = DialogState.Loading)
}

// TODO:: this shouldn't work, we need account id to block account
viewModelScope.launch {
val result = repository.blockAccount(state.client.id)
val result = repository.blockAccount(accountId)
sendAction(DisableAccountResult(result))
}
}
Expand Down
Loading