mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-21 16:57:18 +02:00
fix(YouTube/Hide trending searches): patch does not support new types of search icons
This commit is contained in:
parent
79897a163f
commit
867c08e1e8
@ -11,6 +11,7 @@ import app.revanced.patches.youtube.utils.integrations.Constants.GENERAL
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.YtOutlineArrowTimeBlack
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.YtOutlineFireBlack
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.YtOutlineNewSearchBlack
|
||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.YtOutlineSearchBlack
|
||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||
import app.revanced.util.exception
|
||||
@ -66,20 +67,22 @@ object TrendingSearchesPatch : BytecodePatch(
|
||||
SearchBarEntryFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
SearchTerm.entries
|
||||
.map { searchTerm -> getWideLiteralInstructionIndex(searchTerm.resourceId) to searchTerm.value }
|
||||
.map { searchTerm -> getWideLiteralInstructionIndex(searchTerm.resourceId) to searchTerm.booleanValue }
|
||||
.sortedBy { searchTerm -> searchTerm.first }
|
||||
.reversed()
|
||||
.forEach { (index, value) ->
|
||||
val freeRegister = getInstruction<OneRegisterInstruction>(index).registerA
|
||||
val viewRegister =
|
||||
getInstruction<TwoRegisterInstruction>(index - 1).registerA
|
||||
.forEach { (targetIndex, booleanValue) ->
|
||||
if (targetIndex > 1) {
|
||||
val freeRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
val viewRegister =
|
||||
getInstruction<TwoRegisterInstruction>(targetIndex - 1).registerA
|
||||
|
||||
addInstructions(
|
||||
index, """
|
||||
const/4 v$freeRegister, $value
|
||||
invoke-static {v$viewRegister, v$freeRegister}, $GENERAL->hideTrendingSearches(Landroid/widget/ImageView;Z)V
|
||||
"""
|
||||
)
|
||||
addInstructions(
|
||||
targetIndex, """
|
||||
const/4 v$freeRegister, $booleanValue
|
||||
invoke-static {v$viewRegister, v$freeRegister}, $GENERAL->hideTrendingSearches(Landroid/widget/ImageView;Z)V
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
} ?: throw SearchBarEntryFingerprint.exception
|
||||
@ -98,9 +101,10 @@ object TrendingSearchesPatch : BytecodePatch(
|
||||
|
||||
}
|
||||
|
||||
private enum class SearchTerm(val resourceId: Long, val value: Int) {
|
||||
private enum class SearchTerm(val resourceId: Long, val booleanValue: Int) {
|
||||
HISTORY(YtOutlineArrowTimeBlack, 0),
|
||||
SEARCH(YtOutlineSearchBlack, 0),
|
||||
NEW_SEARCH(YtOutlineNewSearchBlack, 0),
|
||||
TRENDING(YtOutlineFireBlack, 1)
|
||||
}
|
||||
}
|
@ -86,6 +86,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
var YoutubeControlsOverlaySubtitleButton: Long = -1
|
||||
var YtOutlineArrowTimeBlack: Long = -1
|
||||
var YtOutlineFireBlack: Long = -1
|
||||
var YtOutlineNewSearchBlack: Long = -1
|
||||
var YtOutlineSearchBlack: Long = -1
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
@ -169,6 +170,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
YoutubeControlsOverlaySubtitleButton = find(LAYOUT, "youtube_controls_overlay_subtitle_button")
|
||||
YtOutlineArrowTimeBlack = find(DRAWABLE, "yt_outline_arrow_time_black_24")
|
||||
YtOutlineFireBlack = find(DRAWABLE, "yt_outline_fire_black_24")
|
||||
YtOutlineNewSearchBlack = find(DRAWABLE, "yt_outline_new_search_black_24")
|
||||
YtOutlineSearchBlack = find(DRAWABLE, "yt_outline_search_black_24")
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user