diff --git a/patches/src/main/kotlin/app/revanced/patches/finanzonline/detection/root/RootDetectionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/finanzonline/detection/root/RootDetectionPatch.kt index e2b7b0616..c5ce1efe1 100644 --- a/patches/src/main/kotlin/app/revanced/patches/finanzonline/detection/root/RootDetectionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/finanzonline/detection/root/RootDetectionPatch.kt @@ -2,11 +2,13 @@ package app.revanced.patches.finanzonline.detection.root import app.revanced.patcher.extensions.InstructionExtensions.addInstructions 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") val rootDetectionPatch = bytecodePatch( - name = "Remove root detection", - description = "Removes the check for root permissions.", + name = PATCH_NAME_REMOVE_ROOT_DETECTION, + description = PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION, ) { compatibleWith("at.gv.bmf.bmf2go") diff --git a/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/root/RootDetectionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/root/RootDetectionPatch.kt index 6c79650d9..07874bac7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/root/RootDetectionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/root/RootDetectionPatch.kt @@ -1,12 +1,14 @@ package app.revanced.patches.idaustria.detection.root 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 @Suppress("unused") val rootDetectionPatch = bytecodePatch( - name = "Remove root detection", - description = "Removes the check for root permissions and unlocked bootloader.", + name = PATCH_NAME_REMOVE_ROOT_DETECTION, + description = PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION ) { compatibleWith("at.gv.oe.app") diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/misc/privacy/SanitizeSharingLinksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/privacy/SanitizeSharingLinksPatch.kt index c7b4d0f40..54d7e9c03 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/misc/privacy/SanitizeSharingLinksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/privacy/SanitizeSharingLinksPatch.kt @@ -4,6 +4,8 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.bytecodePatch 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 com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction @@ -13,8 +15,8 @@ private const val EXTENSION_CLASS_DESCRIPTOR = @Suppress("unused") val sanitizeSharingLinksPatch = bytecodePatch( - name = "Sanitize sharing links", - description = "Removes the tracking query parameters from shared links.", + name = PATCH_NAME_SANITIZE_SHARING_LINKS, + description = PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS, ) { compatibleWith("com.instagram.android") diff --git a/patches/src/main/kotlin/app/revanced/patches/orfon/detection/root/RemoveRootDetectionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/orfon/detection/root/RemoveRootDetectionPatch.kt index 594083337..8669f6132 100644 --- a/patches/src/main/kotlin/app/revanced/patches/orfon/detection/root/RemoveRootDetectionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/orfon/detection/root/RemoveRootDetectionPatch.kt @@ -1,12 +1,14 @@ package app.revanced.patches.orfon.detection.root 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 @Suppress("unused") val removeRootDetectionPatch = bytecodePatch( - name = "Remove root detection", - description = "Removes the check for root permissions.", + name = PATCH_NAME_REMOVE_ROOT_DETECTION, + description = PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION ) { compatibleWith("com.nousguide.android.orftvthek") diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/misc/tracking/url/SanitizeUrlQueryPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/misc/tracking/url/SanitizeUrlQueryPatch.kt index cfdb320e1..11bc79212 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/misc/tracking/url/SanitizeUrlQueryPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/misc/tracking/url/SanitizeUrlQueryPatch.kt @@ -2,11 +2,13 @@ package app.revanced.patches.reddit.misc.tracking.url import app.revanced.patcher.extensions.InstructionExtensions.addInstructions 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") val sanitizeUrlQueryPatch = bytecodePatch( - name = "Sanitize sharing links", - description = "Removes the tracking query parameters from shared links.", + name = PATCH_NAME_SANITIZE_SHARING_LINKS, + description = PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS, ) { compatibleWith("com.reddit.frontpage") diff --git a/patches/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/RootDetectionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/RootDetectionPatch.kt index 43ebaa19f..0c9fd9040 100644 --- a/patches/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/RootDetectionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/serviceportalbund/detection/root/RootDetectionPatch.kt @@ -2,11 +2,13 @@ package app.revanced.patches.serviceportalbund.detection.root import app.revanced.patcher.extensions.InstructionExtensions.addInstruction 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") val rootDetectionPatch = bytecodePatch( - name = "Remove root detection", - description = "Removes the check for root permissions and unlocked bootloader.", + name = PATCH_NAME_REMOVE_ROOT_DETECTION, + description = PATCH_DESCRIPTION_REMOVE_ROOT_DETECTION ) { compatibleWith("at.gv.bka.serviceportal") diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/SharedPatchNames.kt b/patches/src/main/kotlin/app/revanced/patches/shared/SharedPatchNames.kt new file mode 100644 index 000000000..34b91a59c --- /dev/null +++ b/patches/src/main/kotlin/app/revanced/patches/shared/SharedPatchNames.kt @@ -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." diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/privacy/SanitizeSharingLinksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/privacy/SanitizeSharingLinksPatch.kt index 7a52c3d81..2fe4d7e81 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/privacy/SanitizeSharingLinksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/privacy/SanitizeSharingLinksPatch.kt @@ -10,6 +10,8 @@ import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.all.misc.resources.addResources 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.PreferenceCategory 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 = "Lapp/revanced/extension/shared/patches/SanitizeSharingLinksPatch;" +/** + * Patch shared by YouTube and YT Music. + */ internal fun sanitizeSharingLinksPatch( block: BytecodePatchBuilder.() -> Unit = {}, executeBlock: BytecodePatchContext.() -> Unit = {}, preferenceScreen: BasePreferenceScreen.Screen, replaceMusicLinksWithYouTube: Boolean = false ) = bytecodePatch( - name = "Sanitize sharing links", - description = "Adds an option to remove the tracking query parameter from shared links.", + name = PATCH_NAME_SANITIZE_SHARING_LINKS, + description = PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS, ) { block() diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/privacy/SanitizeSharingLinksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/privacy/SanitizeSharingLinksPatch.kt index 0954d4ed5..4e4ad474c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/privacy/SanitizeSharingLinksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/privacy/SanitizeSharingLinksPatch.kt @@ -3,6 +3,8 @@ package app.revanced.patches.spotify.misc.privacy import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstruction 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.util.getReference import app.revanced.util.indexOfFirstInstructionOrThrow @@ -15,8 +17,8 @@ private const val EXTENSION_CLASS_DESCRIPTOR = @Suppress("unused") val sanitizeSharingLinksPatch = bytecodePatch( - name = "Sanitize sharing links", - description = "Removes the tracking query parameters from shared links.", + name = PATCH_NAME_SANITIZE_SHARING_LINKS, + description = PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS, ) { compatibleWith("com.spotify.music") diff --git a/patches/src/main/kotlin/app/revanced/patches/twitter/misc/links/SanitizeSharingLinksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitter/misc/links/SanitizeSharingLinksPatch.kt index 24b4e127b..7856bfe96 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitter/misc/links/SanitizeSharingLinksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitter/misc/links/SanitizeSharingLinksPatch.kt @@ -2,11 +2,13 @@ package app.revanced.patches.twitter.misc.links import app.revanced.patcher.extensions.InstructionExtensions.addInstructions 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") val sanitizeSharingLinksPatch = bytecodePatch( - name = "Sanitize sharing links", - description = "Removes the tracking query parameters from links before they are shared.", + name = PATCH_NAME_SANITIZE_SHARING_LINKS, + description = PATCH_DESCRIPTION_SANITIZE_SHARING_LINKS, ) { compatibleWith( "com.twitter.android"(