mirror of
https://github.com/revanced/revanced-patches
synced 2024-12-27 12:15:50 +01:00
fix(Twitter - Change link sharing domain): Use correct extension package
This commit is contained in:
parent
9194e15a4b
commit
ad7fab6731
@ -11,8 +11,8 @@ import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
|||||||
import app.revanced.patches.shared.misc.mapping.resourceMappings
|
import app.revanced.patches.shared.misc.mapping.resourceMappings
|
||||||
import app.revanced.patches.twitter.misc.extension.sharedExtensionPatch
|
import app.revanced.patches.twitter.misc.extension.sharedExtensionPatch
|
||||||
import app.revanced.util.indexOfFirstLiteralInstructionOrThrow
|
import app.revanced.util.indexOfFirstLiteralInstructionOrThrow
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
|
||||||
|
|
||||||
internal var tweetShareLinkTemplateId = -1L
|
internal var tweetShareLinkTemplateId = -1L
|
||||||
private set
|
private set
|
||||||
@ -25,15 +25,7 @@ internal val changeLinkSharingDomainResourcePatch = resourcePatch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method is used to build the link that is shared when the "Share via..." button is pressed.
|
private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/twitter/patches/links/ChangeLinkSharingDomainPatch;"
|
||||||
private const val FORMAT_METHOD_RESOURCE_REFERENCE =
|
|
||||||
"Lapp/revanced/extension/twitter/patches/links/ChangeLinkSharingDomainPatch;->" +
|
|
||||||
"formatResourceLink([Ljava/lang/Object;)Ljava/lang/String;"
|
|
||||||
|
|
||||||
// This method is used to build the link that is shared when the "Copy link" button is pressed.
|
|
||||||
private const val FORMAT_METHOD_REFERENCE =
|
|
||||||
"Lapp/revanced/extension/twitter/patches/links/ChangeLinkSharingDomainPatch;->" +
|
|
||||||
"formatLink(JLjava/lang/String;)Ljava/lang/String;"
|
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val changeLinkSharingDomainPatch = bytecodePatch(
|
val changeLinkSharingDomainPatch = bytecodePatch(
|
||||||
@ -71,7 +63,7 @@ val changeLinkSharingDomainPatch = bytecodePatch(
|
|||||||
addInstructions(
|
addInstructions(
|
||||||
0,
|
0,
|
||||||
"""
|
"""
|
||||||
invoke-static { p0, p1, p2 }, $FORMAT_METHOD_REFERENCE
|
invoke-static { p0, p1, p2 }, $EXTENSION_CLASS_DESCRIPTOR->formatLink(JLjava/lang/String;)Ljava/lang/String;
|
||||||
move-result-object p0
|
move-result-object p0
|
||||||
return-object p0
|
return-object p0
|
||||||
""",
|
""",
|
||||||
@ -84,12 +76,12 @@ val changeLinkSharingDomainPatch = bytecodePatch(
|
|||||||
|
|
||||||
// Format the link with the new domain name register (1 instruction below the const).
|
// Format the link with the new domain name register (1 instruction below the const).
|
||||||
val formatLinkCallIndex = templateIdConstIndex + 1
|
val formatLinkCallIndex = templateIdConstIndex + 1
|
||||||
val formatLinkCall = getInstruction<Instruction35c>(formatLinkCallIndex)
|
val register = getInstruction<FiveRegisterInstruction>(formatLinkCallIndex).registerE
|
||||||
|
|
||||||
// Replace the original method call with the new method call.
|
// Replace the original method call with the new method call.
|
||||||
replaceInstruction(
|
replaceInstruction(
|
||||||
formatLinkCallIndex,
|
formatLinkCallIndex,
|
||||||
"invoke-static { v${formatLinkCall.registerE} }, $FORMAT_METHOD_RESOURCE_REFERENCE",
|
"invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR->formatResourceLink([Ljava/lang/Object;)Ljava/lang/String;",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user