diff --git a/app/src/main/kotlin/com/aliucord/manager/patcher/steps/patch/ReplaceIconStep.kt b/app/src/main/kotlin/com/aliucord/manager/patcher/steps/patch/ReplaceIconStep.kt index 4538552..5f5e09b 100644 --- a/app/src/main/kotlin/com/aliucord/manager/patcher/steps/patch/ReplaceIconStep.kt +++ b/app/src/main/kotlin/com/aliucord/manager/patcher/steps/patch/ReplaceIconStep.kt @@ -39,7 +39,13 @@ class ReplaceIconStep(private val options: PatchOptions) : Step(), KoinComponent override val localizedName = R.string.patch_step_patch_icon override suspend fun execute(container: StepRunner) { - if (Build.VERSION.SDK_INT < 26 || (!options.monochromeIcon && options.iconReplacement is IconReplacement.Original)) { + val isAdaptiveIconsAvailable = Build.VERSION.SDK_INT >= 28 + val isMonochromeIconsAvailable = Build.VERSION.SDK_INT >= 31 + + // Adaptive icons are available starting with Android 8 + // Monochrome icons are always patched starting with Android 12 + // Skip if adaptive icons are unavailable or { not patching main icon AND monochrome icons are unavailable } + if (!isAdaptiveIconsAvailable || (!isMonochromeIconsAvailable && options.iconReplacement is IconReplacement.Original)) { state = StepState.Skipped return } @@ -56,7 +62,7 @@ class ReplaceIconStep(private val options: PatchOptions) : Step(), KoinComponent var monochromeIcon: BinaryResourceIdentifier? = null // Add the monochrome resource and add the resource file later - if (options.monochromeIcon) { + if (isMonochromeIconsAvailable) { val filePathIdx = arsc.getMainArscChunk().stringPool .addString("res/ic_aliucord_monochrome.xml") @@ -100,7 +106,7 @@ class ReplaceIconStep(private val options: PatchOptions) : Step(), KoinComponent } ZipWriter(apk, /* append = */ true).use { - if (options.monochromeIcon) { + if (isMonochromeIconsAvailable) { it.writeEntry("res/ic_aliucord_monochrome.xml", context.getResBytes(R.drawable.ic_discord_monochrome)) } diff --git a/app/src/main/kotlin/com/aliucord/manager/ui/screens/patchopts/PatchOptions.kt b/app/src/main/kotlin/com/aliucord/manager/ui/screens/patchopts/PatchOptions.kt index 818775d..4f98fc0 100644 --- a/app/src/main/kotlin/com/aliucord/manager/ui/screens/patchopts/PatchOptions.kt +++ b/app/src/main/kotlin/com/aliucord/manager/ui/screens/patchopts/PatchOptions.kt @@ -33,12 +33,6 @@ data class PatchOptions( * Replacement of the user-facing launcher icon. */ val iconReplacement: IconReplacement, - - /** - * Adding a monochrome variant to the launcher icon. - * This is independent of [PatchOptions.iconReplacement] - */ - val monochromeIcon: Boolean, ) : Parcelable { @Immutable @Parcelize @@ -95,7 +89,6 @@ data class PatchOptions( packageName = "com.aliucord", debuggable = false, iconReplacement = IconReplacement.Aliucord, - monochromeIcon = true, ) } } diff --git a/app/src/main/kotlin/com/aliucord/manager/ui/screens/patchopts/PatchOptionsModel.kt b/app/src/main/kotlin/com/aliucord/manager/ui/screens/patchopts/PatchOptionsModel.kt index f43dda8..ef72979 100644 --- a/app/src/main/kotlin/com/aliucord/manager/ui/screens/patchopts/PatchOptionsModel.kt +++ b/app/src/main/kotlin/com/aliucord/manager/ui/screens/patchopts/PatchOptionsModel.kt @@ -92,7 +92,6 @@ class PatchOptionsModel( debuggable = debuggable, // TODO: advanced icon options iconReplacement = if (replaceIcon) PatchOptions.IconReplacement.Aliucord else PatchOptions.IconReplacement.Original, - monochromeIcon = true, ) }