Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Twitter): Change patch name to Enable app icons #475

Merged
merged 1 commit into from
Nov 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<OneRegisterInstruction>(loc).registerA

method.addInstruction(loc+1,"""
method.addInstruction(
loc + 1,
"""
const v$reg, 0x0
""".trimIndent())
""".trimIndent(),
)

SettingsStatusLoadFingerprint.enableSettings("customAppIcon")
//end
// end
}
}
}
Loading