feat(youtube): remove hide-search-terms patch

This commit is contained in:
inotia00 2023-06-29 17:43:34 +09:00
parent 29533dd392
commit c5fa1aa807
7 changed files with 0 additions and 144 deletions

View File

@ -1,19 +0,0 @@
package app.revanced.patches.youtube.general.searchterms.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
object SearchEndpointFingerprint : MethodFingerprint(
returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("L"),
opcodes = listOf(
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT,
Opcode.CONST_4,
Opcode.CONST_16,
Opcode.CONST_4
)
)

View File

@ -1,12 +0,0 @@
package app.revanced.patches.youtube.general.searchterms.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
object SearchEndpointParentFingerprint : MethodFingerprint(
returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf(),
strings = listOf("voz-target-id")
)

View File

@ -1,9 +0,0 @@
package app.revanced.patches.youtube.general.searchterms.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.SearchSuggestionEntry
import app.revanced.util.bytecode.isWideLiteralExists
object SearchSuggestionEntryFingerprint : MethodFingerprint(
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(SearchSuggestionEntry) }
)

View File

@ -1,95 +0,0 @@
package app.revanced.patches.youtube.general.searchterms.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.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
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.general.searchterms.fingerprints.SearchEndpointFingerprint
import app.revanced.patches.youtube.general.searchterms.fingerprints.SearchEndpointParentFingerprint
import app.revanced.patches.youtube.general.searchterms.fingerprints.SearchSuggestionEntryFingerprint
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.SearchSuggestionEntry
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.bytecode.getWideLiteralIndex
import app.revanced.util.integrations.Constants.GENERAL
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@Name("hide-search-terms")
@Description("Hide trending searches and search history in the search bar.")
@DependsOn(
[
SettingsPatch::class,
SharedResourceIdPatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class SearchTermsPatch : BytecodePatch(
listOf(
SearchEndpointParentFingerprint,
SearchSuggestionEntryFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
SearchEndpointParentFingerprint.result?.let { parentResult ->
SearchEndpointFingerprint.also {
it.resolve(
context,
parentResult.classDef
)
}.result?.let {
it.mutableMethod.apply {
val targetIndex = it.scanResult.patternScanResult!!.startIndex + 1
val targetRegister =
getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstruction(
targetIndex + 1,
"sput-boolean v$targetRegister, $GENERAL->isSearchWordEmpty:Z"
)
}
} ?: return SearchEndpointFingerprint.toErrorResult()
} ?: return SearchEndpointParentFingerprint.toErrorResult()
SearchSuggestionEntryFingerprint.result?.mutableMethod?.let {
val targetIndex = it.getWideLiteralIndex(SearchSuggestionEntry) + 2
val targetRegister = it.getInstruction<OneRegisterInstruction>(targetIndex).registerA
it.addInstruction(
targetIndex + 4,
"invoke-static {v$targetRegister}, $GENERAL->hideSearchTerms(Landroid/view/View;)V"
)
it.addInstruction(
targetIndex + 2,
"invoke-static {v$targetRegister}, $GENERAL->hideSearchTerms(Landroid/view/View;)V"
)
} ?: return SearchSuggestionEntryFingerprint.toErrorResult()
/**
* Add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: GENERAL_SETTINGS",
"SETTINGS: HIDE_SEARCH_TERMS"
)
)
SettingsPatch.updatePatchStatus("hide-search-terms")
return PatchResultSuccess()
}
}

View File

@ -72,7 +72,6 @@ class SharedResourceIdPatch : ResourcePatch {
var RightComment: Long = -1
var ScrimOverlay: Long = -1
var Scrubbing: Long = -1
var SearchSuggestionEntry: Long = -1
var SettingsBooleanTimeRangeDialog: Long = -1
var SuggestedAction: Long = -1
var ToolBarPaddingHome: Long = -1
@ -140,7 +139,6 @@ class SharedResourceIdPatch : ResourcePatch {
RightComment = find(DRAWABLE, "ic_right_comment_32c")
ScrimOverlay = find(ID, "scrim_overlay")
Scrubbing = find(DIMEN, "vertical_touch_offset_to_enter_fine_scrubbing")
SearchSuggestionEntry = find(LAYOUT, "search_suggestion_entry")
SettingsBooleanTimeRangeDialog = find(LAYOUT, "setting_boolean_time_range_dialog")
SuggestedAction = find(LAYOUT, "suggested_action")
ToolBarPaddingHome = find(DIMEN, "toolbar_padding_home_action_up")

View File

@ -410,9 +410,6 @@ Only available on YouTube v18.24.37+"</string>
<string name="revanced_hide_quick_actions_summary_off">Quick actions container is shown</string>
<string name="revanced_hide_quick_actions_summary_on">Quick actions container is hidden</string>
<string name="revanced_hide_quick_actions_title">Hide quick actions container</string>
<string name="revanced_hide_search_terms_summary_off">Trending searches &amp; search history are shown</string>
<string name="revanced_hide_search_terms_summary_on">Trending searches &amp; search history are hidden</string>
<string name="revanced_hide_search_terms_title">Hide search term suggestions</string>
<string name="revanced_hide_seekbar_summary_off">Video player seekbar is shown</string>
<string name="revanced_hide_seekbar_summary_on">Video player seekbar is hidden</string>
<string name="revanced_hide_seekbar_thumbnail_summary_off">Thumbnail seekbar is shown</string>

View File

@ -169,9 +169,6 @@
<!-- SETTINGS: HIDE_MIX_PLAYLISTS
<SwitchPreference android:title="@string/revanced_hide_mix_playlists_title" android:key="revanced_hide_mix_playlists" android:defaultValue="false" android:summaryOn="@string/revanced_hide_mix_playlists_summary_on" android:summaryOff="@string/revanced_hide_mix_playlists_summary_off" />SETTINGS: HIDE_MIX_PLAYLISTS -->
<!-- SETTINGS: HIDE_SEARCH_TERMS
<SwitchPreference android:title="@string/revanced_hide_search_terms_title" android:key="revanced_hide_search_terms" android:defaultValue="false" android:summaryOn="@string/revanced_hide_search_terms_summary_on" android:summaryOff="@string/revanced_hide_search_terms_summary_off" />SETTINGS: HIDE_SEARCH_TERMS -->
<!-- SETTINGS: HIDE_SNACK_BAR
<SwitchPreference android:title="@string/revanced_hide_snack_bar_title" android:key="revanced_hide_snack_bar" android:defaultValue="false" android:summaryOn="@string/revanced_hide_snack_bar_summary_on" android:summaryOff="@string/revanced_hide_snack_bar_summary_off" />SETTINGS: HIDE_SNACK_BAR -->
@ -311,7 +308,6 @@
<Preference android:title="hide-layout-components" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-load-more-button" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-mix-playlists" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-search-terms" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-snack-bar" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
<Preference android:title="hide-suggestions-shelf" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>