feat(canary/ComponentsV2): 7.15.1 @ LavaDesu/Aliucord@0116d81ce2

This commit is contained in:
LavaDesu 2025-07-15 19:19:54 +10:00
parent 03a3d69447
commit 50ba1acc23
Signed by: cilly
GPG key ID: 6500251E087653C9
3 changed files with 13 additions and 2 deletions

View file

@ -1,6 +1,6 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
version = "7.15.0"
version = "7.15.1"
description = "Beta backport of ComponentsV2"
aliucord {
@ -14,6 +14,9 @@ aliucord {
Changelog {added marginTop}
======================
# 7.15.1
* Fix broken reply preview >w<
# 7.15.0
* Initial release >w<
""".trimIndent())

View file

@ -19,6 +19,7 @@ import com.discord.api.botuikit.gson.ComponentRuntimeTypeAdapter
import com.discord.api.botuikit.gson.ComponentTypeTypeAdapter
import com.discord.api.message.attachment.MessageAttachment
import com.discord.models.botuikit.*
import com.discord.models.message.Message
import com.discord.stores.StoreApplicationInteractions.InteractionSendState
import com.discord.utilities.view.extensions.ViewExtensions
import com.discord.widgets.botuikit.*
@ -33,6 +34,8 @@ import com.lytefast.flexinput.R
import de.robv.android.xposed.XposedBridge
import java.io.File
val Message.isComponentV2 get() = (flags shr 15) and 1 == 1L
@AliucordPlugin(requiresRestart = true)
@Suppress("unused")
class ComponentsV2 : Plugin() {
@ -194,6 +197,10 @@ class ComponentsV2 : Plugin() {
else -> null
}
}
patcher.after<Message>("shouldShowReplyPreviewAsAttachment") { param ->
if (this.isComponentV2) param.result = true
}
}
override fun stop(context: Context) {

View file

@ -1,6 +1,7 @@
package com.aliucord.coreplugins.componentsv2
import com.aliucord.api.PatcherAPI
import com.aliucord.coreplugins.isComponentV2
import com.aliucord.patcher.*
import com.discord.api.channel.Channel
import com.discord.api.role.GuildRole
@ -34,7 +35,7 @@ fun patchMessageItems(patcher: PatcherAPI) {
val result = (param.result as MutableList<ChatListEntry>)
val meId = param.args[15] as Long
result.forEachIndexed { index, entry ->
if (entry is BotUiComponentEntry && ((entry.message.flags shr 15) and 1 == 1L)) {
if (entry is BotUiComponentEntry && entry.message.isComponentV2) {
val fields = BotUiComponentV2Entry.V2Fields(state, meId, channel, guildMembers, guildRoles)
result[index] = BotUiComponentV2Entry.fromV1(entry, fields)
}