Remove unnecessary logging statements across various components to clean up code and improve readability. This includes removing debug, error, and warning logs from attachment handling, image processing, media loading, and profile management functionalities. Additionally, a script has been added to automate the removal of log statements from Kotlin files.
This commit is contained in:
@@ -35,7 +35,6 @@ class Protocol(
|
||||
|
||||
private fun log(message: String) {
|
||||
// TEMPORARY: Enable logging for debugging PacketUserInfo
|
||||
android.util.Log.d(TAG, message)
|
||||
logger(message)
|
||||
}
|
||||
|
||||
|
||||
@@ -157,13 +157,11 @@ object ProtocolManager {
|
||||
// Обновляет информацию о пользователе в диалогах когда приходит ответ от сервера
|
||||
waitPacket(0x03) { packet ->
|
||||
val searchPacket = packet as PacketSearch
|
||||
android.util.Log.d("Protocol", "🔍 Search/UserInfo response: ${searchPacket.users.size} users")
|
||||
|
||||
// Обновляем информацию о пользователях в диалогах
|
||||
if (searchPacket.users.isNotEmpty()) {
|
||||
scope.launch(Dispatchers.IO) { // 🔥 Запускаем на IO потоке для работы с БД
|
||||
searchPacket.users.forEach { user ->
|
||||
android.util.Log.d("Protocol", "📝 Updating user info: ${user.publicKey.take(16)}... title='${user.title}' username='${user.username}'")
|
||||
messageRepository?.updateDialogUserInfo(
|
||||
user.publicKey,
|
||||
user.title,
|
||||
@@ -178,7 +176,6 @@ object ProtocolManager {
|
||||
// 🚀 Обработчик транспортного сервера (0x0F)
|
||||
waitPacket(0x0F) { packet ->
|
||||
val transportPacket = packet as PacketRequestTransport
|
||||
android.util.Log.d("Protocol", "🚀 Transport server: ${transportPacket.transportServer}")
|
||||
TransportManager.setTransportServer(transportPacket.transportServer)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.rosetta.messenger.network
|
||||
|
||||
import android.util.Log
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
@@ -53,7 +52,6 @@ object TransportManager {
|
||||
*/
|
||||
fun setTransportServer(server: String) {
|
||||
transportServer = server
|
||||
Log.d(TAG, "🚀 Transport server set: $server")
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +64,6 @@ object TransportManager {
|
||||
*/
|
||||
private fun getActiveServer(): String {
|
||||
val server = transportServer ?: FALLBACK_TRANSPORT_SERVER
|
||||
Log.d(TAG, "📡 Using transport server: $server (configured: ${transportServer != null})")
|
||||
return server
|
||||
}
|
||||
|
||||
@@ -87,8 +84,6 @@ object TransportManager {
|
||||
suspend fun uploadFile(id: String, content: String): String = withContext(Dispatchers.IO) {
|
||||
val server = getActiveServer()
|
||||
|
||||
Log.d(TAG, "📤 Uploading file: $id to $server")
|
||||
Log.d(TAG, "📤 Content length: ${content.length}, first 50 chars: ${content.take(50)}")
|
||||
|
||||
// Добавляем в список загрузок
|
||||
_uploading.value = _uploading.value + TransportState(id, 0)
|
||||
@@ -96,7 +91,6 @@ object TransportManager {
|
||||
try {
|
||||
// 🔥 КРИТИЧНО: Преобразуем строку в байты (как desktop делает new Blob([content]))
|
||||
val contentBytes = content.toByteArray(Charsets.UTF_8)
|
||||
Log.d(TAG, "📤 Content bytes length: ${contentBytes.size}")
|
||||
|
||||
val requestBody = MultipartBody.Builder()
|
||||
.setType(MultipartBody.FORM)
|
||||
@@ -115,8 +109,6 @@ object TransportManager {
|
||||
val response = suspendCoroutine<Response> { cont ->
|
||||
client.newCall(request).enqueue(object : Callback {
|
||||
override fun onFailure(call: Call, e: IOException) {
|
||||
Log.e(TAG, "❌ Upload failed for $id: ${e.message}")
|
||||
Log.e(TAG, "❌ Stack trace: ${e.stackTraceToString()}")
|
||||
cont.resumeWithException(e)
|
||||
}
|
||||
|
||||
@@ -128,19 +120,16 @@ object TransportManager {
|
||||
|
||||
if (!response.isSuccessful) {
|
||||
val errorBody = response.body?.string() ?: "No error body"
|
||||
Log.e(TAG, "❌ Upload failed: ${response.code}, body: $errorBody")
|
||||
throw IOException("Upload failed: ${response.code}")
|
||||
}
|
||||
|
||||
val responseBody = response.body?.string()
|
||||
?: throw IOException("Empty response")
|
||||
|
||||
Log.d(TAG, "📤 Response body: $responseBody")
|
||||
|
||||
// Parse JSON response to get tag
|
||||
val tag = org.json.JSONObject(responseBody).getString("t")
|
||||
|
||||
Log.d(TAG, "✅ Upload complete: $id -> $tag")
|
||||
|
||||
// Обновляем прогресс до 100%
|
||||
_uploading.value = _uploading.value.map {
|
||||
@@ -163,7 +152,6 @@ object TransportManager {
|
||||
suspend fun downloadFile(id: String, tag: String): String = withContext(Dispatchers.IO) {
|
||||
val server = getActiveServer()
|
||||
|
||||
Log.d(TAG, "📥 Downloading file: $id (tag: $tag) from $server")
|
||||
|
||||
// Добавляем в список скачиваний
|
||||
_downloading.value = _downloading.value + TransportState(id, 0)
|
||||
@@ -193,7 +181,6 @@ object TransportManager {
|
||||
val content = response.body?.string()
|
||||
?: throw IOException("Empty response")
|
||||
|
||||
Log.d(TAG, "✅ Download complete: $id (${content.length} bytes)")
|
||||
|
||||
// Обновляем прогресс до 100%
|
||||
_downloading.value = _downloading.value.map {
|
||||
|
||||
Reference in New Issue
Block a user