diff --git a/src/main/kotlin/crimera/patches/twitter/premium/customAppIcon/CustomAppIconPatch.kt b/src/main/kotlin/crimera/patches/twitter/premium/customAppIcon/CustomAppIconPatch.kt index 02a2131c..731a5611 100644 --- a/src/main/kotlin/crimera/patches/twitter/premium/customAppIcon/CustomAppIconPatch.kt +++ b/src/main/kotlin/crimera/patches/twitter/premium/customAppIcon/CustomAppIconPatch.kt @@ -2,10 +2,8 @@ package crimera.patches.twitter.premium.customAppIcon import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction -import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstructions -import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction import app.revanced.patcher.fingerprint.MethodFingerprint import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.PatchException @@ -16,37 +14,46 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import crimera.patches.twitter.misc.settings.SettingsPatch import crimera.patches.twitter.misc.settings.fingerprints.SettingsStatusLoadFingerprint -object CustomiseAppIconFingerprint:MethodFingerprint( - strings = listOf( - "current_app_icon_id" - ) +object CustomiseAppIconFingerprint : MethodFingerprint( + strings = + listOf( + "current_app_icon_id", + ), ) @Patch( - name = "Enable app icon settings", - dependencies = [SettingsPatch::class,RedirectBMTab::class], + name = "Enable app icons", + dependencies = [SettingsPatch::class, RedirectBMTab::class], compatiblePackages = [CompatiblePackage("com.twitter.android")], use = true, - requiresIntegrations = true + requiresIntegrations = true, ) @Suppress("unused") -object CustomiseAppIcon:BytecodePatch( - setOf(CustomiseAppIconFingerprint,SettingsStatusLoadFingerprint) -){ +object CustomiseAppIcon : BytecodePatch( + setOf(CustomiseAppIconFingerprint, SettingsStatusLoadFingerprint), +) { override fun execute(context: BytecodeContext) { - val result = CustomiseAppIconFingerprint.result - ?:throw PatchException("CustomiseAppIconFingerprint not found") + val result = + CustomiseAppIconFingerprint.result + ?: throw PatchException("CustomiseAppIconFingerprint not found") val method = result.mutableClass.methods.last() - val loc = method.getInstructions().last { it.opcode == Opcode.MOVE_RESULT }.location.index + val loc = + method + .getInstructions() + .last { it.opcode == Opcode.MOVE_RESULT } + .location.index val reg = method.getInstruction(loc).registerA - method.addInstruction(loc+1,""" + method.addInstruction( + loc + 1, + """ const v$reg, 0x0 - """.trimIndent()) + """.trimIndent(), + ) SettingsStatusLoadFingerprint.enableSettings("customAppIcon") - //end + // end } -} \ No newline at end of file +}