Skip to content

Commit

Permalink
Move Content blockers closer to Use custom Dns setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Rawa committed Oct 20, 2023
1 parent 52fd2c2 commit 132a25a
Showing 1 changed file with 90 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,95 +302,6 @@ fun VpnSettingsScreen(
}
item { MtuSubtitle() }

itemWithDivider {
ExpandableComposeCell(
title = stringResource(R.string.dns_content_blockers_title),
isExpanded = expandContentBlockersState,
isEnabled = !uiState.isCustomDnsEnabled,
onInfoClicked = { onContentsBlockersInfoClick() },
onCellClicked = { expandContentBlockersState = !expandContentBlockersState }
)
}

if (expandContentBlockersState) {
itemWithDivider {
NormalSwitchComposeCell(
title = stringResource(R.string.block_ads_title),
isToggled = uiState.contentBlockersOptions.blockAds,
isEnabled = !uiState.isCustomDnsEnabled,
onCellClicked = { onToggleBlockAds(it) },
background = MaterialTheme.colorScheme.secondaryContainer,
startPadding = Dimens.indentedCellStartPadding
)
}
itemWithDivider {
NormalSwitchComposeCell(
title = stringResource(R.string.block_trackers_title),
isToggled = uiState.contentBlockersOptions.blockTrackers,
isEnabled = !uiState.isCustomDnsEnabled,
onCellClicked = { onToggleBlockTrackers(it) },
background = MaterialTheme.colorScheme.secondaryContainer,
startPadding = Dimens.indentedCellStartPadding
)
}
itemWithDivider {
NormalSwitchComposeCell(
title = stringResource(R.string.block_malware_title),
isToggled = uiState.contentBlockersOptions.blockMalware,
isEnabled = !uiState.isCustomDnsEnabled,
onCellClicked = { onToggleBlockMalware(it) },
onInfoClicked = { onMalwareInfoClick() },
background = MaterialTheme.colorScheme.secondaryContainer,
startPadding = Dimens.indentedCellStartPadding
)
}
itemWithDivider {
NormalSwitchComposeCell(
title = stringResource(R.string.block_gambling_title),
isToggled = uiState.contentBlockersOptions.blockGambling,
isEnabled = !uiState.isCustomDnsEnabled,
onCellClicked = { onToggleBlockGambling(it) },
background = MaterialTheme.colorScheme.secondaryContainer,
startPadding = Dimens.indentedCellStartPadding
)
}
itemWithDivider {
NormalSwitchComposeCell(
title = stringResource(R.string.block_adult_content_title),
isToggled = uiState.contentBlockersOptions.blockAdultContent,
isEnabled = !uiState.isCustomDnsEnabled,
onCellClicked = { onToggleBlockAdultContent(it) },
background = MaterialTheme.colorScheme.secondaryContainer,
startPadding = Dimens.indentedCellStartPadding
)
}

itemWithDivider {
NormalSwitchComposeCell(
title = stringResource(R.string.block_social_media_title),
isToggled = uiState.contentBlockersOptions.blockSocialMedia,
isEnabled = !uiState.isCustomDnsEnabled,
onCellClicked = { onToggleBlockSocialMedia(it) },
background = MaterialTheme.colorScheme.secondaryContainer,
startPadding = Dimens.indentedCellStartPadding
)
}

if (uiState.isCustomDnsEnabled) {
item {
ContentBlockersDisableModeCellSubtitle(
Modifier.background(MaterialTheme.colorScheme.secondary)
.padding(
start = Dimens.cellStartPadding,
top = topPadding,
end = Dimens.cellEndPadding,
bottom = Dimens.cellLabelVerticalPadding
)
)
}
}
}

itemWithDivider {
Spacer(modifier = Modifier.height(Dimens.cellLabelVerticalPadding))
InformationComposeCell(
Expand Down Expand Up @@ -499,6 +410,96 @@ fun VpnSettingsScreen(
mainTestTag = LAZY_LIST_WIREGUARD_CUSTOM_PORT_TEXT_TEST_TAG,
numberTestTag = LAZY_LIST_WIREGUARD_CUSTOM_PORT_NUMBER_TEST_TAG
)
Spacer(modifier = Modifier.height(Dimens.cellLabelVerticalPadding))
}

itemWithDivider {
ExpandableComposeCell(
title = stringResource(R.string.dns_content_blockers_title),
isExpanded = expandContentBlockersState,
isEnabled = !uiState.isCustomDnsEnabled,
onInfoClicked = { onContentsBlockersInfoClick() },
onCellClicked = { expandContentBlockersState = !expandContentBlockersState }
)
}

if (expandContentBlockersState) {
itemWithDivider {
NormalSwitchComposeCell(
title = stringResource(R.string.block_ads_title),
isToggled = uiState.contentBlockersOptions.blockAds,
isEnabled = !uiState.isCustomDnsEnabled,
onCellClicked = { onToggleBlockAds(it) },
background = MaterialTheme.colorScheme.secondaryContainer,
startPadding = Dimens.indentedCellStartPadding
)
}
itemWithDivider {
NormalSwitchComposeCell(
title = stringResource(R.string.block_trackers_title),
isToggled = uiState.contentBlockersOptions.blockTrackers,
isEnabled = !uiState.isCustomDnsEnabled,
onCellClicked = { onToggleBlockTrackers(it) },
background = MaterialTheme.colorScheme.secondaryContainer,
startPadding = Dimens.indentedCellStartPadding
)
}
itemWithDivider {
NormalSwitchComposeCell(
title = stringResource(R.string.block_malware_title),
isToggled = uiState.contentBlockersOptions.blockMalware,
isEnabled = !uiState.isCustomDnsEnabled,
onCellClicked = { onToggleBlockMalware(it) },
onInfoClicked = { onMalwareInfoClick() },
background = MaterialTheme.colorScheme.secondaryContainer,
startPadding = Dimens.indentedCellStartPadding
)
}
itemWithDivider {
NormalSwitchComposeCell(
title = stringResource(R.string.block_gambling_title),
isToggled = uiState.contentBlockersOptions.blockGambling,
isEnabled = !uiState.isCustomDnsEnabled,
onCellClicked = { onToggleBlockGambling(it) },
background = MaterialTheme.colorScheme.secondaryContainer,
startPadding = Dimens.indentedCellStartPadding
)
}
itemWithDivider {
NormalSwitchComposeCell(
title = stringResource(R.string.block_adult_content_title),
isToggled = uiState.contentBlockersOptions.blockAdultContent,
isEnabled = !uiState.isCustomDnsEnabled,
onCellClicked = { onToggleBlockAdultContent(it) },
background = MaterialTheme.colorScheme.secondaryContainer,
startPadding = Dimens.indentedCellStartPadding
)
}

itemWithDivider {
NormalSwitchComposeCell(
title = stringResource(R.string.block_social_media_title),
isToggled = uiState.contentBlockersOptions.blockSocialMedia,
isEnabled = !uiState.isCustomDnsEnabled,
onCellClicked = { onToggleBlockSocialMedia(it) },
background = MaterialTheme.colorScheme.secondaryContainer,
startPadding = Dimens.indentedCellStartPadding
)
}

if (uiState.isCustomDnsEnabled) {
item {
ContentBlockersDisableModeCellSubtitle(
Modifier.background(MaterialTheme.colorScheme.secondary)
.padding(
start = Dimens.cellStartPadding,
top = topPadding,
end = Dimens.cellEndPadding,
bottom = Dimens.cellLabelVerticalPadding
)
)
}
}
}

item {
Expand Down

0 comments on commit 132a25a

Please sign in to comment.