@@ -15,9 +15,9 @@ import java.util.logging.Logger
1515
1616internal const val EXTENSION_CLASS_DESCRIPTOR = " Lapp/revanced/twitter/patches/links/ChangeLinkSharingDomainPatch;"
1717
18- internal val domainNameOption by stringOption(
18+ internal val domainNameOption = stringOption(
1919 key = " domainName" ,
20- default = " https:// fxtwitter.com" ,
20+ default = " fxtwitter.com" ,
2121 title = " Domain name" ,
2222 description = " The domain name to use when sharing links." ,
2323 required = true ,
@@ -28,7 +28,7 @@ internal val domainNameOption by stringOption(
2828 // may not allow network connections or the network may be down.
2929 try {
3030 InetAddress .getByName(it)
31- } catch (e : UnknownHostException ) {
31+ } catch (_ : UnknownHostException ) {
3232 Logger .getLogger(this ::class .java.name).warning(
3333 " Host \" $it \" did not resolve to any domain."
3434 )
@@ -38,13 +38,9 @@ internal val domainNameOption by stringOption(
3838
3939internal val changeLinkSharingDomainResourcePatch = resourcePatch {
4040 execute {
41- val domainName = domainNameOption!!
41+ val domainName = domainNameOption.value !!
4242
43- val shareLinkTemplate = if (domainName.endsWith(" /" )) {
44- " $domainName %1\$ s/status/%2\$ s"
45- } else {
46- " $domainName /%1\$ s/status/%2\$ s"
47- }
43+ val shareLinkTemplate = " https://$domainName /%1\$ s/status/%2\$ s"
4844
4945 document(" res/values/strings.xml" ).use { document ->
5046 document.documentElement.childNodes.findElementByAttributeValueOrThrow(
@@ -58,7 +54,8 @@ internal val changeLinkSharingDomainResourcePatch = resourcePatch {
5854@Suppress(" unused" )
5955val changeLinkSharingDomainPatch = bytecodePatch(
6056 name = PATCH_NAME_CHANGE_LINK_SHARING_DOMAIN ,
61- description = PATCH_DESCRIPTION_CHANGE_LINK_SHARING_DOMAIN
57+ description = PATCH_DESCRIPTION_CHANGE_LINK_SHARING_DOMAIN ,
58+ use = false
6259) {
6360 dependsOn(
6461 changeLinkSharingDomainResourcePatch,
@@ -72,11 +69,11 @@ val changeLinkSharingDomainPatch = bytecodePatch(
7269 )
7370 )
7471
75- execute {
76- val domainName = domainNameOption!!
72+ val domainName by domainNameOption()
7773
74+ execute {
7875 // Replace the domain name in the link sharing extension methods.
79- linkSharingDomainHelperFingerprint.method.returnEarly(domainName)
76+ linkSharingDomainHelperFingerprint.method.returnEarly(domainName!! )
8077
8178 // Replace the domain name when copying a link with "Copy link" button.
8279 linkBuilderFingerprint.method.addInstructions(
0 commit comments