mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 13:17:46 +02:00
feat(YouTube - Hide ads): Add Hide end screen store banner
setting (#131)
* add patch option to clean related video overlay * feat(YouTube - Hide ads): Add `Hide end screen store banner` setting * feat: Revert edit xml * chore: Lint code --------- Co-authored-by: inotia00 <108592928+inotia00@users.noreply.github.com>
This commit is contained in:
@ -28,6 +28,7 @@ import app.revanced.util.fingerprint.matchOrThrow
|
||||
import app.revanced.util.fingerprint.methodOrThrow
|
||||
import app.revanced.util.injectHideViewCall
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction31i
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
@ -132,6 +133,24 @@ val adsPatch = bytecodePatch(
|
||||
|
||||
// endregion
|
||||
|
||||
// region patch for hide end screen store banner
|
||||
|
||||
fullScreenEngagementAdContainerFingerprint.methodOrThrow().apply {
|
||||
val addListIndex = indexOfAddListInstruction(this)
|
||||
val addListInstruction =
|
||||
getInstruction<FiveRegisterInstruction>(addListIndex)
|
||||
val listRegister = addListInstruction.registerC
|
||||
val objectRegister = addListInstruction.registerD
|
||||
|
||||
replaceInstruction(
|
||||
addListIndex,
|
||||
"invoke-static { v$listRegister, v$objectRegister }, " +
|
||||
"$ADS_CLASS_DESCRIPTOR->hideEndScreenStoreBanner(Ljava/util/List;Ljava/lang/Object;)V"
|
||||
)
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
findMethodOrThrow("$PATCHES_PATH/PatchStatus;") {
|
||||
name == "HideFullscreenAdsDefaultBoolean"
|
||||
}.replaceInstruction(
|
||||
|
@ -1,11 +1,16 @@
|
||||
package app.revanced.patches.youtube.ads.general
|
||||
|
||||
import app.revanced.patches.youtube.utils.resourceid.fullScreenEngagementAdContainer
|
||||
import app.revanced.patches.youtube.utils.resourceid.interstitialsContainer
|
||||
import app.revanced.patches.youtube.utils.resourceid.slidingDialogAnimation
|
||||
import app.revanced.util.fingerprint.legacyFingerprint
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.indexOfFirstInstructionReversed
|
||||
import app.revanced.util.or
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.Method
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
internal val compactYpcOfferModuleViewFingerprint = legacyFingerprint(
|
||||
name = "compactYpcOfferModuleViewFingerprint",
|
||||
@ -24,6 +29,23 @@ internal val compactYpcOfferModuleViewFingerprint = legacyFingerprint(
|
||||
}
|
||||
)
|
||||
|
||||
internal val fullScreenEngagementAdContainerFingerprint = legacyFingerprint(
|
||||
name = "fullScreenEngagementAdContainerFingerprint",
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = emptyList(),
|
||||
literals = listOf(fullScreenEngagementAdContainer),
|
||||
customFingerprint = { method, _ ->
|
||||
indexOfAddListInstruction(method) >= 0
|
||||
}
|
||||
)
|
||||
|
||||
internal fun indexOfAddListInstruction(method: Method) =
|
||||
method.indexOfFirstInstructionReversed {
|
||||
opcode == Opcode.INVOKE_VIRTUAL &&
|
||||
getReference<MethodReference>()?.name == "add"
|
||||
}
|
||||
|
||||
internal val interstitialsContainerFingerprint = legacyFingerprint(
|
||||
name = "interstitialsContainerFingerprint",
|
||||
returnType = "V",
|
||||
|
@ -105,6 +105,8 @@ var floatyBarTopMargin = -1L
|
||||
private set
|
||||
var fullScreenButton = -1L
|
||||
private set
|
||||
var fullScreenEngagementAdContainer = -1L
|
||||
private set
|
||||
var fullScreenEngagementOverlay = -1L
|
||||
private set
|
||||
var fullScreenEngagementPanel = -1L
|
||||
@ -432,6 +434,10 @@ internal val sharedResourceIdPatch = resourcePatch(
|
||||
ID,
|
||||
"fullscreen_button"
|
||||
]
|
||||
fullScreenEngagementAdContainer = resourceMappings[
|
||||
ID,
|
||||
"fullscreen_engagement_ad_container"
|
||||
]
|
||||
fullScreenEngagementOverlay = resourceMappings[
|
||||
LAYOUT,
|
||||
"fullscreen_engagement_overlay"
|
||||
|
Reference in New Issue
Block a user