mirror of
https://github.com/revanced/revanced-patches
synced 2024-08-24 16:20:36 +02:00
feat(reddit): add disable-screenshot-popup
patch (#2387)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
1b66069c02
commit
473e051231
@ -4,5 +4,5 @@
|
|||||||
<component name="FrameworkDetectionExcludesConfiguration">
|
<component name="FrameworkDetectionExcludesConfiguration">
|
||||||
<file type="web" url="file://$PROJECT_DIR$" />
|
<file type="web" url="file://$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="azul-17" project-jdk-type="JavaSDK" />
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="azul-17" project-jdk-type="JavaSDK" />
|
||||||
</project>
|
</project>
|
@ -0,0 +1,8 @@
|
|||||||
|
package app.revanced.patches.reddit.layout.disablescreenshotpopup.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility([Package("com.reddit.frontpage")])
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
internal annotation class DisableScreenshotPopupCompatibility
|
@ -0,0 +1,14 @@
|
|||||||
|
package app.revanced.patches.reddit.layout.disablescreenshotpopup.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
|
||||||
|
object DisableScreenshotPopupFingerprint : MethodFingerprint(
|
||||||
|
"V",
|
||||||
|
parameters = listOf("Landroidx/compose/runtime/", "I"),
|
||||||
|
customFingerprint = custom@{ methodDef, classDef ->
|
||||||
|
if (!classDef.type.endsWith("\$ScreenshotTakenBannerKt\$lambda-1\$1;"))
|
||||||
|
return@custom false
|
||||||
|
|
||||||
|
methodDef.name == "invoke"
|
||||||
|
}
|
||||||
|
)
|
@ -0,0 +1,30 @@
|
|||||||
|
package app.revanced.patches.reddit.layout.disablescreenshotpopup.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.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.reddit.layout.disablescreenshotpopup.annotations.DisableScreenshotPopupCompatibility
|
||||||
|
import app.revanced.patches.reddit.layout.disablescreenshotpopup.fingerprints.DisableScreenshotPopupFingerprint
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("disable-screenshot-popup")
|
||||||
|
@Description("Disables the popup that shows up when taking a screenshot.")
|
||||||
|
@DisableScreenshotPopupCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class DisableScreenshotPopupPatch : BytecodePatch(
|
||||||
|
listOf(DisableScreenshotPopupFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
DisableScreenshotPopupFingerprint.result?.mutableMethod?.addInstruction(0, "return-void")
|
||||||
|
?: return DisableScreenshotPopupFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user