Skip to content

Commit f69eab3

Browse files
author
LisoUseInAIKyrios
authored
fix(YouTube - Spoof app version): Do not hide spoof version in general settings menu (#4861)
1 parent 7c5c2d9 commit f69eab3

File tree

3 files changed

+12
-33
lines changed

3 files changed

+12
-33
lines changed

patches/api/patches.api

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,14 +642,12 @@ public abstract class app/revanced/patches/shared/misc/settings/preference/BaseP
642642
public static final field Companion Lapp/revanced/patches/shared/misc/settings/preference/BasePreference$Companion;
643643
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
644644
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
645-
public fun equals (Ljava/lang/Object;)Z
646645
public final fun getIcon ()Ljava/lang/String;
647646
public final fun getKey ()Ljava/lang/String;
648647
public final fun getLayout ()Ljava/lang/String;
649648
public final fun getSummaryKey ()Ljava/lang/String;
650649
public final fun getTag ()Ljava/lang/String;
651650
public final fun getTitleKey ()Ljava/lang/String;
652-
public fun hashCode ()I
653651
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
654652
}
655653

patches/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/BasePreference.kt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,6 @@ abstract class BasePreference(
5151
layout?.let { setAttribute("android:layout", layout) }
5252
}
5353

54-
override fun hashCode(): Int {
55-
var result = key?.hashCode() ?: 0
56-
result = 31 * result + titleKey.hashCode()
57-
result = 31 * result + tag.hashCode()
58-
return result
59-
}
60-
61-
override fun equals(other: Any?): Boolean {
62-
if (this === other) return true
63-
if (javaClass != other?.javaClass) return false
64-
65-
other as BasePreference
66-
67-
if (key != other.key) return false
68-
if (titleKey != other.titleKey) return false
69-
if (tag != other.tag) return false
70-
71-
return true
72-
}
73-
7454
companion object {
7555
fun Element.addSummary(summaryKey: String, summaryType: SummaryType = SummaryType.DEFAULT) =
7656
setAttribute("android:${summaryType.type}", "@string/$summaryKey")

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ val spoofAppVersionPatch = bytecodePatch(
7373

7474
PreferenceScreen.GENERAL_LAYOUT.addPreferences(
7575
// Group the switch and list preference together, since General menu is sorted by name
76-
// and the preferences can be scattered apart with non English langauges.
76+
// and the preferences can be scattered apart with non English languages.
7777
PreferenceCategory(
7878
titleKey = null,
7979
sorting = Sorting.UNSORTED,
@@ -122,16 +122,17 @@ val spoofAppVersionPatch = bytecodePatch(
122122
)
123123
}
124124

125-
val insertIndex = spoofAppVersionFingerprint.patternMatch!!.startIndex + 1
126-
val buildOverrideNameRegister =
127-
spoofAppVersionFingerprint.method.getInstruction<OneRegisterInstruction>(insertIndex - 1).registerA
125+
spoofAppVersionFingerprint.apply {
126+
val startIndex = patternMatch!!.startIndex
127+
val buildOverrideNameRegister = method.getInstruction<OneRegisterInstruction>(startIndex).registerA
128128

129-
spoofAppVersionFingerprint.method.addInstructions(
130-
insertIndex,
131-
"""
132-
invoke-static {v$buildOverrideNameRegister}, $EXTENSION_CLASS_DESCRIPTOR->getYouTubeVersionOverride(Ljava/lang/String;)Ljava/lang/String;
133-
move-result-object v$buildOverrideNameRegister
134-
"""
135-
)
129+
method.addInstructions(
130+
startIndex + 1,
131+
"""
132+
invoke-static {v$buildOverrideNameRegister}, $EXTENSION_CLASS_DESCRIPTOR->getYouTubeVersionOverride(Ljava/lang/String;)Ljava/lang/String;
133+
move-result-object v$buildOverrideNameRegister
134+
"""
135+
)
136+
}
136137
}
137138
}

0 commit comments

Comments
 (0)