Skip to content

Commit

Permalink
Missing Implementation for Group Sync. MIFOSAC-309
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkeye14 committed Dec 14, 2024
1 parent 72142da commit e21a27b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,6 @@ fun GroupsListScreen(
resetSelectionMode: () -> Unit,
) {
var syncGroups by rememberSaveable { mutableStateOf(false) }
if (syncGroups) {
SyncGroupDialogScreen(
dismiss = { syncGroups = false },
hide = {
// TODO implement hide
},
)
}

Scaffold(
modifier = modifier,
Expand All @@ -184,7 +176,6 @@ fun GroupsListScreen(
FilledTonalButton(
onClick = {
syncGroups = true
resetSelectionMode()
},
) {
Icon(
Expand All @@ -194,14 +185,24 @@ fun GroupsListScreen(
Text(text = stringResource(id = R.string.feature_groups_sync))
}
},

)
}
if (syncGroups) {
SyncGroupDialogScreen(
dismiss = {
syncGroups = false
resetSelectionMode()
},
hide = {
syncGroups = false
},
groups = selectedItems
)
}
},
) { paddingValues ->
SwipeRefresh(
modifier = Modifier.semantics {
contentDescription = "SwipeRefresh::GroupList"
},
state = swipeRefreshState,
onRefresh = { data.refresh() },
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
Expand All @@ -38,18 +39,23 @@ import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.mifos.core.designsystem.component.MifosCircularProgress
import com.mifos.core.objects.group.Group
import com.mifos.feature.groups.R

@Composable
internal fun SyncGroupDialogScreen(
dismiss: () -> Unit,
viewModel: SyncGroupsDialogViewModel = hiltViewModel(),
groups : List<Group>? = listOf(),
hide: () -> Unit,
) {
val uiState by viewModel.syncGroupsDialogUiState.collectAsStateWithLifecycle()
val uiData by viewModel.syncGroupData.collectAsStateWithLifecycle()

LaunchedEffect(key1 = Unit) {
groups?.let{
viewModel.setGroupList(groups)
}
viewModel.syncGroups()
}

Expand All @@ -71,7 +77,10 @@ internal fun SyncGroupDialogScreen(
) {
val snackBarHostState = remember { SnackbarHostState() }

Box(modifier = modifier) {
Box(
modifier = modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
SyncGroupDialogContent(
uiData = uiData,
okClicked = dismiss,
Expand Down

0 comments on commit e21a27b

Please sign in to comment.