|
@@ -32,12 +32,10 @@ import androidx.compose.foundation.lazy.LazyColumn
|
|
|
import androidx.compose.foundation.lazy.items
|
|
|
import androidx.compose.foundation.rememberScrollState
|
|
|
import androidx.compose.foundation.text.KeyboardOptions
|
|
|
-import androidx.compose.material3.ButtonColors
|
|
|
import androidx.compose.material3.ButtonDefaults
|
|
|
import androidx.compose.material3.FilledTonalButton
|
|
|
import androidx.compose.material3.Text
|
|
|
import androidx.compose.material3.TextField
|
|
|
-import androidx.compose.material3.TextFieldDefaults
|
|
|
import androidx.compose.runtime.Composable
|
|
|
import androidx.compose.runtime.collectAsState
|
|
|
import androidx.compose.runtime.getValue
|
|
@@ -50,10 +48,9 @@ import androidx.compose.ui.res.stringResource
|
|
|
import androidx.compose.ui.text.input.KeyboardType
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
|
|
-import com.nextcloud.android.common.ui.theme.utils.ColorRole
|
|
|
-import com.nextcloud.operations.assistant.model.OcsType
|
|
|
import com.nextcloud.ui.composeComponents.SimpleAlertDialog
|
|
|
import com.owncloud.android.R
|
|
|
+import com.owncloud.android.lib.resources.assistant.model.TaskType
|
|
|
|
|
|
@OptIn(ExperimentalFoundationApi::class)
|
|
|
@Composable
|
|
@@ -77,14 +74,16 @@ fun AssistantScreen(viewModel: AssistantViewModel, floatingActionButton: Floatin
|
|
|
.padding(16.dp)
|
|
|
) {
|
|
|
stickyHeader {
|
|
|
- taskTypes?.let { it ->
|
|
|
- TaskTypesRow(selectedTaskType, data = it.ocs.data.types) { taskId ->
|
|
|
- selectedTaskType = taskId
|
|
|
+ taskTypes?.let { taskTypes ->
|
|
|
+ taskTypes.resultData?.types.let {
|
|
|
+ TaskTypesRow(selectedTaskType, data = it) { taskId ->
|
|
|
+ selectedTaskType = taskId
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- items(taskTypes?.ocs?.data?.types ?: listOf()) {
|
|
|
+ items(taskTypes?.resultData?.types ?: listOf()) {
|
|
|
Text(text = it.toString())
|
|
|
}
|
|
|
}
|
|
@@ -131,13 +130,13 @@ private fun AddTaskAlertDialog(viewModel: AssistantViewModel, type: String, dism
|
|
|
}
|
|
|
|
|
|
@Composable
|
|
|
-private fun TaskTypesRow(selectedTaskType: String?, data: List<OcsType>, selectTaskType: (String) -> Unit) {
|
|
|
+private fun TaskTypesRow(selectedTaskType: String?, data: List<TaskType>?, selectTaskType: (String) -> Unit) {
|
|
|
Row(
|
|
|
modifier = Modifier
|
|
|
.fillMaxWidth()
|
|
|
.horizontalScroll(rememberScrollState())
|
|
|
) {
|
|
|
- data.forEach {
|
|
|
+ data?.forEach {
|
|
|
FilledTonalButton(
|
|
|
onClick = { selectTaskType(it.id) },
|
|
|
colors = ButtonDefaults.buttonColors(
|