fix: location disclosure missing
This commit is contained in:
parent
ffeb089aa7
commit
7e3405f3fd
|
@ -269,17 +269,19 @@ fun SettingsScreen(
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
|
||||||
checkFineLocationGranted()
|
checkFineLocationGranted()
|
||||||
}
|
}
|
||||||
|
if(!uiState.isLocationDisclosureShown) {
|
||||||
|
BackgroundLocationDisclosure(
|
||||||
|
onDismiss = { viewModel.setLocationDisclosureShown() },
|
||||||
|
onAttest = {
|
||||||
|
context.launchAppSettings()
|
||||||
|
viewModel.setLocationDisclosureShown()
|
||||||
|
},
|
||||||
|
scrollState,
|
||||||
|
focusRequester,
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
BackgroundLocationDisclosure(
|
|
||||||
!uiState.isLocationDisclosureShown,
|
|
||||||
onDismiss = { viewModel.setLocationDisclosureShown() },
|
|
||||||
onAttest = {
|
|
||||||
context.launchAppSettings()
|
|
||||||
viewModel.setLocationDisclosureShown()
|
|
||||||
},
|
|
||||||
scrollState,
|
|
||||||
focusRequester,
|
|
||||||
)
|
|
||||||
|
|
||||||
BackgroundLocationDialog(
|
BackgroundLocationDialog(
|
||||||
showLocationDialog,
|
showLocationDialog,
|
||||||
|
|
|
@ -29,67 +29,64 @@ import com.zaneschepke.wireguardautotunnel.util.extensions.isRunningOnTv
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun BackgroundLocationDisclosure(
|
fun BackgroundLocationDisclosure(
|
||||||
show: Boolean,
|
|
||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
onAttest: () -> Unit,
|
onAttest: () -> Unit,
|
||||||
scrollState: ScrollState,
|
scrollState: ScrollState,
|
||||||
focusRequester: FocusRequester,
|
focusRequester: FocusRequester,
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
if (show) {
|
Column(
|
||||||
Column(
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
verticalArrangement = Arrangement.Top,
|
||||||
verticalArrangement = Arrangement.Top,
|
modifier =
|
||||||
|
Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.verticalScroll(scrollState),
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
Icons.Rounded.LocationOff,
|
||||||
|
contentDescription = stringResource(id = R.string.map),
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.fillMaxSize()
|
.padding(30.dp)
|
||||||
.verticalScroll(scrollState),
|
.size(128.dp),
|
||||||
) {
|
)
|
||||||
Icon(
|
Text(
|
||||||
Icons.Rounded.LocationOff,
|
stringResource(R.string.prominent_background_location_title),
|
||||||
contentDescription = stringResource(id = R.string.map),
|
textAlign = TextAlign.Center,
|
||||||
modifier =
|
modifier = Modifier.padding(30.dp),
|
||||||
|
fontSize = 20.sp,
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
stringResource(R.string.prominent_background_location_message),
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
modifier = Modifier.padding(30.dp),
|
||||||
|
fontSize = 15.sp,
|
||||||
|
)
|
||||||
|
Row(
|
||||||
|
modifier =
|
||||||
|
if (context.isRunningOnTv()) {
|
||||||
Modifier
|
Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(10.dp)
|
||||||
|
} else {
|
||||||
|
Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
.padding(30.dp)
|
.padding(30.dp)
|
||||||
.size(128.dp),
|
},
|
||||||
)
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
Text(
|
horizontalArrangement = Arrangement.SpaceEvenly,
|
||||||
stringResource(R.string.prominent_background_location_title),
|
) {
|
||||||
textAlign = TextAlign.Center,
|
TextButton(onClick = { onDismiss() }) {
|
||||||
modifier = Modifier.padding(30.dp),
|
Text(stringResource(id = R.string.no_thanks))
|
||||||
fontSize = 20.sp,
|
}
|
||||||
)
|
TextButton(
|
||||||
Text(
|
modifier = Modifier.focusRequester(focusRequester),
|
||||||
stringResource(R.string.prominent_background_location_message),
|
onClick = {
|
||||||
textAlign = TextAlign.Center,
|
onAttest()
|
||||||
modifier = Modifier.padding(30.dp),
|
|
||||||
fontSize = 15.sp,
|
|
||||||
)
|
|
||||||
Row(
|
|
||||||
modifier =
|
|
||||||
if (context.isRunningOnTv()) {
|
|
||||||
Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(10.dp)
|
|
||||||
} else {
|
|
||||||
Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(30.dp)
|
|
||||||
},
|
},
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
horizontalArrangement = Arrangement.SpaceEvenly,
|
|
||||||
) {
|
) {
|
||||||
TextButton(onClick = { onDismiss() }) {
|
Text(stringResource(id = R.string.turn_on))
|
||||||
Text(stringResource(id = R.string.no_thanks))
|
|
||||||
}
|
|
||||||
TextButton(
|
|
||||||
modifier = Modifier.focusRequester(focusRequester),
|
|
||||||
onClick = {
|
|
||||||
onAttest()
|
|
||||||
},
|
|
||||||
) {
|
|
||||||
Text(stringResource(id = R.string.turn_on))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue