mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-02 15:44:37 +02:00
feat(YouTube/Spoof app version): add target version 18.33.40 - Restore old shorts action bar
This commit is contained in:
parent
38389817e5
commit
6bffafb24a
@ -1,6 +1,7 @@
|
||||
package app.revanced.patches.youtube.misc.spoofappversion
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.shared.patch.versionspoof.AbstractVersionSpoofPatch
|
||||
@ -8,6 +9,7 @@ import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch.contexts
|
||||
import app.revanced.util.integrations.Constants.MISC_PATH
|
||||
import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
||||
import org.w3c.dom.Element
|
||||
|
||||
@Patch(
|
||||
name = "Spoof app version",
|
||||
@ -47,6 +49,10 @@ object SpoofAppVersionPatch : AbstractVersionSpoofPatch(
|
||||
*/
|
||||
contexts.copyXmlNode("youtube/spoofappversion/host", "values/arrays.xml", "resources")
|
||||
|
||||
if (SettingsPatch.upward1834) {
|
||||
contexts.appendChild()
|
||||
}
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
@ -60,4 +66,29 @@ object SpoofAppVersionPatch : AbstractVersionSpoofPatch(
|
||||
SettingsPatch.updatePatchStatus("Spoof app version")
|
||||
|
||||
}
|
||||
|
||||
private fun ResourceContext.appendChild(){
|
||||
arrayOf(
|
||||
"revanced_spoof_app_version_target_entry" to "@string/revanced_spoof_app_version_target_entry_18_33_40",
|
||||
"revanced_spoof_app_version_target_entry_value" to "18.33.40",
|
||||
).map { (attributeName, attributeValue) ->
|
||||
this.xmlEditor["res/values/arrays.xml"].use { editor ->
|
||||
editor.file.apply {
|
||||
val resourcesNode = getElementsByTagName("resources").item(0) as Element
|
||||
|
||||
val newElement: Element = createElement("item")
|
||||
for (i in 0 until resourcesNode.childNodes.length) {
|
||||
val node = resourcesNode.childNodes.item(i) as? Element ?: continue
|
||||
|
||||
if (node.getAttribute("name") == attributeName) {
|
||||
newElement.appendChild(createTextNode(attributeValue))
|
||||
val firstChild = node.firstChild
|
||||
|
||||
node.insertBefore(newElement, firstChild)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -653,6 +653,7 @@ If later turned off, the old UI may remain until clear the app data"</string>
|
||||
<string name="revanced_spoof_app_version_target_entry_18_01_38">"18.01.38 - Remove 'Comments by members' banner"</string>
|
||||
<string name="revanced_spoof_app_version_target_entry_18_05_40">18.05.40 - Restore old comment input box</string>
|
||||
<string name="revanced_spoof_app_version_target_entry_18_17_43">18.17.43 - Restore old player flyout panel</string>
|
||||
<string name="revanced_spoof_app_version_target_entry_18_33_40">18.33.40 - Restore old shorts action bar</string>
|
||||
<string name="revanced_spoof_app_version_target_entry_title">Spoof app version target</string>
|
||||
<string name="revanced_spoof_app_version_target_summary">Type the spoof app version target</string>
|
||||
<string name="revanced_spoof_app_version_target_title">Edit spoof app version</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user