mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-05 09:04:34 +02:00
fix(YouTube/Settings): Patch Information is no longer updated by ReVancedSettingsFragment
This commit is contained in:
parent
eecc48c6d5
commit
2c52f9c2f7
@ -24,6 +24,8 @@ object SettingsBytecodePatch : BytecodePatch(
|
|||||||
setOf(ThemeSetterSystemFingerprint)
|
setOf(ThemeSetterSystemFingerprint)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
|
contexts = context
|
||||||
|
|
||||||
// apply the current theme of the settings page
|
// apply the current theme of the settings page
|
||||||
ThemeSetterSystemFingerprint.result?.let {
|
ThemeSetterSystemFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
@ -47,6 +49,7 @@ object SettingsBytecodePatch : BytecodePatch(
|
|||||||
context.injectInit("InitializationPatch", "initializeReVancedSettings", true)
|
context.injectInit("InitializationPatch", "initializeReVancedSettings", true)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
internal lateinit var contexts: BytecodeContext
|
||||||
|
|
||||||
private const val SET_THEME =
|
private const val SET_THEME =
|
||||||
"invoke-static {v0}, $INTEGRATIONS_PATH/utils/ThemeHelper;->setTheme(Ljava/lang/Object;)V"
|
"invoke-static {v0}, $INTEGRATIONS_PATH/utils/ThemeHelper;->setTheme(Ljava/lang/Object;)V"
|
||||||
|
@ -13,9 +13,11 @@ import app.revanced.util.resources.IconHelper.makeDirectoryAndCopyFiles
|
|||||||
import app.revanced.util.resources.ResourceHelper.addPreference
|
import app.revanced.util.resources.ResourceHelper.addPreference
|
||||||
import app.revanced.util.resources.ResourceHelper.addReVancedPreference
|
import app.revanced.util.resources.ResourceHelper.addReVancedPreference
|
||||||
import app.revanced.util.resources.ResourceHelper.updatePatchStatus
|
import app.revanced.util.resources.ResourceHelper.updatePatchStatus
|
||||||
|
import app.revanced.util.resources.ResourceHelper.updatePatchStatusSettings
|
||||||
import app.revanced.util.resources.ResourceUtils
|
import app.revanced.util.resources.ResourceUtils
|
||||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
|
import java.io.Closeable
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
@ -63,7 +65,7 @@ object SettingsPatch : AbstractSettingsResourcePatch(
|
|||||||
"youtube/settings",
|
"youtube/settings",
|
||||||
"youtube/settings/host",
|
"youtube/settings/host",
|
||||||
true
|
true
|
||||||
) {
|
), Closeable {
|
||||||
override fun execute(context: ResourceContext) {
|
override fun execute(context: ResourceContext) {
|
||||||
super.execute(context)
|
super.execute(context)
|
||||||
contexts = context
|
contexts = context
|
||||||
@ -220,4 +222,30 @@ object SettingsPatch : AbstractSettingsResourcePatch(
|
|||||||
internal fun updatePatchStatus(patchTitle: String) {
|
internal fun updatePatchStatus(patchTitle: String) {
|
||||||
contexts.updatePatchStatus(patchTitle)
|
contexts.updatePatchStatus(patchTitle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun close() {
|
||||||
|
SettingsBytecodePatch.contexts.classes.forEach { classDef ->
|
||||||
|
if (classDef.sourceFile != "BuildConfig.java")
|
||||||
|
return@forEach
|
||||||
|
|
||||||
|
classDef.fields.forEach { field ->
|
||||||
|
if (field.name == "VERSION_NAME") {
|
||||||
|
contexts.updatePatchStatusSettings(
|
||||||
|
"ReVanced Integrations",
|
||||||
|
field.initialValue.toString().trim()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
contexts["res/xml/revanced_prefs.xml"].apply {
|
||||||
|
writeText(
|
||||||
|
readText()
|
||||||
|
.replace(
|
||||||
|
""",
|
||||||
|
""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -82,7 +82,7 @@ internal object ResourceHelper {
|
|||||||
updatePatchStatusSettings("Theme", themeName)
|
updatePatchStatusSettings("Theme", themeName)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ResourceContext.updatePatchStatusSettings(
|
internal fun ResourceContext.updatePatchStatusSettings(
|
||||||
patchTitle: String,
|
patchTitle: String,
|
||||||
updateText: String
|
updateText: String
|
||||||
) {
|
) {
|
||||||
|
@ -338,7 +338,7 @@
|
|||||||
<PreferenceScreen android:title="@string/revanced_patches_information" android:summary="@string/revanced_patches_information_summary" >
|
<PreferenceScreen android:title="@string/revanced_patches_information" android:summary="@string/revanced_patches_information_summary" >
|
||||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_tool_used" />
|
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_tool_used" />
|
||||||
<Preference android:title="ReVanced Patches" android:selectable="false" android:summary="2.196.1" />
|
<Preference android:title="ReVanced Patches" android:selectable="false" android:summary="2.196.1" />
|
||||||
<Preference android:title="ReVanced Integrations" android:key="revanced-integrations" android:selectable="false"/>
|
<Preference android:title="ReVanced Integrations" android:selectable="false" android:summary="" />
|
||||||
|
|
||||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_ads" />
|
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_ads" />
|
||||||
<Preference android:title="Hide general ads" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="Hide general ads" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user