refactor: Extract shared patch names/descriptions (#6056)
This commit is contained in:
+4
-2
@@ -2,11 +2,13 @@ package app.revanced.patches.finanzonline.detection.root
|
|||||||
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
|
import app.revanced.patches.shared.PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION
|
||||||
|
import app.revanced.patches.shared.PATCH_NAME_REMOVE_ROOT_DETECTION
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val rootDetectionPatch = bytecodePatch(
|
val rootDetectionPatch = bytecodePatch(
|
||||||
name = "Remove root detection",
|
name = PATCH_NAME_REMOVE_ROOT_DETECTION,
|
||||||
description = "Removes the check for root permissions.",
|
description = PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION,
|
||||||
) {
|
) {
|
||||||
compatibleWith("at.gv.bmf.bmf2go")
|
compatibleWith("at.gv.bmf.bmf2go")
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -1,12 +1,14 @@
|
|||||||
package app.revanced.patches.idaustria.detection.root
|
package app.revanced.patches.idaustria.detection.root
|
||||||
|
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
|
import app.revanced.patches.shared.PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION
|
||||||
|
import app.revanced.patches.shared.PATCH_NAME_REMOVE_ROOT_DETECTION
|
||||||
import app.revanced.util.returnEarly
|
import app.revanced.util.returnEarly
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val rootDetectionPatch = bytecodePatch(
|
val rootDetectionPatch = bytecodePatch(
|
||||||
name = "Remove root detection",
|
name = PATCH_NAME_REMOVE_ROOT_DETECTION,
|
||||||
description = "Removes the check for root permissions and unlocked bootloader.",
|
description = PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION
|
||||||
) {
|
) {
|
||||||
compatibleWith("at.gv.oe.app")
|
compatibleWith("at.gv.oe.app")
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -4,6 +4,8 @@ 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.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
import app.revanced.patches.instagram.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.instagram.misc.extension.sharedExtensionPatch
|
||||||
|
import app.revanced.patches.shared.PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS
|
||||||
|
import app.revanced.patches.shared.PATCH_NAME_SANITIZE_SHARING_LINKS
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
@@ -13,8 +15,8 @@ private const val EXTENSION_CLASS_DESCRIPTOR =
|
|||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val sanitizeSharingLinksPatch = bytecodePatch(
|
val sanitizeSharingLinksPatch = bytecodePatch(
|
||||||
name = "Sanitize sharing links",
|
name = PATCH_NAME_SANITIZE_SHARING_LINKS,
|
||||||
description = "Removes the tracking query parameters from shared links.",
|
description = PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS,
|
||||||
) {
|
) {
|
||||||
compatibleWith("com.instagram.android")
|
compatibleWith("com.instagram.android")
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -1,12 +1,14 @@
|
|||||||
package app.revanced.patches.orfon.detection.root
|
package app.revanced.patches.orfon.detection.root
|
||||||
|
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
|
import app.revanced.patches.shared.PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION
|
||||||
|
import app.revanced.patches.shared.PATCH_NAME_REMOVE_ROOT_DETECTION
|
||||||
import app.revanced.util.returnEarly
|
import app.revanced.util.returnEarly
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val removeRootDetectionPatch = bytecodePatch(
|
val removeRootDetectionPatch = bytecodePatch(
|
||||||
name = "Remove root detection",
|
name = PATCH_NAME_REMOVE_ROOT_DETECTION,
|
||||||
description = "Removes the check for root permissions.",
|
description = PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION
|
||||||
) {
|
) {
|
||||||
compatibleWith("com.nousguide.android.orftvthek")
|
compatibleWith("com.nousguide.android.orftvthek")
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -2,11 +2,13 @@ package app.revanced.patches.reddit.misc.tracking.url
|
|||||||
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
|
import app.revanced.patches.shared.PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS
|
||||||
|
import app.revanced.patches.shared.PATCH_NAME_SANITIZE_SHARING_LINKS
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val sanitizeUrlQueryPatch = bytecodePatch(
|
val sanitizeUrlQueryPatch = bytecodePatch(
|
||||||
name = "Sanitize sharing links",
|
name = PATCH_NAME_SANITIZE_SHARING_LINKS,
|
||||||
description = "Removes the tracking query parameters from shared links.",
|
description = PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS,
|
||||||
) {
|
) {
|
||||||
compatibleWith("com.reddit.frontpage")
|
compatibleWith("com.reddit.frontpage")
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -2,11 +2,13 @@ package app.revanced.patches.serviceportalbund.detection.root
|
|||||||
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
|
import app.revanced.patches.shared.PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION
|
||||||
|
import app.revanced.patches.shared.PATCH_NAME_REMOVE_ROOT_DETECTION
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val rootDetectionPatch = bytecodePatch(
|
val rootDetectionPatch = bytecodePatch(
|
||||||
name = "Remove root detection",
|
name = PATCH_NAME_REMOVE_ROOT_DETECTION,
|
||||||
description = "Removes the check for root permissions and unlocked bootloader.",
|
description = PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION
|
||||||
) {
|
) {
|
||||||
compatibleWith("at.gv.bka.serviceportal")
|
compatibleWith("at.gv.bka.serviceportal")
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package app.revanced.patches.shared
|
||||||
|
|
||||||
|
//
|
||||||
|
// Names and descriptions used by different patches implementing the same feature.
|
||||||
|
//
|
||||||
|
|
||||||
|
internal const val PATCH_NAME_REMOVE_ROOT_DETECTION = "Remove root detection"
|
||||||
|
internal const val PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION = "Removes the check for root permissions and unlocked bootloader."
|
||||||
|
|
||||||
|
internal const val PATCH_NAME_SANITIZE_SHARING_LINKS = "Sanitize sharing links"
|
||||||
|
internal const val PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS = "Removes the tracking query parameters from shared links."
|
||||||
+7
-2
@@ -10,6 +10,8 @@ import app.revanced.patcher.patch.bytecodePatch
|
|||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patches.all.misc.resources.addResources
|
import app.revanced.patches.all.misc.resources.addResources
|
||||||
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
import app.revanced.patches.all.misc.resources.addResourcesPatch
|
||||||
|
import app.revanced.patches.shared.PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS
|
||||||
|
import app.revanced.patches.shared.PATCH_NAME_SANITIZE_SHARING_LINKS
|
||||||
import app.revanced.patches.shared.misc.settings.preference.BasePreferenceScreen
|
import app.revanced.patches.shared.misc.settings.preference.BasePreferenceScreen
|
||||||
import app.revanced.patches.shared.misc.settings.preference.PreferenceCategory
|
import app.revanced.patches.shared.misc.settings.preference.PreferenceCategory
|
||||||
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreenPreference.Sorting
|
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreenPreference.Sorting
|
||||||
@@ -20,14 +22,17 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
|||||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||||
"Lapp/revanced/extension/shared/patches/SanitizeSharingLinksPatch;"
|
"Lapp/revanced/extension/shared/patches/SanitizeSharingLinksPatch;"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Patch shared by YouTube and YT Music.
|
||||||
|
*/
|
||||||
internal fun sanitizeSharingLinksPatch(
|
internal fun sanitizeSharingLinksPatch(
|
||||||
block: BytecodePatchBuilder.() -> Unit = {},
|
block: BytecodePatchBuilder.() -> Unit = {},
|
||||||
executeBlock: BytecodePatchContext.() -> Unit = {},
|
executeBlock: BytecodePatchContext.() -> Unit = {},
|
||||||
preferenceScreen: BasePreferenceScreen.Screen,
|
preferenceScreen: BasePreferenceScreen.Screen,
|
||||||
replaceMusicLinksWithYouTube: Boolean = false
|
replaceMusicLinksWithYouTube: Boolean = false
|
||||||
) = bytecodePatch(
|
) = bytecodePatch(
|
||||||
name = "Sanitize sharing links",
|
name = PATCH_NAME_SANITIZE_SHARING_LINKS,
|
||||||
description = "Adds an option to remove the tracking query parameter from shared links.",
|
description = PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS,
|
||||||
) {
|
) {
|
||||||
block()
|
block()
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -3,6 +3,8 @@ package app.revanced.patches.spotify.misc.privacy
|
|||||||
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.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
|
import app.revanced.patches.shared.PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS
|
||||||
|
import app.revanced.patches.shared.PATCH_NAME_SANITIZE_SHARING_LINKS
|
||||||
import app.revanced.patches.spotify.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.spotify.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.util.getReference
|
import app.revanced.util.getReference
|
||||||
import app.revanced.util.indexOfFirstInstructionOrThrow
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
@@ -15,8 +17,8 @@ private const val EXTENSION_CLASS_DESCRIPTOR =
|
|||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val sanitizeSharingLinksPatch = bytecodePatch(
|
val sanitizeSharingLinksPatch = bytecodePatch(
|
||||||
name = "Sanitize sharing links",
|
name = PATCH_NAME_SANITIZE_SHARING_LINKS,
|
||||||
description = "Removes the tracking query parameters from shared links.",
|
description = PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS,
|
||||||
) {
|
) {
|
||||||
compatibleWith("com.spotify.music")
|
compatibleWith("com.spotify.music")
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -2,11 +2,13 @@ package app.revanced.patches.twitter.misc.links
|
|||||||
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
import app.revanced.patcher.patch.bytecodePatch
|
||||||
|
import app.revanced.patches.shared.PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS
|
||||||
|
import app.revanced.patches.shared.PATCH_NAME_SANITIZE_SHARING_LINKS
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val sanitizeSharingLinksPatch = bytecodePatch(
|
val sanitizeSharingLinksPatch = bytecodePatch(
|
||||||
name = "Sanitize sharing links",
|
name = PATCH_NAME_SANITIZE_SHARING_LINKS,
|
||||||
description = "Removes the tracking query parameters from links before they are shared.",
|
description = PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS,
|
||||||
) {
|
) {
|
||||||
compatibleWith(
|
compatibleWith(
|
||||||
"com.twitter.android"(
|
"com.twitter.android"(
|
||||||
|
|||||||
Reference in New Issue
Block a user