generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 310
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(YouTube - Hide layout components): Add option to hide horizontal…
… shelves (#2951) Co-authored-by: oSumAtrIX <[email protected]> Co-authored-by: LisoUseInAIKyrios <[email protected]>
- Loading branch information
1 parent
abbc372
commit 9ae0650
Showing
5 changed files
with
12 additions
and
125 deletions.
There are no files selected for viewing
66 changes: 3 additions & 63 deletions
66
src/main/kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,13 @@ | ||
package app.revanced.patches.youtube.layout.hide.breakingnews | ||
|
||
import app.revanced.util.exception | ||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction | ||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.patch.annotation.CompatiblePackage | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.youtube.layout.hide.breakingnews.fingerprints.BreakingNewsFingerprint | ||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch | ||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction | ||
import app.revanced.patches.youtube.layout.hide.general.HideLayoutComponentsPatch | ||
|
||
@Patch( | ||
name = "Hide breaking news shelf", | ||
description = "Adds an option to hide the breaking news shelf on the homepage tab.", | ||
dependencies = [ | ||
IntegrationsPatch::class, | ||
BreakingNewsResourcePatch::class | ||
], | ||
compatiblePackages = [ | ||
CompatiblePackage( | ||
"com.google.android.youtube", | ||
[ | ||
"18.32.39", | ||
"18.37.36", | ||
"18.38.44", | ||
"18.43.45", | ||
"18.44.41", | ||
"18.45.43", | ||
"18.48.39", | ||
"18.49.37", | ||
"19.01.34", | ||
"19.02.39", | ||
"19.03.36", | ||
"19.04.38", | ||
"19.05.36", | ||
"19.06.39", | ||
"19.07.40", | ||
"19.08.36", | ||
"19.09.37" | ||
] | ||
) | ||
] | ||
) | ||
@Suppress("unused") | ||
@Deprecated("This patch has been merged to HideLayoutComponentsPatch.") | ||
object BreakingNewsPatch : BytecodePatch( | ||
setOf(BreakingNewsFingerprint) | ||
dependencies = setOf(HideLayoutComponentsPatch::class), | ||
) { | ||
override fun execute(context: BytecodeContext) { | ||
BreakingNewsFingerprint.result?.let { | ||
val insertIndex = it.scanResult.patternScanResult!!.endIndex - 1 | ||
val moveResultIndex = insertIndex - 1 | ||
|
||
it.mutableMethod.apply { | ||
val breakingNewsViewRegister = | ||
getInstruction<OneRegisterInstruction>(moveResultIndex).registerA | ||
|
||
addInstruction( | ||
insertIndex, | ||
""" | ||
invoke-static {v$breakingNewsViewRegister}, | ||
Lapp/revanced/integrations/youtube/patches/HideBreakingNewsPatch; | ||
-> | ||
hideBreakingNews(Landroid/view/View;)V | ||
""" | ||
) | ||
} | ||
|
||
} ?: throw BreakingNewsFingerprint.exception | ||
|
||
} | ||
} |
32 changes: 0 additions & 32 deletions
32
...kotlin/app/revanced/patches/youtube/layout/hide/breakingnews/BreakingNewsResourcePatch.kt
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
...revanced/patches/youtube/layout/hide/breakingnews/fingerprints/BreakingNewsFingerprint.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters