feat(canary/ComponentsV2): 7.15.1 @ LavaDesu/Aliucord@0116d81ce2
This commit is contained in:
parent
03a3d69447
commit
50ba1acc23
3 changed files with 13 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
|
|
||||||
version = "7.15.0"
|
version = "7.15.1"
|
||||||
description = "Beta backport of ComponentsV2"
|
description = "Beta backport of ComponentsV2"
|
||||||
|
|
||||||
aliucord {
|
aliucord {
|
||||||
|
|
@ -14,6 +14,9 @@ aliucord {
|
||||||
|
|
||||||
Changelog {added marginTop}
|
Changelog {added marginTop}
|
||||||
======================
|
======================
|
||||||
|
# 7.15.1
|
||||||
|
* Fix broken reply preview >w<
|
||||||
|
|
||||||
# 7.15.0
|
# 7.15.0
|
||||||
* Initial release >w<
|
* Initial release >w<
|
||||||
""".trimIndent())
|
""".trimIndent())
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import com.discord.api.botuikit.gson.ComponentRuntimeTypeAdapter
|
||||||
import com.discord.api.botuikit.gson.ComponentTypeTypeAdapter
|
import com.discord.api.botuikit.gson.ComponentTypeTypeAdapter
|
||||||
import com.discord.api.message.attachment.MessageAttachment
|
import com.discord.api.message.attachment.MessageAttachment
|
||||||
import com.discord.models.botuikit.*
|
import com.discord.models.botuikit.*
|
||||||
|
import com.discord.models.message.Message
|
||||||
import com.discord.stores.StoreApplicationInteractions.InteractionSendState
|
import com.discord.stores.StoreApplicationInteractions.InteractionSendState
|
||||||
import com.discord.utilities.view.extensions.ViewExtensions
|
import com.discord.utilities.view.extensions.ViewExtensions
|
||||||
import com.discord.widgets.botuikit.*
|
import com.discord.widgets.botuikit.*
|
||||||
|
|
@ -33,6 +34,8 @@ import com.lytefast.flexinput.R
|
||||||
import de.robv.android.xposed.XposedBridge
|
import de.robv.android.xposed.XposedBridge
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
val Message.isComponentV2 get() = (flags shr 15) and 1 == 1L
|
||||||
|
|
||||||
@AliucordPlugin(requiresRestart = true)
|
@AliucordPlugin(requiresRestart = true)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
class ComponentsV2 : Plugin() {
|
class ComponentsV2 : Plugin() {
|
||||||
|
|
@ -194,6 +197,10 @@ class ComponentsV2 : Plugin() {
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
patcher.after<Message>("shouldShowReplyPreviewAsAttachment") { param ->
|
||||||
|
if (this.isComponentV2) param.result = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun stop(context: Context) {
|
override fun stop(context: Context) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.aliucord.coreplugins.componentsv2
|
package com.aliucord.coreplugins.componentsv2
|
||||||
|
|
||||||
import com.aliucord.api.PatcherAPI
|
import com.aliucord.api.PatcherAPI
|
||||||
|
import com.aliucord.coreplugins.isComponentV2
|
||||||
import com.aliucord.patcher.*
|
import com.aliucord.patcher.*
|
||||||
import com.discord.api.channel.Channel
|
import com.discord.api.channel.Channel
|
||||||
import com.discord.api.role.GuildRole
|
import com.discord.api.role.GuildRole
|
||||||
|
|
@ -34,7 +35,7 @@ fun patchMessageItems(patcher: PatcherAPI) {
|
||||||
val result = (param.result as MutableList<ChatListEntry>)
|
val result = (param.result as MutableList<ChatListEntry>)
|
||||||
val meId = param.args[15] as Long
|
val meId = param.args[15] as Long
|
||||||
result.forEachIndexed { index, entry ->
|
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)
|
val fields = BotUiComponentV2Entry.V2Fields(state, meId, channel, guildMembers, guildRoles)
|
||||||
result[index] = BotUiComponentV2Entry.fromV1(entry, fields)
|
result[index] = BotUiComponentV2Entry.fromV1(entry, fields)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue