feat: Implement user blocking check in MessageRepository and ChatViewModel to ignore messages from blocked users

This commit is contained in:
k1ngsterr1
2026-01-14 00:14:42 +05:00
parent f9c1425403
commit e14de42c5f
2 changed files with 23 additions and 10 deletions

View File

@@ -200,6 +200,12 @@ class ChatViewModel(application: Application) : AndroidViewModel(application) {
val privateKey = myPrivateKey ?: return@launch
val account = myPublicKey ?: return@launch
// 🔥 Проверяем блокировку (как в Архиве)
val isBlocked = database.blacklistDao().isUserBlocked(packet.fromPublicKey, account)
if (isBlocked) {
Log.d(TAG, "🚫 BLOCKED: Ignoring message from blocked user ${packet.fromPublicKey.take(20)}...")
return@launch
}
// Расшифровываем в фоне - получаем и текст и plainKeyAndNonce
val decryptResult = MessageCrypto.decryptIncomingFull(