diff --git a/src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/fingerprints/ShowGiftMessagePopupFingerprint.kt b/src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/fingerprints/ShowGiftMessagePopupFingerprint.kt index c65cd0291c..dc5a168a6b 100644 --- a/src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/fingerprints/ShowGiftMessagePopupFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tumblr/annoyances/popups/fingerprints/ShowGiftMessagePopupFingerprint.kt @@ -1,9 +1,12 @@ package app.revanced.patches.tumblr.annoyances.popups.fingerprints +import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint +import com.android.tools.smali.dexlib2.AccessFlags // This method is responsible for loading and displaying the visual Layout of the Gift Message Popup. internal object ShowGiftMessagePopupFingerprint : MethodFingerprint( - strings = listOf("activity", "anchorView"), - customFingerprint = { methodDef, _ -> methodDef.definingClass.endsWith("GiftMessagePopup;") } + strings = listOf("activity", "anchorView", "textMessage"), + returnType = "V", + accessFlags = AccessFlags.FINAL or AccessFlags.PUBLIC ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt b/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt index 267ab358a9..94367009c3 100644 --- a/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt +++ b/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt @@ -28,6 +28,9 @@ object OverrideFeatureFlagsPatch : BytecodePatch( internal lateinit var addOverride: (name: String, value: String) -> Unit private set override fun execute(context: BytecodeContext) = GetFeatureValueFingerprint.result?.let { + val configurationClass = it.method.definingClass + val featureClass = it.method.parameterTypes[0].toString() + // The method we want to inject into does not have enough registers, so we inject a helper method // and inject more instructions into it later, see addOverride. // This is not in an integration since the unused variable would get compiled away and the method would @@ -35,7 +38,7 @@ object OverrideFeatureFlagsPatch : BytecodePatch( val helperMethod = ImmutableMethod( it.method.definingClass, "getValueOverride", - listOf(ImmutableMethodParameter("Lcom/tumblr/configuration/Feature;", null, "feature")), + listOf(ImmutableMethodParameter(featureClass, null, "feature")), "Ljava/lang/String;", AccessFlags.PUBLIC or AccessFlags.FINAL, null, @@ -50,7 +53,7 @@ object OverrideFeatureFlagsPatch : BytecodePatch( 0, """ # toString() the enum value - invoke-virtual {p1}, Lcom/tumblr/configuration/Feature;->toString()Ljava/lang/String; + invoke-virtual {p1}, $featureClass->toString()Ljava/lang/String; move-result-object v0 # !!! If you add more instructions above this line, update helperInsertIndex below! @@ -75,7 +78,7 @@ object OverrideFeatureFlagsPatch : BytecodePatch( getFeatureIndex, """ # Call the Helper Method with the Feature - invoke-virtual {p0, p1}, Lcom/tumblr/configuration/Configuration;->getValueOverride(Lcom/tumblr/configuration/Feature;)Ljava/lang/String; + invoke-virtual {p0, p1}, $configurationClass->getValueOverride($featureClass)Ljava/lang/String; move-result-object v0 # If it returned null, skip if-eqz v0, :is_null diff --git a/src/main/kotlin/app/revanced/patches/tumblr/featureflags/fingerprints/GetFeatureValueFingerprint.kt b/src/main/kotlin/app/revanced/patches/tumblr/featureflags/fingerprints/GetFeatureValueFingerprint.kt index d0274125d1..0088c3aa6b 100644 --- a/src/main/kotlin/app/revanced/patches/tumblr/featureflags/fingerprints/GetFeatureValueFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/tumblr/featureflags/fingerprints/GetFeatureValueFingerprint.kt @@ -1,6 +1,8 @@ package app.revanced.patches.tumblr.featureflags.fingerprints +import app.revanced.patcher.extensions.or import app.revanced.patcher.fingerprint.MethodFingerprint +import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode // This fingerprint targets the method to get the value of a Feature in the class "com.tumblr.configuration.Feature". @@ -19,5 +21,7 @@ internal object GetFeatureValueFingerprint : MethodFingerprint( Opcode.INVOKE_STATIC, Opcode.MOVE_RESULT ), - customFingerprint = { method, _ -> method.definingClass == "Lcom/tumblr/configuration/Configuration;" } + returnType = "Ljava/lang/String;", + parameters = listOf("L", "Z"), + accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL ) \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/tumblr/live/DisableTumblrLivePatch.kt b/src/main/kotlin/app/revanced/patches/tumblr/live/DisableTumblrLivePatch.kt index 8cbdaca6e9..f5b53133a6 100644 --- a/src/main/kotlin/app/revanced/patches/tumblr/live/DisableTumblrLivePatch.kt +++ b/src/main/kotlin/app/revanced/patches/tumblr/live/DisableTumblrLivePatch.kt @@ -8,11 +8,11 @@ import app.revanced.patches.tumblr.featureflags.OverrideFeatureFlagsPatch import app.revanced.patches.tumblr.timelinefilter.TimelineFilterPatch @Patch( - name = "Disable Tumblr Live", description = "Disable the Tumblr Live tab button and dashboard carousel.", dependencies = [OverrideFeatureFlagsPatch::class, TimelineFilterPatch::class], compatiblePackages = [CompatiblePackage("com.tumblr")], ) +@Deprecated("Tumblr Live was removed and is no longer served in the feed, making this patch useless.") @Suppress("unused") object DisableTumblrLivePatch : BytecodePatch(emptySet()) { override fun execute(context: BytecodeContext) {