Skip to content

Commit

Permalink
manager: Use AnimatedVisibility for Exclude Modifications SwitchItem
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsummer233 authored and pomelohan committed Nov 23, 2024
1 parent 2492b40 commit 68e6ead
Showing 1 changed file with 25 additions and 35 deletions.
60 changes: 25 additions & 35 deletions app/src/main/java/me/bmax/apatch/ui/screen/SuperUser.kt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package me.bmax.apatch.ui.screen

import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
Expand Down Expand Up @@ -212,42 +214,30 @@ private fun AppItem(
})
},
)
if (showEditProfile && !rootGranted) {
//var viahook by remember { mutableStateOf(app.config.profile.scontext.isEmpty()) }

Column(modifier = Modifier.padding(start = 24.dp, end = 24.dp)) {
/*SwitchItem(
icon = Icons.Filled.Security,
title = "SU Thread",
summary = "bypass selinux via hooks",
checked = viahook,
onCheckedChange = {
viahook = !viahook
if (viahook) app.config.profile.scontext = ""
else app.config.profile.scontext = APApplication.MAGISK_SCONTEXT
PkgConfig.changeConfig(app.config)
},
)*/
SwitchItem(
icon = Icons.Filled.Security,
title = stringResource(id = R.string.su_pkg_excluded_setting_title),
summary = stringResource(id = R.string.su_pkg_excluded_setting_summary),
checked = excludeApp == 1,
onCheckedChange = {
if (it) {
excludeApp = 1
config.allow = 0
Natives.revokeSu(app.uid)
} else {
excludeApp = 0
}
config.exclude = excludeApp
config.profile.uid = app.uid
PkgConfig.changeConfig(config)
Natives.setUidExclude(app.uid, excludeApp)
},
)
}
AnimatedVisibility(
visible = showEditProfile && !rootGranted,
modifier = Modifier.fillMaxWidth().padding(horizontal = 24.dp)
) {
SwitchItem(
icon = Icons.Filled.Security,
title = stringResource(id = R.string.su_pkg_excluded_setting_title),
summary = stringResource(id = R.string.su_pkg_excluded_setting_summary),
checked = excludeApp == 1,
onCheckedChange = {
if (it) {
excludeApp = 1
config.allow = 0
Natives.revokeSu(app.uid)
} else {
excludeApp = 0
}
config.exclude = excludeApp
config.profile.uid = app.uid
PkgConfig.changeConfig(config)
Natives.setUidExclude(app.uid, excludeApp)
},
)
}
}

Expand Down

0 comments on commit 68e6ead

Please sign in to comment.