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

manager: Use AnimatedVisibility for Exclude Modifications SwitchItem #799

Merged
merged 1 commit into from
Nov 23, 2024
Merged
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
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