manager: minor fixes for app profile
This commit is contained in:
@@ -49,8 +49,6 @@ import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
||||
import kotlinx.coroutines.launch
|
||||
import me.weishu.kernelsu.Natives
|
||||
import me.weishu.kernelsu.R
|
||||
import me.weishu.kernelsu.ui.component.AboutDialog
|
||||
import me.weishu.kernelsu.ui.component.LoadingDialog
|
||||
import me.weishu.kernelsu.ui.util.LocalSnackbarHost
|
||||
|
||||
/**
|
||||
@@ -101,9 +99,9 @@ fun AppProfileScreen(
|
||||
}
|
||||
|
||||
val setAllowlistFailedMsg = if (allowlistMode) {
|
||||
stringResource(R.string.failed_to_set_allowlist_mode)
|
||||
} else {
|
||||
stringResource(R.string.failed_to_set_denylist_mode)
|
||||
} else {
|
||||
stringResource(R.string.failed_to_set_allowlist_mode)
|
||||
}
|
||||
WorkingMode(allowlistMode) { checked ->
|
||||
if (Natives.setAllowlistMode(checked)) {
|
||||
@@ -135,23 +133,23 @@ fun AppProfileScreen(
|
||||
},
|
||||
)
|
||||
|
||||
var isChecked by rememberSaveable {
|
||||
var isGrantRoot by rememberSaveable {
|
||||
mutableStateOf(grantRoot)
|
||||
}
|
||||
|
||||
val failMessage = stringResource(R.string.superuser_failed_to_grant_root)
|
||||
val failToGrantRoot = stringResource(R.string.superuser_failed_to_grant_root)
|
||||
AppSwitch(
|
||||
Icons.Filled.Security,
|
||||
stringResource(id = R.string.app_profile_root_switch),
|
||||
checked = isChecked
|
||||
stringResource(id = R.string.superuser),
|
||||
checked = isGrantRoot
|
||||
) { checked ->
|
||||
|
||||
scope.launch {
|
||||
val success = Natives.allowRoot(uid, checked)
|
||||
if (success) {
|
||||
isChecked = checked
|
||||
isGrantRoot = checked
|
||||
} else {
|
||||
snackbarHost.showSnackbar(failMessage.format(uid))
|
||||
snackbarHost.showSnackbar(failToGrantRoot.format(uid))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,12 @@
|
||||
<string name="home_support_content">KernelSU 将保持免费和开源,向开发者捐赠以表示支持。</string>
|
||||
<string name="about_source_code"><![CDATA[在 %1$s 查看源码<br/>加入我们的 %2$s 频道<br/>加入我们的 <b><a href="https://pd.qq.com/s/8lipl1brp">QQ 频道</a></b>]]></string>
|
||||
<string name="app_profile_title1">应用</string>
|
||||
<string name="app_profile_root_switch">Root 权限</string>
|
||||
<string name="app_profile_denylist">Denylist</string>
|
||||
<string name="app_profile_title0">全局</string>
|
||||
<string name="app_profile_allowlist">白名单</string>
|
||||
<string name="app_profile_denylist">黑名单</string>
|
||||
<string name="app_profile_mode">工作模式</string>
|
||||
<string name="failed_to_set_allowlist_mode">全换到白名单模式失败!</string>
|
||||
<string name="failed_to_add_to_allowlist">添加 %s 到白名单失败!</string>
|
||||
<string name="failed_to_add_to_denylist">添加 %s 到黑名单失败!</string>
|
||||
<string name="failed_to_set_denylist_mode">切换到黑名单模式失败!</string>
|
||||
</resources>
|
||||
|
||||
@@ -64,4 +64,11 @@
|
||||
<string name="home_support_title">支持我們</string>
|
||||
<string name="home_support_content">KernelSU 是免費且開源的,您可以透過捐贈來向我們展示您對我們的關心。</string>
|
||||
<string name="about_source_code"><![CDATA[在 %1$s 中檢視原始碼<br/>加入我們的 %2$s 頻道]]></string>
|
||||
<string name="app_profile_allowlist">白名單</string>
|
||||
<string name="app_profile_denylist">黑名單</string>
|
||||
<string name="app_profile_mode">工作模式</string>
|
||||
<string name="failed_to_set_allowlist_mode">全換到白名單模式失敗! </string>
|
||||
<string name="failed_to_add_to_allowlist">添加 %s 到白名單失敗! </string>
|
||||
<string name="failed_to_add_to_denylist">添加 %s 到黑名單失敗! </string>
|
||||
<string name="failed_to_set_denylist_mode">切換到黑名單模式失敗! </string>
|
||||
</resources>
|
||||
|
||||
@@ -64,4 +64,11 @@
|
||||
<string name="home_support_title">支持開發</string>
|
||||
<string name="home_support_content">KernelSU 將保持免費和開源,您可以考慮向開發人員捐贈以表示支持。</string>
|
||||
<string name="about_source_code"><![CDATA[在 %1$s 中檢視原始碼<br/>加入我們的 %2$s 頻道]]></string>
|
||||
<string name="app_profile_allowlist">白名單</string>
|
||||
<string name="app_profile_denylist">黑名單</string>
|
||||
<string name="app_profile_mode">工作模式</string>
|
||||
<string name="failed_to_set_allowlist_mode">全換到白名單模式失敗! </string>
|
||||
<string name="failed_to_add_to_allowlist">添加 %s 到白名單失敗! </string>
|
||||
<string name="failed_to_add_to_denylist">添加 %s 到黑名單失敗! </string>
|
||||
<string name="failed_to_set_denylist_mode">切換到黑名單模式失敗! </string>
|
||||
</resources>
|
||||
|
||||
@@ -68,7 +68,6 @@
|
||||
<string name="app_profile" translatable="false">App Profile</string>
|
||||
<string name="app_profile_title1">Application</string>
|
||||
<string name="app_profile_title2" translatable="false">Root Profile</string>
|
||||
<string name="app_profile_root_switch">Grant Root</string>
|
||||
<string name="app_profile_allowlist">Allowlist</string>
|
||||
<string name="app_profile_denylist">Denylist</string>
|
||||
<string name="app_profile_title0">Global</string>
|
||||
|
||||
Reference in New Issue
Block a user