diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/activity/exportall/ExportAllActivitiesPatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/activity/exportall/ExportAllActivitiesPatch.kt index 30193b704..8336cebdb 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/activity/exportall/ExportAllActivitiesPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/activity/exportall/ExportAllActivitiesPatch.kt @@ -8,7 +8,7 @@ val exportAllActivitiesPatch = resourcePatch( description = "Makes all app activities exportable.", use = false, ) { - execute { + apply { val exportedFlag = "android:exported" document("AndroidManifest.xml").use { document -> diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/appicon/HideAppIconPatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/appicon/HideAppIconPatch.kt index a0411d89f..f81347c7c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/appicon/HideAppIconPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/appicon/HideAppIconPatch.kt @@ -12,7 +12,7 @@ val hideAppIconPatch = resourcePatch( description = "Hides the app icon from the Android launcher.", use = false, ) { - execute { + apply { document("AndroidManifest.xml").use { document -> var changed = false diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/customcertificates/CustomCertificatesPatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/customcertificates/CustomCertificatesPatch.kt index 009758977..d32bef08a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/customcertificates/CustomCertificatesPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/customcertificates/CustomCertificatesPatch.kt @@ -132,7 +132,7 @@ ${trustAnchorsXML.trimEnd()} } - execute { + apply { val nscFileNameBare = "network_security_config" val resXmlDir = "res/xml" val resRawDir = "res/raw" diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/debugging/EnableAndroidDebuggingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/debugging/EnableAndroidDebuggingPatch.kt index fc7e33c5d..5287e29ac 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/debugging/EnableAndroidDebuggingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/debugging/EnableAndroidDebuggingPatch.kt @@ -8,7 +8,7 @@ val enableAndroidDebuggingPatch = resourcePatch( description = "Enables Android debugging capabilities. This can slow down the app.", use = false, ) { - execute { + apply { document("AndroidManifest.xml").use { document -> val applicationNode = document diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/directory/documentsprovider/ExportInternalDataDocumentsProviderPatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/directory/documentsprovider/ExportInternalDataDocumentsProviderPatch.kt index 187fd2381..68b98adfe 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/directory/documentsprovider/ExportInternalDataDocumentsProviderPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/directory/documentsprovider/ExportInternalDataDocumentsProviderPatch.kt @@ -18,7 +18,7 @@ val exportInternalDataDocumentsProviderPatch = resourcePatch( }, ) - execute { + apply { val documentsProviderClass = "app.revanced.extension.all.misc.directory.documentsprovider.InternalDataDocumentsProvider" diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/interaction/gestures/PredictiveBackGesturePatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/interaction/gestures/PredictiveBackGesturePatch.kt index 29f644435..ad96c61d8 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/interaction/gestures/PredictiveBackGesturePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/interaction/gestures/PredictiveBackGesturePatch.kt @@ -8,7 +8,7 @@ val predictiveBackGesturePatch = resourcePatch( description = "Enables the predictive back gesture introduced on Android 13.", use = false, ) { - execute { + apply { val flag = "android:enableOnBackInvokedCallback" document("AndroidManifest.xml").use { document -> diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/network/OverrideCertificatePinningPatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/network/OverrideCertificatePinningPatch.kt index c85f4c3ba..02594f120 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/network/OverrideCertificatePinningPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/network/OverrideCertificatePinningPatch.kt @@ -14,7 +14,7 @@ val overrideCertificatePinningPatch = resourcePatch( ) { dependsOn(enableAndroidDebuggingPatch) - execute { + apply { val resXmlDirectory = get("res/xml") // Add android:networkSecurityConfig="@xml/network_security_config" and the "networkSecurityConfig" attribute if it does not exist. diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/packagename/ChangePackageNamePatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/packagename/ChangePackageNamePatch.kt index 4a6443a8c..572291caf 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/packagename/ChangePackageNamePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/packagename/ChangePackageNamePatch.kt @@ -59,7 +59,7 @@ val changePackageNamePatch = resourcePatch( "Enabling this can fix installation errors, but this can also break features in certain apps.", ) - finalize { + afterDependents { /** * Apps that are confirmed to not work correctly with this patch. * This is not an exhaustive list, and is only the apps with @@ -80,7 +80,7 @@ val changePackageNamePatch = resourcePatch( val packageName = manifest.getAttribute("package") if (incompatibleAppPackages.contains(packageName)) { - return@finalize Logger.getLogger(this::class.java.name).severe( + return@afterDependents Logger.getLogger(this::class.java.name).severe( "'$packageName' does not work correctly with \"Change package name\"", ) } diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/resources/AddResourcesPatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/resources/AddResourcesPatch.kt index f32986ea6..cc94674e8 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/resources/AddResourcesPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/resources/AddResourcesPatch.kt @@ -215,8 +215,8 @@ fun addResources( * @see addResourcesPatch */ fun addResources( - patch: Patch<*>, - parseIds: (Patch<*>) -> Map> = { + patch: Patch, + parseIds: (Patch) -> Map> = { val patchId = patch.name ?: throw PatchException("Patch has no name") val packages = patch.compatiblePackages ?: throw PatchException("Patch has no compatible packages") @@ -273,9 +273,9 @@ val addResourcesPatch = resourcePatch( from the temporary map to addResourcesPatch. After all patches that depend on addResourcesPatch have been executed, - addResourcesPatch#finalize is finally called to add all staged resources to the app. + addResourcesPatch#afterDependents is finally called to add all staged resources to the app. */ - execute { + apply { stagedResources = buildMap { /** * Puts resources under `/resources/addresources//.xml` into the map. @@ -324,7 +324,7 @@ val addResourcesPatch = resourcePatch( // Stage all resources to a temporary map. // Staged resources consumed by addResourcesPatch#invoke(Patch) - // are later used in addResourcesPatch#finalize. + // are later used in addResourcesPatch#afterDependents. try { val addStringResources = { source: Value, dest: Value -> addResources(source, dest, "strings", StringResource::fromNode) @@ -343,7 +343,7 @@ val addResourcesPatch = resourcePatch( * Adds all resources staged in [addResourcesPatch] to the app. * This is called after all patches that depend on [addResourcesPatch] have been executed. */ - finalize { + afterDependents { operator fun MutableMap>.invoke( value: Value, resource: BaseResource, @@ -359,7 +359,7 @@ val addResourcesPatch = resourcePatch( } getOrPut(resourceFileName) { - this@finalize["res/$value/$resourceFileName.xml"].also { + this@afterDependents["res/$value/$resourceFileName.xml"].also { it.parentFile?.mkdirs() if (it.createNewFile()) { diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/screencapture/RemoveScreenCaptureRestrictionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/screencapture/RemoveScreenCaptureRestrictionPatch.kt index f11d27f53..0b0edcb69 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/screencapture/RemoveScreenCaptureRestrictionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/screencapture/RemoveScreenCaptureRestrictionPatch.kt @@ -10,7 +10,7 @@ import org.w3c.dom.Element private val removeCaptureRestrictionResourcePatch = resourcePatch( description = "Sets allowAudioPlaybackCapture in manifest to true.", ) { - execute { + apply { document("AndroidManifest.xml").use { document -> // Get the application node. val applicationNode = diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/shortcut/sharetargets/RemoveShareTargetsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/shortcut/sharetargets/RemoveShareTargetsPatch.kt index 817a29197..7d7a8781e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/shortcut/sharetargets/RemoveShareTargetsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/shortcut/sharetargets/RemoveShareTargetsPatch.kt @@ -13,7 +13,7 @@ val removeShareTargetsPatch = resourcePatch( description = "Removes share targets like directly sharing to a frequent contact.", use = false, ) { - execute { + apply { try { document("res/xml/shortcuts.xml") } catch (_: FileNotFoundException) { diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/spoof/EnableRomSignatureSpoofing.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/spoof/EnableRomSignatureSpoofing.kt index ea9136312..837566ade 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/spoof/EnableRomSignatureSpoofing.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/spoof/EnableRomSignatureSpoofing.kt @@ -32,7 +32,7 @@ val enableRomSignatureSpoofing = resourcePatch( description = "The hex-encoded signature or path to an APK file with the desired signature.", required = true, ) - execute { + apply { document("AndroidManifest.xml").use { document -> val permission = document.createElement("uses-permission").apply { setAttribute("android:name", "android.permission.FAKE_PACKAGE_SIGNATURE") diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/targetSdk/SetTargetSdkVersion34.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/targetSdk/SetTargetSdkVersion34.kt index c79654d1f..820e98d64 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/targetSdk/SetTargetSdkVersion34.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/targetSdk/SetTargetSdkVersion34.kt @@ -12,7 +12,7 @@ val setTargetSdkVersion34 = resourcePatch( "For devices running Android 15+, this will disable edge-to-edge display.", use = false, ) { - execute { + apply { val targetSdkOverride = 34 // Android 14. document("AndroidManifest.xml").use { document -> diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/transformation/TransformInstructionsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/transformation/TransformInstructionsPatch.kt index 3a82bc7a9..d17386935 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/transformation/TransformInstructionsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/transformation/TransformInstructionsPatch.kt @@ -11,7 +11,7 @@ fun transformInstructionsPatch( filterMap: (ClassDef, Method, Instruction, Int) -> T?, transform: (MutableMethod, T) -> Unit, ) = bytecodePatch { - execute { + apply { forEachInstructionAsSequence { classDef, method, i, instruction -> transform(method, filterMap(classDef, method, instruction, i) ?: return@forEachInstructionAsSequence) } diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/versioncode/ChangeVersionCodePatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/versioncode/ChangeVersionCodePatch.kt index a50fe58da..e3c7375d8 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/versioncode/ChangeVersionCodePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/versioncode/ChangeVersionCodePatch.kt @@ -25,7 +25,7 @@ val changeVersionCodePatch = resourcePatch( required = true, ) { versionCode -> versionCode!! >= 1 } - execute { + apply { document("AndroidManifest.xml").use { document -> val manifestElement = document.getNode("manifest") as Element manifestElement.setAttribute("android:versionCode", "$versionCode") diff --git a/patches/src/main/kotlin/app/revanced/patches/amazon/DeepLinkingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/amazon/DeepLinkingPatch.kt index 2d58b1ccf..7dff3513c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/amazon/DeepLinkingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/amazon/DeepLinkingPatch.kt @@ -10,7 +10,7 @@ val deepLinkingPatch = bytecodePatch( ) { compatibleWith("com.amazon.mShop.android.shopping") - execute { + apply { deepLinkingFingerprint.method.addInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/angulus/ads/RemoveAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/angulus/ads/RemoveAdsPatch.kt index c1f3acb8e..c8c726de3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/angulus/ads/RemoveAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/angulus/ads/RemoveAdsPatch.kt @@ -10,7 +10,7 @@ val angulusPatch = bytecodePatch(name = "Hide ads") { dependsOn(disableLicenseCheckPatch) - execute { + apply { // Always return 0 as the daily measurement count. getDailyMeasurementCountFingerprint.method.returnEarly(0) } diff --git a/patches/src/main/kotlin/app/revanced/patches/bandcamp/limitations/RemovePlayLimitsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/bandcamp/limitations/RemovePlayLimitsPatch.kt index f0740d04c..a9326cc94 100644 --- a/patches/src/main/kotlin/app/revanced/patches/bandcamp/limitations/RemovePlayLimitsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/bandcamp/limitations/RemovePlayLimitsPatch.kt @@ -10,7 +10,7 @@ val removePlayLimitsPatch = bytecodePatch( ) { compatibleWith("com.bandcamp.android") - execute { + apply { handlePlaybackLimitsFingerprint.method.returnEarly() } } diff --git a/patches/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/BypassRootChecksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/BypassRootChecksPatch.kt index c3b4ac21d..c559aa1e7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/BypassRootChecksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/cieid/restrictions/root/BypassRootChecksPatch.kt @@ -10,7 +10,7 @@ val bypassRootChecksPatch = bytecodePatch( ) { compatibleWith("it.ipzs.cieid") - execute { + apply { checkRootFingerprint.method.addInstruction(1, "return-void") } } diff --git a/patches/src/main/kotlin/app/revanced/patches/com/sbs/ondemand/tv/RemoveAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/com/sbs/ondemand/tv/RemoveAdsPatch.kt index 1b628562a..34bda85aa 100644 --- a/patches/src/main/kotlin/app/revanced/patches/com/sbs/ondemand/tv/RemoveAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/com/sbs/ondemand/tv/RemoveAdsPatch.kt @@ -14,7 +14,7 @@ val removeAdsPatch = bytecodePatch( dependsOn(disableLicenseCheckPatch) - execute { + apply { shouldShowAdvertisingTVFingerprint.method.returnEarly(true) shouldShowPauseAdFingerprint.method.returnEarly(false) diff --git a/patches/src/main/kotlin/app/revanced/patches/cricbuzz/ads/DisableAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/cricbuzz/ads/DisableAdsPatch.kt index dba0af7e1..b99aca907 100644 --- a/patches/src/main/kotlin/app/revanced/patches/cricbuzz/ads/DisableAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/cricbuzz/ads/DisableAdsPatch.kt @@ -22,7 +22,7 @@ val disableAdsPatch = bytecodePatch ( dependsOn(sharedExtensionPatch) - execute { + apply { userStateSwitchFingerprint.method.returnEarly(true) // Remove region-specific Cricbuzz11 elements. diff --git a/patches/src/main/kotlin/app/revanced/patches/crunchyroll/ads/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/crunchyroll/ads/HideAdsPatch.kt index 50773f29f..39c331aff 100644 --- a/patches/src/main/kotlin/app/revanced/patches/crunchyroll/ads/HideAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/crunchyroll/ads/HideAdsPatch.kt @@ -18,7 +18,7 @@ val hideAdsPatch = bytecodePatch( ) { compatibleWith("com.crunchyroll.crunchyroid") - execute { + apply { // Get obfuscated "enableAds" field from toString method. val enableAdsField = videoUrlReadyToStringFingerprint.let { val strIndex = videoUrlReadyToStringFingerprint.stringMatches.last().index diff --git a/patches/src/main/kotlin/app/revanced/patches/disneyplus/SkipAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/disneyplus/SkipAdsPatch.kt index e93cafc0d..8b01aa411 100644 --- a/patches/src/main/kotlin/app/revanced/patches/disneyplus/SkipAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/disneyplus/SkipAdsPatch.kt @@ -14,7 +14,7 @@ val skipAdsPatch = bytecodePatch( "in.startv.hotstaronly", ) - execute { + apply { arrayOf(insertionGetPointsFingerprint, insertionGetRangesFingerprint).forEach { it.method.addInstructions( 0, diff --git a/patches/src/main/kotlin/app/revanced/patches/duolingo/ad/DisableAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/duolingo/ad/DisableAdsPatch.kt index 92733cf03..ad068e96e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/duolingo/ad/DisableAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/duolingo/ad/DisableAdsPatch.kt @@ -12,7 +12,7 @@ val disableAdsPatch = bytecodePatch( // 6.55.3 and higher can show ads after each exercise. compatibleWith("com.duolingo"("6.54.5")) - execute { + apply { // Couple approaches to remove ads exist: // // MonetizationDebugSettings has a boolean value for "disableAds". diff --git a/patches/src/main/kotlin/app/revanced/patches/duolingo/debug/EnableDebugMenuPatch.kt b/patches/src/main/kotlin/app/revanced/patches/duolingo/debug/EnableDebugMenuPatch.kt index 4c9edc744..3d527834f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/duolingo/debug/EnableDebugMenuPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/duolingo/debug/EnableDebugMenuPatch.kt @@ -13,7 +13,7 @@ val enableDebugMenuPatch = bytecodePatch( ) { compatibleWith("com.duolingo") - execute { + apply { // It seems all categories are allowed on release. Force this on anyway. debugCategoryAllowOnReleaseBuildsFingerprint.method.returnEarly(true) diff --git a/patches/src/main/kotlin/app/revanced/patches/duolingo/energy/SkipEnergyRechargeAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/duolingo/energy/SkipEnergyRechargeAdsPatch.kt index 397350454..9a99747c5 100644 --- a/patches/src/main/kotlin/app/revanced/patches/duolingo/energy/SkipEnergyRechargeAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/duolingo/energy/SkipEnergyRechargeAdsPatch.kt @@ -11,7 +11,7 @@ val skipEnergyRechargeAdsPatch = bytecodePatch( ) { compatibleWith("com.duolingo") - execute { + apply { initializeEnergyConfigFingerprint .match(energyConfigToStringFingerprint.classDef) .method.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/facebook/ads/mainfeed/HideSponsoredStoriesPatch.kt b/patches/src/main/kotlin/app/revanced/patches/facebook/ads/mainfeed/HideSponsoredStoriesPatch.kt index 12593cc24..9b9e6ad1d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/facebook/ads/mainfeed/HideSponsoredStoriesPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/facebook/ads/mainfeed/HideSponsoredStoriesPatch.kt @@ -16,7 +16,7 @@ val hideSponsoredStoriesPatch = bytecodePatch( ) { compatibleWith("com.facebook.katana"("490.0.0.63.82")) - execute { + apply { val sponsoredDataModelTemplateMethod = getSponsoredDataModelTemplateFingerprint.originalMethod val baseModelMapperMethod = baseModelMapperFingerprint.originalMethod val baseModelWithTreeType = baseModelMapperMethod.returnType diff --git a/patches/src/main/kotlin/app/revanced/patches/facebook/ads/story/HideStoryAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/facebook/ads/story/HideStoryAdsPatch.kt index c5a679db6..7f03abcff 100644 --- a/patches/src/main/kotlin/app/revanced/patches/facebook/ads/story/HideStoryAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/facebook/ads/story/HideStoryAdsPatch.kt @@ -10,7 +10,7 @@ val hideStoryAdsPatch = bytecodePatch( ) { compatibleWith("com.facebook.katana") - execute { + apply { setOf( fetchMoreAdsFingerprint, adsInsertionFingerprint, diff --git a/patches/src/main/kotlin/app/revanced/patches/finanzonline/detection/bootloader/BootloaderDetectionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/finanzonline/detection/bootloader/BootloaderDetectionPatch.kt index 3a1426088..77830cadc 100644 --- a/patches/src/main/kotlin/app/revanced/patches/finanzonline/detection/bootloader/BootloaderDetectionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/finanzonline/detection/bootloader/BootloaderDetectionPatch.kt @@ -10,7 +10,7 @@ val bootloaderDetectionPatch = bytecodePatch( ) { compatibleWith("at.gv.bmf.bmf2go") - execute { + apply { setOf(createKeyFingerprint, bootStateFingerprint).forEach { fingerprint -> fingerprint.method.addInstructions( 0, 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 daad95dbc..d5529e9a7 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 @@ -12,7 +12,7 @@ val rootDetectionPatch = bytecodePatch( ) { compatibleWith("at.gv.bmf.bmf2go") - execute { + apply { rootDetectionFingerprint.method.addInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/googlenews/customtabs/EnableCustomTabsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/googlenews/customtabs/EnableCustomTabsPatch.kt index ecaac3b32..d491cabee 100644 --- a/patches/src/main/kotlin/app/revanced/patches/googlenews/customtabs/EnableCustomTabsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/googlenews/customtabs/EnableCustomTabsPatch.kt @@ -12,7 +12,7 @@ val enableCustomTabsPatch = bytecodePatch( ) { compatibleWith("com.google.android.apps.magazines") - execute { + apply { launchCustomTabFingerprint.method.apply { val checkIndex = launchCustomTabFingerprint.instructionMatches.last().index + 1 val register = getInstruction(checkIndex).registerA diff --git a/patches/src/main/kotlin/app/revanced/patches/googlephotos/misc/backup/EnableDCIMFoldersBackupControlPatch.kt b/patches/src/main/kotlin/app/revanced/patches/googlephotos/misc/backup/EnableDCIMFoldersBackupControlPatch.kt index 35c541159..232edb2e6 100644 --- a/patches/src/main/kotlin/app/revanced/patches/googlephotos/misc/backup/EnableDCIMFoldersBackupControlPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/googlephotos/misc/backup/EnableDCIMFoldersBackupControlPatch.kt @@ -12,7 +12,7 @@ val enableDCIMFoldersBackupControlPatch = bytecodePatch( ) { compatibleWith("com.google.android.apps.photos") - execute { + apply { isDCIMFolderBackupControlDisabled.method.returnEarly(false) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/googlephotos/misc/features/SpoofFeaturesPatch.kt b/patches/src/main/kotlin/app/revanced/patches/googlephotos/misc/features/SpoofFeaturesPatch.kt index 516314944..1cc88fa16 100644 --- a/patches/src/main/kotlin/app/revanced/patches/googlephotos/misc/features/SpoofFeaturesPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/googlephotos/misc/features/SpoofFeaturesPatch.kt @@ -55,7 +55,7 @@ val spoofFeaturesPatch = bytecodePatch( required = true, ) - execute { + apply { @Suppress("NAME_SHADOWING") val featuresToEnable = featuresToEnable!!.toSet() diff --git a/patches/src/main/kotlin/app/revanced/patches/googlerecorder/restrictions/RemoveDeviceRestrictions.kt b/patches/src/main/kotlin/app/revanced/patches/googlerecorder/restrictions/RemoveDeviceRestrictions.kt index 201d90360..24f54df64 100644 --- a/patches/src/main/kotlin/app/revanced/patches/googlerecorder/restrictions/RemoveDeviceRestrictions.kt +++ b/patches/src/main/kotlin/app/revanced/patches/googlerecorder/restrictions/RemoveDeviceRestrictions.kt @@ -13,7 +13,7 @@ val removeDeviceRestrictionsPatch = bytecodePatch( ) { compatibleWith("com.google.android.apps.recorder") - execute { + apply { val featureStringIndex = onApplicationCreateFingerprint.stringMatches.first().index onApplicationCreateFingerprint.method.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/hexeditor/ad/DisableAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/hexeditor/ad/DisableAdsPatch.kt index 4fe1b54d2..075ed46cf 100644 --- a/patches/src/main/kotlin/app/revanced/patches/hexeditor/ad/DisableAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/hexeditor/ad/DisableAdsPatch.kt @@ -9,7 +9,7 @@ val disableAdsPatch = bytecodePatch( ) { compatibleWith("com.myprog.hexedit") - execute { + apply { primaryAdsFingerprint.method.replaceInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/iconpackstudio/misc/pro/UnlockProPatch.kt b/patches/src/main/kotlin/app/revanced/patches/iconpackstudio/misc/pro/UnlockProPatch.kt index af4aad566..447c6713d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/iconpackstudio/misc/pro/UnlockProPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/iconpackstudio/misc/pro/UnlockProPatch.kt @@ -9,7 +9,7 @@ val unlockProPatch = bytecodePatch( ) { compatibleWith("ginlemon.iconpackstudio"("2.2 build 016")) - execute { + apply { checkProFingerprint.method.addInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/deviceintegrity/RemoveDeviceIntegrityChecksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/deviceintegrity/RemoveDeviceIntegrityChecksPatch.kt index 3c72e69f3..92e5a646e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/deviceintegrity/RemoveDeviceIntegrityChecksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/deviceintegrity/RemoveDeviceIntegrityChecksPatch.kt @@ -12,7 +12,7 @@ val removeDeviceIntegrityChecksPatch = bytecodePatch( ) { compatibleWith("at.gv.oe.app") - execute { + apply { isDeviceRootedFingerprint.method.returnEarly(false) isDeviceBootloaderOpenFingerprint.method.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/signature/SpoofSignaturePatch.kt b/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/signature/SpoofSignaturePatch.kt index 3c4a939c1..26e02e091 100644 --- a/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/signature/SpoofSignaturePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/idaustria/detection/signature/SpoofSignaturePatch.kt @@ -10,7 +10,7 @@ val spoofSignaturePatch = bytecodePatch( ) { compatibleWith("at.gv.oe.app") - execute { + apply { val expectedSignature = "OpenSSLRSAPublicKey{modulus=ac3e6fd6050aa7e0d6010ae58190404cd89a56935b44f6fee" + "067c149768320026e10b24799a1339e414605e448e3f264444a327b9ae292be2b62ad567dd1800dbed4a88f718a33dc6db6b" + diff --git a/patches/src/main/kotlin/app/revanced/patches/inshorts/ad/InshortsAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/inshorts/ad/InshortsAdsPatch.kt index c2f8bc62f..5d3880c7c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/inshorts/ad/InshortsAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/inshorts/ad/InshortsAdsPatch.kt @@ -9,7 +9,7 @@ val hideAdsPatch = bytecodePatch( ) { compatibleWith("com.nis.app") - execute { + apply { inshortsAdsFingerprint.method.addInstruction( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/ads/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/ads/HideAdsPatch.kt index e82a54b05..6fdc9708d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/ads/HideAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/ads/HideAdsPatch.kt @@ -10,7 +10,7 @@ val hideAdsPatch = bytecodePatch( ) { compatibleWith("com.instagram.android") - execute { + apply { adInjectorFingerprint.method.returnEarly(false) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/feed/LimitFeedToFollowedProfiles.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/feed/LimitFeedToFollowedProfiles.kt index 24e9f9184..a8c7fcc1f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/feed/LimitFeedToFollowedProfiles.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/feed/LimitFeedToFollowedProfiles.kt @@ -22,7 +22,7 @@ val limitFeedToFollowedProfiles = bytecodePatch( dependsOn(sharedExtensionPatch) - execute { + apply { /** * Since the header field is obfuscated and there is no easy way to identify it among all the class fields, * an additional method is fingerprinted. diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/ghost/story/AnonymousStoryViewingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/ghost/story/AnonymousStoryViewingPatch.kt index 72cae7fd2..394fcc4f4 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/ghost/story/AnonymousStoryViewingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/ghost/story/AnonymousStoryViewingPatch.kt @@ -16,7 +16,7 @@ val anonymousStoryViewingPatch = bytecodePatch( ) { compatibleWith("com.instagram.android") - execute { + apply { // Prevent the hashmap of the seen media to be filled setMediaSeenHashmapFingerprint.method.returnEarly() } diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/hide/explore/HideExploreFeed.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/hide/explore/HideExploreFeed.kt index c0a35c694..b66f5856e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/hide/explore/HideExploreFeed.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/hide/explore/HideExploreFeed.kt @@ -33,7 +33,7 @@ val hideExploreFeedPatch = bytecodePatch( ) { compatibleWith("com.instagram.android") - execute { + apply { exploreResponseJsonParserFingerprint.replaceJsonFieldWithBogus(EXPLORE_KEY_TO_BE_HIDDEN) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/hide/navigation/HideNavigationButtons.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/hide/navigation/HideNavigationButtons.kt index f937cdd2b..cbfa0e4b1 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/hide/navigation/HideNavigationButtons.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/hide/navigation/HideNavigationButtons.kt @@ -71,7 +71,7 @@ val hideNavigationButtonsPatch = bytecodePatch( description = "Permanently hides the Create button." ) - execute { + apply { if (!hideHome!! &&!hideReels!! && !hideDirect!! && !hideSearch!! && !hideProfile!! && !hideCreate!!) { return@execute Logger.getLogger(this::class.java.name).warning( "No hide navigation buttons options are enabled. No changes made." diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/hide/stories/HideStories.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/hide/stories/HideStories.kt index 2647ee4f7..14550a6a8 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/hide/stories/HideStories.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/hide/stories/HideStories.kt @@ -10,7 +10,7 @@ val hideStoriesPatch = bytecodePatch( ) { compatibleWith("com.instagram.android") - execute { + apply { val addStoryMethod = getOrCreateAvatarViewFingerprint.method // Creates Story val addStoryEndIndex = getOrCreateAvatarViewFingerprint.patternMatch.endIndex diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/hide/suggestions/HideSuggestedContent.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/hide/suggestions/HideSuggestedContent.kt index 0c2501411..d78aa00e1 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/hide/suggestions/HideSuggestedContent.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/hide/suggestions/HideSuggestedContent.kt @@ -11,7 +11,7 @@ val hideSuggestedContent = bytecodePatch( ) { compatibleWith("com.instagram.android") - execute { + apply { FEED_ITEM_KEYS_TO_BE_HIDDEN.forEach { key -> feedItemParseFromJsonFingerprint.replaceJsonFieldWithBogus(key) } diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/misc/devmenu/EnableDeveloperMenuPatch.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/devmenu/EnableDeveloperMenuPatch.kt index a43b3e9f7..f582ca186 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/misc/devmenu/EnableDeveloperMenuPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/devmenu/EnableDeveloperMenuPatch.kt @@ -20,7 +20,7 @@ val enableDeveloperMenuPatch = bytecodePatch( ) { compatibleWith("com.instagram.android") - execute { + apply { with(clearNotificationReceiverFingerprint.method) { indexOfFirstInstructionReversedOrThrow(clearNotificationReceiverFingerprint.stringMatches.first().index) { val reference = getReference() diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/misc/links/OpenLinksExternallyPatch.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/links/OpenLinksExternallyPatch.kt index 4d66ce3c5..4cb428bf7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/misc/links/OpenLinksExternallyPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/links/OpenLinksExternallyPatch.kt @@ -21,7 +21,7 @@ val openLinksExternallyPatch = bytecodePatch( compatibleWith("com.instagram.android") - execute { + apply { inAppBrowserFunctionFingerprint.let { val stringMatchIndex = it.stringMatches?.first { match -> match.string == TARGET_STRING }!!.index diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/misc/share/domain/ChangeLinkSharingDomainPatch.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/share/domain/ChangeLinkSharingDomainPatch.kt index a2bcbba07..ce9d20602 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/misc/share/domain/ChangeLinkSharingDomainPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/share/domain/ChangeLinkSharingDomainPatch.kt @@ -29,7 +29,7 @@ val changeLinkSharingDomainPatch = bytecodePatch( description = "The domain name to use when sharing links." ) - execute { + apply { getCustomShareDomainFingerprint.method.returnEarly(customDomainHost!!) editShareLinksPatch { index, register -> diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/misc/share/privacy/SanitizeSharingLinksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/share/privacy/SanitizeSharingLinksPatch.kt index 8a22ffff8..0b2956c15 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/misc/share/privacy/SanitizeSharingLinksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/share/privacy/SanitizeSharingLinksPatch.kt @@ -19,7 +19,7 @@ val sanitizeSharingLinksPatch = bytecodePatch( dependsOn(sharedExtensionPatch) - execute { + apply { editShareLinksPatch { index, register -> addInstructions( index, diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/misc/signature/SignatureCheckPatch.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/signature/SignatureCheckPatch.kt index 0493be62d..bb805d053 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/misc/signature/SignatureCheckPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/signature/SignatureCheckPatch.kt @@ -12,7 +12,7 @@ val signatureCheckPatch = bytecodePatch( ) { compatibleWith("com.instagram.android") - execute { + apply { isValidSignatureMethodFingerprint .match(isValidSignatureClassFingerprint.classDef) .method diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/reels/DisableReelsScrollingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/reels/DisableReelsScrollingPatch.kt index acb8235fb..3dd2c5880 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/reels/DisableReelsScrollingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/reels/DisableReelsScrollingPatch.kt @@ -13,7 +13,7 @@ val disableReelsScrollingPatch = bytecodePatch( ) { compatibleWith("com.instagram.android") - execute { + apply { val viewPagerField = clipsViewPagerImplGetViewAtIndexFingerprint.classDef.fields.first { it.type == "Landroidx/viewpager2/widget/ViewPager2;" } diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/story/flipping/DisableStoryAutoFlippingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/story/flipping/DisableStoryAutoFlippingPatch.kt index 172f7dce7..1e0776b32 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/story/flipping/DisableStoryAutoFlippingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/story/flipping/DisableStoryAutoFlippingPatch.kt @@ -11,7 +11,7 @@ val disableStoryAutoFlippingPatch = bytecodePatch( ) { compatibleWith("com.instagram.android") - execute { + apply { onStoryTimeoutActionFingerprint.method.returnEarly() } } diff --git a/patches/src/main/kotlin/app/revanced/patches/irplus/ad/RemoveAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/irplus/ad/RemoveAdsPatch.kt index 1082180cf..c4bc43fbe 100644 --- a/patches/src/main/kotlin/app/revanced/patches/irplus/ad/RemoveAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/irplus/ad/RemoveAdsPatch.kt @@ -9,7 +9,7 @@ val removeAdsPatch = bytecodePatch( ) { compatibleWith("net.binarymode.android.irplus") - execute { + apply { // By overwriting the second parameter of the method, // the view which holds the advertisement is removed. irplusAdsFingerprint.method.addInstruction(0, "const/4 p2, 0x0") diff --git a/patches/src/main/kotlin/app/revanced/patches/letterboxd/ads/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/letterboxd/ads/HideAdsPatch.kt index 4de06ff32..c670e8565 100644 --- a/patches/src/main/kotlin/app/revanced/patches/letterboxd/ads/HideAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/letterboxd/ads/HideAdsPatch.kt @@ -11,7 +11,7 @@ val hideAdsPatch = bytecodePatch( ) { compatibleWith("com.letterboxd.letterboxd") - execute { + apply { admobHelperSetShowAdsFingerprint.method.addInstruction(0, "const p1, 0x0") listOf(admobHelperShouldShowAdsFingerprint, filmFragmentShowAdsFingerprint, memberExtensionShowAdsFingerprint).forEach { it.method.returnEarly(false) diff --git a/patches/src/main/kotlin/app/revanced/patches/lightroom/misc/bypassVersionCheck/DisableVersionCheckPatch.kt b/patches/src/main/kotlin/app/revanced/patches/lightroom/misc/bypassVersionCheck/DisableVersionCheckPatch.kt index 9d23b7716..038d2a35a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/lightroom/misc/bypassVersionCheck/DisableVersionCheckPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/lightroom/misc/bypassVersionCheck/DisableVersionCheckPatch.kt @@ -11,7 +11,7 @@ val disableVersionCheckPatch = bytecodePatch( ) { compatibleWith("com.adobe.lrmobile"("9.3.0")) - execute { + apply { refreshRemoteConfigurationFingerprint.method.apply { val igetIndex = refreshRemoteConfigurationFingerprint.patternMatch!!.endIndex diff --git a/patches/src/main/kotlin/app/revanced/patches/lightroom/misc/login/DisableMandatoryLoginPatch.kt b/patches/src/main/kotlin/app/revanced/patches/lightroom/misc/login/DisableMandatoryLoginPatch.kt index 778f857b9..b6c52ce9d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/lightroom/misc/login/DisableMandatoryLoginPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/lightroom/misc/login/DisableMandatoryLoginPatch.kt @@ -9,7 +9,7 @@ val disableMandatoryLoginPatch = bytecodePatch( ) { compatibleWith("com.adobe.lrmobile"("9.3.0")) - execute { + apply { isLoggedInFingerprint.method.apply { val index = implementation!!.instructions.lastIndex - 1 // Set isLoggedIn = true. diff --git a/patches/src/main/kotlin/app/revanced/patches/lightroom/misc/premium/UnlockPremiumPatch.kt b/patches/src/main/kotlin/app/revanced/patches/lightroom/misc/premium/UnlockPremiumPatch.kt index 44ca12d70..53525cf3f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/lightroom/misc/premium/UnlockPremiumPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/lightroom/misc/premium/UnlockPremiumPatch.kt @@ -9,7 +9,7 @@ val unlockPremiumPatch = bytecodePatch( ) { compatibleWith("com.adobe.lrmobile"("9.3.0")) - execute { + apply { // Set hasPremium = true. hasPurchasedFingerprint.method.replaceInstruction(2, "const/4 v2, 0x1") } diff --git a/patches/src/main/kotlin/app/revanced/patches/memegenerator/detection/license/LicenseValidationPatch.kt b/patches/src/main/kotlin/app/revanced/patches/memegenerator/detection/license/LicenseValidationPatch.kt index d3ac9d985..02955f903 100644 --- a/patches/src/main/kotlin/app/revanced/patches/memegenerator/detection/license/LicenseValidationPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/memegenerator/detection/license/LicenseValidationPatch.kt @@ -7,7 +7,7 @@ val licenseValidationPatch = bytecodePatch( description = "Disables Firebase license validation.", ) { - execute { + apply { licenseValidationFingerprint.method.replaceInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/memegenerator/detection/signature/SignatureVerificationPatch.kt b/patches/src/main/kotlin/app/revanced/patches/memegenerator/detection/signature/SignatureVerificationPatch.kt index b9a8d3ccd..94e1029a3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/memegenerator/detection/signature/SignatureVerificationPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/memegenerator/detection/signature/SignatureVerificationPatch.kt @@ -7,7 +7,7 @@ val signatureVerificationPatch = bytecodePatch( description = "Disables detection of incorrect signature.", ) { - execute { + apply { verifySignatureFingerprint.method.replaceInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/memegenerator/misc/pro/UnlockProVersionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/memegenerator/misc/pro/UnlockProVersionPatch.kt index bad3bea1f..b087ffcc8 100644 --- a/patches/src/main/kotlin/app/revanced/patches/memegenerator/misc/pro/UnlockProVersionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/memegenerator/misc/pro/UnlockProVersionPatch.kt @@ -13,7 +13,7 @@ val unlockProVersionPatch = bytecodePatch( compatibleWith("com.zombodroid.MemeGenerator"("4.6364", "4.6370", "4.6375", "4.6377")) - execute { + apply { isFreeVersionFingerprint.method.replaceInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxAdsPatch.kt index eb332a6b8..3150dabde 100644 --- a/patches/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxAdsPatch.kt @@ -10,7 +10,7 @@ val hideInboxAdsPatch = bytecodePatch( ) { compatibleWith("com.facebook.orca") - execute { + apply { loadInboxAdsFingerprint.method.replaceInstruction(0, "return-void") } } diff --git a/patches/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxSubtabsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxSubtabsPatch.kt index 399bcc2a4..a9f915f69 100644 --- a/patches/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxSubtabsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/messenger/inbox/HideInboxSubtabsPatch.kt @@ -10,7 +10,7 @@ val hideInboxSubtabsPatch = bytecodePatch( ) { compatibleWith("com.facebook.orca") - execute { + apply { createInboxSubTabsFingerprint.method.replaceInstruction(2, "const/4 v0, 0x0") } } diff --git a/patches/src/main/kotlin/app/revanced/patches/messenger/layout/HideFacebookButtonPatch.kt b/patches/src/main/kotlin/app/revanced/patches/messenger/layout/HideFacebookButtonPatch.kt index 9e003d871..08a56b964 100644 --- a/patches/src/main/kotlin/app/revanced/patches/messenger/layout/HideFacebookButtonPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/messenger/layout/HideFacebookButtonPatch.kt @@ -10,7 +10,7 @@ val hideFacebookButtonPatch = bytecodePatch( ) { compatibleWith("com.facebook.orca") - execute { + apply { isFacebookButtonEnabledFingerprint.method.returnEarly(false) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/messenger/metaai/RemoveMetaAIPatch.kt b/patches/src/main/kotlin/app/revanced/patches/messenger/metaai/RemoveMetaAIPatch.kt index ed4bf770c..26471260a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/messenger/metaai/RemoveMetaAIPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/messenger/metaai/RemoveMetaAIPatch.kt @@ -20,7 +20,7 @@ val removeMetaAIPatch = bytecodePatch( dependsOn(sharedExtensionPatch) - execute { + apply { getMobileConfigBoolFingerprint.method.apply { val returnIndex = getMobileConfigBoolFingerprint.patternMatch.startIndex val returnRegister = getInstruction(returnIndex).registerA diff --git a/patches/src/main/kotlin/app/revanced/patches/mifitness/misc/locale/ForceEnglishLocalePatch.kt b/patches/src/main/kotlin/app/revanced/patches/mifitness/misc/locale/ForceEnglishLocalePatch.kt index 5e6581b9f..01939aa16 100644 --- a/patches/src/main/kotlin/app/revanced/patches/mifitness/misc/locale/ForceEnglishLocalePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/mifitness/misc/locale/ForceEnglishLocalePatch.kt @@ -15,7 +15,7 @@ val forceEnglishLocalePatch = bytecodePatch( dependsOn(fixLoginPatch) - execute { + apply { syncBluetoothLanguageFingerprint.method.apply { val resolvePhoneLocaleInstruction = syncBluetoothLanguageFingerprint.instructionMatches.first().index val registerIndexToUpdate = getInstruction(resolvePhoneLocaleInstruction).registerA diff --git a/patches/src/main/kotlin/app/revanced/patches/mifitness/misc/login/FixLoginPatch.kt b/patches/src/main/kotlin/app/revanced/patches/mifitness/misc/login/FixLoginPatch.kt index a74fc307d..7567aba65 100644 --- a/patches/src/main/kotlin/app/revanced/patches/mifitness/misc/login/FixLoginPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/mifitness/misc/login/FixLoginPatch.kt @@ -9,7 +9,7 @@ val fixLoginPatch = bytecodePatch( ) { compatibleWith("com.xiaomi.wearable") - execute { + apply { xiaomiAccountManagerConstructorFingerprint.method.addInstruction(0, "const/16 p2, 0x0") } } diff --git a/patches/src/main/kotlin/app/revanced/patches/music/ad/video/HideVideoAds.kt b/patches/src/main/kotlin/app/revanced/patches/music/ad/video/HideVideoAds.kt index 7faf52664..37d2f02b5 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/ad/video/HideVideoAds.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/ad/video/HideVideoAds.kt @@ -29,7 +29,7 @@ val hideVideoAdsPatch = bytecodePatch( ) ) - execute { + apply { addResources("music", "ad.video.hideVideoAdsPatch") PreferenceScreen.ADS.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt b/patches/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt index f0b1974c3..fac17d7a7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt @@ -22,7 +22,7 @@ val enableExclusiveAudioPlaybackPatch = bytecodePatch( ) ) - execute { + apply { allowExclusiveAudioPlaybackFingerprint.method.returnEarly(true) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt index c0a9bde21..20b43ff29 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt @@ -32,7 +32,7 @@ val permanentRepeatPatch = bytecodePatch( ) ) - execute { + apply { addResources("music", "interaction.permanentrepeat.permanentRepeatPatch") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/branding/CustomBrandingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/branding/CustomBrandingPatch.kt index 8c70395cd..2dbf06008 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/branding/CustomBrandingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/branding/CustomBrandingPatch.kt @@ -24,7 +24,7 @@ private val disableSplashAnimationPatch = bytecodePatch { dependsOn(resourceMappingPatch) - execute { + apply { // The existing YT animation usually only shows for a fraction of a second, // and the existing animation does not match the new splash screen // causing the original YT Music logo to momentarily flash on screen as the animation starts. diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/buttons/HideButtons.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/buttons/HideButtons.kt index 2a71bd912..54a34c458 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/buttons/HideButtons.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/buttons/HideButtons.kt @@ -51,7 +51,7 @@ val hideButtons = bytecodePatch( ) ) - execute { + apply { playerOverlayChip = getResourceId(ResourceType.ID, "player_overlay_chip") historyMenuItem = getResourceId(ResourceType.ID, "history_menu_item") offlineSettingsMenuItem = getResourceId(ResourceType.ID, "offline_settings_menu_item") diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt index 345a17f4d..370501741 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt @@ -36,7 +36,7 @@ val hideCategoryBar = bytecodePatch( ) ) - execute { + apply { addResources("music", "layout.compactheader.hideCategoryBar") PreferenceScreen.GENERAL.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt index 3a32af35c..dc35ceedb 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/miniplayercolor/ChangeMiniplayerColor.kt @@ -43,7 +43,7 @@ val changeMiniplayerColor = bytecodePatch( ) ) - execute { + apply { addResources("music", "layout.miniplayercolor.changeMiniplayerColor") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/navigationbar/NavigationBarPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/navigationbar/NavigationBarPatch.kt index e2fc4ec1e..c361cf174 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/navigationbar/NavigationBarPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/navigationbar/NavigationBarPatch.kt @@ -38,7 +38,7 @@ val navigationBarPatch = bytecodePatch( settingsPatch, addResourcesPatch, resourcePatch { - execute { + apply { // Ensure the first ImageView has 'layout_weight' to stay properly sized // when the TextView is hidden. document("res/layout/image_with_text_tab.xml").use { document -> @@ -62,7 +62,7 @@ val navigationBarPatch = bytecodePatch( ) ) - execute { + apply { text1 = getResourceId(ResourceType.ID, "text1") addResources("music", "layout.navigationbar.navigationBarPatch") diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt index 30d9b9e25..6f4c7d940 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt @@ -33,7 +33,7 @@ val hideGetPremiumPatch = bytecodePatch( ) ) - execute { + apply { addResources("music", "layout.premium.hideGetPremiumPatch") PreferenceScreen.ADS.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt index 245569d9e..923be9207 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt @@ -22,7 +22,7 @@ val bypassCertificateChecksPatch = bytecodePatch( ) ) - execute { + apply { checkCertificateFingerprint.method.returnEarly(true) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/music/misc/backgroundplayback/BackgroundPlaybackPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/misc/backgroundplayback/BackgroundPlaybackPatch.kt index 360f4aac4..50514790e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/misc/backgroundplayback/BackgroundPlaybackPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/misc/backgroundplayback/BackgroundPlaybackPatch.kt @@ -22,7 +22,7 @@ val backgroundPlaybackPatch = bytecodePatch( ) ) - execute { + apply { kidsBackgroundPlaybackPolicyControllerFingerprint.method.addInstruction( 0, "return-void", diff --git a/patches/src/main/kotlin/app/revanced/patches/music/misc/fileprovider/FileProviderPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/misc/fileprovider/FileProviderPatch.kt index 8d0dd9a12..ac388a11a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/misc/fileprovider/FileProviderPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/misc/fileprovider/FileProviderPatch.kt @@ -11,7 +11,7 @@ internal fun fileProviderPatch( ) = bytecodePatch( description = "Fixes broken YouTube Music file provider that prevents sharing with specific apps such as Instagram." ) { - finalize { + afterDependents { // Must do modification last, so change package name value is correctly set. val musicChangedPackageName = setOrGetFallbackPackageName(musicPackageName) diff --git a/patches/src/main/kotlin/app/revanced/patches/music/misc/settings/SettingsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/misc/settings/SettingsPatch.kt index 4b613827d..3a153e8b9 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/misc/settings/SettingsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/misc/settings/SettingsPatch.kt @@ -8,14 +8,7 @@ import app.revanced.patches.all.misc.resources.addResourcesPatch import app.revanced.patches.music.misc.extension.sharedExtensionPatch import app.revanced.patches.music.misc.gms.Constants.MUSIC_PACKAGE_NAME import app.revanced.patches.shared.misc.mapping.resourceMappingPatch -import app.revanced.patches.shared.misc.settings.preference.BasePreference -import app.revanced.patches.shared.misc.settings.preference.BasePreferenceScreen -import app.revanced.patches.shared.misc.settings.preference.InputType -import app.revanced.patches.shared.misc.settings.preference.IntentPreference -import app.revanced.patches.shared.misc.settings.preference.NonInteractivePreference -import app.revanced.patches.shared.misc.settings.preference.PreferenceScreenPreference -import app.revanced.patches.shared.misc.settings.preference.SwitchPreference -import app.revanced.patches.shared.misc.settings.preference.TextPreference +import app.revanced.patches.shared.misc.settings.preference.* import app.revanced.patches.shared.misc.settings.settingsPatch import app.revanced.patches.youtube.misc.settings.modifyActivityForSettingsInjection import app.revanced.util.copyXmlNode @@ -41,7 +34,7 @@ private val settingsResourcePatch = resourcePatch { ) ) - execute { + apply { // Set the style for the ReVanced settings to follow the style of the music settings, // namely: action bar height, menu item padding and remove horizontal dividers. @@ -80,7 +73,7 @@ val settingsPatch = bytecodePatch( addResourcesPatch, ) - execute { + apply { addResources("music", "misc.settings.settingsPatch") addResources("shared", "misc.debugging.enableDebuggingPatch") @@ -114,7 +107,7 @@ val settingsPatch = bytecodePatch( ) } - finalize { + afterDependents { PreferenceScreen.close() } } diff --git a/patches/src/main/kotlin/app/revanced/patches/music/playservice/VersionCheckPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/playservice/VersionCheckPatch.kt index d8f1fd709..e5b8ba0d0 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/playservice/VersionCheckPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/playservice/VersionCheckPatch.kt @@ -24,7 +24,7 @@ var is_8_15_or_greater: Boolean by Delegates.notNull() val versionCheckPatch = resourcePatch( description = "Uses the Play Store service version to find the major/minor version of the YouTube Music target app.", ) { - execute { + apply { // The app version is missing from the decompiled manifest, // so instead use the Google Play services version and compare against specific releases. val playStoreServicesVersion = findPlayStoreServicesVersion() diff --git a/patches/src/main/kotlin/app/revanced/patches/myexpenses/misc/pro/UnlockProPatch.kt b/patches/src/main/kotlin/app/revanced/patches/myexpenses/misc/pro/UnlockProPatch.kt index 2067e8ffa..bc85dc122 100644 --- a/patches/src/main/kotlin/app/revanced/patches/myexpenses/misc/pro/UnlockProPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/myexpenses/misc/pro/UnlockProPatch.kt @@ -9,7 +9,7 @@ val unlockProPatch = bytecodePatch( ) { compatibleWith("org.totschnig.myexpenses"("3.4.9")) - execute { + apply { isEnabledFingerprint.method.addInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/myfitnesspal/ads/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/myfitnesspal/ads/HideAdsPatch.kt index 97738aa3e..f32015c62 100644 --- a/patches/src/main/kotlin/app/revanced/patches/myfitnesspal/ads/HideAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/myfitnesspal/ads/HideAdsPatch.kt @@ -10,7 +10,7 @@ val hideAdsPatch = bytecodePatch( ) { compatibleWith("com.myfitnesspal.android"("24.14.2")) - execute { + apply { // Overwrite the premium status specifically for ads. isPremiumUseCaseImplFingerprint.method.replaceInstructions( 0, diff --git a/patches/src/main/kotlin/app/revanced/patches/netguard/broadcasts/removerestriction/RemoveBroadcastsRestrictionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/netguard/broadcasts/removerestriction/RemoveBroadcastsRestrictionPatch.kt index b4f675ed7..a7e6912e0 100644 --- a/patches/src/main/kotlin/app/revanced/patches/netguard/broadcasts/removerestriction/RemoveBroadcastsRestrictionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/netguard/broadcasts/removerestriction/RemoveBroadcastsRestrictionPatch.kt @@ -10,7 +10,7 @@ val removeBroadcastsRestrictionPatch = resourcePatch( ) { compatibleWith("eu.faircode.netguard") - execute { + apply { document("AndroidManifest.xml").use { document -> val applicationNode = document diff --git a/patches/src/main/kotlin/app/revanced/patches/nunl/ads/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/nunl/ads/HideAdsPatch.kt index 1908b3a28..8a94c24b8 100644 --- a/patches/src/main/kotlin/app/revanced/patches/nunl/ads/HideAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/nunl/ads/HideAdsPatch.kt @@ -18,7 +18,7 @@ val hideAdsPatch = bytecodePatch( dependsOn(sharedExtensionPatch("nunl", mainActivityOnCreateHook)) - execute { + apply { // Disable video pre-roll ads. // Whenever the app tries to define the advertising config for JWPlayer, don't set the advertising config and directly return. val iputInstructionIndex = jwPlayerConfigFingerprint.method.indexOfFirstInstructionOrThrow(Opcode.IPUT_OBJECT) diff --git a/patches/src/main/kotlin/app/revanced/patches/nunl/firebase/SpoofCertificatePatch.kt b/patches/src/main/kotlin/app/revanced/patches/nunl/firebase/SpoofCertificatePatch.kt index 65944c4c1..9c0202ee7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/nunl/firebase/SpoofCertificatePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/nunl/firebase/SpoofCertificatePatch.kt @@ -10,7 +10,7 @@ val spoofCertificatePatch = bytecodePatch( ) { compatibleWith("nl.sanomamedia.android.nu") - execute { + apply { getFingerprintHashForPackageFingerprints.forEach { fingerprint -> fingerprint.method.returnEarly("eae41fc018df2731a9b6ae1ac327da44a288667b") } diff --git a/patches/src/main/kotlin/app/revanced/patches/openinghours/misc/fix/crash/FixCrashPatch.kt b/patches/src/main/kotlin/app/revanced/patches/openinghours/misc/fix/crash/FixCrashPatch.kt index 90173f2c8..778a1e110 100644 --- a/patches/src/main/kotlin/app/revanced/patches/openinghours/misc/fix/crash/FixCrashPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/openinghours/misc/fix/crash/FixCrashPatch.kt @@ -17,7 +17,7 @@ val fixCrashPatch = bytecodePatch( ) { compatibleWith("de.simon.openinghours"("1.0")) - execute { + apply { val indexedInstructions = setPlaceFingerprint.method.instructions.withIndex().toList() /** 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 8669f6132..f0dd38df2 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 @@ -12,7 +12,7 @@ val removeRootDetectionPatch = bytecodePatch( ) { compatibleWith("com.nousguide.android.orftvthek") - execute { + apply { isDeviceRootedFingeprint.method.returnEarly(false) } } \ No newline at end of file diff --git a/patches/src/main/kotlin/app/revanced/patches/pandora/ads/DisableAudioAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/pandora/ads/DisableAudioAdsPatch.kt index 6cc89a0b4..d95eaa1f3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/pandora/ads/DisableAudioAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/pandora/ads/DisableAudioAdsPatch.kt @@ -9,7 +9,7 @@ val disableAudioAdsPatch = bytecodePatch( ) { compatibleWith("com.pandora.android") - execute { + apply { getIsAdSupportedFingerprint.method.returnEarly(false) requestAudioAdFingerprint.method.returnEarly() } diff --git a/patches/src/main/kotlin/app/revanced/patches/pandora/misc/EnableUnlimitedSkipsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/pandora/misc/EnableUnlimitedSkipsPatch.kt index 2ce53fdfe..cfb18c439 100644 --- a/patches/src/main/kotlin/app/revanced/patches/pandora/misc/EnableUnlimitedSkipsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/pandora/misc/EnableUnlimitedSkipsPatch.kt @@ -9,7 +9,7 @@ val enableUnlimitedSkipsPatch = bytecodePatch( ) { compatibleWith("com.pandora.android") - execute { + apply { skipLimitBehaviorFingerprint.method.returnEarly("unlimited") } } diff --git a/patches/src/main/kotlin/app/revanced/patches/peacocktv/ads/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/peacocktv/ads/HideAdsPatch.kt index 52e07e238..ce6b7ec5a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/peacocktv/ads/HideAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/peacocktv/ads/HideAdsPatch.kt @@ -10,7 +10,7 @@ val hideAdsPatch = bytecodePatch( ) { compatibleWith("com.peacocktv.peacockandroid") - execute { + apply { mediaTailerAdServiceFingerprint.method.returnEarly(false) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/photomath/detection/deviceid/SpoofDeviceIdPatch.kt b/patches/src/main/kotlin/app/revanced/patches/photomath/detection/deviceid/SpoofDeviceIdPatch.kt index b502eb40b..44d4df42c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/photomath/detection/deviceid/SpoofDeviceIdPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/photomath/detection/deviceid/SpoofDeviceIdPatch.kt @@ -14,7 +14,7 @@ val getDeviceIdPatch = bytecodePatch( compatibleWith("com.microblink.photomath") - execute { + apply { getDeviceIdFingerprint.method.returnEarly(Random.nextLong().toString(16)) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/photomath/detection/signature/SignatureDetectionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/photomath/detection/signature/SignatureDetectionPatch.kt index 95331fe87..af1f088c0 100644 --- a/patches/src/main/kotlin/app/revanced/patches/photomath/detection/signature/SignatureDetectionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/photomath/detection/signature/SignatureDetectionPatch.kt @@ -9,7 +9,7 @@ val signatureDetectionPatch = bytecodePatch( description = "Disables detection of incorrect signature.", ) { - execute { + apply { val replacementIndex = checkSignatureFingerprint.instructionMatches.last().index val checkRegister = checkSignatureFingerprint.method.getInstruction(replacementIndex).registerA diff --git a/patches/src/main/kotlin/app/revanced/patches/photomath/misc/annoyances/HideUpdatePopupPatch.kt b/patches/src/main/kotlin/app/revanced/patches/photomath/misc/annoyances/HideUpdatePopupPatch.kt index e8f42f6ea..6a9c66b07 100644 --- a/patches/src/main/kotlin/app/revanced/patches/photomath/misc/annoyances/HideUpdatePopupPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/photomath/misc/annoyances/HideUpdatePopupPatch.kt @@ -13,7 +13,7 @@ val hideUpdatePopupPatch = bytecodePatch( compatibleWith("com.microblink.photomath") - execute { + apply { hideUpdatePopupFingerprint.method.addInstructions( 2, // Insert after the null check. "return-void", diff --git a/patches/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/EnableBookpointPatch.kt b/patches/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/EnableBookpointPatch.kt index e32610e25..7617395e1 100644 --- a/patches/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/EnableBookpointPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/bookpoint/EnableBookpointPatch.kt @@ -7,7 +7,7 @@ val enableBookpointPatch = bytecodePatch( description = "Enables textbook access", ) { - execute { + apply { isBookpointEnabledFingerprint.method.replaceInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/UnlockPlusPatch.kt b/patches/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/UnlockPlusPatch.kt index 96bd6c0ca..132a1eacb 100644 --- a/patches/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/UnlockPlusPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/photomath/misc/unlock/plus/UnlockPlusPatch.kt @@ -13,7 +13,7 @@ val unlockPlusPatch = bytecodePatch( compatibleWith("com.microblink.photomath") - execute { + apply { isPlusUnlockedFingerprint.method.addInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/piccomafr/misc/SpoofAndroidDeviceIdPatch.kt b/patches/src/main/kotlin/app/revanced/patches/piccomafr/misc/SpoofAndroidDeviceIdPatch.kt index a86d937d2..45f800c1e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/piccomafr/misc/SpoofAndroidDeviceIdPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/piccomafr/misc/SpoofAndroidDeviceIdPatch.kt @@ -39,7 +39,7 @@ val spoofAndroidDeviceIdPatch = bytecodePatch( required = true, ) { it!!.matches("[A-Fa-f0-9]{16}".toRegex()) } - execute { + apply { getAndroidIdFingerprint.method.returnEarly(androidDeviceId!!) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/piccomafr/tracking/DisableTrackingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/piccomafr/tracking/DisableTrackingPatch.kt index 775757277..a31cfff13 100644 --- a/patches/src/main/kotlin/app/revanced/patches/piccomafr/tracking/DisableTrackingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/piccomafr/tracking/DisableTrackingPatch.kt @@ -33,7 +33,7 @@ val disableTrackingPatch = bytecodePatch( ), ) - execute { + apply { facebookSDKFingerprint.method.apply { instructions.filter { instruction -> instruction.opcode == Opcode.CONST_STRING diff --git a/patches/src/main/kotlin/app/revanced/patches/pixiv/ads/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/pixiv/ads/HideAdsPatch.kt index 4454895b1..93962a332 100644 --- a/patches/src/main/kotlin/app/revanced/patches/pixiv/ads/HideAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/pixiv/ads/HideAdsPatch.kt @@ -9,7 +9,7 @@ val hideAdsPatch = bytecodePatch( ) { compatibleWith("jp.pxv.android"("6.141.1")) - execute { + apply { shouldShowAdsFingerprint.method.returnEarly(false) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/primevideo/ads/SkipAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/primevideo/ads/SkipAdsPatch.kt index 6c364c79e..d223490b6 100644 --- a/patches/src/main/kotlin/app/revanced/patches/primevideo/ads/SkipAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/primevideo/ads/SkipAdsPatch.kt @@ -18,7 +18,7 @@ val skipAdsPatch = bytecodePatch( // Skip all the logic in ServerInsertedAdBreakState.enter(), which plays all the ad clips in this // ad break. Instead, force the video player to seek over the entire break and reset the state machine. - execute { + apply { // Force doTrigger() access to public so we can call it from our extension. doTriggerFingerprint.method.accessFlags = AccessFlags.PUBLIC.value; diff --git a/patches/src/main/kotlin/app/revanced/patches/primevideo/misc/permissions/RenamePermissionsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/primevideo/misc/permissions/RenamePermissionsPatch.kt index 9a671879f..4894e10a1 100644 --- a/patches/src/main/kotlin/app/revanced/patches/primevideo/misc/permissions/RenamePermissionsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/primevideo/misc/permissions/RenamePermissionsPatch.kt @@ -24,7 +24,7 @@ val renamePermissionsPatch = resourcePatch( "com.amazon.appmanager.preload.permission.READ_PRELOAD_DEVICE_INFO_PROVIDER" ) - execute { + apply { document("AndroidManifest.xml").use { document -> val manifest = document.getNode("manifest") as Element diff --git a/patches/src/main/kotlin/app/revanced/patches/primevideo/video/speed/PlaybackSpeedPatch.kt b/patches/src/main/kotlin/app/revanced/patches/primevideo/video/speed/PlaybackSpeedPatch.kt index 9229fc50a..36829f818 100644 --- a/patches/src/main/kotlin/app/revanced/patches/primevideo/video/speed/PlaybackSpeedPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/primevideo/video/speed/PlaybackSpeedPatch.kt @@ -25,7 +25,7 @@ val playbackSpeedPatch = bytecodePatch( "com.amazon.avod.thirdpartyclient"("3.0.412.2947") ) - execute { + apply { playbackUserControlsInitializeFingerprint.method.apply { val getIndex = indexOfFirstInstructionOrThrow { opcode == Opcode.IPUT_OBJECT && diff --git a/patches/src/main/kotlin/app/revanced/patches/protonmail/account/RemoveFreeAccountsLimitPatch.kt b/patches/src/main/kotlin/app/revanced/patches/protonmail/account/RemoveFreeAccountsLimitPatch.kt index cd81f1bb4..bc99597b9 100644 --- a/patches/src/main/kotlin/app/revanced/patches/protonmail/account/RemoveFreeAccountsLimitPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/protonmail/account/RemoveFreeAccountsLimitPatch.kt @@ -10,7 +10,7 @@ val removeFreeAccountsLimitPatch = resourcePatch( ) { compatibleWith("ch.protonmail.android"("4.15.0")) - execute { + apply { document("res/values/integers.xml").use { document -> document.documentElement.childNodes.findElementByAttributeValueOrThrow( "name", diff --git a/patches/src/main/kotlin/app/revanced/patches/protonmail/signature/RemoveSentFromSignaturePatch.kt b/patches/src/main/kotlin/app/revanced/patches/protonmail/signature/RemoveSentFromSignaturePatch.kt index 44098a2df..440daca54 100644 --- a/patches/src/main/kotlin/app/revanced/patches/protonmail/signature/RemoveSentFromSignaturePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/protonmail/signature/RemoveSentFromSignaturePatch.kt @@ -12,7 +12,7 @@ val removeSentFromSignaturePatch = resourcePatch( ) { compatibleWith("ch.protonmail.android"("4.15.0")) - execute { + apply { val stringResourceFiles = mutableListOf() get("res").walk().forEach { file -> diff --git a/patches/src/main/kotlin/app/revanced/patches/protonvpn/delay/RemoveDelayPatch.kt b/patches/src/main/kotlin/app/revanced/patches/protonvpn/delay/RemoveDelayPatch.kt index 512813e59..01794b88f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/protonvpn/delay/RemoveDelayPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/protonvpn/delay/RemoveDelayPatch.kt @@ -10,7 +10,7 @@ val removeDelayPatch = bytecodePatch( ) { compatibleWith("ch.protonvpn.android") - execute { + apply { longDelayFingerprint.method.returnEarly(0) shortDelayFingerprint.method.returnEarly(0) } diff --git a/patches/src/main/kotlin/app/revanced/patches/protonvpn/splittunneling/UnlockSplitTunneling.kt b/patches/src/main/kotlin/app/revanced/patches/protonvpn/splittunneling/UnlockSplitTunneling.kt index f50a5f993..35bac4c70 100644 --- a/patches/src/main/kotlin/app/revanced/patches/protonvpn/splittunneling/UnlockSplitTunneling.kt +++ b/patches/src/main/kotlin/app/revanced/patches/protonvpn/splittunneling/UnlockSplitTunneling.kt @@ -16,7 +16,7 @@ val unlockSplitTunnelingPatch = ) { compatibleWith("ch.protonvpn.android") - execute { + apply { val registerIndex = enableSplitTunnelingUiFingerprint.patternMatch!!.endIndex - 1 enableSplitTunnelingUiFingerprint.method.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/rar/misc/annoyances/purchasereminder/HidePurchaseReminderPatch.kt b/patches/src/main/kotlin/app/revanced/patches/rar/misc/annoyances/purchasereminder/HidePurchaseReminderPatch.kt index 1ebbf78c8..59b3eb1f8 100644 --- a/patches/src/main/kotlin/app/revanced/patches/rar/misc/annoyances/purchasereminder/HidePurchaseReminderPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/rar/misc/annoyances/purchasereminder/HidePurchaseReminderPatch.kt @@ -11,7 +11,7 @@ val hidePurchaseReminderPatch = bytecodePatch( ) { compatibleWith("com.rarlab.rar") - execute { + apply { showReminderFingerprint.method.addInstruction(0, "return-void") } } diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/ad/banner/HideBannerPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/ad/banner/HideBannerPatch.kt index 62e8d5d84..adca01e02 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/ad/banner/HideBannerPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/ad/banner/HideBannerPatch.kt @@ -8,7 +8,7 @@ import app.revanced.patcher.patch.resourcePatch val hideBannerPatch = resourcePatch( description = "Hides banner ads from comments on subreddits.", ) { - execute { + apply { val resourceFilePath = "res/layout/merge_listheader_link_detail.xml" document(resourceFilePath).use { document -> diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/ad/comments/HideCommentAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/ad/comments/HideCommentAdsPatch.kt index 9b7c98af6..4890ea83c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/ad/comments/HideCommentAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/ad/comments/HideCommentAdsPatch.kt @@ -7,7 +7,7 @@ val hideCommentAdsPatch = bytecodePatch( description = "Removes ads in the comments.", ) { - execute { + apply { hideCommentAdsFingerprint.method.replaceInstructions(0, "return-object p1") } } diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/ad/general/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/ad/general/HideAdsPatch.kt index 1d7a79c8d..14e53a3d0 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/ad/general/HideAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/ad/general/HideAdsPatch.kt @@ -19,7 +19,7 @@ val hideAdsPatch = bytecodePatch( compatibleWith("com.reddit.frontpage") - execute { + apply { // region Filter promoted ads (does not work in popular or latest feed) val filterMethodDescriptor = diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/FixRedgifsApiPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/FixRedgifsApiPatch.kt index 92ff76f9e..382e8cb97 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/FixRedgifsApiPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/FixRedgifsApiPatch.kt @@ -8,7 +8,7 @@ const val INSTALL_NEW_CLIENT_METHOD = "install(Lokhttp3/OkHttpClient${'$'}Builde const val CREATE_NEW_CLIENT_METHOD = "createClient()Lokhttp3/OkHttpClient;" fun fixRedgifsApiPatch( - extensionPatch: Patch<*>, + extensionPatch: Patch, block: BytecodePatchBuilder.() -> Unit = {}, ) = bytecodePatch(name = "Fix Redgifs API") { dependsOn(extensionPatch) diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/FixSLinksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/FixSLinksPatch.kt index ccc0346a6..2c3d89acc 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/FixSLinksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/FixSLinksPatch.kt @@ -8,7 +8,7 @@ const val RESOLVE_S_LINK_METHOD = "patchResolveSLink(Ljava/lang/String;)Z" const val SET_ACCESS_TOKEN_METHOD = "patchSetAccessToken(Ljava/lang/String;)V" fun fixSLinksPatch( - extensionPatch: Patch<*>, + extensionPatch: Patch, block: BytecodePatchBuilder.() -> Unit = {}, ) = bytecodePatch(name = "Fix /s/ links") { dependsOn(extensionPatch) diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch.kt index 0e98f5295..588af2338 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/api/SpoofClientPatch.kt @@ -21,7 +21,7 @@ val spoofClientPatch = spoofClientPatch(redirectUri = "http://baconreader.com/au val clientId by clientIdOption - execute { + apply { fun Fingerprint.patch(replacementString: String) { val clientIdIndex = stringMatches.first().index diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/fix/redgifs/FixRedgifsApiPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/fix/redgifs/FixRedgifsApiPatch.kt index d6f18db5d..5b4d73241 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/fix/redgifs/FixRedgifsApiPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/baconreader/fix/redgifs/FixRedgifsApiPatch.kt @@ -25,7 +25,7 @@ val fixRedgifsApi = fixRedgifsApiPatch( "com.onelouder.baconreader.premium", ) - execute { + apply { // region Patch Redgifs OkHttp3 client. getOkHttpClientFingerprint.method.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/DisableAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/DisableAdsPatch.kt index 2b2cf0f59..5ffab44fc 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/DisableAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/ads/DisableAdsPatch.kt @@ -9,7 +9,7 @@ val disableAdsPatch = bytecodePatch( ) { compatibleWith("com.rubenmayayo.reddit") - execute { + apply { arrayOf(maxMediationFingerprint, admobMediationFingerprint).forEach { fingerprint -> fingerprint.method.addInstructions(0, "return-void") } diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt index b4046aed0..bc2c3b6c6 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch.kt @@ -11,7 +11,7 @@ val spoofClientPatch = spoofClientPatch(redirectUri = "http://rubenmayayo.com") val clientId by clientIdOption - execute { + apply { // region Patch client id. getClientIdFingerprint.method.returnEarly(clientId!!) diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/downloads/FixAudioMissingInDownloadsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/downloads/FixAudioMissingInDownloadsPatch.kt index bc52fc303..ec0f99ec7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/downloads/FixAudioMissingInDownloadsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/downloads/FixAudioMissingInDownloadsPatch.kt @@ -12,7 +12,7 @@ val fixAudioMissingInDownloadsPatch = bytecodePatch( ) { compatibleWith("com.rubenmayayo.reddit") - execute { + apply { val endpointReplacements = mapOf( "/DASH_audio.mp4" to "/DASH_AUDIO_128.mp4", "/audio" to "/DASH_AUDIO_64.mp4", diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/redgifs/FixRedgifsApiPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/redgifs/FixRedgifsApiPatch.kt index bcf0e0e7f..be54ca33c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/redgifs/FixRedgifsApiPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/redgifs/FixRedgifsApiPatch.kt @@ -16,7 +16,7 @@ val fixRedgifsApi = fixRedgifsApiPatch( ) { compatibleWith("com.rubenmayayo.reddit") - execute { + apply { // region Patch Redgifs OkHttp3 client. createOkHttpClientFingerprint.method.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/slink/FixSLinksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/slink/FixSLinksPatch.kt index 7af9375c4..6960751f6 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/slink/FixSLinksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/boostforreddit/fix/slink/FixSLinksPatch.kt @@ -17,7 +17,7 @@ val fixSlinksPatch = fixSLinksPatch( ) { compatibleWith("com.rubenmayayo.reddit") - execute { + apply { // region Patch navigation handler. handleNavigationFingerprint.method.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch.kt index 7ac6270c4..a85068052 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch.kt @@ -16,7 +16,7 @@ val spoofClientPatch = spoofClientPatch(redirectUri = "infinity://localhost") { val clientId by clientIdOption - execute { + apply { apiUtilsFingerprint.classDef.methods.apply { val getClientIdMethod = single { it.name == "getId" }.also(::remove) diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/UnlockSubscriptionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/UnlockSubscriptionPatch.kt index ba39c29a5..86c228fca 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/UnlockSubscriptionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/subscription/UnlockSubscriptionPatch.kt @@ -17,7 +17,7 @@ val unlockSubscriptionPatch = bytecodePatch( "ml.docilealligator.infinityforreddit.patreon" ) - execute { + apply { setOf( startSubscriptionActivityFingerprint, billingClientOnServiceConnectedFingerprint, diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/DisableAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/DisableAdsPatch.kt index 1c1c1cb2e..25db4840b 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/DisableAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/ads/DisableAdsPatch.kt @@ -12,7 +12,7 @@ val disableAdsPatch = bytecodePatch( compatibleWith("o.o.joey") - execute { + apply { isAdFreeUserFingerprint.method.addInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch.kt index e1855a50f..1de143ee7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/api/SpoofClientPatch.kt @@ -15,7 +15,7 @@ val spoofClientPatch = spoofClientPatch(redirectUri = "https://127.0.0.1:65023/a val clientId by clientIdOption - execute { + apply { // region Patch client id. getClientIdFingerprint.method.returnEarly(clientId!!) diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/DisablePiracyDetectionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/DisablePiracyDetectionPatch.kt index b4ce3b16e..aa8089358 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/DisablePiracyDetectionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/joeyforreddit/detection/piracy/DisablePiracyDetectionPatch.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.patch.bytecodePatch val disablePiracyDetectionPatch = bytecodePatch { - execute { + apply { piracyDetectionFingerprint.method.addInstruction(0, "return-void") } } diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt index 8cb7a226b..e94ffec60 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/redditisfun/api/SpoofClientPatch.kt @@ -19,7 +19,7 @@ val spoofClientPatch = spoofClientPatch(redirectUri = "redditisfun://auth") { cl val clientId by clientIdOption - execute { + apply { // region Patch client id. /** diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/SpoofClientPatch.kt index 8f501db84..fa6745dcc 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/relayforreddit/api/SpoofClientPatch.kt @@ -17,7 +17,7 @@ val spoofClientPatch = spoofClientPatch(redirectUri = "dbrady://relay") { val clientId by it - execute { + apply { // region Patch client id. setOf( diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/SpoofClientPatch.kt index 692bb828b..4e0600afb 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/slide/api/SpoofClientPatch.kt @@ -8,7 +8,7 @@ val spoofClientPatch = spoofClientPatch(redirectUri = "http://www.ccrama.me") { val clientId by clientIdOption - execute { + apply { getClientIdFingerprint.method.returnEarly(clientId!!) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/ads/DisableAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/ads/DisableAdsPatch.kt index 738c6835a..ce2b324ca 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/ads/DisableAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/ads/DisableAdsPatch.kt @@ -7,7 +7,7 @@ import app.revanced.util.returnEarly fun disableAdsPatch(block: BytecodePatchBuilder.() -> Unit = {}) = bytecodePatch( name = "Disable ads", ) { - execute { + apply { isAdsEnabledFingerprint.method.returnEarly(false) } diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/detection/piracy/DisablePiracyDetectionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/detection/piracy/DisablePiracyDetectionPatch.kt index a2aef861a..fc0e976ef 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/detection/piracy/DisablePiracyDetectionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/detection/piracy/DisablePiracyDetectionPatch.kt @@ -7,7 +7,7 @@ val disablePiracyDetectionPatch = bytecodePatch( description = "Disables detection of modified versions.", ) { - execute { + apply { // Do not throw an error if the fingerprint is not resolved. // This is fine because new versions of the target app do not need this patch. piracyDetectionFingerprint.methodOrNull?.addInstruction(0, "return-void") diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/annoyances/startup/DisableSyncForLemmyBottomSheetPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/annoyances/startup/DisableSyncForLemmyBottomSheetPatch.kt index bb067df82..865af827d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/annoyances/startup/DisableSyncForLemmyBottomSheetPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/annoyances/startup/DisableSyncForLemmyBottomSheetPatch.kt @@ -14,7 +14,7 @@ val disableSyncForLemmyBottomSheetPatch = bytecodePatch( "com.laurencedawson.reddit_sync.dev"(), // Version unknown. ) - execute { + apply { mainActivityOnCreateFingerprint.method.apply { val showBottomSheetIndex = implementation!!.instructions.lastIndex - 1 diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/api/SpoofClientPatch.kt index 37e9a0845..47a5cf815 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/api/SpoofClientPatch.kt @@ -29,7 +29,7 @@ val spoofClientPatch = spoofClientPatch( val clientId by clientIdOption - execute { + apply { // region Patch client id. getBearerTokenFingerprint.match(getAuthorizationStringFingerprint.originalClassDef).method.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/redgifs/FixRedgifsApiPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/redgifs/FixRedgifsApiPatch.kt index 986968818..9d6454198 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/redgifs/FixRedgifsApiPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/redgifs/FixRedgifsApiPatch.kt @@ -23,7 +23,7 @@ val fixRedgifsApi = fixRedgifsApiPatch( "com.laurencedawson.reddit_sync.dev", ) - execute { + apply { // region Patch Redgifs OkHttp3 client. createOkHttpClientFingerprint.method.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/slink/FixSLinksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/slink/FixSLinksPatch.kt index 8389f0704..cd42f995f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/slink/FixSLinksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/slink/FixSLinksPatch.kt @@ -21,7 +21,7 @@ val fixSLinksPatch = fixSLinksPatch( "com.laurencedawson.reddit_sync.dev", ) - execute { + apply { // region Patch navigation handler. linkHelperOpenLinkFingerprint.method.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/thumbnail/FixPostThumbnailsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/thumbnail/FixPostThumbnailsPatch.kt index 02afc33be..6fd693d01 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/thumbnail/FixPostThumbnailsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/thumbnail/FixPostThumbnailsPatch.kt @@ -16,7 +16,7 @@ val fixPostThumbnailsPatch = bytecodePatch( ) // Image URLs contain escaped ampersands (&), let's replace these with unescaped ones (&). - execute { + apply { customImageViewLoadFingerprint.method.addInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/user/UseUserEndpointPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/user/UseUserEndpointPatch.kt index fa521cf1a..f9fd31fad 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/user/UseUserEndpointPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/user/UseUserEndpointPatch.kt @@ -20,7 +20,7 @@ val useUserEndpointPatch = bytecodePatch( "com.laurencedawson.reddit_sync.dev", ) - execute { + apply { arrayOf( oAuthFriendRequestFingerprint, oAuthSubredditInfoRequestConstructorFingerprint, diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/video/FixVideoDownloadsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/video/FixVideoDownloadsPatch.kt index 8052f3aa3..3eedf0c9c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/video/FixVideoDownloadsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/sync/syncforreddit/fix/video/FixVideoDownloadsPatch.kt @@ -23,7 +23,7 @@ val fixVideoDownloadsPatch = bytecodePatch( "com.laurencedawson.reddit_sync.dev", ) - execute { + apply { val scanResult = parseRedditVideoNetworkResponseFingerprint.instructionMatches val newInstanceIndex = scanResult.first().index val invokeDirectIndex = scanResult.last().index - 1 diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/layout/disablescreenshotpopup/DisableScreenshotPopupPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/layout/disablescreenshotpopup/DisableScreenshotPopupPatch.kt index 477fb8a57..7db9bd8bb 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/layout/disablescreenshotpopup/DisableScreenshotPopupPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/layout/disablescreenshotpopup/DisableScreenshotPopupPatch.kt @@ -10,7 +10,7 @@ val disableScreenshotPopupPatch = bytecodePatch( ) { compatibleWith("com.reddit.frontpage") - execute { + apply { disableScreenshotPopupFingerprint.method.addInstruction(0, "return-void") } } diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/layout/premiumicon/UnlockPremiumIconPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/layout/premiumicon/UnlockPremiumIconPatch.kt index 76a63947a..9a6076894 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/layout/premiumicon/UnlockPremiumIconPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/layout/premiumicon/UnlockPremiumIconPatch.kt @@ -10,7 +10,7 @@ val unlockPremiumIconsPatch = bytecodePatch( ) { compatibleWith("com.reddit.frontpage") - execute { + apply { hasPremiumIconAccessFingerprint.method.addInstructions( 0, """ 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 99a16844d..4dbf9f444 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 @@ -12,7 +12,7 @@ val sanitizeUrlQueryPatch = bytecodePatch( ) { compatibleWith("com.reddit.frontpage") - execute { + apply { shareLinkFormatterFingerprint.method.addInstructions( 0, "return-object p0", diff --git a/patches/src/main/kotlin/app/revanced/patches/samsung/radio/misc/fix/crash/AddManifestPermissionsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/samsung/radio/misc/fix/crash/AddManifestPermissionsPatch.kt index 35641f2e7..a129479ee 100644 --- a/patches/src/main/kotlin/app/revanced/patches/samsung/radio/misc/fix/crash/AddManifestPermissionsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/samsung/radio/misc/fix/crash/AddManifestPermissionsPatch.kt @@ -13,7 +13,7 @@ internal val addManifestPermissionsPatch = resourcePatch { "android.permission.RECORD_AUDIO", ) - execute { + apply { document("AndroidManifest.xml").use { document -> document.getElementsByTagName("manifest").item(0).let { manifestEl -> diff --git a/patches/src/main/kotlin/app/revanced/patches/samsung/radio/misc/fix/crash/FixCrashPatch.kt b/patches/src/main/kotlin/app/revanced/patches/samsung/radio/misc/fix/crash/FixCrashPatch.kt index d7c0807fd..213b49874 100644 --- a/patches/src/main/kotlin/app/revanced/patches/samsung/radio/misc/fix/crash/FixCrashPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/samsung/radio/misc/fix/crash/FixCrashPatch.kt @@ -20,7 +20,7 @@ val fixCrashPatch = bytecodePatch( extendWith("extensions/samsung/radio.rve") compatibleWith("com.sec.android.app.fm"("12.4.00.7", "12.3.00.13", "12.3.00.11")) - execute { + apply { permissionRequestListFingerprint.method.apply { findInstructionIndicesReversedOrThrow(Opcode.FILLED_NEW_ARRAY).forEach { filledNewArrayIndex -> val moveResultIndex = indexOfFirstInstruction(filledNewArrayIndex, Opcode.MOVE_RESULT_OBJECT) diff --git a/patches/src/main/kotlin/app/revanced/patches/samsung/radio/restrictions/device/BypassDeviceChecksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/samsung/radio/restrictions/device/BypassDeviceChecksPatch.kt index b577305d7..b21e012d4 100644 --- a/patches/src/main/kotlin/app/revanced/patches/samsung/radio/restrictions/device/BypassDeviceChecksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/samsung/radio/restrictions/device/BypassDeviceChecksPatch.kt @@ -21,7 +21,7 @@ val bypassDeviceChecksPatch = bytecodePatch( extendWith("extensions/samsung/radio.rve") compatibleWith("com.sec.android.app.fm"("12.4.00.7", "12.3.00.13", "12.3.00.11")) - execute { + apply { // Return false = The device is not blacklisted. checkDeviceFingerprint.method.apply { // Find the first string that start with "SM-", that's the list of incompatible devices. 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 f3d0f124b..44728b2eb 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 @@ -12,7 +12,7 @@ val rootDetectionPatch = bytecodePatch( ) { compatibleWith("at.gv.bka.serviceportal") - execute { + apply { rootDetectionFingerprint.method.addInstruction(0, "return-void") } } diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/AddBrandLicensePatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/AddBrandLicensePatch.kt index 629a53e2e..933af7882 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/AddBrandLicensePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/AddBrandLicensePatch.kt @@ -10,7 +10,7 @@ import java.nio.file.Files * This patch must be a dependency for all patches that add ReVanced branding to the target app. */ internal val addBrandLicensePatch = rawResourcePatch { - execute { + apply { val brandingLicenseFileName = "LICENSE_REVANCED.TXT" val inputFileStream = inputStreamFromBundledResource( diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/BaseCustomBrandingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/BaseCustomBrandingPatch.kt index fbbd91d2d..d8d72d935 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/BaseCustomBrandingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/BaseCustomBrandingPatch.kt @@ -125,7 +125,7 @@ internal fun baseCustomBrandingPatch( resourceMappingPatch, addBrandLicensePatch, bytecodePatch { - execute { + apply { mainActivityOnCreateFingerprint.method.addInstruction( 0, "invoke-static { }, $EXTENSION_CLASS_DESCRIPTOR->setBranding()V" @@ -172,10 +172,10 @@ internal fun baseCustomBrandingPatch( }, ) - finalize { + afterDependents { // Can only check if app is root installation by checking if change package name patch is in use. - // and can only do that in the finalize block here. - // The UI preferences cannot be selectively added here, because the settings finalize block + // and can only do that in the afterDependents block here. + // The UI preferences cannot be selectively added here, because the settings afterDependents block // may have already run and the settings are already wrote to file. // Instead, show a warning if any patch option was used (A rooted device launcher ignores the manifest changes), // and the non-functional in-app settings are removed on app startup by extension code. @@ -188,7 +188,7 @@ internal fun baseCustomBrandingPatch( } } - execute { + apply { addResources("shared", "layout.branding.baseCustomBrandingPatch") addResources(addResourcePatchName, "layout.branding.customBrandingPatch") diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/layout/theme/BaseThemePatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/layout/theme/BaseThemePatch.kt index 40fb77980..23f974cbc 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/layout/theme/BaseThemePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/layout/theme/BaseThemePatch.kt @@ -92,7 +92,7 @@ internal fun baseThemePatch( dependsOn(lithoColorHookPatch) - execute { + apply { executeBlock() lithoColorOverrideHook(extensionClassDescriptor, "getValue") @@ -105,7 +105,7 @@ internal fun baseThemeResourcePatch( lightColorReplacement: (() -> String)? = null ) = resourcePatch { - execute { + apply { // After patch option validators are fixed https://github.com/ReVanced/revanced-patcher/issues/372 // This should changed to a patch option validator. val darkColor by darkThemeBackgroundColorOption diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/layout/theme/LithoColorHookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/layout/theme/LithoColorHookPatch.kt index 7518776ca..5b6a9986f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/layout/theme/LithoColorHookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/layout/theme/LithoColorHookPatch.kt @@ -10,7 +10,7 @@ val lithoColorHookPatch = bytecodePatch( description = "Adds a hook to set color of Litho components.", ) { - execute { + apply { var insertionIndex = lithoOnBoundsChangeFingerprint.patternMatch.endIndex - 1 lithoColorOverrideHook = { targetMethodClass, targetMethodName -> diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/audio/ForceOriginalAudioPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/audio/ForceOriginalAudioPatch.kt index fdaa58646..8c3e4c127 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/audio/ForceOriginalAudioPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/audio/ForceOriginalAudioPatch.kt @@ -47,7 +47,7 @@ internal fun forceOriginalAudioPatch( dependsOn(addResourcesPatch) - execute { + apply { addResources("shared", "misc.audio.forceOriginalAudioPatch") preferenceScreen.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/checks/BaseCheckEnvironmentPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/checks/BaseCheckEnvironmentPatch.kt index 8a711f75b..845eb29f0 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/checks/BaseCheckEnvironmentPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/checks/BaseCheckEnvironmentPatch.kt @@ -22,7 +22,7 @@ private const val EXTENSION_CLASS_DESCRIPTOR = fun checkEnvironmentPatch( mainActivityOnCreateFingerprint: Fingerprint, - extensionPatch: Patch<*>, + extensionPatch: Patch, vararg compatiblePackages: String, ) = bytecodePatch( description = "Checks, if the application was patched by, otherwise warns the user.", @@ -34,7 +34,7 @@ fun checkEnvironmentPatch( addResourcesPatch, ) - execute { + apply { addResources("shared", "misc.checks.checkEnvironmentPatch") fun setPatchInfo() { diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/debugging/EnableDebuggingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/debugging/EnableDebuggingPatch.kt index b7def26ae..3f567cca9 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/debugging/EnableDebuggingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/debugging/EnableDebuggingPatch.kt @@ -42,7 +42,7 @@ internal fun enableDebuggingPatch( dependsOn( addResourcesPatch, resourcePatch { - execute { + apply { copyResources( "settings", ResourceGroup("drawable", @@ -63,7 +63,7 @@ internal fun enableDebuggingPatch( block() - execute { + apply { executeBlock() addResources("shared", "misc.debugging.enableDebuggingPatch") diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/dns/CheckWatchHistoryDomainNameResolutionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/dns/CheckWatchHistoryDomainNameResolutionPatch.kt index 79fab44cc..28fae6bf0 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/dns/CheckWatchHistoryDomainNameResolutionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/dns/CheckWatchHistoryDomainNameResolutionPatch.kt @@ -23,7 +23,7 @@ internal fun checkWatchHistoryDomainNameResolutionPatch( ) { block() - execute { + apply { executeBlock() addResources("shared", "misc.dns.checkWatchHistoryDomainNameResolutionPatch") diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/extension/SharedExtensionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/extension/SharedExtensionPatch.kt index e21a082d6..076a62431 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/extension/SharedExtensionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/extension/SharedExtensionPatch.kt @@ -39,13 +39,13 @@ fun sharedExtensionPatch( ) = bytecodePatch { extendWith("extensions/shared.rve") - execute { + apply { // Verify the extension class exists. firstClassDefMutable(EXTENSION_CLASS_DESCRIPTOR) } - finalize { - // The hooks are made in finalize to ensure that the context is hooked before any other patches. + afterDependents { + // The hooks are made in afterDependents to ensure that the context is hooked before any other patches. hooks.forEach { hook -> hook()(EXTENSION_CLASS_DESCRIPTOR) } // Modify Utils method to include the patches release version. diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/fix/verticalscroll/VerticalScrollPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/fix/verticalscroll/VerticalScrollPatch.kt index ac0172a10..502add6a7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/fix/verticalscroll/VerticalScrollPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/fix/verticalscroll/VerticalScrollPatch.kt @@ -9,7 +9,7 @@ val verticalScrollPatch = bytecodePatch( description = "Fixes issues with refreshing the feed when the first component is of type EmptyComponent.", ) { - execute { + apply { canScrollVerticallyFingerprint.let { it.method.apply { val moveResultIndex = it.instructionMatches.last().index diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/gms/GmsCoreSupportPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/gms/GmsCoreSupportPatch.kt index be9e80c7c..ef075aed7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/gms/GmsCoreSupportPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/gms/GmsCoreSupportPatch.kt @@ -49,8 +49,8 @@ fun gmsCoreSupportPatch( primeMethodFingerprint: Fingerprint? = null, earlyReturnFingerprints: Set = setOf(), mainActivityOnCreateFingerprint: Fingerprint, - extensionPatch: Patch<*>, - gmsCoreSupportResourcePatchFactory: (gmsCoreVendorGroupIdOption: Option) -> Patch<*>, + extensionPatch: Patch, + gmsCoreSupportResourcePatchFactory: (gmsCoreVendorGroupIdOption: Option) -> Patch, executeBlock: BytecodePatchContext.() -> Unit = {}, block: BytecodePatchBuilder.() -> Unit = {}, ) = bytecodePatch( @@ -78,7 +78,7 @@ fun gmsCoreSupportPatch( val gmsCoreVendorGroupId by gmsCoreVendorGroupIdOption - execute { + apply { fun transformStringReferences(transform: (str: String) -> String?) { val transformations = mutableListOf<() -> Unit>() @@ -533,7 +533,7 @@ fun gmsCoreSupportResourcePatch( val gmsCoreVendorGroupId by gmsCoreVendorGroupIdOption - execute { + apply { // Some patches don't use shared String resources so there's no need to add them. if (addStringResources) { addResources("shared", "misc.gms.gmsCoreSupportResourcePatch") diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/hex/HexPatchBuilder.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/hex/HexPatchBuilder.kt index 8b6bc4dc2..c49e0e96c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/hex/HexPatchBuilder.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/hex/HexPatchBuilder.kt @@ -43,7 +43,7 @@ class HexPatchBuilder internal constructor( @Deprecated("Use the hexPatch function with the builder parameter instead.") fun hexPatch(ignoreMissingTargetFiles: Boolean = false, replacementsSupplier: () -> Set) = rawResourcePatch { - execute { + apply { replacementsSupplier().groupBy { it.targetFilePath }.forEach { (targetFilePath, replacements) -> val targetFile = get(targetFilePath, true) if (ignoreMissingTargetFiles && !targetFile.exists()) return@forEach diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/mapping/ResourceMappingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/mapping/ResourceMappingPatch.kt index bea541c7c..9c6bab891 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/mapping/ResourceMappingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/mapping/ResourceMappingPatch.kt @@ -86,7 +86,7 @@ fun resourceLiteral( ) = literal({ getResourceId(type, name) }, null, location) val resourceMappingPatch = resourcePatch { - execute { + apply { // Use a stream of the file, since no modifications are done // and using a File parameter causes the file to be re-wrote when closed. document(get("res/values/public.xml").inputStream()).use { document -> diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/pairip/license/DisableLicenseCheckPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/pairip/license/DisableLicenseCheckPatch.kt index 57de4180b..edb42a29a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/pairip/license/DisableLicenseCheckPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/pairip/license/DisableLicenseCheckPatch.kt @@ -12,7 +12,7 @@ val disableLicenseCheckPatch = bytecodePatch( use = false ) { - execute { + apply { if (processLicenseResponseFingerprint.methodOrNull == null || validateLicenseResponseFingerprint.methodOrNull == null) { return@execute Logger.getLogger(this::class.java.name) .warning("Could not find Pairip licensing check. No changes applied.") 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 f093c9c7c..cfb29c603 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 @@ -37,7 +37,7 @@ internal fun sanitizeSharingLinksPatch( dependsOn(addResourcesPatch) - execute { + apply { executeBlock() addResources("shared", "misc.privacy.sanitizeSharingLinksPatch") diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/settings/SettingsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/settings/SettingsPatch.kt index 3587e9d54..c3080fe0e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/settings/SettingsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/settings/SettingsPatch.kt @@ -31,7 +31,7 @@ fun overrideThemeColors(lightThemeColorString: String?, darkThemeColorString: St } private val settingsColorPatch = bytecodePatch { - finalize { + afterDependents { if (lightThemeColor != null) { themeLightColorResourceNameFingerprint.method.returnEarly(lightThemeColor!!) } @@ -58,7 +58,7 @@ fun settingsPatch ( addBrandLicensePatch ) - execute { + apply { copyResources( "settings", ResourceGroup("xml", @@ -105,7 +105,7 @@ fun settingsPatch ( addResources("shared", "misc.settings.settingsResourcePatch") } - finalize { + afterDependents { fun Node.addPreference(preference: BasePreference) { preference.serialize(ownerDocument) { resource -> // TODO: Currently, resources can only be added to "values", which may not be the correct place. diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen.kt index 24cfac230..6de553397 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/settings/preference/BasePreferenceScreen.kt @@ -16,7 +16,7 @@ abstract class BasePreferenceScreen( } /** - * Finalize and insert root preference into resource patch + * Insert root preference into resource patch */ abstract fun commit(screen: PreferenceScreenPreference) diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/spoof/SpoofVideoStreamsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/spoof/SpoofVideoStreamsPatch.kt index 561cd781f..98c5da9d9 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/spoof/SpoofVideoStreamsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/spoof/SpoofVideoStreamsPatch.kt @@ -53,7 +53,7 @@ internal fun spoofVideoStreamsPatch( dependsOn(addResourcesPatch) - execute { + apply { addResources("shared", "misc.fix.playback.spoofVideoStreamsPatch") mainActivityOnCreateFingerprint.method.addInstruction( diff --git a/patches/src/main/kotlin/app/revanced/patches/solidexplorer2/functionality/filesize/RemoveFileSizeLimitPatch.kt b/patches/src/main/kotlin/app/revanced/patches/solidexplorer2/functionality/filesize/RemoveFileSizeLimitPatch.kt index 6b8b4d664..f9d0901b4 100644 --- a/patches/src/main/kotlin/app/revanced/patches/solidexplorer2/functionality/filesize/RemoveFileSizeLimitPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/solidexplorer2/functionality/filesize/RemoveFileSizeLimitPatch.kt @@ -12,7 +12,7 @@ val removeFileSizeLimitPatch = bytecodePatch( ) { compatibleWith("pl.solidexplorer2") - execute { + apply { onReadyFingerprint.method.apply { val cmpIndex = onReadyFingerprint.instructionMatches.first().index + 1 val cmpResultRegister = getInstruction(cmpIndex).registerA diff --git a/patches/src/main/kotlin/app/revanced/patches/songpal/badge/BadgeTabPatch.kt b/patches/src/main/kotlin/app/revanced/patches/songpal/badge/BadgeTabPatch.kt index 506c20ed4..f160d8391 100644 --- a/patches/src/main/kotlin/app/revanced/patches/songpal/badge/BadgeTabPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/songpal/badge/BadgeTabPatch.kt @@ -15,7 +15,7 @@ val badgeTabPatch = bytecodePatch( val arrayTabs = listOf("Log", "HealthCare") - execute { + apply { createTabsFingerprint.method.apply { removeInstructions(0, 2) diff --git a/patches/src/main/kotlin/app/revanced/patches/songpal/badge/RemoveNotificationBadgePatch.kt b/patches/src/main/kotlin/app/revanced/patches/songpal/badge/RemoveNotificationBadgePatch.kt index 2c8c3b51a..f102c6bab 100644 --- a/patches/src/main/kotlin/app/revanced/patches/songpal/badge/RemoveNotificationBadgePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/songpal/badge/RemoveNotificationBadgePatch.kt @@ -10,7 +10,7 @@ val removeNotificationBadgePatch = bytecodePatch( ) { compatibleWith("com.sony.songpal.mdr"("10.1.0")) - execute { + apply { showNotificationFingerprint.method.addInstructions(0, "return-void") } } diff --git a/patches/src/main/kotlin/app/revanced/patches/soundcloud/ad/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/soundcloud/ad/HideAdsPatch.kt index 88a4bf277..400ff24bf 100644 --- a/patches/src/main/kotlin/app/revanced/patches/soundcloud/ad/HideAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/soundcloud/ad/HideAdsPatch.kt @@ -14,7 +14,7 @@ val hideAdsPatch = bytecodePatch( ) { compatibleWith("com.soundcloud.android"("2025.05.27-release")) - execute { + apply { // Enable a preset feature to disable audio ads by modifying the JSON server response. // This method is the constructor of a class representing a "Feature" object parsed from JSON data. // p1 is the name of the feature. diff --git a/patches/src/main/kotlin/app/revanced/patches/soundcloud/analytics/DisableTelemetryPatch.kt b/patches/src/main/kotlin/app/revanced/patches/soundcloud/analytics/DisableTelemetryPatch.kt index 81137ff24..2f83a3347 100644 --- a/patches/src/main/kotlin/app/revanced/patches/soundcloud/analytics/DisableTelemetryPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/soundcloud/analytics/DisableTelemetryPatch.kt @@ -10,7 +10,7 @@ val disableTelemetryPatch = bytecodePatch( ) { compatibleWith("com.soundcloud.android"("2025.05.27-release")) - execute { + apply { // Empty the "backend" argument to abort the initializer. createTrackingApiFingerprint.method.addInstruction(0, "const-string p1, \"\"") } diff --git a/patches/src/main/kotlin/app/revanced/patches/soundcloud/offlinesync/EnableOfflineSyncPatch.kt b/patches/src/main/kotlin/app/revanced/patches/soundcloud/offlinesync/EnableOfflineSyncPatch.kt index a3c58c3ef..5ec725a64 100644 --- a/patches/src/main/kotlin/app/revanced/patches/soundcloud/offlinesync/EnableOfflineSyncPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/soundcloud/offlinesync/EnableOfflineSyncPatch.kt @@ -19,7 +19,7 @@ val enableOfflineSync = bytecodePatch( ) { compatibleWith("com.soundcloud.android"("2025.05.27-release")) - execute { + apply { // Enable the feature to allow offline track syncing by modifying the JSON server response. // This method is the constructor of a class representing a "Feature" object parsed from JSON data. // p1 is the name of the feature. diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/layout/theme/CustomThemePatch.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/layout/theme/CustomThemePatch.kt index d46ae1013..286a3af31 100644 --- a/patches/src/main/kotlin/app/revanced/patches/spotify/layout/theme/CustomThemePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/layout/theme/CustomThemePatch.kt @@ -18,7 +18,7 @@ private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/spotify/ private val customThemeBytecodePatch = bytecodePatch { dependsOn(sharedExtensionPatch) - execute { + apply { val colorSpaceUtilsClassDef = colorSpaceUtilsClassFingerprint.originalClassDef // Hook a util method that converts ARGB to RGBA in the sRGB color space to replace hardcoded accent colors. @@ -129,7 +129,7 @@ val customThemePatch = resourcePatch( required = true, ) - execute { + apply { document("res/values/colors.xml").use { document -> val resourcesNode = document.getElementsByTagName("resources").item(0) as Element diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/login/FixFacebookLoginPatch.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/login/FixFacebookLoginPatch.kt index f8be93ac5..d15ac40a7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/login/FixFacebookLoginPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/login/FixFacebookLoginPatch.kt @@ -11,7 +11,7 @@ val fixFacebookLoginPatch = bytecodePatch( ) { compatibleWith("com.spotify.music") - execute { + apply { // The Facebook SDK tries to handle the login using the Facebook app in case it is installed. // However, the Facebook app does signature checks with the app that is requesting the authentication, // which ends up making the Facebook server reject with an invalid key hash for the app signature. diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/lyrics/ChangeLyricsProviderPatch.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/lyrics/ChangeLyricsProviderPatch.kt index 7ab3de2d8..8acda65f9 100644 --- a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/lyrics/ChangeLyricsProviderPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/lyrics/ChangeLyricsProviderPatch.kt @@ -61,7 +61,7 @@ val changeLyricsProviderPatch = bytecodePatch( true } - execute { + apply { val httpClientBuilderMethod = httpClientBuilderFingerprint.originalMethod // region Create a modified copy of the HTTP client builder method with the custom lyrics provider host. 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 6c7115b75..2a0a24906 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 @@ -24,7 +24,7 @@ val sanitizeSharingLinksPatch = bytecodePatch( dependsOn(sharedExtensionPatch) - execute { + apply { val extensionMethodDescriptor = "$EXTENSION_CLASS_DESCRIPTOR->" + "sanitizeSharingLink(Ljava/lang/String;)Ljava/lang/String;" diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/widgets/FixThirdPartyLaunchersWidgets.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/widgets/FixThirdPartyLaunchersWidgets.kt index ad40f24e2..626b9ac6f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/widgets/FixThirdPartyLaunchersWidgets.kt +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/widgets/FixThirdPartyLaunchersWidgets.kt @@ -10,7 +10,7 @@ val fixThirdPartyLaunchersWidgets = bytecodePatch( ) { compatibleWith("com.spotify.music") - execute { + apply { // Only system app launchers are granted the BIND_APPWIDGET permission. // Override the method that checks for it to always return true, as this permission is not actually required // for the widgets to work. diff --git a/patches/src/main/kotlin/app/revanced/patches/stocard/layout/HideOffersTabPatch.kt b/patches/src/main/kotlin/app/revanced/patches/stocard/layout/HideOffersTabPatch.kt index b7831e14a..d7772b200 100644 --- a/patches/src/main/kotlin/app/revanced/patches/stocard/layout/HideOffersTabPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/stocard/layout/HideOffersTabPatch.kt @@ -10,7 +10,7 @@ val hideOffersTabPatch = resourcePatch( ) { compatibleWith("de.stocard.stocard") - execute { + apply { document("res/menu/bottom_navigation_menu.xml").use { document -> document.getNode("menu").apply { removeChild( diff --git a/patches/src/main/kotlin/app/revanced/patches/stocard/layout/HideStoryBubblesPatch.kt b/patches/src/main/kotlin/app/revanced/patches/stocard/layout/HideStoryBubblesPatch.kt index aab14bae9..b4e86e9da 100644 --- a/patches/src/main/kotlin/app/revanced/patches/stocard/layout/HideStoryBubblesPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/stocard/layout/HideStoryBubblesPatch.kt @@ -9,7 +9,7 @@ val hideStoryBubblesPatch = resourcePatch( ) { compatibleWith("de.stocard.stocard") - execute { + apply { document("res/layout/rv_story_bubbles_list.xml").use { document -> document.getNode("androidx.recyclerview.widget.RecyclerView").apply { arrayOf( diff --git a/patches/src/main/kotlin/app/revanced/patches/strava/password/EnablePasswordLoginPatch.kt b/patches/src/main/kotlin/app/revanced/patches/strava/password/EnablePasswordLoginPatch.kt index 1d6a62569..9b6a04ac1 100644 --- a/patches/src/main/kotlin/app/revanced/patches/strava/password/EnablePasswordLoginPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/strava/password/EnablePasswordLoginPatch.kt @@ -11,7 +11,7 @@ val enablePasswordLoginPatch = bytecodePatch( ) { compatibleWith("com.strava") - execute { + apply { fun Fingerprint.loadTrueInsteadOfField() = method.replaceInstruction(patternMatch!!.startIndex, "const/4 v0, 0x1") diff --git a/patches/src/main/kotlin/app/revanced/patches/strava/privacy/BlockSnowplowTrackingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/strava/privacy/BlockSnowplowTrackingPatch.kt index 313a98d1d..96ad093c3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/strava/privacy/BlockSnowplowTrackingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/strava/privacy/BlockSnowplowTrackingPatch.kt @@ -10,7 +10,7 @@ val blockSnowplowTrackingPatch = bytecodePatch( ) { compatibleWith("com.strava") - execute { + apply { // Keep events list empty, otherwise sent to https://c.strava.com/com.snowplowanalytics.snowplow/tp2. insertEventFingerprint.method.returnEarly() } diff --git a/patches/src/main/kotlin/app/revanced/patches/strava/subscription/UnlockSubscriptionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/strava/subscription/UnlockSubscriptionPatch.kt index 06f876cb0..472992a20 100644 --- a/patches/src/main/kotlin/app/revanced/patches/strava/subscription/UnlockSubscriptionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/strava/subscription/UnlockSubscriptionPatch.kt @@ -10,7 +10,7 @@ val unlockSubscriptionPatch = bytecodePatch( ) { compatibleWith("com.strava") - execute { + apply { getSubscribedFingerprint.method.replaceInstruction( getSubscribedFingerprint.instructionMatches.first().index, "const/4 v0, 0x1", diff --git a/patches/src/main/kotlin/app/revanced/patches/strava/upselling/DisableSubscriptionSuggestionsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/strava/upselling/DisableSubscriptionSuggestionsPatch.kt index 9fb3d45f5..5dc9f7bdb 100644 --- a/patches/src/main/kotlin/app/revanced/patches/strava/upselling/DisableSubscriptionSuggestionsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/strava/upselling/DisableSubscriptionSuggestionsPatch.kt @@ -14,7 +14,7 @@ val disableSubscriptionSuggestionsPatch = bytecodePatch( ) { compatibleWith("com.strava") - execute { + apply { val helperMethodName = "getModulesIfNotUpselling" val pageSuffix = "_upsell" val label = "original" diff --git a/patches/src/main/kotlin/app/revanced/patches/swissid/integritycheck/RemoveGooglePlayIntegrityCheckPatch.kt b/patches/src/main/kotlin/app/revanced/patches/swissid/integritycheck/RemoveGooglePlayIntegrityCheckPatch.kt index b71a6896e..0de10e9f4 100644 --- a/patches/src/main/kotlin/app/revanced/patches/swissid/integritycheck/RemoveGooglePlayIntegrityCheckPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/swissid/integritycheck/RemoveGooglePlayIntegrityCheckPatch.kt @@ -17,7 +17,7 @@ val removeGooglePlayIntegrityCheckPatch = bytecodePatch( ) { compatibleWith("com.swisssign.swissid.mobile"("5.2.9")) - execute { + apply { checkIntegrityFingerprint.method.addInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/threads/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/threads/HideAdsPatch.kt index c71869480..f87110e12 100644 --- a/patches/src/main/kotlin/app/revanced/patches/threads/HideAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/threads/HideAdsPatch.kt @@ -10,7 +10,7 @@ val hideAdsPatch = bytecodePatch( ) { compatibleWith("com.instagram.barcelona"("382.0.0.51.85")) - execute { + apply { adInjectorFingerprint.method.returnEarly(false) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/UnlockThemePatch.kt b/patches/src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/UnlockThemePatch.kt index 7a84b9018..1506eb673 100644 --- a/patches/src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/UnlockThemePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/ticktick/misc/themeunlock/UnlockThemePatch.kt @@ -11,7 +11,7 @@ val unlockProPatch = bytecodePatch( ) { compatibleWith("com.ticktick.task") - execute { + apply { checkLockedThemesFingerprint.method.addInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/tiktok/feedfilter/FeedFilterPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tiktok/feedfilter/FeedFilterPatch.kt index 9acd2fee3..8f6ddfafb 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tiktok/feedfilter/FeedFilterPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tiktok/feedfilter/FeedFilterPatch.kt @@ -27,7 +27,7 @@ val feedFilterPatch = bytecodePatch( "com.zhiliaoapp.musically"("36.5.4"), ) - execute { + apply { arrayOf( feedApiServiceLIZFingerprint.method to "$EXTENSION_CLASS_DESCRIPTOR->filter(Lcom/ss/android/ugc/aweme/feed/model/FeedItemList;)V", followFeedFingerprint.method to "$EXTENSION_CLASS_DESCRIPTOR->filter(Lcom/ss/android/ugc/aweme/follow/presenter/FollowFeedList;)V" diff --git a/patches/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/RememberClearDisplayPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/RememberClearDisplayPatch.kt index 5847e32d2..1a56b9335 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/RememberClearDisplayPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tiktok/interaction/cleardisplay/RememberClearDisplayPatch.kt @@ -20,7 +20,7 @@ val rememberClearDisplayPatch = bytecodePatch( "com.zhiliaoapp.musically"("36.5.4"), ) - execute { + apply { onClearDisplayEventFingerprint.method.let { // region Hook the "Clear display" configuration save event to remember the state of clear display. diff --git a/patches/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/DownloadsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/DownloadsPatch.kt index 61c3e3750..0b0e05ce4 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/DownloadsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tiktok/interaction/downloads/DownloadsPatch.kt @@ -33,7 +33,7 @@ val downloadsPatch = bytecodePatch( "com.zhiliaoapp.musically"("36.5.4"), ) - execute { + apply { aclCommonShareFingerprint.method.returnEarly(0) aclCommonShare2Fingerprint.method.returnEarly(2) diff --git a/patches/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/ShowSeekbarPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/ShowSeekbarPatch.kt index 5b42be109..2f46b07fb 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/ShowSeekbarPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tiktok/interaction/seekbar/ShowSeekbarPatch.kt @@ -13,7 +13,7 @@ val showSeekbarPatch = bytecodePatch( "com.zhiliaoapp.musically", ) - execute { + apply { shouldShowSeekBarFingerprint.method.addInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/PlaybackSpeedPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/PlaybackSpeedPatch.kt index 22ec24641..384d5e635 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/PlaybackSpeedPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tiktok/interaction/speed/PlaybackSpeedPatch.kt @@ -22,7 +22,7 @@ val playbackSpeedPatch = bytecodePatch( "com.zhiliaoapp.musically"("36.5.4"), ) - execute { + apply { setSpeedFingerprint.let { onVideoSwiped -> getSpeedFingerprint.method.apply { val injectIndex = diff --git a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/login/disablerequirement/DisableLoginRequirementPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/login/disablerequirement/DisableLoginRequirementPatch.kt index 08106cf3a..caab1234d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/login/disablerequirement/DisableLoginRequirementPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/login/disablerequirement/DisableLoginRequirementPatch.kt @@ -12,7 +12,7 @@ val disableLoginRequirementPatch = bytecodePatch( "com.zhiliaoapp.musically", ) - execute { + apply { listOf( mandatoryLoginServiceFingerprint, mandatoryLoginService2Fingerprint, diff --git a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/FixGoogleLoginPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/FixGoogleLoginPatch.kt index a23e7a785..84518179e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/FixGoogleLoginPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/FixGoogleLoginPatch.kt @@ -13,7 +13,7 @@ val fixGoogleLoginPatch = bytecodePatch( "com.zhiliaoapp.musically", ) - execute { + apply { listOf( googleOneTapAuthAvailableFingerprint.method, googleAuthAvailableFingerprint.method, diff --git a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/SettingsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/SettingsPatch.kt index 30132540d..55e88d95d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/SettingsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/settings/SettingsPatch.kt @@ -26,7 +26,7 @@ val settingsPatch = bytecodePatch( "com.zhiliaoapp.musically"("36.5.4"), ) - execute { + apply { val initializeSettingsMethodDescriptor = "$EXTENSION_CLASS_DESCRIPTOR->initialize(" + "Lcom/bytedance/ies/ugc/aweme/commercialize/compliance/personalization/AdPersonalizationActivity;" + diff --git a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/share/SanitizeShareUrlsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/share/SanitizeShareUrlsPatch.kt index 4a81e74a5..ac9fa4003 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/share/SanitizeShareUrlsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/share/SanitizeShareUrlsPatch.kt @@ -30,7 +30,7 @@ val sanitizeShareUrlsPatch = bytecodePatch( "com.zhiliaoapp.musically"("36.5.4"), ) - execute { + apply { urlShorteningFingerprint.method.apply { val invokeIndex = indexOfFirstInstructionOrThrow { val ref = getReference() diff --git a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/spoof/sim/SpoofSimPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/spoof/sim/SpoofSimPatch.kt index 758fcebdf..a0f30417f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/spoof/sim/SpoofSimPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/spoof/sim/SpoofSimPatch.kt @@ -29,7 +29,7 @@ val spoofSimPatch = bytecodePatch( "com.zhiliaoapp.musically", ) - execute { + apply { val replacements = hashMapOf( "getSimCountryIso" to "getCountryIso", "getNetworkCountryIso" to "getCountryIso", diff --git a/patches/src/main/kotlin/app/revanced/patches/trakt/UnlockProPatch.kt b/patches/src/main/kotlin/app/revanced/patches/trakt/UnlockProPatch.kt index 12ae71987..4d9743f61 100644 --- a/patches/src/main/kotlin/app/revanced/patches/trakt/UnlockProPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/trakt/UnlockProPatch.kt @@ -9,7 +9,7 @@ val unlockProPatch = bytecodePatch( ) { compatibleWith("tv.trakt.trakt"("1.1.1")) - execute { + apply { arrayOf(isVIPFingerprint, isVIPEPFingerprint).onEach { fingerprint -> // Resolve both fingerprints on the same class. fingerprint.match(remoteUserFingerprint.originalClassDef) diff --git a/patches/src/main/kotlin/app/revanced/patches/tudortmund/lockscreen/ShowOnLockscreenPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tudortmund/lockscreen/ShowOnLockscreenPatch.kt index 5546b1182..5b8a93bd3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tudortmund/lockscreen/ShowOnLockscreenPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tudortmund/lockscreen/ShowOnLockscreenPatch.kt @@ -24,7 +24,7 @@ val showOnLockscreenPatch = bytecodePatch( compatibleWith("de.tudortmund.app") - execute { + apply { brightnessFingerprint.method.apply { // Find the instruction where the brightness value is loaded into a register val brightnessInstruction = instructions.firstNotNullOf { instruction -> diff --git a/patches/src/main/kotlin/app/revanced/patches/tumblr/ads/DisableDashboardAds.kt b/patches/src/main/kotlin/app/revanced/patches/tumblr/ads/DisableDashboardAds.kt index 4a9bbe297..c5310ea85 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tumblr/ads/DisableDashboardAds.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tumblr/ads/DisableDashboardAds.kt @@ -13,7 +13,7 @@ val disableDashboardAdsPatch = bytecodePatch( compatibleWith("com.tumblr") - execute { + apply { // The timeline object types are filtered by their name in the TimelineObjectType enum. // This is often different from the "object_type" returned in the api (noted in comments here) arrayOf( diff --git a/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/adfree/DisableAdFreeBannerPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/adfree/DisableAdFreeBannerPatch.kt index c166cb83b..71bdda792 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/adfree/DisableAdFreeBannerPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/adfree/DisableAdFreeBannerPatch.kt @@ -13,7 +13,7 @@ val disableAdFreeBannerPatch = bytecodePatch( compatibleWith("com.tumblr") - execute { + apply { // Disable the "AD_FREE_CTA_BANNER" ("Whether or not to show ad free prompt") feature flag. addFeatureFlagOverride("adFreeCtaBanner", "false") } diff --git a/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/inappupdate/DisableInAppUpdatePatch.kt b/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/inappupdate/DisableInAppUpdatePatch.kt index 3a46c19b2..0454cc9ef 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/inappupdate/DisableInAppUpdatePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/inappupdate/DisableInAppUpdatePatch.kt @@ -13,7 +13,7 @@ val disableInAppUpdatePatch = bytecodePatch( compatibleWith("com.tumblr") - execute { + apply { // Before checking for updates using Google Play core AppUpdateManager, the value of this feature flag is checked. // If this flag is false or the last update check was today and no update check is performed. addFeatureFlagOverride("inAppUpdate", "false") diff --git a/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/notifications/DisableBlogNotificationReminderPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/notifications/DisableBlogNotificationReminderPatch.kt index 863f3384c..1d0cee9c4 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/notifications/DisableBlogNotificationReminderPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/notifications/DisableBlogNotificationReminderPatch.kt @@ -10,7 +10,7 @@ val disableBlogNotificationReminderPatch = bytecodePatch( ) { compatibleWith("com.tumblr") - execute { + apply { isBlogNotifyEnabledFingerprint.method.addInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/DisableGiftMessagePopupPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/DisableGiftMessagePopupPatch.kt index ec3022fd7..68ca5ea2a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/DisableGiftMessagePopupPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/DisableGiftMessagePopupPatch.kt @@ -10,7 +10,7 @@ val disableGiftMessagePopupPatch = bytecodePatch( ) { compatibleWith("com.tumblr") - execute { + apply { showGiftMessagePopupFingerprint.method.addInstructions(0, "return-void") } } diff --git a/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/tv/DisableTumblrTvPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/tv/DisableTumblrTvPatch.kt index 00f8c3f37..1ee007660 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/tv/DisableTumblrTvPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tumblr/annoyances/tv/DisableTumblrTvPatch.kt @@ -13,7 +13,7 @@ val disableTumblrTvPatch = bytecodePatch( compatibleWith("com.tumblr") - execute { + apply { addFeatureFlagOverride("tumblrTvMobileNav", "false") } } diff --git a/patches/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt index a00635b18..5569aea82 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt @@ -23,7 +23,7 @@ val overrideFeatureFlagsPatch = bytecodePatch( description = "Forcibly set the value of A/B testing features of your choice.", ) { - execute { + apply { val configurationClass = getFeatureValueFingerprint.originalMethod.definingClass val featureClass = getFeatureValueFingerprint.originalMethod.parameterTypes[0].toString() diff --git a/patches/src/main/kotlin/app/revanced/patches/tumblr/fixes/FixOldVersionsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tumblr/fixes/FixOldVersionsPatch.kt index 3eec1dfbd..45a33aa75 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tumblr/fixes/FixOldVersionsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tumblr/fixes/FixOldVersionsPatch.kt @@ -12,7 +12,7 @@ val fixOldVersionsPatch = bytecodePatch( ) { compatibleWith("com.tumblr") - execute { + apply { val liveQueryParameters = listOf( ",?live_now", ",?live_streaming_user_id", diff --git a/patches/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/FilterTimelineObjectsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/FilterTimelineObjectsPatch.kt index 3f00ec6ca..01ba7793c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/FilterTimelineObjectsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tumblr/timelinefilter/FilterTimelineObjectsPatch.kt @@ -23,7 +23,7 @@ val filterTimelineObjectsPatch = bytecodePatch( ) { dependsOn(sharedExtensionPatch) - execute { + apply { val filterInsertIndex = timelineFilterExtensionFingerprint.instructionMatches.first().index timelineFilterExtensionFingerprint.method.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/twitch/ad/audio/AudioAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitch/ad/audio/AudioAdsPatch.kt index 24dbcfa25..307e2b184 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitch/ad/audio/AudioAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitch/ad/audio/AudioAdsPatch.kt @@ -23,7 +23,7 @@ val audioAdsPatch = bytecodePatch( compatibleWith("tv.twitch.android.app"("16.9.1", "25.3.0")) - execute { + apply { addResources("twitch", "ad.audio.audioAdsPatch") PreferenceScreen.ADS.CLIENT_SIDE.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/twitch/ad/embedded/EmbeddedAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitch/ad/embedded/EmbeddedAdsPatch.kt index 1262db7d6..cb58ba722 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitch/ad/embedded/EmbeddedAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitch/ad/embedded/EmbeddedAdsPatch.kt @@ -21,7 +21,7 @@ val embeddedAdsPatch = bytecodePatch( compatibleWith("tv.twitch.android.app"("16.9.1", "25.3.0")) - execute { + apply { addResources("twitch", "ad.embedded.embeddedAdsPatch") PreferenceScreen.ADS.SURESTREAM.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/twitch/ad/video/VideoAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitch/ad/video/VideoAdsPatch.kt index f9ea74076..1168f7263 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitch/ad/video/VideoAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitch/ad/video/VideoAdsPatch.kt @@ -27,7 +27,7 @@ val videoAdsPatch = bytecodePatch( addResourcesPatch, adPatch(conditionCall, skipLabelName) { createConditionInstructions, blockMethods -> - execute { + apply { addResources("twitch", "ad.video.videoAdsPatch") PreferenceScreen.ADS.CLIENT_SIDE.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/ShowDeletedMessagesPatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/ShowDeletedMessagesPatch.kt index eb34f75d7..762949433 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/ShowDeletedMessagesPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitch/chat/antidelete/ShowDeletedMessagesPatch.kt @@ -30,7 +30,7 @@ val showDeletedMessagesPatch = bytecodePatch( if-eqz $register, :no_spoiler """ - execute { + apply { addResources("twitch", "chat.antidelete.showDeletedMessagesPatch") PreferenceScreen.CHAT.GENERAL.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/twitch/chat/autoclaim/AutoClaimChannelPointsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitch/chat/autoclaim/AutoClaimChannelPointsPatch.kt index 74b482a81..29c20889f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitch/chat/autoclaim/AutoClaimChannelPointsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitch/chat/autoclaim/AutoClaimChannelPointsPatch.kt @@ -22,7 +22,7 @@ val autoClaimChannelPointsPatch = bytecodePatch( compatibleWith("tv.twitch.android.app"("16.9.1", "25.3.0")) - execute { + apply { addResources("twitch", "chat.autoclaim.autoClaimChannelPointsPatch") PreferenceScreen.CHAT.GENERAL.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/twitch/debug/DebugModePatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitch/debug/DebugModePatch.kt index f08036a01..62e8d6a3a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitch/debug/DebugModePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitch/debug/DebugModePatch.kt @@ -22,7 +22,7 @@ val debugModePatch = bytecodePatch( compatibleWith("tv.twitch.android.app"("16.9.1", "25.3.0")) - execute { + apply { addResources("twitch", "debug.debugModePatch") PreferenceScreen.MISC.OTHER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/twitch/misc/settings/SettingsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitch/misc/settings/SettingsPatch.kt index 5a0d48743..7fe6d21f5 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitch/misc/settings/SettingsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitch/misc/settings/SettingsPatch.kt @@ -50,7 +50,7 @@ val settingsPatch = bytecodePatch( compatibleWith("tv.twitch.android.app"("16.9.1")) - execute { + apply { addResources("twitch", "misc.settings.settingsPatch") preferences += NonInteractivePreference( @@ -166,7 +166,7 @@ val settingsPatch = bytecodePatch( ) } - finalize { + afterDependents { PreferenceScreen.close() } } diff --git a/patches/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/UnlockDownloadsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/UnlockDownloadsPatch.kt index 436718a1d..03bbc9f54 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/UnlockDownloadsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitter/interaction/downloads/UnlockDownloadsPatch.kt @@ -19,7 +19,7 @@ val unlockDownloadsPatch = bytecodePatch( ) { compatibleWith("com.twitter.android") - execute { + apply { fun Fingerprint.patch(getRegisterAndIndex: Fingerprint.() -> Pair) { val (index, register) = getRegisterAndIndex() method.addInstruction(index, "const/4 v$register, 0x1") diff --git a/patches/src/main/kotlin/app/revanced/patches/twitter/layout/viewcount/HideViewCountPatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitter/layout/viewcount/HideViewCountPatch.kt index e140f44b7..a703af725 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitter/layout/viewcount/HideViewCountPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitter/layout/viewcount/HideViewCountPatch.kt @@ -11,7 +11,7 @@ val hideViewCountPatch = bytecodePatch( ) { compatibleWith("com.twitter.android") - execute { + apply { viewCountsEnabledFingerprint.method.addInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/twitter/misc/dynamiccolor/DynamicColorPatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitter/misc/dynamiccolor/DynamicColorPatch.kt index 74a6136f8..2802c9caf 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitter/misc/dynamiccolor/DynamicColorPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitter/misc/dynamiccolor/DynamicColorPatch.kt @@ -17,7 +17,7 @@ val dynamicColorPatch = resourcePatch( ) ) - execute { + apply { val resDirectory = get("res") if (!resDirectory.isDirectory) throw PatchException("The res folder can not be found.") diff --git a/patches/src/main/kotlin/app/revanced/patches/twitter/misc/hook/HookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitter/misc/hook/HookPatch.kt index 682bb4f37..a366929f9 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitter/misc/hook/HookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitter/misc/hook/HookPatch.kt @@ -18,7 +18,7 @@ fun hookPatch( ) ) - execute { + apply { addJsonHook(JsonHook(hookClassDescriptor)) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/JsonHookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/JsonHookPatch.kt index 2e30ac3ea..66ab1997b 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/JsonHookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitter/misc/hook/json/JsonHookPatch.kt @@ -47,7 +47,7 @@ val jsonHookPatch = bytecodePatch( ) { dependsOn(sharedExtensionPatch) - execute { + apply { jsonHookPatchFingerprint.apply { val jsonHookPatch = firstClassDef(JSON_HOOK_PATCH_CLASS_DESCRIPTOR) @@ -73,7 +73,7 @@ val jsonHookPatch = bytecodePatch( ) } - finalize { + afterDependents { // Remove hooks.add(dummyHook). jsonHookPatchFingerprint.method.apply { val addDummyHookIndex = jsonHookPatchFingerprint.instructionMatches.last().index - 2 diff --git a/patches/src/main/kotlin/app/revanced/patches/twitter/misc/links/ChangeLinkSharingDomainPatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitter/misc/links/ChangeLinkSharingDomainPatch.kt index 4f0987da4..91f2dd040 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitter/misc/links/ChangeLinkSharingDomainPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitter/misc/links/ChangeLinkSharingDomainPatch.kt @@ -46,7 +46,7 @@ internal val domainNameOption = stringOption( // TODO restore this once Manager uses a fixed version of Patcher /* internal val changeLinkSharingDomainResourcePatch = resourcePatch { - execute { + apply { val domainName = domainNameOption.value!! val shareLinkTemplate = "https://$domainName/%1\$s/status/%2\$s" @@ -80,7 +80,7 @@ val changeLinkSharingDomainPatch = bytecodePatch( val domainName by domainNameOption() - execute { + apply { // Replace the domain name in the link sharing extension methods. linkSharingDomainHelperFingerprint.method.returnEarly(domainName!!) 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 082c82027..c8267a107 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 @@ -17,7 +17,7 @@ val sanitizeSharingLinksPatch = bytecodePatch( ) ) - execute { + apply { sanitizeSharingLinksFingerprint.method.addInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/viber/ads/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/viber/ads/HideAdsPatch.kt index 5e02955b8..8559b5176 100644 --- a/patches/src/main/kotlin/app/revanced/patches/viber/ads/HideAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/viber/ads/HideAdsPatch.kt @@ -16,7 +16,7 @@ val hideAdsPatch = bytecodePatch( ) { compatibleWith("com.viber.voip"("25.9.2.0", "26.1.2.0")) - execute { + apply { val method = findAdStringFingerprint.method // Find the ads free string index diff --git a/patches/src/main/kotlin/app/revanced/patches/viber/misc/navbar/HideNavigationButtons.kt b/patches/src/main/kotlin/app/revanced/patches/viber/misc/navbar/HideNavigationButtons.kt index 441936837..90bc66d48 100644 --- a/patches/src/main/kotlin/app/revanced/patches/viber/misc/navbar/HideNavigationButtons.kt +++ b/patches/src/main/kotlin/app/revanced/patches/viber/misc/navbar/HideNavigationButtons.kt @@ -23,7 +23,7 @@ val hideNavigationButtonsPatch = bytecodePatch( ) } - execute { + apply { // Items that won't be forcefully hidden. val allowedItems = hideOptions.filter { (option, enabled) -> enabled.value != true } diff --git a/patches/src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/FirebaseGetCertPatch.kt b/patches/src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/FirebaseGetCertPatch.kt index 416ccc8f5..9f49b000b 100644 --- a/patches/src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/FirebaseGetCertPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/warnwetter/misc/firebasegetcert/FirebaseGetCertPatch.kt @@ -8,7 +8,7 @@ val firebaseGetCertPatch = bytecodePatch( ) { compatibleWith("de.dwd.warnapp") - execute { + apply { listOf(getRegistrationCertFingerprint, getMessagingCertFingerprint).forEach { match -> match.method.returnEarly("0799DDF0414D3B3475E88743C91C0676793ED450") } diff --git a/patches/src/main/kotlin/app/revanced/patches/warnwetter/misc/promocode/PromoCodeUnlockPatch.kt b/patches/src/main/kotlin/app/revanced/patches/warnwetter/misc/promocode/PromoCodeUnlockPatch.kt index 208470aa4..231a0a89d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/warnwetter/misc/promocode/PromoCodeUnlockPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/warnwetter/misc/promocode/PromoCodeUnlockPatch.kt @@ -13,7 +13,7 @@ val promoCodeUnlockPatch = bytecodePatch( compatibleWith("de.dwd.warnapp"("4.2.2")) - execute { + apply { promoCodeUnlockFingerprint.method.addInstructions( 0, """ diff --git a/patches/src/main/kotlin/app/revanced/patches/willhaben/ads/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/willhaben/ads/HideAdsPatch.kt index 0d7119a0b..aa3ca94fb 100644 --- a/patches/src/main/kotlin/app/revanced/patches/willhaben/ads/HideAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/willhaben/ads/HideAdsPatch.kt @@ -10,7 +10,7 @@ internal val hideAdsPatch = bytecodePatch( ) { compatibleWith("at.willhaben") - execute { + apply { adResolverFingerprint.method.returnEarly(null) whAdViewInjectorFingerprint.method.returnEarly() } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt index 23165780d..d7f93e6d8 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/ad/general/HideAdsPatch.kt @@ -39,7 +39,7 @@ private val hideAdsResourcePatch = resourcePatch { addResourcesPatch, ) - execute { + apply { addResources("youtube", "ad.general.hideAdsResourcePatch") PreferenceScreen.ADS.addPreferences( @@ -83,7 +83,7 @@ val hideAdsPatch = bytecodePatch( ) ) - execute { + apply { // Hide end screen store banner. fullScreenEngagementAdContainerFingerprint.method.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt index 7a8850cf1..4739a53d5 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/ad/getpremium/HideGetPremiumPatch.kt @@ -32,7 +32,7 @@ val hideGetPremiumPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "ad.getpremium.hideGetPremiumPatch") PreferenceScreen.ADS.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt index acd3287c8..9621b567a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/ad/video/VideoAdsPatch.kt @@ -30,7 +30,7 @@ val videoAdsPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "ad.video.videoAdsPatch") PreferenceScreen.ADS.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlPatch.kt index b7f6352d1..f479d7330 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/CopyVideoUrlPatch.kt @@ -19,7 +19,7 @@ private val copyVideoUrlResourcePatch = resourcePatch { addResourcesPatch, ) - execute { + apply { addResources("youtube", "interaction.copyvideourl.copyVideoUrlResourcePatch") PreferenceScreen.PLAYER.addPreferences( @@ -60,7 +60,7 @@ val copyVideoUrlPatch = bytecodePatch( ) ) - execute { + apply { val extensionPlayerPackage = "Lapp/revanced/extension/youtube/videoplayer" val buttonsDescriptors = listOf( "$extensionPlayerPackage/CopyVideoUrlButton;", diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt index 48b6a2dc0..666e5fb8b 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch.kt @@ -33,7 +33,7 @@ val removeViewerDiscretionDialogPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "interaction.dialog.removeViewerDiscretionDialogPatch") PreferenceScreen.GENERAL_LAYOUT.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/doubletap/DisableChapterSkipDoubleTapPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/doubletap/DisableChapterSkipDoubleTapPatch.kt index f4c80afde..8a85caf7f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/doubletap/DisableChapterSkipDoubleTapPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/doubletap/DisableChapterSkipDoubleTapPatch.kt @@ -38,7 +38,7 @@ val disableDoubleTapActionsPatch = bytecodePatch( ) ) - execute { + apply { if (!is_20_14_or_greater) { // Show a message if users have version constrain off and are patching the oldest version, // just to prevent spamming a cryptic error message the user may not understand diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/DownloadsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/DownloadsPatch.kt index fb00d46aa..75d7aead3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/DownloadsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/DownloadsPatch.kt @@ -28,7 +28,7 @@ private val downloadsResourcePatch = resourcePatch { addResourcesPatch, ) - execute { + apply { addResources("youtube", "interaction.downloads.downloadsResourcePatch") PreferenceScreen.PLAYER.addPreferences( @@ -80,7 +80,7 @@ val downloadsPatch = bytecodePatch( ) ) - execute { + apply { initializeBottomControl(BUTTON_DESCRIPTOR) injectVisibilityCheckCall(BUTTON_DESCRIPTOR) diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt index 46d8ef72e..8114c661f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/DisablePreciseSeekingGesturePatch.kt @@ -23,7 +23,7 @@ val disablePreciseSeekingGesturePatch = bytecodePatch( addResourcesPatch, ) - execute { + apply { addResources("youtube", "interaction.seekbar.disablePreciseSeekingGesturePatch") PreferenceScreen.SEEKBAR.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt index 449574b03..50d506590 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSeekbarTappingPatch.kt @@ -26,7 +26,7 @@ val enableSeekbarTappingPatch = bytecodePatch( addResourcesPatch, ) - execute { + apply { addResources("youtube", "interaction.seekbar.enableSeekbarTappingPatch") PreferenceScreen.SEEKBAR.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt index 505810089..832a22cd2 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt @@ -31,7 +31,7 @@ val enableSlideToSeekPatch = bytecodePatch( versionCheckPatch, ) - execute { + apply { addResources("youtube", "interaction.seekbar.enableSlideToSeekPatch") PreferenceScreen.SEEKBAR.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/HideSeekbarPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/HideSeekbarPatch.kt index b39627690..3ca21258e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/HideSeekbarPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/HideSeekbarPatch.kt @@ -28,7 +28,7 @@ val hideSeekbarPatch = bytecodePatch( versionCheckPatch ) - execute { + apply { addResources("youtube", "layout.hide.seekbar.hideSeekbarPatch") PreferenceScreen.SEEKBAR.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/SeekbarThumbnailsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/SeekbarThumbnailsPatch.kt index aa7d48a1a..98969ed37 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/SeekbarThumbnailsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/SeekbarThumbnailsPatch.kt @@ -27,7 +27,7 @@ val seekbarThumbnailsPatch = bytecodePatch( versionCheckPatch, ) - execute { + apply { if (is_20_09_or_greater) { // High quality seekbar thumbnails is partially broken in 20.09 // and the code is completely removed in 20.10+ diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsPatch.kt index 303b70aaf..a251df4a2 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsPatch.kt @@ -31,7 +31,7 @@ private val swipeControlsResourcePatch = resourcePatch { versionCheckPatch, ) - execute { + apply { addResources("youtube", "interaction.swipecontrols.swipeControlsResourcePatch") // If fullscreen swipe is enabled in newer versions the app can crash. @@ -102,7 +102,7 @@ val swipeControlsPatch = bytecodePatch( ) ) - execute { + apply { val wrapperClass = swipeControlsHostActivityFingerprint.classDef val targetClass = mainActivityConstructorFingerprint.classDef diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt index 3a336b3a9..9964909e0 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/autocaptions/AutoCaptionsPatch.kt @@ -31,7 +31,7 @@ val autoCaptionsPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.autocaptions.autoCaptionsPatch") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/ChangeHeaderPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/ChangeHeaderPatch.kt index e7600187e..d253d7eb2 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/ChangeHeaderPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/branding/header/ChangeHeaderPatch.kt @@ -61,7 +61,7 @@ private val changeHeaderBytecodePatch = bytecodePatch { addBrandLicensePatch ) - execute { + apply { // Verify images exist. Resources are not used during patching but extension code does. arrayOf( "yt_ringo2_wordmark_header", @@ -127,7 +127,7 @@ val changeHeaderPatch = resourcePatch( """.trimIndentMultiline() ) - execute { + apply { addResources("youtube", "layout.branding.changeHeaderPatch") PreferenceScreen.GENERAL_LAYOUT.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt index 15cadfd63..3f52e5059 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/action/HideButtonsPatch.kt @@ -33,7 +33,7 @@ val hideButtonsPatch = resourcePatch( ) ) - execute { + apply { addResources("youtube", "layout.buttons.action.hideButtonsPatch") val preferences = mutableSetOf( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt index e2ed61167..62c8bea9a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/navigation/NavigationButtonsPatch.kt @@ -45,7 +45,7 @@ val navigationButtonsPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.buttons.navigation.navigationButtonsPatch") val preferences = mutableSetOf( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/overlay/HidePlayerOverlayButtonsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/overlay/HidePlayerOverlayButtonsPatch.kt index 6782b1fd8..2830e54a6 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/overlay/HidePlayerOverlayButtonsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/overlay/HidePlayerOverlayButtonsPatch.kt @@ -52,7 +52,7 @@ val hidePlayerOverlayButtonsPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.buttons.overlay.hidePlayerOverlayButtonsPatch") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/formfactor/ChangeFormFactorPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/formfactor/ChangeFormFactorPatch.kt index 7fe45cf8e..44135b146 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/formfactor/ChangeFormFactorPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/formfactor/ChangeFormFactorPatch.kt @@ -40,7 +40,7 @@ val changeFormFactorPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.formfactor.changeFormFactorPatch") PreferenceScreen.GENERAL_LAYOUT.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndScreenCardsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndScreenCardsPatch.kt index e084b962b..c7071bbbc 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndScreenCardsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreencards/HideEndScreenCardsPatch.kt @@ -32,7 +32,7 @@ private val hideEndScreenCardsResourcePatch = resourcePatch { addResourcesPatch, ) - execute { + apply { addResources("youtube", "layout.hide.endscreencards.hideEndScreenCardsResourcePatch") PreferenceScreen.PLAYER.addPreferences( @@ -70,7 +70,7 @@ val hideEndScreenCardsPatch = bytecodePatch( ) ) - execute { + apply { listOf( layoutCircleFingerprint, layoutIconFingerprint, diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreensuggestion/HideEndScreenSuggestedVideoPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreensuggestion/HideEndScreenSuggestedVideoPatch.kt index ffe0891fe..befd222dd 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreensuggestion/HideEndScreenSuggestedVideoPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/endscreensuggestion/HideEndScreenSuggestedVideoPatch.kt @@ -38,7 +38,7 @@ val hideEndScreenSuggestedVideoPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.hide.endscreensuggestion.hideEndScreenSuggestedVideoPatch") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt index 6becd8e3b..c5af0b303 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/fullscreenambientmode/DisableFullscreenAmbientModePatch.kt @@ -36,7 +36,7 @@ val disableFullscreenAmbientModePatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.hide.fullscreenambientmode.disableFullscreenAmbientModePatch") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt index 2475d969e..30553496d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/general/HideLayoutComponentsPatch.kt @@ -43,7 +43,7 @@ internal var barContainerHeightId = -1L private val hideLayoutComponentsResourcePatch = resourcePatch { dependsOn(resourceMappingPatch) - execute { + apply { albumCardId = getResourceId( ResourceType.LAYOUT, "album_card", @@ -106,7 +106,7 @@ val hideLayoutComponentsPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.hide.general.hideLayoutComponentsPatch") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt index ef67d6f46..c1a2a231f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/infocards/HideInfoCardsPatch.kt @@ -28,7 +28,7 @@ private val hideInfocardsResourcePatch = resourcePatch { dependsOn(resourceMappingPatch ) - execute { + apply { drawerResourceId = getResourceId( ResourceType.ID, @@ -59,7 +59,7 @@ val hideInfoCardsPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.hide.infocards.hideInfocardsResourcePatch") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt index 8c07b3424..636597777 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/player/flyoutmenupanel/HidePlayerFlyoutMenuPatch.kt @@ -31,7 +31,7 @@ val hidePlayerFlyoutMenuPatch = bytecodePatch( ) ) - execute { + apply { val filterClassDescriptor = "Lapp/revanced/extension/youtube/patches/components/PlayerFlyoutMenuItemsFilter;" addResources("youtube", "layout.hide.player.flyoutmenupanel.hidePlayerFlyoutMenuPatch") diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/relatedvideooverlay/HideRelatedVideoOverlayPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/relatedvideooverlay/HideRelatedVideoOverlayPatch.kt index c548c58b3..4d41c5e09 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/relatedvideooverlay/HideRelatedVideoOverlayPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/relatedvideooverlay/HideRelatedVideoOverlayPatch.kt @@ -36,7 +36,7 @@ val hideRelatedVideoOverlayPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.hide.relatedvideooverlay.hideRelatedVideoOverlayPatch") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt index 9f29511e4..f7cd529a3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/rollingnumber/DisableRollingNumberAnimationPatch.kt @@ -36,7 +36,7 @@ val disableRollingNumberAnimationPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.hide.rollingnumber.disableRollingNumberAnimationPatch") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt index 9c26bfa4f..92a288921 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/shorts/HideShortsComponentsPatch.kt @@ -48,7 +48,7 @@ private val hideShortsComponentsResourcePatch = resourcePatch { versionCheckPatch, ) - execute { + apply { val hideShortsAppShortcut by hideShortsAppShortcutOption val hideShortsWidget by hideShortsWidgetOption @@ -183,7 +183,7 @@ val hideShortsComponentsPatch = bytecodePatch( hideShortsAppShortcutOption() hideShortsWidgetOption() - execute { + apply { addLithoFilter(FILTER_CLASS_DESCRIPTOR) val id = getResourceId(ResourceType.DIMEN, "reel_player_right_pivot_v2_size") diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/signintotvpopup/DisableSignInToTvPatchPopup.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/signintotvpopup/DisableSignInToTvPatchPopup.kt index f128e3f19..cf9a990eb 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/signintotvpopup/DisableSignInToTvPatchPopup.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/signintotvpopup/DisableSignInToTvPatchPopup.kt @@ -33,7 +33,7 @@ val disableSignInToTvPopupPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.hide.signintotv.disableSignInToTvPopupPatch") PreferenceScreen.MISC.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt index e79dea12a..796c68488 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/hide/time/HideTimestampPatch.kt @@ -30,7 +30,7 @@ val hideTimestampPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.hide.time.hideTimestampPatch") PreferenceScreen.SEEKBAR.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/MiniplayerPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/MiniplayerPatch.kt index 0b8f69ca0..45bdb73f7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/MiniplayerPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/MiniplayerPatch.kt @@ -45,7 +45,7 @@ private val miniplayerResourcePatch = resourcePatch { versionCheckPatch, ) - execute { + apply { // Resource id is not used during patching, but is used by extension. // Verify the resource is present while patching. getResourceId( @@ -91,7 +91,7 @@ val miniplayerPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.miniplayer.miniplayerPatch") val preferences = mutableSetOf() diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt index 909a73371..55c005154 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/panels/popup/PlayerPopupPanelsPatch.kt @@ -30,7 +30,7 @@ val playerPopupPanelsPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.panels.popup.playerPopupPanelsPatch") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/ExitFullscreenPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/ExitFullscreenPatch.kt index 2a8f07370..a9c4b836d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/ExitFullscreenPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/ExitFullscreenPatch.kt @@ -45,7 +45,7 @@ internal val exitFullscreenPatch = bytecodePatch( val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/ExitFullscreenPatch;" - execute { + apply { addResources("youtube", "layout.player.fullscreen.exitFullscreenPatch") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenHookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenHookPatch.kt index 6be6014fe..fce9eedcb 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenHookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenHookPatch.kt @@ -23,7 +23,7 @@ internal val openVideosFullscreenHookPatch = bytecodePatch { versionCheckPatch ) - execute { + apply { var fingerprint: Fingerprint var insertIndex: Int diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenPatch.kt index 2a3e7d483..7864e353f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenPatch.kt @@ -30,7 +30,7 @@ val openVideosFullscreenPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.player.fullscreen.openVideosFullscreen") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityPatch.kt index 7e843849d..d4c3e1962 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityPatch.kt @@ -34,7 +34,7 @@ val customPlayerOverlayOpacityPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.player.overlay.customPlayerOverlayOpacityResourcePatch") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt index 943006308..b906dfeba 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/returnyoutubedislike/ReturnYouTubeDislikePatch.kt @@ -71,7 +71,7 @@ val returnYouTubeDislikePatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.returnyoutubedislike.returnYouTubeDislikePatch") PreferenceScreen.RETURN_YOUTUBE_DISLIKE.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt index b568b7c19..bfa0769d7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/searchbar/WideSearchbarPatch.kt @@ -46,7 +46,7 @@ val wideSearchbarPatch = bytecodePatch( ) ) - execute { + apply { if (is_20_31_or_greater) { // YT removed the legacy text search text field all code required to use it. // This functionality could be restored by adding a search text field to the toolbar diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt index c1319ac78..dbb7d762e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt @@ -42,7 +42,7 @@ val seekbarColorPatch = bytecodePatch( versionCheckPatch ) - execute { + apply { fun MutableMethod.addColorChangeInstructions(index: Int) { insertLiteralOverride( index, diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/shortsautoplay/ShortsAutoplayPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/shortsautoplay/ShortsAutoplayPatch.kt index cbe4633c0..3508d7e1a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/shortsautoplay/ShortsAutoplayPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/shortsautoplay/ShortsAutoplayPatch.kt @@ -51,7 +51,7 @@ val shortsAutoplayPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.shortsautoplay.shortsAutoplayPatch") PreferenceScreen.SHORTS.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/shortsplayer/OpenShortsInRegularPlayerPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/shortsplayer/OpenShortsInRegularPlayerPatch.kt index b1441c074..e9b21bdca 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/shortsplayer/OpenShortsInRegularPlayerPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/shortsplayer/OpenShortsInRegularPlayerPatch.kt @@ -53,7 +53,7 @@ val openShortsInRegularPlayerPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.shortsplayer.shortsPlayerTypePatch") PreferenceScreen.SHORTS.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockPatch.kt index c7c9fc0ab..25361cc65 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/sponsorblock/SponsorBlockPatch.kt @@ -46,7 +46,7 @@ private val sponsorBlockResourcePatch = resourcePatch { playerControlsPatch, ) - execute { + apply { addResources("youtube", "layout.sponsorblock.sponsorBlockResourcePatch") PreferenceScreen.SPONSORBLOCK.addPreferences( @@ -139,7 +139,7 @@ val sponsorBlockPatch = bytecodePatch( ) ) - execute { + apply { // Hook the video time methods. videoTimeHook( EXTENSION_SEGMENT_PLAYBACK_CONTROLLER_CLASS_DESCRIPTOR, diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt index 61fb25c9f..699c4b914 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/spoofappversion/SpoofAppVersionPatch.kt @@ -45,7 +45,7 @@ val spoofAppVersionPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.spoofappversion.spoofAppVersionPatch") PreferenceScreen.GENERAL_LAYOUT.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/startpage/ChangeStartPagePatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/startpage/ChangeStartPagePatch.kt index a7d254208..8a33bfaa9 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/startpage/ChangeStartPagePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/startpage/ChangeStartPagePatch.kt @@ -36,7 +36,7 @@ val changeStartPagePatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.startpage.changeStartPagePatch") PreferenceScreen.GENERAL_LAYOUT.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt index ca448d1b7..78badb380 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch.kt @@ -41,7 +41,7 @@ val disableResumingShortsOnStartupPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.startupshortsreset.disableResumingShortsOnStartupPatch") PreferenceScreen.SHORTS.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemePatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemePatch.kt index 15782751d..ee42590a3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemePatch.kt @@ -53,7 +53,7 @@ val themePatch = baseThemePatch( val themeResourcePatch = resourcePatch { dependsOn(resourceMappingPatch) - execute { + apply { overrideThemeColors( lightThemeBackgroundColor!!, darkThemeBackgroundColorOption.value!! diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt index d98ca06f6..46d1c3b42 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch.kt @@ -40,7 +40,7 @@ val alternativeThumbnailsPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.thumbnails.alternativeThumbnailsPatch") val entries = "revanced_alt_thumbnail_options_entries" diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/BypassImageRegionRestrictionsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/BypassImageRegionRestrictionsPatch.kt index ac90f1db2..709f75fc7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/BypassImageRegionRestrictionsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/thumbnails/BypassImageRegionRestrictionsPatch.kt @@ -34,7 +34,7 @@ val bypassImageRegionRestrictionsPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "layout.thumbnails.bypassImageRegionRestrictionsPatch") PreferenceScreen.MISC.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/announcements/AnnouncementsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/announcements/AnnouncementsPatch.kt index 4dad64da0..cd00c6295 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/announcements/AnnouncementsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/announcements/AnnouncementsPatch.kt @@ -30,7 +30,7 @@ val announcementsPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "misc.announcements.announcementsPatch") PreferenceScreen.MISC.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch.kt index e36f43322..60da0304d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch.kt @@ -50,7 +50,7 @@ val backgroundPlaybackPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "misc.backgroundplayback.backgroundPlaybackPatch") PreferenceScreen.SHORTS.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt index 881ce5214..eb4c1789a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/dimensions/spoof/SpoofDeviceDimensionsPatch.kt @@ -31,7 +31,7 @@ val spoofDeviceDimensionsPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "misc.dimensions.spoof.spoofDeviceDimensionsPatch") PreferenceScreen.MISC.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/FixBackToExitGesturePatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/FixBackToExitGesturePatch.kt index 45c507763..c953d1a04 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/FixBackToExitGesturePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/fix/backtoexitgesture/FixBackToExitGesturePatch.kt @@ -15,7 +15,7 @@ internal val fixBackToExitGesturePatch = bytecodePatch( description = "Fixes the swipe back to exit gesture." ) { - execute { + apply { recyclerViewTopScrollingFingerprint.let { it.method.addInstructionsAtControlFlowLabel( it.instructionMatches.last().index + 1, diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/fix/contentprovider/FIxContentProviderPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/fix/contentprovider/FIxContentProviderPatch.kt index a88934c17..d8eb6af8a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/fix/contentprovider/FIxContentProviderPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/fix/contentprovider/FIxContentProviderPatch.kt @@ -18,7 +18,7 @@ internal val fixContentProviderPatch = bytecodePatch{ sharedExtensionPatch ) - execute { + apply { unstableContentProviderFingerprint.let { val insertIndex = it.instructionMatches.first().index diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playbackspeed/FixPlaybackSpeedWhilePlayingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playbackspeed/FixPlaybackSpeedWhilePlayingPatch.kt index d7f8dd099..a6f34b75d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playbackspeed/FixPlaybackSpeedWhilePlayingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/fix/playbackspeed/FixPlaybackSpeedWhilePlayingPatch.kt @@ -36,7 +36,7 @@ val fixPlaybackSpeedWhilePlayingPatch = bytecodePatch { versionCheckPatch, ) - execute { + apply { if (!is_19_34_or_greater) { return@execute } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/gms/AccountCredentialsInvalidTextPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/gms/AccountCredentialsInvalidTextPatch.kt index 6d0a1d99c..0dd38409e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/gms/AccountCredentialsInvalidTextPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/gms/AccountCredentialsInvalidTextPatch.kt @@ -17,7 +17,7 @@ internal val accountCredentialsInvalidTextPatch = bytecodePatch { addResourcesPatch ) - execute { + apply { addResources("youtube", "misc.gms.accountCredentialsInvalidTextPatch") // If the user recently changed their account password, diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/hapticfeedback/DisableHapticFeedbackPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/hapticfeedback/DisableHapticFeedbackPatch.kt index b41d86d47..6d18c444e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/hapticfeedback/DisableHapticFeedbackPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/hapticfeedback/DisableHapticFeedbackPatch.kt @@ -33,7 +33,7 @@ val disableHapticFeedbackPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "misc.hapticfeedback.disableHapticFeedbackPatch") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/imageurlhook/CronetImageUrlHook.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/imageurlhook/CronetImageUrlHook.kt index 7d080f24e..729f9a113 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/imageurlhook/CronetImageUrlHook.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/imageurlhook/CronetImageUrlHook.kt @@ -29,7 +29,7 @@ val cronetImageUrlHookPatch = bytecodePatch( ) { dependsOn(sharedExtensionPatch) - execute { + apply { loadImageUrlMethod = messageDigestImageUrlFingerprint .match(messageDigestImageUrlParentFingerprint.originalClassDef).method diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt index 23e4b71ef..1c05cef48 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/links/BypassURLRedirectsPatch.kt @@ -33,7 +33,7 @@ val bypassURLRedirectsPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "misc.links.bypassURLRedirectsPatch") PreferenceScreen.MISC.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt index ea88ec744..fd750035f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/links/OpenLinksExternallyPatch.kt @@ -48,7 +48,7 @@ val openLinksExternallyPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "misc.links.openLinksExternallyPatch") PreferenceScreen.MISC.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt index 9b6dbd2be..d0582b5bb 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/litho/filter/LithoFilterPatch.kt @@ -66,7 +66,7 @@ val lithoFilterPatch = bytecodePatch( * } * } */ - execute { + apply { // Remove dummy filter from extenion static field // and add the filters included during patching. lithoFilterFingerprint.method.apply { @@ -210,7 +210,7 @@ val lithoFilterPatch = bytecodePatch( // endregion } - finalize { + afterDependents { lithoFilterFingerprint.method.replaceInstruction(0, "const/16 v0, $filterCount") } } \ No newline at end of file diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/loopvideo/LoopVideoPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/loopvideo/LoopVideoPatch.kt index 1e87c0d4a..bbdd16645 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/loopvideo/LoopVideoPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/loopvideo/LoopVideoPatch.kt @@ -35,7 +35,7 @@ val loopVideoPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "misc.loopvideo.loopVideoPatch") PreferenceScreen.MISC.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/loopvideo/button/LoopVideoButtonPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/loopvideo/button/LoopVideoButtonPatch.kt index 0c3b9dc68..62ce94750 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/loopvideo/button/LoopVideoButtonPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/loopvideo/button/LoopVideoButtonPatch.kt @@ -15,7 +15,7 @@ import app.revanced.util.copyResources private val loopVideoButtonResourcePatch = resourcePatch { dependsOn(playerControlsResourcePatch) - execute { + apply { copyResources( "loopvideobutton", ResourceGroup( @@ -43,7 +43,7 @@ internal val loopVideoButtonPatch = bytecodePatch( playerControlsPatch, ) - execute { + apply { addResources("youtube", "misc.loopvideo.button.loopVideoButtonPatch") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt index 8e7f1b75e..43fc20df3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt @@ -47,7 +47,7 @@ val navigationBarHookPatch = bytecodePatch(description = "Hooks the active navig resourceMappingPatch, // Used by fingerprints resourcePatch { // Copy missing notification icon. - execute { + apply { copyResources( "navigationbuttons", ResourceGroup( @@ -59,7 +59,7 @@ val navigationBarHookPatch = bytecodePatch(description = "Hooks the active navig } ) - execute { + apply { fun MutableMethod.addHook(hook: NavigationHook, insertPredicate: Instruction.() -> Boolean) { val filtered = instructions.filter(insertPredicate) if (filtered.isEmpty()) throw PatchException("Could not find insert indexes") diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsOverlayVisibilityPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsOverlayVisibilityPatch.kt index 0c6a1d0d4..749334e04 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsOverlayVisibilityPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsOverlayVisibilityPatch.kt @@ -15,7 +15,7 @@ private const val EXTENSION_PLAYER_CONTROLS_VISIBILITY_HOOK_CLASS_DESCRIPTOR = val playerControlsOverlayVisibilityPatch = bytecodePatch { dependsOn(sharedExtensionPatch) - execute { + apply { playerControlsVisibilityEntityModelFingerprint.let { it.method.apply { val startIndex = it.instructionMatches.first().index diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsPatch.kt index 1fa2a6751..dbbb431e8 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsPatch.kt @@ -57,7 +57,7 @@ internal val playerControlsResourcePatch = resourcePatch { lateinit var bottomTargetDocument: Document - execute { + apply { val targetResourceName = "youtube_controls_bottom_ui_container.xml" bottomTargetDocument = document("res/layout/$targetResourceName") @@ -142,7 +142,7 @@ internal val playerControlsResourcePatch = resourcePatch { } } - finalize { + afterDependents { val childNodes = bottomTargetDocument.childNodes arrayOf( @@ -243,7 +243,7 @@ val playerControlsPatch = bytecodePatch( versionCheckPatch ) - execute { + apply { playerBottomControlsInflateFingerprint.let { it.method.apply { inflateBottomControlMethod = this diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/PlayerTypeHookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/PlayerTypeHookPatch.kt index b9b58e5bd..c39dea6b0 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/PlayerTypeHookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/PlayerTypeHookPatch.kt @@ -21,7 +21,7 @@ val playerTypeHookPatch = bytecodePatch( ) { dependsOn(sharedExtensionPatch, resourceMappingPatch) - execute { + apply { val playerOverlaysSetPlayerTypeFingerprint = fingerprint { accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) returns("V") diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playservice/VersionCheckPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playservice/VersionCheckPatch.kt index ff131156a..aa761dac9 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playservice/VersionCheckPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playservice/VersionCheckPatch.kt @@ -101,7 +101,7 @@ var is_20_46_or_greater : Boolean by Delegates.notNull() val versionCheckPatch = resourcePatch( description = "Uses the Play Store service version to find the major/minor version of the YouTube target app.", ) { - execute { + apply { // The app version is missing from the decompiled manifest, // so instead use the Google Play services version and compare against specific releases. val playStoreServicesVersion = findPlayStoreServicesVersion() diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/recyclerviewtree/hook/RecyclerViewTreeHookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/recyclerviewtree/hook/RecyclerViewTreeHookPatch.kt index 176314b17..fa5adde94 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/recyclerviewtree/hook/RecyclerViewTreeHookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/recyclerviewtree/hook/RecyclerViewTreeHookPatch.kt @@ -10,7 +10,7 @@ lateinit var addRecyclerViewTreeHook: (String) -> Unit val recyclerViewTreeHookPatch = bytecodePatch { dependsOn(sharedExtensionPatch) - execute { + apply { recyclerViewTreeObserverFingerprint.method.apply { val insertIndex = recyclerViewTreeObserverFingerprint.instructionMatches.first().index + 1 val recyclerViewParameter = 2 diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt index 2b2f19021..646dfea6c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt @@ -67,7 +67,7 @@ private val settingsResourcePatch = resourcePatch { ) ) - execute { + apply { // Use same colors as stock YouTube. overrideThemeColors("@color/yt_white1", "@color/yt_black3") @@ -170,7 +170,7 @@ val settingsPatch = bytecodePatch( checkEnvironmentPatch, ) - execute { + apply { addResources("youtube", "misc.settings.settingsPatch") // Add an "about" preference to the top. @@ -263,7 +263,7 @@ val settingsPatch = bytecodePatch( ) } - finalize { + afterDependents { PreferenceScreen.close() } } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/codecs/DisableVideoCodecsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/codecs/DisableVideoCodecsPatch.kt index 99953f276..ed76901a5 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/codecs/DisableVideoCodecsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/codecs/DisableVideoCodecsPatch.kt @@ -64,7 +64,7 @@ val disableVideoCodecsPatch = bytecodePatch( ) ) - execute { + apply { addResources("youtube", "video.codecs.disableVideoCodecsPatch") PreferenceScreen.VIDEO.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt index 3e6e4d74e..4e6384eb3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt @@ -91,7 +91,7 @@ val videoInformationPatch = bytecodePatch( versionCheckPatch, ) - execute { + apply { playerInitMethod = playerInitFingerprint.classDef.methods.first { MethodUtil.isConstructor(it) } // Find the location of the first invoke-direct call and extract the register storing the 'this' object reference. diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt index 07e83e510..3ec288910 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt @@ -40,7 +40,7 @@ val playerResponseMethodHookPatch = bytecodePatch { versionCheckPatch, ) - execute { + apply { val fingerprint : Fingerprint if (is_20_46_or_greater) { parameterIsShortAndOpeningOrPlaying = 13 @@ -82,7 +82,7 @@ val playerResponseMethodHookPatch = bytecodePatch { } } - finalize { + afterDependents { fun hookVideoId(hook: Hook) { playerResponseMethod.addInstruction( 0, diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/quality/AdvancedVideoQualityMenuPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/quality/AdvancedVideoQualityMenuPatch.kt index 5731bb461..5942c0768 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/quality/AdvancedVideoQualityMenuPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/quality/AdvancedVideoQualityMenuPatch.kt @@ -40,7 +40,7 @@ internal val advancedVideoQualityMenuPatch = bytecodePatch { resourceMappingPatch ) - execute { + apply { addResources("youtube", "video.quality.advancedVideoQualityMenuPatch") settingsMenuVideoQualityGroup.add( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt index da912cdc9..7b373afe1 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/quality/RememberVideoQualityPatch.kt @@ -30,7 +30,7 @@ val rememberVideoQualityPatch = bytecodePatch { versionCheckPatch, ) - execute { + apply { addResources("youtube", "video.quality.rememberVideoQualityPatch") settingsMenuVideoQualityGroup.addAll(listOf( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/quality/VideoQualityDialogButtonPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/quality/VideoQualityDialogButtonPatch.kt index 0473f29db..f0cd306c1 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/quality/VideoQualityDialogButtonPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/quality/VideoQualityDialogButtonPatch.kt @@ -15,7 +15,7 @@ import app.revanced.util.copyResources private val videoQualityButtonResourcePatch = resourcePatch { dependsOn(playerControlsPatch) - execute { + apply { copyResources( "qualitybutton", ResourceGroup( @@ -43,7 +43,7 @@ val videoQualityDialogButtonPatch = bytecodePatch( playerControlsPatch, ) - execute { + apply { addResources("youtube", "video.quality.button.videoQualityDialogButtonPatch") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/quality/VideoQualityPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/quality/VideoQualityPatch.kt index e1e58e482..0b4f9138e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/quality/VideoQualityPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/quality/VideoQualityPatch.kt @@ -31,7 +31,7 @@ val videoQualityPatch = bytecodePatch( ) ) - execute { + apply { PreferenceScreen.VIDEO.addPreferences( // Keep the preferences organized together. PreferenceCategory( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt index 2a19db7ca..cecb755e0 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/PlaybackSpeedPatch.kt @@ -35,7 +35,7 @@ val playbackSpeedPatch = bytecodePatch( ) ) - execute { + apply { PreferenceScreen.VIDEO.addPreferences( PreferenceCategory( key = "revanced_zz_video_key", // Dummy key to force the speed settings last. diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/button/PlaybackSpeedButtonPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/button/PlaybackSpeedButtonPatch.kt index 2d752eb6d..98c425f89 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/button/PlaybackSpeedButtonPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/button/PlaybackSpeedButtonPatch.kt @@ -19,7 +19,7 @@ import app.revanced.util.copyResources private val playbackSpeedButtonResourcePatch = resourcePatch { dependsOn(playerControlsPatch) - execute { + apply { copyResources( "speedbutton", ResourceGroup( @@ -48,7 +48,7 @@ val playbackSpeedButtonPatch = bytecodePatch( videoInformationPatch, ) - execute { + apply { addResources("youtube", "video.speed.button.playbackSpeedButtonPatch") PreferenceScreen.PLAYER.addPreferences( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt index 5f1d3927a..448ffead3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt @@ -50,7 +50,7 @@ internal val customPlaybackSpeedPatch = bytecodePatch( resourceMappingPatch ) - execute { + apply { addResources("youtube", "video.speed.custom.customPlaybackSpeedPatch") settingsMenuVideoSpeedGroup.addAll( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/remember/RememberPlaybackSpeedPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/remember/RememberPlaybackSpeedPatch.kt index 23faa8b94..3ec1b8b6a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/remember/RememberPlaybackSpeedPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/remember/RememberPlaybackSpeedPatch.kt @@ -27,7 +27,7 @@ internal val rememberPlaybackSpeedPatch = bytecodePatch { customPlaybackSpeedPatch ) - execute { + apply { addResources("youtube", "video.speed.remember.rememberPlaybackSpeedPatch") settingsMenuVideoSpeedGroup.addAll( diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt index 2c203e09f..e7f0ae457 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt @@ -91,7 +91,7 @@ val videoIdPatch = bytecodePatch( playerResponseMethodHookPatch, ) - execute { + apply { videoIdFingerprint.match(videoIdParentFingerprint.originalClassDef).let { it.method.apply { videoIdMethod = this