Skip to content

Commit 3edd8eb

Browse files
committed
feat(YouTube Music/Spoof app version): add target version 7.16.53
1 parent 6360f97 commit 3edd8eb

File tree

5 files changed

+13
-23
lines changed

5 files changed

+13
-23
lines changed

src/main/kotlin/app/revanced/patches/music/general/spoofappversion/SpoofAppVersionPatch.kt

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import app.revanced.patches.music.general.oldstylelibraryshelf.OldStyleLibrarySh
55
import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE
66
import app.revanced.patches.music.utils.settings.CategoryType
77
import app.revanced.patches.music.utils.settings.SettingsPatch
8+
import app.revanced.util.appendAppVersion
89
import app.revanced.util.patch.BaseResourcePatch
910

1011
@Suppress("unused")
@@ -21,6 +22,10 @@ object SpoofAppVersionPatch : BaseResourcePatch(
2122
) {
2223
override fun execute(context: ResourceContext) {
2324

25+
if (SettingsPatch.upward0718) {
26+
context.appendAppVersion("7.16.53")
27+
}
28+
2429
SettingsPatch.addSwitchPreference(
2530
CategoryType.GENERAL,
2631
"revanced_spoof_app_version",

src/main/kotlin/app/revanced/patches/youtube/general/spoofappversion/SpoofAppVersionPatch.kt

+1-20
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package app.revanced.patches.youtube.general.spoofappversion
22

33
import app.revanced.patcher.data.ResourceContext
44
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
5-
import app.revanced.patches.youtube.utils.settings.ResourceUtils.addEntryValues
65
import app.revanced.patches.youtube.utils.settings.SettingsPatch
6+
import app.revanced.util.appendAppVersion
77
import app.revanced.util.patch.BaseResourcePatch
88

99
@Suppress("unused")
@@ -17,12 +17,6 @@ object SpoofAppVersionPatch : BaseResourcePatch(
1717
),
1818
compatiblePackages = COMPATIBLE_PACKAGE
1919
) {
20-
private const val ATTRIBUTE_NAME_ENTRIES =
21-
"revanced_spoof_app_version_target_entries"
22-
23-
private const val ATTRIBUTE_NAME_ENTRY_VALUE =
24-
"revanced_spoof_app_version_target_entry_values"
25-
2620
override fun execute(context: ResourceContext) {
2721

2822
if (SettingsPatch.upward1834) {
@@ -48,17 +42,4 @@ object SpoofAppVersionPatch : BaseResourcePatch(
4842

4943
SettingsPatch.updatePatchStatus(this)
5044
}
51-
52-
private fun ResourceContext.appendAppVersion(appVersion: String) {
53-
addEntryValues(
54-
ATTRIBUTE_NAME_ENTRIES,
55-
"@string/revanced_spoof_app_version_target_entry_" + appVersion.replace(".", "_"),
56-
prepend = false
57-
)
58-
addEntryValues(
59-
ATTRIBUTE_NAME_ENTRY_VALUE,
60-
appVersion,
61-
prepend = false
62-
)
63-
}
6445
}

src/main/kotlin/app/revanced/util/ResourceUtils.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,10 @@ internal fun NodeList.findElementByAttributeValue(attributeName: String, value:
258258
return null
259259
}
260260

261-
internal fun NodeList.findElementByAttributeValueOrThrow(attributeName: String, value: String): Element {
261+
internal fun NodeList.findElementByAttributeValueOrThrow(
262+
attributeName: String,
263+
value: String
264+
): Element {
262265
return findElementByAttributeValue(attributeName, value)
263266
?: throw PatchException("Could not find: $attributeName $value")
264267
}

src/main/resources/music/settings/host/values/arrays.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<item>@string/revanced_change_start_page_entry_library</item>
88
<item>@string/revanced_change_start_page_entry_subscription</item>
99
</string-array>
10-
<string-array name="revanced_change_start_page_entry_value">
10+
<string-array name="revanced_change_start_page_entry_values">
1111
<item>FEmusic_charts</item>
1212
<item>FEmusic_explore</item>
1313
<item>FEmusic_home</item>
@@ -41,7 +41,7 @@
4141
<item>@string/revanced_spoof_app_version_target_entry_6_11_52</item>
4242
<item>@string/revanced_spoof_app_version_target_entry_4_27_53</item>
4343
</string-array>
44-
<string-array name="revanced_spoof_app_version_target_entry_value">
44+
<string-array name="revanced_spoof_app_version_target_entry_values">
4545
<item>6.11.52</item>
4646
<item>4.27.53</item>
4747
</string-array>

src/main/resources/music/settings/host/values/strings.xml

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ This does not bypass the age restriction. It just accepts it automatically."</st
194194
<string name="revanced_spoof_app_version_target_summary">Select the spoof app version target.</string>
195195
<string name="revanced_spoof_app_version_target_entry_4_27_53">4.27.53 - Disable Radio mode in Canadian regions</string>
196196
<string name="revanced_spoof_app_version_target_entry_6_11_52">6.11.52 - Disable real-time lyrics</string>
197+
<string name="revanced_spoof_app_version_target_entry_7_16_53">7.16.53 - Restore old action bar</string>
197198

198199

199200
<!-- PreferenceScreen: Navigation Bar -->

0 commit comments

Comments
 (0)