Skip to content

Commit

Permalink
manager: hide install button when magisk installed.
Browse files Browse the repository at this point in the history
tiann committed Mar 1, 2023
1 parent 9f6e9f5 commit 203dc42
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -53,10 +53,13 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
}

val isSafeMode = Natives.isSafeMode()
val hasMagisk = hasMagisk()

val showInstallButton = !(isSafeMode || hasMagisk)

Scaffold(topBar = {
TopBar()
}, floatingActionButton = if (isSafeMode) {
}, floatingActionButton = if (showInstallButton) {
{ /* Empty */ }
} else {
{
@@ -103,8 +106,8 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
}
return@Scaffold
}
if (hasMagisk()) {
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
if (hasMagisk) {
Box(modifier = Modifier.fillMaxSize().padding(24.dp), contentAlignment = Alignment.Center) {
Text(stringResource(R.string.module_magisk_conflict))
}
return@Scaffold
Original file line number Diff line number Diff line change
@@ -113,5 +113,6 @@ fun overlayFsAvailable(): Boolean {
fun hasMagisk(): Boolean {
val shell = createRootShell()
val result = shell.newJob().add("nsenter --mount=/proc/1/ns/mnt which magisk").exec()
Log.i(TAG, "has magisk: ${result.isSuccess}")
return result.isSuccess
}

0 comments on commit 203dc42

Please sign in to comment.