Skip to content

Commit 585313d

Browse files
authored
Merge pull request #475 from swakwork/dev
fix(Twitter): Change patch name to `Enable app icons`
2 parents 29af3eb + 5a7ef46 commit 585313d

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

src/main/kotlin/crimera/patches/twitter/premium/customAppIcon/CustomAppIconPatch.kt

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ package crimera.patches.twitter.premium.customAppIcon
22

33
import app.revanced.patcher.data.BytecodeContext
44
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
5-
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
65
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
76
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
8-
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
97
import app.revanced.patcher.fingerprint.MethodFingerprint
108
import app.revanced.patcher.patch.BytecodePatch
119
import app.revanced.patcher.patch.PatchException
@@ -16,37 +14,46 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
1614
import crimera.patches.twitter.misc.settings.SettingsPatch
1715
import crimera.patches.twitter.misc.settings.fingerprints.SettingsStatusLoadFingerprint
1816

19-
object CustomiseAppIconFingerprint:MethodFingerprint(
20-
strings = listOf(
21-
"current_app_icon_id"
22-
)
17+
object CustomiseAppIconFingerprint : MethodFingerprint(
18+
strings =
19+
listOf(
20+
"current_app_icon_id",
21+
),
2322
)
2423

2524
@Patch(
26-
name = "Enable app icon settings",
27-
dependencies = [SettingsPatch::class,RedirectBMTab::class],
25+
name = "Enable app icons",
26+
dependencies = [SettingsPatch::class, RedirectBMTab::class],
2827
compatiblePackages = [CompatiblePackage("com.twitter.android")],
2928
use = true,
30-
requiresIntegrations = true
29+
requiresIntegrations = true,
3130
)
3231
@Suppress("unused")
33-
object CustomiseAppIcon:BytecodePatch(
34-
setOf(CustomiseAppIconFingerprint,SettingsStatusLoadFingerprint)
35-
){
32+
object CustomiseAppIcon : BytecodePatch(
33+
setOf(CustomiseAppIconFingerprint, SettingsStatusLoadFingerprint),
34+
) {
3635
override fun execute(context: BytecodeContext) {
37-
val result = CustomiseAppIconFingerprint.result
38-
?:throw PatchException("CustomiseAppIconFingerprint not found")
36+
val result =
37+
CustomiseAppIconFingerprint.result
38+
?: throw PatchException("CustomiseAppIconFingerprint not found")
3939

4040
val method = result.mutableClass.methods.last()
41-
val loc = method.getInstructions().last { it.opcode == Opcode.MOVE_RESULT }.location.index
41+
val loc =
42+
method
43+
.getInstructions()
44+
.last { it.opcode == Opcode.MOVE_RESULT }
45+
.location.index
4246

4347
val reg = method.getInstruction<OneRegisterInstruction>(loc).registerA
4448

45-
method.addInstruction(loc+1,"""
49+
method.addInstruction(
50+
loc + 1,
51+
"""
4652
const v$reg, 0x0
47-
""".trimIndent())
53+
""".trimIndent(),
54+
)
4855

4956
SettingsStatusLoadFingerprint.enableSettings("customAppIcon")
50-
//end
57+
// end
5158
}
52-
}
59+
}

0 commit comments

Comments
 (0)