fix: log image load errors and show placeholder on error
This commit is contained in:
@@ -20,6 +20,7 @@ import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||
import org.threeten.bp.OffsetDateTime
|
||||
import org.tinylog.kotlin.Logger
|
||||
|
||||
@@ -92,4 +93,13 @@ internal object Utils {
|
||||
context.getSystemService(ActivityManager::class.java).appTasks?.getOrNull(0)
|
||||
?.setExcludeFromRecents(excludeFromRecent)
|
||||
}
|
||||
|
||||
fun redactPassword(stringUrl: String?): String {
|
||||
val url = stringUrl?.toHttpUrlOrNull()
|
||||
return when {
|
||||
url == null -> "unknown"
|
||||
url.password.isEmpty() -> url.toString()
|
||||
else -> url.newBuilder().password("REDACTED").toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user