fix: don't include all Litho patches, when not included
This commit is contained in:
+8
@@ -66,6 +66,14 @@ class HideButtonsPatch : ResourcePatch {
|
||||
StringResource("revanced_hide_buttons_preference_screen_summary", "Hide or show buttons under videos")
|
||||
)
|
||||
)
|
||||
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/components/ButtonsFilter;"
|
||||
}
|
||||
}
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.artistcards.annotations
|
||||
|
||||
import app.revanced.patcher.annotation.Compatibility
|
||||
import app.revanced.patcher.annotation.Package
|
||||
|
||||
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37", "18.19.35"))])
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
internal annotation class HideArtistCardCompatibility
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
package app.revanced.patches.youtube.layout.hide.artistcards.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||
import app.revanced.patches.youtube.layout.hide.artistcards.annotations.HideArtistCardCompatibility
|
||||
import app.revanced.patches.youtube.misc.litho.filter.patch.LithoFilterPatch
|
||||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||
|
||||
@Patch
|
||||
@DependsOn([ResourceMappingPatch::class, LithoFilterPatch::class])
|
||||
@Name("hide-artist-card")
|
||||
@Description("Hides the artist card below the searchbar.")
|
||||
@HideArtistCardCompatibility
|
||||
@Version("0.0.1")
|
||||
class HideArtistCardsPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
SwitchPreference(
|
||||
"revanced_hide_artist_cards",
|
||||
StringResource("revanced_hide_artist_cards_title", "Hide artist cards"),
|
||||
StringResource("revanced_hide_artist_cards_on", "Artist cards is hidden"),
|
||||
StringResource("revanced_hide_artist_cards_off", "Artist cards is shown")
|
||||
),
|
||||
)
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
||||
+8
-6
@@ -49,6 +49,8 @@ class HideShortsComponentsPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||
|
||||
// region Hide the Shorts shelf.
|
||||
|
||||
ReelConstructorFingerprint.result?.let {
|
||||
@@ -59,7 +61,7 @@ class HideShortsComponentsPatch : BytecodePatch(
|
||||
injectHideViewCall(
|
||||
insertIndex,
|
||||
viewRegister,
|
||||
CLASS_DESCRIPTOR,
|
||||
FILTER_CLASS_DESCRIPTOR,
|
||||
"hideShortsShelf"
|
||||
)
|
||||
}
|
||||
@@ -89,7 +91,7 @@ class HideShortsComponentsPatch : BytecodePatch(
|
||||
val viewRegister = getInstruction<OneRegisterInstruction>(checkCastIndex).registerA
|
||||
addInstruction(
|
||||
checkCastIndex + 1,
|
||||
"sput-object v$viewRegister, $CLASS_DESCRIPTOR->pivotBar:" +
|
||||
"sput-object v$viewRegister, $FILTER_CLASS_DESCRIPTOR->pivotBar:" +
|
||||
"Lcom/google/android/libraries/youtube/rendering/ui/pivotbar/PivotBar;"
|
||||
)
|
||||
}
|
||||
@@ -102,7 +104,7 @@ class HideShortsComponentsPatch : BytecodePatch(
|
||||
throw RenderBottomNavigationBarFingerprint.toErrorResult()
|
||||
|
||||
RenderBottomNavigationBarFingerprint.result!!.mutableMethod.apply {
|
||||
addInstruction(0, "invoke-static { }, $CLASS_DESCRIPTOR->hideNavigationBar()V")
|
||||
addInstruction(0, "invoke-static { }, $FILTER_CLASS_DESCRIPTOR->hideNavigationBar()V")
|
||||
}
|
||||
} ?: return RenderBottomNavigationBarParentFingerprint.toErrorResult()
|
||||
|
||||
@@ -115,7 +117,7 @@ class HideShortsComponentsPatch : BytecodePatch(
|
||||
|
||||
addInstruction(
|
||||
insertIndex,
|
||||
"invoke-static { v$viewRegister }, $CLASS_DESCRIPTOR->" +
|
||||
"invoke-static { v$viewRegister }, $FILTER_CLASS_DESCRIPTOR->" +
|
||||
"hideNavigationBar(Landroid/view/View;)Landroid/view/View;"
|
||||
)
|
||||
}
|
||||
@@ -127,7 +129,7 @@ class HideShortsComponentsPatch : BytecodePatch(
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private const val CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/components/ShortsFilter;"
|
||||
private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/integrations/patches/components/ShortsFilter;"
|
||||
|
||||
private enum class ShortsButtons(private val resourceName: String, private val methodName: String) {
|
||||
COMMENTS("reel_dyn_comment", "hideShortsCommentsButton"),
|
||||
@@ -139,7 +141,7 @@ class HideShortsComponentsPatch : BytecodePatch(
|
||||
|
||||
val setIdIndex = referencedIndex + 1
|
||||
val viewRegister = method.getInstruction<FiveRegisterInstruction>(setIdIndex).registerC
|
||||
method.injectHideViewCall(setIdIndex, viewRegister, CLASS_DESCRIPTOR, methodName)
|
||||
method.injectHideViewCall(setIdIndex, viewRegister, FILTER_CLASS_DESCRIPTOR, methodName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user