diff --git a/patches/src/main/kotlin/app/revanced/patches/facebook/ads/story/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/facebook/ads/story/Fingerprints.kt index 293d7ee82f..10e98846a5 100644 --- a/patches/src/main/kotlin/app/revanced/patches/facebook/ads/story/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/facebook/ads/story/Fingerprints.kt @@ -1,24 +1,24 @@ package app.revanced.patches.facebook.ads.story -import app.revanced.patcher.fingerprint +import app.revanced.patcher.* +import app.revanced.patcher.patch.BytecodePatchContext import com.android.tools.smali.dexlib2.iface.value.StringEncodedValue -internal val adsInsertionFingerprint = fieldFingerprint( - fieldValue = "AdBucketDataSourceUtil\$attemptAdsInsertion\$1", +internal val BytecodePatchContext.adsInsertionMethod by runMethod( + fieldValue = $$"AdBucketDataSourceUtil$attemptAdsInsertion$1", ) -internal val fetchMoreAdsFingerprint = fieldFingerprint( - fieldValue = "AdBucketDataSourceUtil\$attemptFetchMoreAds\$1", +internal val BytecodePatchContext.fetchMoreAdsMethod by runMethod( + fieldValue = $$"AdBucketDataSourceUtil$attemptFetchMoreAds$1", ) -internal fun fieldFingerprint(fieldValue: String) = fingerprint { - returns("V") - parameters() - custom { method, classDef -> - method.name == "run" && - classDef.fields.any any@{ field -> - if (field.name != "__redex_internal_original_name") return@any false - (field.initialValue as? StringEncodedValue)?.value == fieldValue - } +internal fun runMethod(fieldValue: String) = gettingFirstMutableMethodDeclaratively { + name("run") + returnType("V") + parameterTypes() + custom { + immutableClassDef.anyField { + name == "__redex_internal_original_name" && (initialValue as? StringEncodedValue)?.value == fieldValue + } } } 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 7f03abcff2..2f9af038cf 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 @@ -1,7 +1,8 @@ package app.revanced.patches.facebook.ads.story -import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patcher.patch.bytecodePatch +import app.revanced.util.returnEarly +import com.android.tools.smali.dexlib2.mutable.MutableMethod @Suppress("unused") val hideStoryAdsPatch = bytecodePatch( @@ -11,11 +12,6 @@ val hideStoryAdsPatch = bytecodePatch( compatibleWith("com.facebook.katana") apply { - setOf( - fetchMoreAdsFingerprint, - adsInsertionFingerprint, - ).forEach { fingerprint -> - fingerprint.method.replaceInstruction(0, "return-void") - } + setOf(fetchMoreAdsMethod, adsInsertionMethod).forEach(MutableMethod::returnEarly) } } 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 9cdb79a254..2b3b6b0109 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 @@ -14,16 +14,14 @@ val removeDeviceIntegrityChecksPatch = bytecodePatch( apply { isDeviceRootedMethod.returnEarly(false) - isDeviceBootloaderOpenMethod.apply { - addInstructions( - 0, - """ - const/4 v0, 0x0 - invoke-static { v0 }, Lkotlin/coroutines/jvm/internal/Boxing;->boxBoolean(Z)Ljava/lang/Boolean; - move-result-object v0 - return-object v0 - """ - ) - } + isDeviceBootloaderOpenMethod.addInstructions( + 0, + """ + const/4 v0, 0x0 + invoke-static { v0 }, Lkotlin/coroutines/jvm/internal/Boxing;->boxBoolean(Z)Ljava/lang/Boolean; + move-result-object v0 + return-object v0 + """, + ) } } 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 a16e7e92f0..087f270f2d 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 @@ -1,7 +1,7 @@ package app.revanced.patches.inshorts.ad -import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.patch.bytecodePatch +import app.revanced.util.returnEarly @Suppress("unused") val hideAdsPatch = bytecodePatch( @@ -10,11 +10,6 @@ val hideAdsPatch = bytecodePatch( compatibleWith("com.nis.app") apply { - inshortsAdsMethod.addInstruction( - 0, - """ - return-void - """, - ) + inshortsAdsMethod.returnEarly() } } 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 b6091f402e..8525c805d8 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 @@ -17,7 +17,7 @@ internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/instagr val limitFeedToFollowedProfiles = bytecodePatch( name = "Limit feed to followed profiles", description = "Filters the home feed to display only content from profiles you follow.", - use = false + use = false, ) { compatibleWith("com.instagram.android") @@ -31,12 +31,11 @@ val limitFeedToFollowedProfiles = bytecodePatch( */ val mainFeedRequestHeaderFieldName: String - with(mainFeedHeaderMapFinderMethod) { + mainFeedHeaderMapFinderMethod.apply { mainFeedRequestHeaderFieldName = indexOfFirstInstructionOrThrow { getReference().let { ref -> ref?.type == "Ljava/util/Map;" && - ref.definingClass == mainFeedRequestClassMethod.classDef.toString() - + ref.definingClass == mainFeedRequestClassMethod.classDef.toString() } }.let { instructionIndex -> getInstruction(instructionIndex).getReference()!!.name @@ -46,7 +45,7 @@ val limitFeedToFollowedProfiles = bytecodePatch( val initMainFeedRequestFingerprint = fingerprint { custom { method, classDef -> method.name == "" && - classDef == mainFeedRequestClassMethod.classDef + classDef == mainFeedRequestClassMethod.classDef } } initMainFeedRequestFingerprint.method.apply { @@ -65,7 +64,7 @@ val limitFeedToFollowedProfiles = bytecodePatch( """ invoke-static { v$paramHeaderRegister }, $EXTENSION_CLASS_DESCRIPTOR->setFollowingHeader(Ljava/util/Map;)Ljava/util/Map; move-result-object v$paramHeaderRegister - """ + """, ) } } 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 e1f0897ba0..ced1a10790 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 @@ -1,19 +1,13 @@ package app.revanced.patches.memegenerator.detection.license -import app.revanced.patcher.extensions.replaceInstructions import app.revanced.patcher.patch.bytecodePatch +import app.revanced.util.returnEarly val licenseValidationPatch = bytecodePatch( description = "Disables Firebase license validation.", ) { apply { - licenseValidationMethod.replaceInstructions( - 0, - """ - const/4 p0, 0x1 - return p0 - """, - ) + licenseValidationMethod.returnEarly(true) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/music/misc/backgroundplayback/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/music/misc/backgroundplayback/Fingerprints.kt index 75ed5193b0..22c3de805a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/misc/backgroundplayback/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/misc/backgroundplayback/Fingerprints.kt @@ -23,7 +23,7 @@ internal val BytecodePatchContext.backgroundPlaybackDisableMethod by gettingFirs } internal val BytecodePatchContext.kidsBackgroundPlaybackPolicyControllerMethod by gettingFirstMutableMethodDeclaratively { - accessFlags(AccessFlags.PUBLIC, AccessFlags.STATIC) + accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) returnType("V") parameterTypes("I", "L", "Z") opcodes( @@ -40,4 +40,4 @@ internal val BytecodePatchContext.kidsBackgroundPlaybackPolicyControllerMethod b Opcode.IF_NE, Opcode.IPUT_BOOLEAN, ) -} \ No newline at end of file +} 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 07be634ae6..c3f84adb49 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 @@ -1,15 +1,15 @@ package app.revanced.patches.serviceportalbund.detection.root -import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.patch.creatingBytecodePatch +import app.revanced.util.returnEarly @Suppress("unused", "ObjectPropertyName") val `Remove root detection` by creatingBytecodePatch( - description = "Removes the check for root permissions and unlocked bootloader." + description = "Removes the check for root permissions and unlocked bootloader.", ) { compatibleWith("at.gv.bka.serviceportal") apply { - rootDetectionMethod.addInstruction(0, "return-void") + rootDetectionMethod.returnEarly() } } 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 40d738a48c..8083163d19 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 @@ -26,7 +26,7 @@ internal fun sanitizeSharingLinksPatch( block: BytecodePatchBuilder.() -> Unit = {}, executeBlock: BytecodePatchContext.() -> Unit = {}, preferenceScreen: BasePreferenceScreen.Screen, - replaceMusicLinksWithYouTube: Boolean = false + replaceMusicLinksWithYouTube: Boolean = false, ) = bytecodePatch( name = "Sanitize sharing links", description = "Removes the tracking query parameters from shared links.", @@ -50,12 +50,12 @@ internal fun sanitizeSharingLinksPatch( tag = "app.revanced.extension.shared.settings.preference.NoTitlePreferenceCategory", preferences = setOf( sanitizePreference, - SwitchPreference("revanced_replace_music_with_youtube") - ) + SwitchPreference("revanced_replace_music_with_youtube"), + ), ) } else { sanitizePreference - } + }, ) fun MatchBuilder.hookUrlString(matchIndex: Int) { @@ -67,7 +67,7 @@ internal fun sanitizeSharingLinksPatch( """ invoke-static { v$urlRegister }, $EXTENSION_CLASS_DESCRIPTOR->sanitize(Ljava/lang/String;)Ljava/lang/String; move-result-object v$urlRegister - """ + """, ) } @@ -80,7 +80,7 @@ internal fun sanitizeSharingLinksPatch( """ invoke-static { v$urlRegister }, $EXTENSION_CLASS_DESCRIPTOR->sanitize(Ljava/lang/String;)Ljava/lang/String; move-result-object v$urlRegister - """ + """, ) } @@ -93,4 +93,4 @@ internal fun sanitizeSharingLinksPatch( // Native system share sheet. youTubeSystemShareSheetMethodMatch.hookIntentPutExtra(3) } -} \ No newline at end of file +} diff --git a/patches/src/main/kotlin/app/revanced/patches/soundcloud/ad/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/soundcloud/ad/Fingerprints.kt index aca1c656a0..e914de5c32 100644 --- a/patches/src/main/kotlin/app/revanced/patches/soundcloud/ad/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/soundcloud/ad/Fingerprints.kt @@ -5,14 +5,14 @@ import app.revanced.patcher.patch.BytecodePatchContext import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode -internal val BytecodePatchContext.interceptFingerprint by gettingFirstMutableMethodDeclaratively("SC-Mob-UserPlan", "Configuration") { +internal val interceptMethodMatch = firstMethodComposite("SC-Mob-UserPlan", "Configuration") { accessFlags(AccessFlags.PUBLIC) returnType("L") parameterTypes("L") opcodes( Opcode.MOVE_RESULT_OBJECT, Opcode.INVOKE_INTERFACE, - Opcode.MOVE_RESULT_OBJECT + Opcode.MOVE_RESULT_OBJECT, ) } 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 a28d432dd0..d2d223f59d 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 @@ -50,8 +50,8 @@ val hideAdsPatch = bytecodePatch( // Prevent verification of an HTTP header containing the user's current plan, which would contradict the previous patch. - val conditionIndex = interceptFingerprint.instructionMatches.last().index + 1 // TODO - interceptFingerprint.addInstruction( + val conditionIndex = interceptMethodMatch.indices.last() + 1 // TODO + interceptMethodMatch.method.addInstruction( conditionIndex, "return-object p1", ) 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 3b2f2c14ba..ebdf1bd0f5 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 @@ -1,10 +1,10 @@ package app.revanced.patches.tiktok.interaction.cleardisplay +import app.revanced.patcher.extensions.ExternalLabel import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructionsWithLabels import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.patch.bytecodePatch -import app.revanced.patcher.extensions.ExternalLabel import app.revanced.patches.tiktok.shared.onRenderFirstFrameFingerprint import app.revanced.util.indexOfFirstInstructionOrThrow import com.android.tools.smali.dexlib2.Opcode @@ -21,13 +21,13 @@ val rememberClearDisplayPatch = bytecodePatch( ) apply { - onClearDisplayEventMethod.let { + onClearDisplayEventMethod.apply { // region Hook the "Clear display" configuration save event to remember the state of clear display. - val isEnabledIndex = it.indexOfFirstInstructionOrThrow(Opcode.IGET_BOOLEAN) + 1 - val isEnabledRegister = it.getInstruction(isEnabledIndex - 1).registerA + val isEnabledIndex = indexOfFirstInstructionOrThrow(Opcode.IGET_BOOLEAN) + 1 + val isEnabledRegister = getInstruction(isEnabledIndex - 1).registerA - it.addInstructions( + addInstructions( isEnabledIndex, "invoke-static { v$isEnabledRegister }, " + "Lapp/revanced/extension/tiktok/cleardisplay/RememberClearDisplayPatch;->rememberClearDisplayState(Z)V", @@ -37,7 +37,7 @@ val rememberClearDisplayPatch = bytecodePatch( // region Override the "Clear display" configuration load event to load the state of clear display. - val clearDisplayEventClass = it.parameters[0].type + val clearDisplayEventClass = parameters[0].type onRenderFirstFrameFingerprint.method.addInstructionsWithLabels( 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 199137e58d..4179a5e016 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 @@ -24,48 +24,46 @@ val playbackSpeedPatch = bytecodePatch( ) apply { - setSpeedMethod.let { onVideoSwiped -> - getSpeedMethod.apply { - val injectIndex = - indexOfFirstInstructionOrThrow { getReference()?.returnType == "F" } + 2 - val register = getInstruction(injectIndex - 1).registerA + getSpeedMethod.apply { + val injectIndex = + indexOfFirstInstructionOrThrow { getReference()?.returnType == "F" } + 2 + val register = getInstruction(injectIndex - 1).registerA - addInstruction( - injectIndex, - "invoke-static { v$register }," + - " Lapp/revanced/extension/tiktok/speed/PlaybackSpeedPatch;->rememberPlaybackSpeed(F)V", - ) - } - - // By default, the playback speed will reset to 1.0 at the start of each video. - // Instead, override it with the desired playback speed. - onRenderFirstFrameFingerprint.method.addInstructions( - 0, - """ - # Video playback location (e.g. home page, following page or search result page) retrieved using getEnterFrom method. - const/4 v0, 0x1 - invoke-virtual { p0, v0 }, ${getEnterFromFingerprint.originalMethod} - move-result-object v0 - - # Model of current video retrieved using getCurrentAweme method. - invoke-virtual { p0 }, Lcom/ss/android/ugc/aweme/feed/panel/BaseListFragmentPanel;->getCurrentAweme()Lcom/ss/android/ugc/aweme/feed/model/Aweme; - move-result-object v1 - - # Desired playback speed retrieved using getPlaybackSpeed method. - invoke-static { }, Lapp/revanced/extension/tiktok/speed/PlaybackSpeedPatch;->getPlaybackSpeed()F - move-result v2 - invoke-static { v0, v1, v2 }, ${onVideoSwiped.originalMethod} // TODO - """, - ) - - // Force enable the playback speed option for all videos. - onVideoSwiped.classDef.methods.find { method -> method.returnType == "Z" }?.addInstructions( - 0, - """ - const/4 v0, 0x1 - return v0 - """, + addInstruction( + injectIndex, + "invoke-static { v$register }," + + " Lapp/revanced/extension/tiktok/speed/PlaybackSpeedPatch;->rememberPlaybackSpeed(F)V", ) } + + // By default, the playback speed will reset to 1.0 at the start of each video. + // Instead, override it with the desired playback speed. + onRenderFirstFrameFingerprint.method.addInstructions( + 0, + """ + # Video playback location (e.g. home page, following page or search result page) retrieved using getEnterFrom method. + const/4 v0, 0x1 + invoke-virtual { p0, v0 }, ${getEnterFromFingerprint.originalMethod} + move-result-object v0 + + # Model of current video retrieved using getCurrentAweme method. + invoke-virtual { p0 }, Lcom/ss/android/ugc/aweme/feed/panel/BaseListFragmentPanel;->getCurrentAweme()Lcom/ss/android/ugc/aweme/feed/model/Aweme; + move-result-object v1 + + # Desired playback speed retrieved using getPlaybackSpeed method. + invoke-static { }, Lapp/revanced/extension/tiktok/speed/PlaybackSpeedPatch;->getPlaybackSpeed()F + move-result v2 + invoke-static { v0, v1, v2 }, $setSpeedMethod + """, + ) + + // Force enable the playback speed option for all videos. + setSpeedMethod.classDef.methods.find { method -> method.returnType == "Z" }?.addInstructions( + 0, + """ + const/4 v0, 0x1 + return v0 + """, + ) } } 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 13a2a2e0c3..4469b8df63 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 @@ -1,7 +1,8 @@ package app.revanced.patches.tiktok.misc.login.fixgoogle -import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.patch.bytecodePatch +import app.revanced.util.returnEarly +import com.android.tools.smali.dexlib2.mutable.MutableMethod @Suppress("unused") val fixGoogleLoginPatch = bytecodePatch( @@ -14,17 +15,6 @@ val fixGoogleLoginPatch = bytecodePatch( ) apply { - listOf( - googleOneTapAuthAvailableMethod, - googleAuthAvailableMethod, - ).forEach { method -> - method.addInstructions( - 0, - """ - const/4 v0, 0x0 - return v0 - """, - ) - } + listOf(googleOneTapAuthAvailableMethod, googleAuthAvailableMethod).forEach(MutableMethod::returnEarly) } } 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 f726d2d516..663ba1c014 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 @@ -29,8 +29,8 @@ val `Sanitize sharing links` by creatingBytecodePatch( apply { urlShorteningMethod.apply { val invokeIndex = indexOfFirstInstructionOrThrow { - val ref = getReference() - ref?.name == "LIZ" && ref.definingClass.startsWith("LX/") + val reference = getReference() + reference?.name == "LIZ" && reference.definingClass.startsWith("LX/") } val moveResultIndex = indexOfFirstInstructionOrThrow(invokeIndex, Opcode.MOVE_RESULT_OBJECT) @@ -74,7 +74,7 @@ val `Sanitize sharing links` by creatingBytecodePatch( :skip_sanitization nop - """ + """, ) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/twitch/ad/embedded/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/twitch/ad/embedded/Fingerprints.kt index 5620b92e19..aa6fcd58ee 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitch/ad/embedded/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitch/ad/embedded/Fingerprints.kt @@ -7,5 +7,5 @@ import app.revanced.patcher.patch.BytecodePatchContext internal val BytecodePatchContext.createsUsherClientMethod by gettingFirstMutableMethodDeclaratively { name("buildOkHttpClient") - definingClass("Ltv/twitch/android/network/OkHttpClientFactory;"::endsWith) + definingClass("Ltv/twitch/android/network/OkHttpClientFactory;") } diff --git a/patches/src/main/kotlin/app/revanced/patches/twitch/misc/settings/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/twitch/misc/settings/Fingerprints.kt index 267e11bce4..a2e8c0f6e7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitch/misc/settings/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitch/misc/settings/Fingerprints.kt @@ -5,7 +5,7 @@ import app.revanced.patcher.patch.BytecodePatchContext import com.android.tools.smali.dexlib2.AccessFlags internal val BytecodePatchContext.menuGroupsOnClickMethod by gettingFirstMutableMethodDeclaratively { - name(String::contains("render")) // TODO + name("render"::contains) definingClass("/SettingsMenuViewDelegate;"::endsWith) accessFlags(AccessFlags.PRIVATE, AccessFlags.STATIC, AccessFlags.FINAL) returnType("V") 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 f6028e916e..d95a340abc 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 @@ -1,7 +1,7 @@ package app.revanced.patches.twitter.layout.viewcount -import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.patch.bytecodePatch +import app.revanced.util.returnEarly @Suppress("unused") val hideViewCountPatch = bytecodePatch( @@ -12,12 +12,6 @@ val hideViewCountPatch = bytecodePatch( compatibleWith("com.twitter.android") apply { - viewCountsEnabledMethod.addInstructions( - 0, - """ - const/4 v0, 0x0 - return v0 - """, - ) + viewCountsEnabledMethod.returnEarly() } } 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 ca3d7fc2f8..7fed6ff70a 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 @@ -9,8 +9,8 @@ val firebaseGetCertPatch = bytecodePatch( compatibleWith("de.dwd.warnapp") apply { - listOf(getRegistrationCertMethod, getMessagingCertMethod).forEach { match -> - match.returnEarly("0799DDF0414D3B3475E88743C91C0676793ED450") + listOf(getRegistrationCertMethod, getMessagingCertMethod).forEach { method -> + method.returnEarly("0799DDF0414D3B3475E88743C91C0676793ED450") } } } 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 03760684c8..ac8900c7c1 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 @@ -11,7 +11,7 @@ internal val hideAdsPatch = bytecodePatch( compatibleWith("at.willhaben") apply { - adResolverMethod.returnEarly(null) // TODO + adResolverMethod.returnEarly() // TODO whAdViewInjectorMethod.returnEarly() } }