From d79ab30c6faf1e3fd490dd01e8f2f3e950d72b6d Mon Sep 17 00:00:00 2001 From: backslashxx <118538522+backslashxx@users.noreply.github.com> Date: Tue, 29 Oct 2024 00:08:06 +0800 Subject: [PATCH] manager: unofficial build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - disable updates - warn and inform that this is not an official build. - also 🍉 emoji as promised - also update setup.sh for automated builds - add 'legacy' on apk filename --- kernel/setup.sh | 2 +- manager/app/build.gradle.kts | 4 +- .../java/me/weishu/kernelsu/ui/screen/Home.kt | 39 +++++++++++++++---- .../me/weishu/kernelsu/ui/screen/Settings.kt | 17 +------- .../me/weishu/kernelsu/ui/util/Downloader.kt | 3 +- manager/app/src/main/res/values/strings.xml | 5 ++- 6 files changed, 41 insertions(+), 29 deletions(-) diff --git a/kernel/setup.sh b/kernel/setup.sh index e688dbaf3ae5..fa35377026b0 100755 --- a/kernel/setup.sh +++ b/kernel/setup.sh @@ -39,7 +39,7 @@ perform_cleanup() { # Sets up or update KernelSU environment setup_kernelsu() { echo "[+] Setting up KernelSU..." - test -d "$GKI_ROOT/KernelSU" || git clone https://github.com/tiann/KernelSU && echo "[+] Repository cloned." + test -d "$GKI_ROOT/KernelSU" || git clone https://github.com/backslashxx/KernelSU && echo "[+] Repository cloned." cd "$GKI_ROOT/KernelSU" git stash && echo "[-] Stashed current changes." if [ "$(git status | grep -Po 'v\d+(\.\d+)*' | head -n1)" ]; then diff --git a/manager/app/build.gradle.kts b/manager/app/build.gradle.kts index 1f98e4a1ba62..43e9ae538ce7 100644 --- a/manager/app/build.gradle.kts +++ b/manager/app/build.gradle.kts @@ -68,7 +68,7 @@ android { applicationVariants.all { outputs.forEach { val output = it as BaseVariantOutputImpl - output.outputFileName = "KernelSU_${managerVersionName}_${managerVersionCode}-$name.apk" + output.outputFileName = "KernelSU_${managerVersionName}_${managerVersionCode}-magic-$name.apk" } kotlin.sourceSets { getByName(name) { @@ -133,4 +133,4 @@ dependencies { implementation(libs.androidx.webkit) implementation(libs.lsposed.cxx) -} \ No newline at end of file +} diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt index 71ddc63d3e57..808cf6e369d4 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt @@ -96,12 +96,7 @@ fun HomeScreen(navigator: DestinationsNavigator) { stringResource(id = R.string.grant_root_failed) ) } - val checkUpdate = - LocalContext.current.getSharedPreferences("settings", Context.MODE_PRIVATE) - .getBoolean("check_update", true) - if (checkUpdate) { - UpdateCard() - } + Unofficial() InfoCard() DonateCard() LearnMoreCard() @@ -405,7 +400,7 @@ private fun InfoCard() { val managerVersion = getManagerVersion(context) InfoCardItem( stringResource(R.string.home_manager_version), - "${managerVersion.first} (${managerVersion.second})" + "${managerVersion.first}-magic (${managerVersion.second})" ) Spacer(Modifier.height(16.dp)) @@ -417,6 +412,34 @@ private fun InfoCard() { } } +@Composable +fun Unofficial() { + val uriHandler = LocalUriHandler.current + val url = stringResource(R.string.home_unofficial_kernelsu_announce) + + ElevatedCard { + + Row(modifier = Modifier + .fillMaxWidth() + .clickable { + uriHandler.openUri(url) + } + .padding(24.dp), verticalAlignment = Alignment.CenterVertically) { + Column { + Text( + text = stringResource(R.string.home_unofficial_kernelsu), + style = MaterialTheme.typography.titleSmall + ) + Spacer(Modifier.height(4.dp)) + Text( + text = stringResource(R.string.home_unofficial_kernelsu_body), + style = MaterialTheme.typography.bodyMedium + ) + } + } + } +} + fun getManagerVersion(context: Context): Pair { val packageInfo = context.packageManager.getPackageInfo(context.packageName, 0)!! val versionCode = PackageInfoCompat.getLongVersionCode(packageInfo) @@ -444,4 +467,4 @@ private fun WarningCardPreview() { MaterialTheme.colorScheme.outlineVariant, onClick = {}) } -} \ No newline at end of file +} diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt index fe6b8786f335..827f0daf6d72 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt @@ -172,21 +172,6 @@ fun SettingScreen(navigator: DestinationsNavigator) { } val prefs = context.getSharedPreferences("settings", Context.MODE_PRIVATE) - var checkUpdate by rememberSaveable { - mutableStateOf( - prefs.getBoolean("check_update", true) - ) - } - SwitchItem( - icon = Icons.Filled.Update, - title = stringResource(id = R.string.settings_check_update), - summary = stringResource(id = R.string.settings_check_update_summary), - checked = checkUpdate - ) { - prefs.edit().putBoolean("check_update", it).apply() - checkUpdate = it - } - var enableWebDebugging by rememberSaveable { mutableStateOf( prefs.getBoolean("enable_web_debugging", false) @@ -483,4 +468,4 @@ private fun TopBar( @Composable private fun SettingsPreview() { SettingScreen(EmptyDestinationsNavigator) -} \ No newline at end of file +} diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/util/Downloader.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/util/Downloader.kt index bdf8496633fd..6991897ea855 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/util/Downloader.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/util/Downloader.kt @@ -62,7 +62,8 @@ fun download( } fun checkNewVersion(): LatestVersionInfo { - val url = "https://api.github.com/repos/tiann/KernelSU/releases/latest" + // disable updates + val url = "https://127.0.0.1/repos/tiann/KernelSU/releases/latest" // default null value if failed val defaultValue = LatestVersionInfo() runCatching { diff --git a/manager/app/src/main/res/values/strings.xml b/manager/app/src/main/res/values/strings.xml index c930c942df87..530766ec984f 100644 --- a/manager/app/src/main/res/values/strings.xml +++ b/manager/app/src/main/res/values/strings.xml @@ -48,6 +48,9 @@ Safe mode Reboot to take effect Modules are unavailable due to a conflict with Magisk! + 🍉 Unofficial Build + https://github.com/tiann/KernelSU/issues/1705 + Non-GKI support ended; see announcement. Learn KernelSU https://kernelsu.org/guide/what-is-kernelsu.html Learn how to install KernelSU and use modules @@ -134,4 +137,4 @@ Selected LKM: %s Save logs Logs saved - \ No newline at end of file +