Skip to content

Commit

Permalink
fix(youtube/theme): move options out of dependency patch
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed May 7, 2023
1 parent 279b193 commit a953448
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.toMethodWalker
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
Expand Down Expand Up @@ -71,7 +69,25 @@ class ThemeBytecodePatch : BytecodePatch(
return PatchResultSuccess()
}

private companion object {
companion object : OptionsContainer() {
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/theme/ThemePatch;"

var darkThemeBackgroundColor: String? by option(
PatchOption.StringOption(
key = "darkThemeBackgroundColor",
default = "@android:color/black",
title = "Background color for the dark theme",
description = "The background color of the dark theme. Can be a hex color or a resource reference.",
)
)

var lightThemeBackgroundColor: String? by option(
PatchOption.StringOption(
key = "lightThemeBackgroundColor",
default = "@android:color/white",
title = "Background color for the light theme",
description = "The background color of the light theme. Can be a hex color or a resource reference.",
)
)
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package app.revanced.patches.youtube.layout.theme.resource

import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.*
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.impl.InputType
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.TextPreference
import app.revanced.patches.youtube.layout.theme.bytecode.patch.ThemeBytecodePatch.Companion.darkThemeBackgroundColor
import app.revanced.patches.youtube.layout.theme.bytecode.patch.ThemeBytecodePatch.Companion.lightThemeBackgroundColor
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.util.resources.ResourceUtils
import app.revanced.util.resources.ResourceUtils.copyResources
Expand Down Expand Up @@ -67,25 +72,7 @@ class ThemeResourcePatch : ResourcePatch {
return PatchResultSuccess()
}

companion object : OptionsContainer() {
internal var inlineTimeBarColorizedBarPlayedColorDarkId = -1L

var darkThemeBackgroundColor: String? by option(
PatchOption.StringOption(
key = "darkThemeBackgroundColor",
default = "@android:color/black",
title = "Background color for the dark theme",
description = "The background color of the dark theme. Can be a hex color or a resource reference.",
)
)

var lightThemeBackgroundColor: String? by option(
PatchOption.StringOption(
key = "lightThemeBackgroundColor",
default = "@android:color/white",
title = "Background color for the light theme",
description = "The background color of the light theme. Can be a hex color or a resource reference.",
)
)
internal companion object {
var inlineTimeBarColorizedBarPlayedColorDarkId = -1L
}
}

0 comments on commit a953448

Please sign in to comment.