@@ -11,8 +11,8 @@ import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
11
11
import app.revanced.patches.shared.misc.mapping.resourceMappings
12
12
import app.revanced.patches.twitter.misc.extension.sharedExtensionPatch
13
13
import app.revanced.util.indexOfFirstLiteralInstructionOrThrow
14
+ import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
14
15
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
15
- import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
16
16
17
17
internal var tweetShareLinkTemplateId = - 1L
18
18
private set
@@ -25,15 +25,7 @@ internal val changeLinkSharingDomainResourcePatch = resourcePatch {
25
25
}
26
26
}
27
27
28
- // This method is used to build the link that is shared when the "Share via..." button is pressed.
29
- private const val FORMAT_METHOD_RESOURCE_REFERENCE =
30
- " Lapp/revanced/extension/twitter/patches/links/ChangeLinkSharingDomainPatch;->" +
31
- " formatResourceLink([Ljava/lang/Object;)Ljava/lang/String;"
32
-
33
- // This method is used to build the link that is shared when the "Copy link" button is pressed.
34
- private const val FORMAT_METHOD_REFERENCE =
35
- " Lapp/revanced/extension/twitter/patches/links/ChangeLinkSharingDomainPatch;->" +
36
- " formatLink(JLjava/lang/String;)Ljava/lang/String;"
28
+ private const val EXTENSION_CLASS_DESCRIPTOR = " Lapp/revanced/twitter/patches/links/ChangeLinkSharingDomainPatch;"
37
29
38
30
@Suppress(" unused" )
39
31
val changeLinkSharingDomainPatch = bytecodePatch(
@@ -71,7 +63,7 @@ val changeLinkSharingDomainPatch = bytecodePatch(
71
63
addInstructions(
72
64
0 ,
73
65
"""
74
- invoke-static { p0, p1, p2 }, $FORMAT_METHOD_REFERENCE
66
+ invoke-static { p0, p1, p2 }, $EXTENSION_CLASS_DESCRIPTOR ->formatLink(JLjava/lang/String;)Ljava/lang/String;
75
67
move-result-object p0
76
68
return-object p0
77
69
""" ,
@@ -84,12 +76,12 @@ val changeLinkSharingDomainPatch = bytecodePatch(
84
76
85
77
// Format the link with the new domain name register (1 instruction below the const).
86
78
val formatLinkCallIndex = templateIdConstIndex + 1
87
- val formatLinkCall = getInstruction<Instruction35c >(formatLinkCallIndex)
79
+ val register = getInstruction<FiveRegisterInstruction >(formatLinkCallIndex).registerE
88
80
89
81
// Replace the original method call with the new method call.
90
82
replaceInstruction(
91
83
formatLinkCallIndex,
92
- " invoke-static { v${formatLinkCall.registerE} }, $FORMAT_METHOD_RESOURCE_REFERENCE " ,
84
+ " invoke-static { v$register }, $EXTENSION_CLASS_DESCRIPTOR ->formatResourceLink([Ljava/lang/Object;)Ljava/lang/String; " ,
93
85
)
94
86
}
95
87
}
0 commit comments