fix(Tumblr): Restore compatibility with latest versions (#2955)
This commit is contained in:
parent
912a77a7f4
commit
2954ba78d2
|
@ -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
|
||||
)
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
)
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue