Skip to content

Commit

Permalink
fixed crash related to the test app
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-alfresco committed May 9, 2024
1 parent 9ee018e commit 51aafbb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ fun convertModelToMapValues(data: UserGroupDetails?) =
}

fun convertModelToMapValues(data: FieldsData): Map<String, Any?> {
if (data.value == null) {
return mapOf()
}
val id = data.options.find { it.name == data.value }?.id
requireNotNull(id)
return mapOf<String, Any?>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ fun DateTimeField(
val dateFormat = updateDateFormat(fieldsData.params?.field?.dateDisplayFormat) ?: DATE_FORMAT_2_1
dateTime = date.first.getLocalFormattedDate(date.second, dateFormat)
}

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,24 +159,26 @@ class ProcessFragment : Fragment(), MavericksView, EntryListener {

override fun invalidate() = withState(viewModel) { state ->
binding.loading.isVisible = state.requestForm is Loading || state.requestStartWorkflow is Loading ||
state.requestSaveForm is Loading || state.requestOutcomes is Loading || state.requestProfile is Loading ||
state.requestAccountInfo is Loading || state.requestContent is Loading
state.requestSaveForm is Loading || state.requestOutcomes is Loading || state.requestProfile is Loading ||
state.requestAccountInfo is Loading || state.requestContent is Loading

when {
state.requestStartWorkflow is Success || state.requestSaveForm is Success ||
state.requestOutcomes is Success || state.requestClaimRelease is Success -> {
state.requestOutcomes is Success || state.requestClaimRelease is Success -> {
viewModel.updateProcessList()
requireActivity().finish()
}

state.requestForm is Success -> {
val hasUploadField = state.formFields.any { it.type == FieldType.UPLOAD.value() }

if (hasUploadField && state.parent.defaultEntries.isNotEmpty()) {
viewModel.fetchUserProfile()
viewModel.fetchAccountInfo()
} else {
showSnackBar(getString(R.string.error_no_upload_fields))
if (state.parent.defaultEntries.isNotEmpty()) {
if (hasUploadField) {
viewModel.fetchUserProfile()
viewModel.fetchAccountInfo()
} else {
showSnackBar(getString(R.string.error_no_upload_fields))
}
}

if (hasUploadField) {
Expand Down Expand Up @@ -226,7 +228,6 @@ class ProcessFragment : Fragment(), MavericksView, EntryListener {

override fun onAttachFiles(field: FieldsData) = withState(viewModel) { state ->
if (isAdded && field.type == FieldType.UPLOAD.value()) {

val listContents = mergeInUploads(field.getContentList(state.parent.processDefinitionId), viewModel.getContents(state, field.id))
val isError = field.required && listContents.isEmpty()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ import com.alfresco.content.process.R
import com.alfresco.content.process.ui.fragments.FormViewState

fun actionsReadOnlyField(
isTapped: Boolean, field: FieldsData, navController: NavController,
state: FormViewState, context: Context
isTapped: Boolean,
field: FieldsData,
navController: NavController,
state: FormViewState,
context: Context,
) {
when (field.params?.field?.type?.lowercase()) {
FieldType.UPLOAD.value() -> {
Expand Down Expand Up @@ -55,4 +58,4 @@ fun actionsReadOnlyField(
.show()
}
}
}
}

0 comments on commit 51aafbb

Please sign in to comment.