fix: friend menu injection
This commit is contained in:
@@ -141,6 +141,22 @@ class DatabaseAccess(private val context: ModContext) : Manager {
|
||||
}
|
||||
}
|
||||
|
||||
fun getConversationType(conversationId: String): Int? {
|
||||
return safeDatabaseOperation(openArroyo()) {
|
||||
val cursor = it.rawQuery(
|
||||
"SELECT * FROM user_conversation WHERE client_conversation_id = ?",
|
||||
arrayOf(conversationId)
|
||||
)
|
||||
if (!cursor.moveToFirst()) {
|
||||
cursor.close()
|
||||
return@safeDatabaseOperation null
|
||||
}
|
||||
val type = cursor.getInt(cursor.getColumnIndex("conversation_type"))
|
||||
cursor.close()
|
||||
type
|
||||
}
|
||||
}
|
||||
|
||||
fun getDMConversationIdFromUserId(userId: String): UserConversationLink? {
|
||||
return safeDatabaseOperation(openArroyo()) {
|
||||
readDatabaseObject(
|
||||
|
||||
@@ -33,7 +33,9 @@ class Messaging : Feature("Messaging", loadParams = FeatureLoadParams.ACTIVITY_C
|
||||
val conversationId = viewItem.substringAfter("conversationId: ").substring(0, 36).also {
|
||||
if (it.startsWith("null")) return@hook
|
||||
}
|
||||
lastFetchGroupConversationUUID = SnapUUID.fromString(conversationId)
|
||||
context.database.getConversationType(conversationId)?.takeIf { it == 1 }?.run {
|
||||
lastFetchGroupConversationUUID = SnapUUID.fromString(conversationId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user