Skip to content
Open
Show file tree
Hide file tree
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
Empty file modified ci-prepush.sh
100644 → 100755
Empty file.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@biplab1 Just wanted a confirmation on whether this change to show errorText only when isError is true is the correct approach in MifosOutlinedFieldText() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also I have replaced hardcoded string with string resource and ran ci-prepush.sh

Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ fun MifosOutlinedTextField(
prefix = prefix,
suffix = suffix,
supportingText = {
if (errorText != null) {
if (errorText != null && isError) {
Text(
modifier = Modifier.testTag(errorTextTag),
text = errorText,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<string name="feature_search_no_search_result_found">No results found for entered query</string>
<string name="feature_search_no_search_query_entered">No Search Query Entered!</string>
<string name="feature_search_exact_match">Exact Match</string>
<string name="feature_search_empty_input_field">Please enter Name or Account Number or External ID to search</string>

<string name="feature_search_search_options_clients_label">Clients</string>
<string name="feature_search_search_options_clients_value">clients</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class SearchViewModel(
searchJob?.cancel()

if (state.value.searchText.isNotEmpty()) {
state.value = state.value.copy(showEmptyError = false)
searchJob = searchRepository.searchResources(
query = state.value.searchText,
resources = state.value.selectedFilter?.value,
Expand Down Expand Up @@ -123,6 +124,9 @@ class SearchViewModel(
}
}
.launchIn(viewModelScope)
} else {
state.value = state.value.copy(showEmptyError = true)
searchResultState.update { SearchResultState.Empty() }
}
}
}
Expand All @@ -138,6 +142,7 @@ data class SearchScreenState(
val searchText: String = "",
val selectedFilter: FilterOption? = null,
val exactMatch: Boolean? = null,
val showEmptyError: Boolean = false,
)

sealed interface SearchScreenEvent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
package com.mifos.feature.search.components

import androidclient.feature.search.generated.resources.Res
import androidclient.feature.search.generated.resources.feature_search_empty_input_field
import androidclient.feature.search.generated.resources.feature_search_exact_match
import androidclient.feature.search.generated.resources.feature_search_search_hint
import androidclient.feature.search.generated.resources.feature_search_title
Expand Down Expand Up @@ -117,6 +118,8 @@ internal fun SearchBox(
onEvent(SearchScreenEvent.ClearSearchText)
},
maxLines = 1,
isError = state.showEmptyError,
errorText = if (state.showEmptyError) stringResource(Res.string.feature_search_empty_input_field) else null,
)

// Search Button
Expand Down