mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-05 00:54:32 +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)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
contexts = context
|
||||
|
||||
// apply the current theme of the settings page
|
||||
ThemeSetterSystemFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
@ -47,6 +49,7 @@ object SettingsBytecodePatch : BytecodePatch(
|
||||
context.injectInit("InitializationPatch", "initializeReVancedSettings", true)
|
||||
|
||||
}
|
||||
internal lateinit var contexts: BytecodeContext
|
||||
|
||||
private const val SET_THEME =
|
||||
"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.addReVancedPreference
|
||||
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.copyResources
|
||||
import org.w3c.dom.Element
|
||||
import java.io.Closeable
|
||||
import java.io.File
|
||||
import java.nio.file.Paths
|
||||
import java.util.concurrent.Executors
|
||||
@ -63,7 +65,7 @@ object SettingsPatch : AbstractSettingsResourcePatch(
|
||||
"youtube/settings",
|
||||
"youtube/settings/host",
|
||||
true
|
||||
) {
|
||||
), Closeable {
|
||||
override fun execute(context: ResourceContext) {
|
||||
super.execute(context)
|
||||
contexts = context
|
||||
@ -220,4 +222,30 @@ object SettingsPatch : AbstractSettingsResourcePatch(
|
||||
internal fun updatePatchStatus(patchTitle: String) {
|
||||
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)
|
||||
}
|
||||
|
||||
private fun ResourceContext.updatePatchStatusSettings(
|
||||
internal fun ResourceContext.updatePatchStatusSettings(
|
||||
patchTitle: String,
|
||||
updateText: String
|
||||
) {
|
||||
|
@ -338,7 +338,7 @@
|
||||
<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="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="Hide general ads" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user