mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 05:07:41 +02:00
feat(YouTube Music/Spoof app version): add target version 7.16.53
This commit is contained in:
@ -5,6 +5,7 @@ import app.revanced.patches.music.general.oldstylelibraryshelf.OldStyleLibrarySh
|
||||
import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
import app.revanced.util.appendAppVersion
|
||||
import app.revanced.util.patch.BaseResourcePatch
|
||||
|
||||
@Suppress("unused")
|
||||
@ -21,6 +22,10 @@ object SpoofAppVersionPatch : BaseResourcePatch(
|
||||
) {
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
if (SettingsPatch.upward0718) {
|
||||
context.appendAppVersion("7.16.53")
|
||||
}
|
||||
|
||||
SettingsPatch.addSwitchPreference(
|
||||
CategoryType.GENERAL,
|
||||
"revanced_spoof_app_version",
|
||||
|
@ -2,8 +2,8 @@ package app.revanced.patches.youtube.general.spoofappversion
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
||||
import app.revanced.patches.youtube.utils.settings.ResourceUtils.addEntryValues
|
||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||
import app.revanced.util.appendAppVersion
|
||||
import app.revanced.util.patch.BaseResourcePatch
|
||||
|
||||
@Suppress("unused")
|
||||
@ -17,12 +17,6 @@ object SpoofAppVersionPatch : BaseResourcePatch(
|
||||
),
|
||||
compatiblePackages = COMPATIBLE_PACKAGE
|
||||
) {
|
||||
private const val ATTRIBUTE_NAME_ENTRIES =
|
||||
"revanced_spoof_app_version_target_entries"
|
||||
|
||||
private const val ATTRIBUTE_NAME_ENTRY_VALUE =
|
||||
"revanced_spoof_app_version_target_entry_values"
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
|
||||
if (SettingsPatch.upward1834) {
|
||||
@ -48,17 +42,4 @@ object SpoofAppVersionPatch : BaseResourcePatch(
|
||||
|
||||
SettingsPatch.updatePatchStatus(this)
|
||||
}
|
||||
|
||||
private fun ResourceContext.appendAppVersion(appVersion: String) {
|
||||
addEntryValues(
|
||||
ATTRIBUTE_NAME_ENTRIES,
|
||||
"@string/revanced_spoof_app_version_target_entry_" + appVersion.replace(".", "_"),
|
||||
prepend = false
|
||||
)
|
||||
addEntryValues(
|
||||
ATTRIBUTE_NAME_ENTRY_VALUE,
|
||||
appVersion,
|
||||
prepend = false
|
||||
)
|
||||
}
|
||||
}
|
@ -258,7 +258,10 @@ internal fun NodeList.findElementByAttributeValue(attributeName: String, value:
|
||||
return null
|
||||
}
|
||||
|
||||
internal fun NodeList.findElementByAttributeValueOrThrow(attributeName: String, value: String): Element {
|
||||
internal fun NodeList.findElementByAttributeValueOrThrow(
|
||||
attributeName: String,
|
||||
value: String
|
||||
): Element {
|
||||
return findElementByAttributeValue(attributeName, value)
|
||||
?: throw PatchException("Could not find: $attributeName $value")
|
||||
}
|
Reference in New Issue
Block a user