Skip to content
Snippets Groups Projects
Unverified Commit 595087d2 authored by Juraj Kusnier's avatar Juraj Kusnier Committed by GitHub
Browse files

Update trace location attributes validation (#2732)

parent 0a2e01cd
No related branches found
No related tags found
No related merge requests found
......@@ -93,17 +93,15 @@ class TraceLocationCreateViewModel @AssistedInject constructor(
isDateVisible = category.uiType == TraceLocationUIType.EVENT,
isSendEnable = when (category.uiType) {
TraceLocationUIType.LOCATION -> {
description.trim().length in 1..100 &&
address.trim().length in 0..100 &&
description.isTextFormattedCorrectly() &&
address.isTextFormattedCorrectly() &&
checkInLength > Duration.ZERO &&
!requestInProgress
}
TraceLocationUIType.EVENT -> {
description.trim().length in 1..100 &&
address.trim().length in 0..100 &&
begin != null &&
end != null &&
end?.isAfter(begin) == true &&
description.isTextFormattedCorrectly() &&
address.isTextFormattedCorrectly() &&
begin != null && end != null && end?.isAfter(begin) == true &&
!requestInProgress
}
}
......@@ -111,6 +109,8 @@ class TraceLocationCreateViewModel @AssistedInject constructor(
)
}
private fun String.isTextFormattedCorrectly() = trim().length in 1..100 && !contains('\n')
data class UIState(
private val begin: LocalDateTime? = null,
private val end: LocalDateTime? = null,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment