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:
2026-01-31 05:20:32 +05:00
parent 430c7d9007
commit c249278421
28 changed files with 0 additions and 506 deletions

View File

@@ -5,7 +5,6 @@ import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.net.Uri
import android.util.Base64
import android.util.Log
import com.vanniktech.blurhash.BlurHash
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
@@ -33,7 +32,6 @@ object MediaUtils {
*/
suspend fun uriToBase64Image(context: Context, uri: Uri): String? = withContext(Dispatchers.IO) {
try {
Log.d(TAG, "📸 Converting image to Base64: $uri")
// Открываем InputStream
val inputStream: InputStream = context.contentResolver.openInputStream(uri)
@@ -44,11 +42,9 @@ object MediaUtils {
inputStream.close()
if (originalBitmap == null) {
Log.e(TAG, "📸 Failed to decode image")
return@withContext null
}
Log.d(TAG, "📸 Original size: ${originalBitmap.width}x${originalBitmap.height}")
// Масштабируем если слишком большое
val scaledBitmap = scaleDownBitmap(originalBitmap, MAX_IMAGE_SIZE)
@@ -56,7 +52,6 @@ object MediaUtils {
originalBitmap.recycle()
}
Log.d(TAG, "📸 Scaled size: ${scaledBitmap.width}x${scaledBitmap.height}")
// Конвертируем в PNG Base64
val outputStream = ByteArrayOutputStream()
@@ -67,10 +62,8 @@ object MediaUtils {
scaledBitmap.recycle()
Log.d(TAG, "📸 ✅ Image converted to Base64, length: ${base64.length}")
base64
} catch (e: Exception) {
Log.e(TAG, "📸 ❌ Failed to convert image to Base64", e)
null
}
}
@@ -80,7 +73,6 @@ object MediaUtils {
*/
suspend fun generateBlurhash(context: Context, uri: Uri): String = withContext(Dispatchers.IO) {
try {
Log.d(TAG, "🎨 Generating blurhash for: $uri")
val inputStream = context.contentResolver.openInputStream(uri)
?: return@withContext ""
@@ -93,7 +85,6 @@ object MediaUtils {
inputStream.close()
if (bitmap == null) {
Log.e(TAG, "🎨 Failed to decode image for blurhash")
return@withContext ""
}
@@ -101,10 +92,8 @@ object MediaUtils {
val blurhash = BlurHash.encode(bitmap, 4, 3)
bitmap.recycle()
Log.d(TAG, "🎨 ✅ Blurhash generated: $blurhash")
blurhash ?: ""
} catch (e: Exception) {
Log.e(TAG, "🎨 ❌ Failed to generate blurhash", e)
""
}
}
@@ -114,7 +103,6 @@ object MediaUtils {
*/
suspend fun uriToBase64File(context: Context, uri: Uri): String? = withContext(Dispatchers.IO) {
try {
Log.d(TAG, "📄 Converting file to Base64: $uri")
val inputStream = context.contentResolver.openInputStream(uri)
?: return@withContext null
@@ -124,10 +112,8 @@ object MediaUtils {
val base64 = Base64.encodeToString(bytes, Base64.NO_WRAP)
Log.d(TAG, "📄 ✅ File converted to Base64, length: ${base64.length}")
base64
} catch (e: Exception) {
Log.e(TAG, "📄 ❌ Failed to convert file to Base64", e)
null
}
}
@@ -158,7 +144,6 @@ object MediaUtils {
}
}
} catch (e: Exception) {
Log.e(TAG, "Failed to get file name", e)
}
return name
}
@@ -212,7 +197,6 @@ object MediaUtils {
}
hash ?: ""
} catch (e: Exception) {
Log.e(TAG, "Failed to generate blurhash from bitmap", e)
""
}
}
@@ -244,10 +228,8 @@ object MediaUtils {
}
}
Log.d(TAG, "📐 Image dimensions: ${width}x${height}")
Pair(width, height)
} catch (e: Exception) {
Log.e(TAG, "📐 Failed to get image dimensions", e)
Pair(0, 0)
}
}
@@ -270,10 +252,8 @@ object MediaUtils {
}
BitmapFactory.decodeByteArray(bytes, 0, bytes.size, options)
Log.d(TAG, "📐 Image dimensions from base64: ${options.outWidth}x${options.outHeight}")
Pair(options.outWidth, options.outHeight)
} catch (e: Exception) {
Log.e(TAG, "📐 Failed to get image dimensions from base64", e)
Pair(0, 0)
}
}