feat(youtube): remove hide-breaking-news-shelf patch

This commit is contained in:
inotia00
2023-06-20 17:19:15 +09:00
parent 38e7711287
commit b5fa1000c0
2 changed files with 0 additions and 80 deletions

View File

@ -1,16 +0,0 @@
package app.revanced.patches.youtube.general.breakingnews.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.HorizontalCardList
import app.revanced.util.bytecode.isWideLiteralExists
import org.jf.dexlib2.Opcode
object BreakingNewsFingerprint : MethodFingerprint(
opcodes = listOf(
Opcode.CONST,
Opcode.CONST_4,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT
),
customFingerprint = { it, _ -> it.isWideLiteralExists(HorizontalCardList) }
)

View File

@ -1,64 +0,0 @@
package app.revanced.patches.youtube.general.breakingnews.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.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.shared.annotation.YouTubeCompatibility
import app.revanced.patches.youtube.general.breakingnews.fingerprints.BreakingNewsFingerprint
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.integrations.Constants.GENERAL
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@Name("hide-breaking-news-shelf")
@Description("Hides the breaking news shelf on the homepage tab.")
@DependsOn(
[
SettingsPatch::class,
SharedResourceIdPatch::class,
]
)
@YouTubeCompatibility
@Version("0.0.1")
class BreakingNewsPatch : BytecodePatch(
listOf(
BreakingNewsFingerprint,
)
) {
override fun execute(context: BytecodeContext): PatchResult {
BreakingNewsFingerprint.result?.let {
it.mutableMethod.apply {
val targetIndex = it.scanResult.patternScanResult!!.endIndex
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstruction(
targetIndex + 1,
"invoke-static {v$targetRegister}, $GENERAL->hideBreakingNewsShelf(Landroid/view/View;)V"
)
}
}?: return BreakingNewsFingerprint.toErrorResult()
/**
* Add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE: GENERAL_SETTINGS",
"SETTINGS: HIDE_BREAKING_NEWS_SHELF"
)
)
SettingsPatch.updatePatchStatus("hide-breaking-news-shelf")
return PatchResultSuccess()
}
}