mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-23 02:31:03 +00:00
Compare commits
2 Commits
v2.174.0-d
...
v2.174.0-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
529e90d232 | ||
|
|
c72fd1e2fc |
@@ -1,3 +1,10 @@
|
|||||||
|
# [2.174.0-dev.20](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.19...v2.174.0-dev.20) (2023-05-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **youtube:** add `hide-filter-bar` patch ([6cc5f61](https://github.com/revanced/revanced-patches/commit/6cc5f61e0712fe25cd45b137773decaf4b9bb582))
|
||||||
|
|
||||||
# [2.174.0-dev.19](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.18...v2.174.0-dev.19) (2023-05-11)
|
# [2.174.0-dev.19](https://github.com/revanced/revanced-patches/compare/v2.174.0-dev.18...v2.174.0-dev.19) (2023-05-11)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ The official ReVanced Patches.
|
|||||||
| `hide-crowdfunding-box` | Hides the crowdfunding box between the player and video description. | 18.16.37 |
|
| `hide-crowdfunding-box` | Hides the crowdfunding box between the player and video description. | 18.16.37 |
|
||||||
| `hide-email-address` | Hides the email address in the account switcher. | 18.16.37 |
|
| `hide-email-address` | Hides the email address in the account switcher. | 18.16.37 |
|
||||||
| `hide-endscreen-cards` | Hides the suggested video cards at the end of a video in fullscreen. | 18.16.37 |
|
| `hide-endscreen-cards` | Hides the suggested video cards at the end of a video in fullscreen. | 18.16.37 |
|
||||||
|
| `hide-filter-bar` | Hides the filter bar in video feeds. | 18.16.37 |
|
||||||
| `hide-floating-microphone-button` | Hides the floating microphone button which appears in search. | 18.16.37 |
|
| `hide-floating-microphone-button` | Hides the floating microphone button which appears in search. | 18.16.37 |
|
||||||
| `hide-get-premium` | Hides advertisement for YouTube Premium under the video player. | 18.16.37 |
|
| `hide-get-premium` | Hides advertisement for YouTube Premium under the video player. | 18.16.37 |
|
||||||
| `hide-info-cards` | Hides info cards in videos. | 18.16.37 |
|
| `hide-info-cards` | Hides info cards in videos. | 18.16.37 |
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.174.0-dev.19
|
version = 2.174.0-dev.20
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.filterbar.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility([Package("com.google.android.youtube", arrayOf("18.16.37"))])
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
internal annotation class HideFilterBar
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.filterbar.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patches.youtube.layout.hide.filterbar.patch.HideFilterBarResourcePatch.Companion.filterBarHeightId
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object FilterBarHeightFingerprint : LiteralOpcodesFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.IPUT
|
||||||
|
),
|
||||||
|
filterBarHeightId
|
||||||
|
)
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.filterbar.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||||
|
|
||||||
|
|
||||||
|
abstract class LiteralOpcodesFingerprint(opcodes: List<Opcode>, literal: Long) : MethodFingerprint(
|
||||||
|
opcodes = opcodes,
|
||||||
|
customFingerprint = {
|
||||||
|
it.implementation?.instructions?.any { instruction ->
|
||||||
|
if (instruction.opcode != Opcode.CONST) return@any false
|
||||||
|
|
||||||
|
val wideLiteral = (instruction as WideLiteralInstruction).wideLiteral
|
||||||
|
|
||||||
|
literal == wideLiteral
|
||||||
|
} ?: false
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.filterbar.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patches.youtube.layout.hide.filterbar.patch.HideFilterBarResourcePatch.Companion.relatedChipCloudMarginId
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object RelatedChipCloudFingerprint : LiteralOpcodesFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
|
),
|
||||||
|
relatedChipCloudMarginId
|
||||||
|
)
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.filterbar.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patches.youtube.layout.hide.filterbar.patch.HideFilterBarResourcePatch.Companion.barContainerHeightId
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object SearchResultsChipBarFingerprint : LiteralOpcodesFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT
|
||||||
|
),
|
||||||
|
barContainerHeightId
|
||||||
|
)
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.filterbar.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.youtube.layout.hide.filterbar.annotations.HideFilterBar
|
||||||
|
import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.FilterBarHeightFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.RelatedChipCloudFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.hide.filterbar.fingerprints.SearchResultsChipBarFingerprint
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("hide-filter-bar")
|
||||||
|
@Description("Hides the filter bar in video feeds.")
|
||||||
|
@DependsOn([HideFilterBarResourcePatch::class])
|
||||||
|
@HideFilterBar
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HideFilterBarPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
RelatedChipCloudFingerprint,
|
||||||
|
SearchResultsChipBarFingerprint,
|
||||||
|
FilterBarHeightFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
FilterBarHeightFingerprint.patch<TwoRegisterInstruction> { register ->
|
||||||
|
"""
|
||||||
|
invoke-static { v$register }, $INTEGRATIONS_CLASS_DESCRIPTOR->hideInFeed(I)I
|
||||||
|
move-result v$register
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
|
||||||
|
RelatedChipCloudFingerprint.patch<OneRegisterInstruction>(1) { register ->
|
||||||
|
"invoke-static { v$register }, " +
|
||||||
|
"$INTEGRATIONS_CLASS_DESCRIPTOR->hideInRelatedVideos(Landroid/view/View;)V"
|
||||||
|
}
|
||||||
|
|
||||||
|
SearchResultsChipBarFingerprint.patch<OneRegisterInstruction>(-1, -2) { register ->
|
||||||
|
"""
|
||||||
|
invoke-static { v$register }, $INTEGRATIONS_CLASS_DESCRIPTOR->hideInSearch(I)I
|
||||||
|
move-result v$register
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
private companion object {
|
||||||
|
const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||||
|
"Lapp/revanced/integrations/patches/HideFilterBarPatch;"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Patch a [MethodFingerprint] with a given [instructions].
|
||||||
|
*
|
||||||
|
* @param RegisterInstruction The type of instruction to get the register from.
|
||||||
|
* @param insertIndexOffset The offset to add to the end index of the [MethodFingerprint].
|
||||||
|
* @param hookRegisterOffset The offset to add to the register of the hook.
|
||||||
|
* @param instructions The instructions to add with the register as a parameter.
|
||||||
|
*/
|
||||||
|
private fun <RegisterInstruction: OneRegisterInstruction> MethodFingerprint.patch(
|
||||||
|
insertIndexOffset: Int = 0,
|
||||||
|
hookRegisterOffset: Int = 0,
|
||||||
|
instructions: (Int) -> String
|
||||||
|
) =
|
||||||
|
result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
|
||||||
|
val insertIndex = endIndex + insertIndexOffset
|
||||||
|
val register = instruction<RegisterInstruction>(endIndex + hookRegisterOffset).registerA
|
||||||
|
|
||||||
|
addInstructions(insertIndex, instructions(register))
|
||||||
|
}
|
||||||
|
} ?: throw toErrorResult()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.hide.filterbar.patch
|
||||||
|
|
||||||
|
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.patches.shared.mapping.misc.patch.ResourceMappingPatch
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.PreferenceScreen
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||||
|
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
|
||||||
|
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HideFilterBarResourcePatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||||
|
PreferenceScreen(
|
||||||
|
"revanced_hide_filter_bar_preference",
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_preference_title",
|
||||||
|
"Hide filter bar"
|
||||||
|
),
|
||||||
|
listOf(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_filter_bar_feed_in_feed",
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_feed_title",
|
||||||
|
"Hide in feed"
|
||||||
|
),
|
||||||
|
false,
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_feed_summary_on",
|
||||||
|
"Hidden in feed"
|
||||||
|
),
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_feed_summary_off",
|
||||||
|
"Shown in feed"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_filter_bar_feed_in_search",
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_search_title",
|
||||||
|
"Hide in search"
|
||||||
|
),
|
||||||
|
false,
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_search_summary_on",
|
||||||
|
"Hidden in search"
|
||||||
|
),
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_search_summary_off",
|
||||||
|
"Shown in search"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_filter_bar_feed_in_related_videos",
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_related_videos_title",
|
||||||
|
"Hide in related videos"
|
||||||
|
),
|
||||||
|
false,
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_related_videos_summary_on",
|
||||||
|
"Hidden in related videos"
|
||||||
|
),
|
||||||
|
StringResource(
|
||||||
|
"revanced_hide_filter_bar_feed_in_related_videos_summary_off",
|
||||||
|
"Shown in related videos"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
relatedChipCloudMarginId = "related_chip_cloud_reduced_margins".layoutResourceId("layout")
|
||||||
|
filterBarHeightId = "filter_bar_height".layoutResourceId()
|
||||||
|
barContainerHeightId = "bar_container_height".layoutResourceId()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
internal companion object {
|
||||||
|
var filterBarHeightId = -1L
|
||||||
|
var relatedChipCloudMarginId = -1L
|
||||||
|
var barContainerHeightId = -1L
|
||||||
|
|
||||||
|
private fun String.layoutResourceId(type: String = "dimen") =
|
||||||
|
ResourceMappingPatch.resourceMappings.single { it.type == type && it.name == this }.id
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user