From 123b2e601dbc3bcc84765bb2ef562df38e3b8da4 Mon Sep 17 00:00:00 2001 From: rushiiMachine <33725716+rushiiMachine@users.noreply.github.com> Date: Mon, 13 Jan 2025 18:37:51 -0800 Subject: [PATCH] feat: add warning for GrapheneOS when applicable --- .../ui/screens/patching/PatchingScreen.kt | 18 ++++++++++++++++++ app/src/main/res/values/strings.xml | 1 + 2 files changed, 19 insertions(+) diff --git a/app/src/main/kotlin/com/aliucord/manager/ui/screens/patching/PatchingScreen.kt b/app/src/main/kotlin/com/aliucord/manager/ui/screens/patching/PatchingScreen.kt index 238c5ac..82cfdec 100644 --- a/app/src/main/kotlin/com/aliucord/manager/ui/screens/patching/PatchingScreen.kt +++ b/app/src/main/kotlin/com/aliucord/manager/ui/screens/patching/PatchingScreen.kt @@ -5,6 +5,7 @@ package com.aliucord.manager.ui.screens.patching +import android.os.Build import android.os.Parcelable import androidx.activity.compose.BackHandler import androidx.compose.animation.* @@ -37,6 +38,7 @@ import com.aliucord.manager.ui.screens.patchopts.PatchOptions import com.aliucord.manager.ui.util.paddings.* import com.aliucord.manager.ui.util.spacedByLastAtBottom import com.aliucord.manager.ui.util.thenIf +import com.aliucord.manager.util.isGrapheneOS import com.aliucord.manager.util.isIgnoringBatteryOptimizations import kotlinx.collections.immutable.persistentListOf import kotlinx.coroutines.flow.filter @@ -162,6 +164,22 @@ class PatchingScreen(private val data: PatchOptions) : Screen, Parcelable { } } + item(key = "GOS_WARNING") { + // Refer to ManifestPatcher for more information + BannerSection(visible = remember { Build.VERSION.SDK_INT < 29 && isGrapheneOS() }) { + TextBanner( + text = stringResource(R.string.installer_gos_warning), + icon = painterResource(R.drawable.ic_warning), + iconColor = MaterialTheme.customColors.onWarningContainer, + outlineColor = MaterialTheme.customColors.warning, + containerColor = MaterialTheme.customColors.warningContainer, + modifier = Modifier + .padding(bottom = VERTICAL_PADDING) + .fillMaxWidth(), + ) + } + } + item(key = "FAILED_BANNER") { BannerSection(visible = state is PatchingScreenState.Failed) { val handler = LocalUriHandler.current diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f89e261..de951fb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -89,6 +89,7 @@ Cancelled uninstallation Failed to verify download Since battery optimizations have not been disabled, minimizing this screen may abort the installation process! + "This device seems to be running GrapheneOS! A workaround will be applied that significantly reduces performance. Using a different ROM will avoid this." Installer failure (Unknown reason) Installation was blocked