mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-06-13 13:47:47 +02:00
fix(core): snap preview
This commit is contained in:
@ -1,18 +1,24 @@
|
|||||||
package me.rhunk.snapenhance.core.event.events.impl
|
package me.rhunk.snapenhance.core.event.events.impl
|
||||||
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.LinearLayout
|
|
||||||
import me.rhunk.snapenhance.core.event.Event
|
import me.rhunk.snapenhance.core.event.Event
|
||||||
|
import me.rhunk.snapenhance.core.util.ktx.getId
|
||||||
|
|
||||||
class BindViewEvent(
|
class BindViewEvent(
|
||||||
val prevModel: Any,
|
val prevModel: Any,
|
||||||
val nextModel: Any?,
|
val nextModel: Any?,
|
||||||
val view: View
|
var view: View
|
||||||
): Event() {
|
): Event() {
|
||||||
|
val chatMessageContentContainerId by lazy {
|
||||||
|
view.resources.getId("chat_message_content_container")
|
||||||
|
}
|
||||||
|
|
||||||
inline fun chatMessage(block: (conversationId: String, messageId: String) -> Unit) {
|
inline fun chatMessage(block: (conversationId: String, messageId: String) -> Unit) {
|
||||||
if (view !is LinearLayout) return
|
|
||||||
val modelToString = prevModel.toString()
|
val modelToString = prevModel.toString()
|
||||||
if (!modelToString.startsWith("ChatViewModel")) return
|
if (!modelToString.startsWith("ChatViewModel")) return
|
||||||
|
if (view.id != chatMessageContentContainerId) {
|
||||||
|
view = view.findViewById(chatMessageContentContainerId) ?: return
|
||||||
|
}
|
||||||
modelToString.substringAfter("messageId=").substringBefore(",").split(":").apply {
|
modelToString.substringAfter("messageId=").substringBefore(",").split(":").apply {
|
||||||
if (size != 3) return
|
if (size != 3) return
|
||||||
block(this[0], this[2])
|
block(this[0], this[2])
|
||||||
|
@ -30,7 +30,7 @@ class MessageLogger : Feature("MessageLogger",
|
|||||||
companion object {
|
companion object {
|
||||||
const val PREFETCH_MESSAGE_COUNT = 20
|
const val PREFETCH_MESSAGE_COUNT = 20
|
||||||
const val PREFETCH_FEED_COUNT = 20
|
const val PREFETCH_FEED_COUNT = 20
|
||||||
const val DELETED_MESSAGE_COLOR = 0x2Eb71c1c
|
const val DELETED_MESSAGE_COLOR = 0x6Eb71c1c
|
||||||
}
|
}
|
||||||
|
|
||||||
private val messageLoggerInterface by lazy { context.bridgeClient.getMessageLogger() }
|
private val messageLoggerInterface by lazy { context.bridgeClient.getMessageLogger() }
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package me.rhunk.snapenhance.mapper.impl
|
package me.rhunk.snapenhance.mapper.impl
|
||||||
|
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||||
|
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||||
import me.rhunk.snapenhance.mapper.AbstractClassMapper
|
import me.rhunk.snapenhance.mapper.AbstractClassMapper
|
||||||
import me.rhunk.snapenhance.mapper.ext.getClassName
|
import me.rhunk.snapenhance.mapper.ext.getClassName
|
||||||
import me.rhunk.snapenhance.mapper.ext.getSuperClassName
|
import me.rhunk.snapenhance.mapper.ext.getSuperClassName
|
||||||
import me.rhunk.snapenhance.mapper.ext.isFinal
|
import me.rhunk.snapenhance.mapper.ext.isFinal
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21t
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22t
|
|
||||||
|
|
||||||
class CallbackMapper : AbstractClassMapper("Callbacks") {
|
class CallbackMapper : AbstractClassMapper("Callbacks") {
|
||||||
val callbacks = map("callbacks")
|
val callbacks = map("callbacks")
|
||||||
@ -21,11 +21,13 @@ class CallbackMapper : AbstractClassMapper("Callbacks") {
|
|||||||
|
|
||||||
if (clazz.getClassName().endsWith("\$CppProxy")) return@filter false
|
if (clazz.getClassName().endsWith("\$CppProxy")) return@filter false
|
||||||
|
|
||||||
// ignore dummy ContentCallback class
|
// ignore dummy ContentCallback classes
|
||||||
if (superclassName.endsWith("ContentCallback") && clazz.methods.none { it.name == "handleContentResult" && it.implementation?.instructions?.firstOrNull { instruction ->
|
if (superclassName.endsWith("ContentCallback") && clazz.methods.none { method ->
|
||||||
instruction is Instruction22t || instruction is Instruction21t
|
method.name == "handleContentResult" &&
|
||||||
} != null})
|
method.implementation?.instructions?.firstOrNull { instruction ->
|
||||||
return@filter false
|
instruction is Instruction35c && (instruction.reference as? MethodReference)?.name == "getBoltContentId"
|
||||||
|
} != null
|
||||||
|
}) return@filter false
|
||||||
|
|
||||||
val superClass = getClass(clazz.superclass) ?: return@filter false
|
val superClass = getClass(clazz.superclass) ?: return@filter false
|
||||||
!superClass.isFinal()
|
!superClass.isFinal()
|
||||||
|
Reference in New Issue
Block a user