Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix + Implementation -> Groups sync issue #2267

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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 @@ -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
Loading