mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
feat(youtube): cleanup
This commit is contained in:
@ -38,6 +38,7 @@ class MusicAdsPatch : AbstractAdsPatch(
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_ADS_PATH/AdsFilter;"
|
||||
|
@ -39,6 +39,7 @@ class HideButtonShelfPatch : BytecodePatch() {
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_ADS_PATH/ButtonShelfFilter;"
|
||||
|
@ -39,6 +39,7 @@ class HideCarouselShelfPatch : BytecodePatch() {
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_ADS_PATH/CarouselShelfFilter;"
|
||||
|
@ -39,6 +39,7 @@ class HidePlaylistCardPatch : BytecodePatch() {
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private const val FILTER_CLASS_DESCRIPTOR =
|
||||
"$MUSIC_ADS_PATH/PlaylistCardFilter;"
|
||||
|
@ -36,7 +36,8 @@ class FeedFlyoutPanelPatch : BytecodePatch(
|
||||
val targetIndex = it.scanResult.patternScanResult!!.endIndex
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
val targetParameter = getInstruction<ReferenceInstruction>(targetIndex - 1).reference
|
||||
val targetParameter =
|
||||
getInstruction<ReferenceInstruction>(targetIndex - 1).reference
|
||||
if (!targetParameter.toString().endsWith("Ljava/lang/CharSequence;"))
|
||||
return PatchResultError("Method signature parameter did not match: $targetParameter")
|
||||
|
||||
|
@ -15,13 +15,13 @@ import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.youtube.general.trendingsearches.fingerprints.SearchBarEntryFingerprint
|
||||
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.YtOutlineArrowTimeBlack
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.YtOutlineFireBlack
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.YtOutlineSearchBlack
|
||||
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
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.YtOutlineArrowTimeBlack
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.YtOutlineFireBlack
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.YtOutlineSearchBlack
|
||||
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@ -48,7 +48,8 @@ class TrendingSearchesPatch : BytecodePatch(
|
||||
.reversed()
|
||||
.forEach { (index, value) ->
|
||||
val freeRegister = getInstruction<OneRegisterInstruction>(index).registerA
|
||||
val viewRegister = getInstruction<TwoRegisterInstruction>(index - 1).registerA
|
||||
val viewRegister =
|
||||
getInstruction<TwoRegisterInstruction>(index - 1).registerA
|
||||
|
||||
addInstructions(
|
||||
index, """
|
||||
@ -74,6 +75,7 @@ class TrendingSearchesPatch : BytecodePatch(
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
|
||||
private enum class SearchTerm(val resourceId: Long, val value: Int) {
|
||||
HISTORY(YtOutlineArrowTimeBlack, 0),
|
||||
SEARCH(YtOutlineSearchBlack, 0),
|
||||
|
@ -15,8 +15,8 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patches.youtube.general.widesearchbar.fingerprints.SetActionBarRingoFingerprint
|
||||
import app.revanced.patches.youtube.utils.fingerprints.SetToolBarPaddingFingerprint
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.fingerprints.SetToolBarPaddingFingerprint
|
||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch.Companion.contexts
|
||||
|
@ -6,7 +6,6 @@ import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
|
@ -37,17 +37,17 @@ class ShortsToolBarPatch : BytecodePatch(
|
||||
(context.toMethodWalker(it.method)
|
||||
.nextMethod(targetIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
).apply {
|
||||
val targetParameter = getInstruction<ReferenceInstruction>(0).reference
|
||||
if (!targetParameter.toString().endsWith("Landroid/support/v7/widget/Toolbar;"))
|
||||
return PatchResultError("Method signature parameter did not match: $targetParameter")
|
||||
val targetRegister = getInstruction<TwoRegisterInstruction>(0).registerA
|
||||
).apply {
|
||||
val targetParameter = getInstruction<ReferenceInstruction>(0).reference
|
||||
if (!targetParameter.toString().endsWith("Landroid/support/v7/widget/Toolbar;"))
|
||||
return PatchResultError("Method signature parameter did not match: $targetParameter")
|
||||
val targetRegister = getInstruction<TwoRegisterInstruction>(0).registerA
|
||||
|
||||
addInstruction(
|
||||
1,
|
||||
"invoke-static {v$targetRegister}, $SHORTS->hideShortsPlayerToolBar(Landroid/support/v7/widget/Toolbar;)V"
|
||||
)
|
||||
}
|
||||
addInstruction(
|
||||
1,
|
||||
"invoke-static {v$targetRegister}, $SHORTS->hideShortsPlayerToolBar(Landroid/support/v7/widget/Toolbar;)V"
|
||||
)
|
||||
}
|
||||
|
||||
} ?: return SetToolBarPaddingFingerprint.toErrorResult()
|
||||
|
||||
|
Reference in New Issue
Block a user