mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-04-29 22:24:31 +02:00
fix(Reddit - Disable screenshot popup): No exception is thrown if no matching pattern is found
This commit is contained in:
parent
2b52380294
commit
7168e49121
@ -2,6 +2,7 @@ package app.revanced.patches.reddit.layout.screenshotpopup
|
|||||||
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.patch.PatchException
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.reddit.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
import app.revanced.patches.reddit.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
||||||
import app.revanced.patches.reddit.utils.extension.Constants.PATCHES_PATH
|
import app.revanced.patches.reddit.utils.extension.Constants.PATCHES_PATH
|
||||||
@ -57,6 +58,8 @@ val screenshotPopupPatch = bytecodePatch(
|
|||||||
indexOfSetValueInstruction(this) >= 0
|
indexOfSetValueInstruction(this) >= 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hookCount = 0
|
||||||
|
|
||||||
classes.forEach { classDef ->
|
classes.forEach { classDef ->
|
||||||
classDef.methods.forEach { method ->
|
classDef.methods.forEach { method ->
|
||||||
if (method.isScreenShotMethod()) {
|
if (method.isScreenShotMethod()) {
|
||||||
@ -75,11 +78,16 @@ val screenshotPopupPatch = bytecodePatch(
|
|||||||
move-result-object v$booleanRegister
|
move-result-object v$booleanRegister
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
hookCount++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hookCount == 0) {
|
||||||
|
throw PatchException("Failed to find hook method")
|
||||||
|
}
|
||||||
|
|
||||||
updatePatchStatus(
|
updatePatchStatus(
|
||||||
"enableScreenshotPopup",
|
"enableScreenshotPopup",
|
||||||
DISABLE_SCREENSHOT_POPUP
|
DISABLE_SCREENSHOT_POPUP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user