manager: hide install button when magisk installed.
This commit is contained in:
@@ -53,10 +53,13 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val isSafeMode = Natives.isSafeMode()
|
val isSafeMode = Natives.isSafeMode()
|
||||||
|
val hasMagisk = hasMagisk()
|
||||||
|
|
||||||
|
val showInstallButton = !(isSafeMode || hasMagisk)
|
||||||
|
|
||||||
Scaffold(topBar = {
|
Scaffold(topBar = {
|
||||||
TopBar()
|
TopBar()
|
||||||
}, floatingActionButton = if (isSafeMode) {
|
}, floatingActionButton = if (showInstallButton) {
|
||||||
{ /* Empty */ }
|
{ /* Empty */ }
|
||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
@@ -103,8 +106,8 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
|
|||||||
}
|
}
|
||||||
return@Scaffold
|
return@Scaffold
|
||||||
}
|
}
|
||||||
if (hasMagisk()) {
|
if (hasMagisk) {
|
||||||
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
Box(modifier = Modifier.fillMaxSize().padding(24.dp), contentAlignment = Alignment.Center) {
|
||||||
Text(stringResource(R.string.module_magisk_conflict))
|
Text(stringResource(R.string.module_magisk_conflict))
|
||||||
}
|
}
|
||||||
return@Scaffold
|
return@Scaffold
|
||||||
|
|||||||
@@ -113,5 +113,6 @@ fun overlayFsAvailable(): Boolean {
|
|||||||
fun hasMagisk(): Boolean {
|
fun hasMagisk(): Boolean {
|
||||||
val shell = createRootShell()
|
val shell = createRootShell()
|
||||||
val result = shell.newJob().add("nsenter --mount=/proc/1/ns/mnt which magisk").exec()
|
val result = shell.newJob().add("nsenter --mount=/proc/1/ns/mnt which magisk").exec()
|
||||||
|
Log.i(TAG, "has magisk: ${result.isSuccess}")
|
||||||
return result.isSuccess
|
return result.isSuccess
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user