diff --git a/capture/src/main/res/values-de/strings.xml b/capture/src/main/res/values-de/strings.xml
index 0fc433ee..21ccd2de 100644
--- a/capture/src/main/res/values-de/strings.xml
+++ b/capture/src/main/res/values-de/strings.xml
@@ -29,4 +29,4 @@
%02d:%02d
Die ausgewählte Dateigröße darf beim Hochladen 100 MB nicht überschreiten.
-
\ No newline at end of file
+
diff --git a/capture/src/main/res/values-es/strings.xml b/capture/src/main/res/values-es/strings.xml
index 33d63f64..1141147c 100644
--- a/capture/src/main/res/values-es/strings.xml
+++ b/capture/src/main/res/values-es/strings.xml
@@ -29,4 +29,4 @@
%02d:%02d
El tamaño del fichero seleccionado no puede superar los 100 MB para cargarlo.
-
\ No newline at end of file
+
diff --git a/common/src/main/kotlin/com/alfresco/content/common/SharedURLParser.kt b/common/src/main/kotlin/com/alfresco/content/common/SharedURLParser.kt
index 6c5ef2e4..f5d0c090 100644
--- a/common/src/main/kotlin/com/alfresco/content/common/SharedURLParser.kt
+++ b/common/src/main/kotlin/com/alfresco/content/common/SharedURLParser.kt
@@ -1,9 +1,23 @@
package com.alfresco.content.common
+import com.alfresco.content.session.Session
+import com.alfresco.content.session.SessionManager
+import com.alfresco.content.session.SessionNotFoundException
+import java.net.URL
import java.net.URLDecoder
class SharedURLParser {
+ lateinit var session: Session
+
+ init {
+ try {
+ session = SessionManager.requireSession
+ } catch (e: SessionNotFoundException) {
+ e.printStackTrace()
+ }
+ }
+
/**
* isPreview (Boolean)
* String
@@ -12,6 +26,16 @@ class SharedURLParser {
fun getEntryIdFromShareURL(url: String, isHyperLink: Boolean = false): Triple {
val extData = URLDecoder.decode(url, "UTF-8")
+ val hostname = URL(session.baseUrl).host
+
+ if (!url.contains(hostname)) {
+ return Triple(
+ true,
+ "",
+ false,
+ )
+ }
+
if (!isHyperLink && !extData.contains(SCHEME)) return Triple(false, "", false)
if (extData.contains(IDENTIFIER_PREVIEW)) {
diff --git a/component/src/main/java/com/alfresco/content/component/ComponentSheet.kt b/component/src/main/java/com/alfresco/content/component/ComponentSheet.kt
index f9ad7edb..fdd7d2ea 100644
--- a/component/src/main/java/com/alfresco/content/component/ComponentSheet.kt
+++ b/component/src/main/java/com/alfresco/content/component/ComponentSheet.kt
@@ -203,7 +203,7 @@ class ComponentSheet : BottomSheetDialogFragment(), MavericksView {
when {
(state.parent?.selector == ComponentType.DROPDOWN_RADIO.value) ||
- (state.parent?.selector == ComponentType.PROCESS_ACTION.value) -> {
+ (state.parent?.selector == ComponentType.PROCESS_ACTION.value) -> {
}
else -> {
diff --git a/process-app/src/main/kotlin/com/alfresco/content/process/FormViewModel.kt b/process-app/src/main/kotlin/com/alfresco/content/process/FormViewModel.kt
index 7a43c829..070e09ef 100644
--- a/process-app/src/main/kotlin/com/alfresco/content/process/FormViewModel.kt
+++ b/process-app/src/main/kotlin/com/alfresco/content/process/FormViewModel.kt
@@ -25,6 +25,7 @@ data class FormViewState(
val requestProcessDefinition: Async = Uninitialized,
val formFields: List = emptyList(),
val processOutcomes: List = emptyList(),
+ val enabledOutcomes: Boolean = false,
) : MavericksState {
constructor(target: ProcessEntry) : this(parent = target)
@@ -98,7 +99,7 @@ class FormViewModel(
}
fun updateFieldValue(fieldId: String, newValue: Any?, state: FormViewState) {
- val updatedFields = state.copy(
+ val updatedState = state.copy(
formFields = state.formFields.map { field ->
if (field.id == fieldId) {
field.copy(value = newValue)
@@ -107,7 +108,10 @@ class FormViewModel(
}
},
)
- setState { updatedFields }
+
+ val hasAllRequiredData = updatedState.formFields.filter { it.required }.all { it.value != null }
+
+ setState { updatedState.copy(enabledOutcomes = hasAllRequiredData) }
}
companion object : MavericksViewModelFactory {
diff --git a/process-app/src/main/kotlin/com/alfresco/content/process/ui/FormDetailScreen.kt b/process-app/src/main/kotlin/com/alfresco/content/process/ui/FormDetailScreen.kt
index 942a5941..2f6050cc 100644
--- a/process-app/src/main/kotlin/com/alfresco/content/process/ui/FormDetailScreen.kt
+++ b/process-app/src/main/kotlin/com/alfresco/content/process/ui/FormDetailScreen.kt
@@ -36,23 +36,27 @@ fun FormDetailScreen(state: FormViewState, viewModel: FormViewModel, outcomes: L
}
Column(
- modifier = Modifier.fillMaxWidth(),
+ modifier = Modifier
+ .fillMaxWidth()
+ .clickable {
+ // Hide the keyboard on click outside of input fields
+// keyboardController?.hide()
+// focusManager.clearFocus()
+ },
) {
LazyColumn(
modifier = Modifier
.fillMaxSize()
- .weight(1f, false)
- .clickable {
- // Hide the keyboard on click outside of input fields
- keyboardController?.hide()
- focusManager.clearFocus()
- },
+ .weight(1f, false),
verticalArrangement = Arrangement.Top,
horizontalAlignment = Alignment.CenterHorizontally,
) {
- items(key = {
- it.id
- }, items = formList) { field ->
+ items(
+ key = {
+ it.id
+ },
+ items = formList,
+ ) { field ->
FormScrollContent(field, viewModel, state)
}
}
@@ -63,7 +67,7 @@ fun FormDetailScreen(state: FormViewState, viewModel: FormViewModel, outcomes: L
.fillMaxWidth()
.align(alignment = Alignment.CenterHorizontally),
) {
- Outcomes(outcomes = outcomes)
+ Outcomes(outcomes = outcomes, state.enabledOutcomes)
}
}
}
diff --git a/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/FloatingActionButton.kt b/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/FloatingActionButton.kt
index 5f50cb64..9fb1e08e 100644
--- a/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/FloatingActionButton.kt
+++ b/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/FloatingActionButton.kt
@@ -17,28 +17,31 @@ import com.alfresco.content.data.OptionsModel
import com.alfresco.content.process.R
@Composable
-fun FloatingActionButton(outcomes: List) {
+fun FloatingActionButton(outcomes: List, enabledOutcomes: Boolean) {
val context = LocalContext.current
ExtendedFloatingActionButton(
onClick = {
- val componentData = ComponentData.with(
- outcomes,
- "",
- "",
- )
- ComponentBuilder(context, componentData)
- .onApply { name, query, _ ->
- }
- .onReset { name, query, _ ->
- }
- .onCancel {
- }
- .show()
+ if (enabledOutcomes) {
+ val componentData = ComponentData.with(
+ outcomes,
+ "",
+ "",
+ )
+ ComponentBuilder(context, componentData)
+ .onApply { name, query, _ ->
+ }
+ .onReset { name, query, _ ->
+ }
+ .onCancel {
+ }
+ .show()
+ }
},
containerColor = MaterialTheme.colorScheme.primary,
icon = { Icon(Icons.Filled.PlaylistAdd, stringResource(id = R.string.accessibility_process_actions)) },
text = { Text(text = stringResource(id = R.string.title_actions)) },
- modifier = Modifier.navigationBarsPadding(),
+ modifier = Modifier
+ .navigationBarsPadding(),
)
}
diff --git a/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/FormScreen.kt b/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/FormScreen.kt
index 5c525de6..71e9d44e 100644
--- a/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/FormScreen.kt
+++ b/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/FormScreen.kt
@@ -62,7 +62,7 @@ fun FormScreen(navController: NavController) {
else -> {
Scaffold(
topBar = { ComposeTopBar() },
- floatingActionButton = { FloatingActionButton(customOutcomes) },
+ floatingActionButton = { FloatingActionButton(customOutcomes, state.enabledOutcomes) },
floatingActionButtonPosition = FabPosition.End,
) { padding ->
val colorScheme = MaterialTheme.colorScheme
diff --git a/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/MultiLineInputField.kt b/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/MultiLineInputField.kt
index ae19f59e..f22c13ce 100644
--- a/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/MultiLineInputField.kt
+++ b/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/MultiLineInputField.kt
@@ -4,7 +4,6 @@ import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
-import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.tooling.preview.Preview
import com.alfresco.content.data.payloads.FieldsData
@@ -17,7 +16,6 @@ fun MultiLineInputField(
fieldsData: FieldsData = FieldsData(),
) {
val keyboardOptions = KeyboardOptions.Default.copy(
- imeAction = ImeAction.None,
keyboardType = KeyboardType.Text,
)
diff --git a/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/Outcomes.kt b/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/Outcomes.kt
index 0837731a..b9f01eb5 100644
--- a/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/Outcomes.kt
+++ b/process-app/src/main/kotlin/com/alfresco/content/process/ui/components/Outcomes.kt
@@ -13,7 +13,7 @@ import com.alfresco.content.data.OptionsModel
import com.alfresco.content.process.ui.theme.AlfrescoGray900
@Composable
-fun Outcomes(outcomes: List) {
+fun Outcomes(outcomes: List, enabledOutcomes: Boolean) {
outcomes.forEach {
Button(
modifier = Modifier
@@ -21,6 +21,7 @@ fun Outcomes(outcomes: List) {
.padding(horizontal = 16.dp, vertical = 4.dp),
onClick = { },
shape = RoundedCornerShape(4.dp),
+ enabled = enabledOutcomes,
colors = ButtonDefaults.buttonColors(
contentColor = AlfrescoGray900,
),