feat: Remove debug logging from various components for cleaner code
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.rosetta.messenger.database
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.rosetta.messenger.crypto.CryptoManager
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
@@ -44,8 +43,6 @@ class DatabaseService(context: Context) {
|
||||
seedPhraseEncrypted: String
|
||||
): Boolean = withContext(Dispatchers.IO) {
|
||||
try {
|
||||
Log.d(TAG, "💾 Saving encrypted account to database: ${publicKey.take(20)}...")
|
||||
|
||||
val account = EncryptedAccountEntity(
|
||||
publicKey = publicKey,
|
||||
privateKeyEncrypted = privateKeyEncrypted,
|
||||
@@ -60,10 +57,8 @@ class DatabaseService(context: Context) {
|
||||
// 🚀 ОПТИМИЗАЦИЯ: Обновляем кэш после сохранения
|
||||
accountCache[publicKey] = account
|
||||
|
||||
Log.d(TAG, "✅ Account saved successfully")
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "❌ Failed to save account", e)
|
||||
false
|
||||
}
|
||||
}
|
||||
@@ -89,7 +84,6 @@ class DatabaseService(context: Context) {
|
||||
}
|
||||
account
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "❌ Failed to load account", e)
|
||||
null
|
||||
}
|
||||
}
|
||||
@@ -102,7 +96,6 @@ class DatabaseService(context: Context) {
|
||||
try {
|
||||
accountDao.getAllAccounts()
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "❌ Failed to load accounts", e)
|
||||
emptyList()
|
||||
}
|
||||
}
|
||||
@@ -121,7 +114,6 @@ class DatabaseService(context: Context) {
|
||||
try {
|
||||
accountDao.updateLastUsed(publicKey, Instant.now().toString())
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "❌ Failed to update last used", e)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,10 +123,8 @@ class DatabaseService(context: Context) {
|
||||
suspend fun deleteAccount(publicKey: String): Boolean = withContext(Dispatchers.IO) {
|
||||
try {
|
||||
accountDao.deleteAccount(publicKey)
|
||||
Log.d(TAG, "🗑️ Account deleted: ${publicKey.take(20)}...")
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "❌ Failed to delete account", e)
|
||||
false
|
||||
}
|
||||
}
|
||||
@@ -146,7 +136,6 @@ class DatabaseService(context: Context) {
|
||||
try {
|
||||
accountDao.getAccountCount() > 0
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "❌ Failed to check accounts", e)
|
||||
false
|
||||
}
|
||||
}
|
||||
@@ -160,10 +149,7 @@ class DatabaseService(context: Context) {
|
||||
password: String
|
||||
): DecryptedAccountData? = withContext(Dispatchers.IO) {
|
||||
try {
|
||||
Log.d(TAG, "🔓 Decrypting account: ${publicKey.take(20)}...")
|
||||
|
||||
val encryptedAccount = getEncryptedAccount(publicKey) ?: run {
|
||||
Log.e(TAG, "❌ Account not found")
|
||||
return@withContext null
|
||||
}
|
||||
|
||||
@@ -173,11 +159,9 @@ class DatabaseService(context: Context) {
|
||||
encryptedAccount.privateKeyEncrypted,
|
||||
password
|
||||
) ?: run {
|
||||
Log.e(TAG, "❌ Failed to decrypt private key - returned null")
|
||||
return@withContext null
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "❌ Failed to decrypt private key - wrong password?", e)
|
||||
return@withContext null
|
||||
}
|
||||
|
||||
@@ -187,11 +171,9 @@ class DatabaseService(context: Context) {
|
||||
encryptedAccount.seedPhraseEncrypted,
|
||||
password
|
||||
) ?: run {
|
||||
Log.e(TAG, "❌ Failed to decrypt seed phrase - returned null")
|
||||
return@withContext null
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "❌ Failed to decrypt seed phrase - wrong password?", e)
|
||||
return@withContext null
|
||||
}
|
||||
|
||||
@@ -200,12 +182,6 @@ class DatabaseService(context: Context) {
|
||||
// Generate private key hash for protocol
|
||||
val privateKeyHash = CryptoManager.generatePrivateKeyHash(privateKey)
|
||||
|
||||
Log.d(TAG, "✅ Account decrypted successfully")
|
||||
Log.d(TAG, " - Public Key: ${publicKey.take(20)}...")
|
||||
Log.d(TAG, " - Private Key: [DECRYPTED]")
|
||||
Log.d(TAG, " - Private Key Hash: $privateKeyHash")
|
||||
Log.d(TAG, " - Seed Phrase: ${seedPhrase.size} words")
|
||||
|
||||
DecryptedAccountData(
|
||||
publicKey = publicKey,
|
||||
privateKey = privateKey,
|
||||
@@ -213,7 +189,6 @@ class DatabaseService(context: Context) {
|
||||
seedPhrase = seedPhrase
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "❌ Failed to decrypt account", e)
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user