Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Update trace location attributes validation #2732

Merged
Merged
Changes from 1 commit
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 @@ -93,24 +93,24 @@ 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
}
}
)
)
}

private fun String.isTextFormattedCorrectly() = trim().length in 1..100 && !contains('\n')

data class UIState(
private val begin: LocalDateTime? = null,
private val end: LocalDateTime? = null,
Expand Down