feat(YouTube Music/Spoof app version): add target version 7.16.53

This commit is contained in:
inotia00 2024-10-03 22:41:58 +09:00
parent 6360f97e54
commit 3edd8eb43c
5 changed files with 13 additions and 23 deletions

View File

@ -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",

View File

@ -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
)
}
}

View File

@ -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")
}

View File

@ -7,7 +7,7 @@
<item>@string/revanced_change_start_page_entry_library</item>
<item>@string/revanced_change_start_page_entry_subscription</item>
</string-array>
<string-array name="revanced_change_start_page_entry_value">
<string-array name="revanced_change_start_page_entry_values">
<item>FEmusic_charts</item>
<item>FEmusic_explore</item>
<item>FEmusic_home</item>
@ -41,7 +41,7 @@
<item>@string/revanced_spoof_app_version_target_entry_6_11_52</item>
<item>@string/revanced_spoof_app_version_target_entry_4_27_53</item>
</string-array>
<string-array name="revanced_spoof_app_version_target_entry_value">
<string-array name="revanced_spoof_app_version_target_entry_values">
<item>6.11.52</item>
<item>4.27.53</item>
</string-array>

View File

@ -194,6 +194,7 @@ This does not bypass the age restriction. It just accepts it automatically."</st
<string name="revanced_spoof_app_version_target_summary">Select the spoof app version target.</string>
<string name="revanced_spoof_app_version_target_entry_4_27_53">4.27.53 - Disable Radio mode in Canadian regions</string>
<string name="revanced_spoof_app_version_target_entry_6_11_52">6.11.52 - Disable real-time lyrics</string>
<string name="revanced_spoof_app_version_target_entry_7_16_53">7.16.53 - Restore old action bar</string>
<!-- PreferenceScreen: Navigation Bar -->