mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 14:07:05 +05:30
all: migrate logging to Napier
This commit is contained in:
parent
239cfb753f
commit
9b9e924475
7 changed files with 17 additions and 9 deletions
|
@ -34,6 +34,7 @@ kotlin {
|
|||
api(compose.material3)
|
||||
api(projects.database)
|
||||
api(projects.model)
|
||||
api(libs.napier)
|
||||
implementation(libs.kotlin.coroutines.core)
|
||||
implementation(libs.compose.richtext.markdown)
|
||||
implementation(libs.compose.richtext.material)
|
||||
|
|
|
@ -3,10 +3,10 @@ package dev.msfjarvis.claw.common.urllauncher
|
|||
import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.browser.customtabs.CustomTabsIntent
|
||||
import androidx.compose.ui.platform.UriHandler
|
||||
import io.github.aakira.napier.Napier
|
||||
|
||||
class UrlLauncher(private val context: Context) : UriHandler {
|
||||
override fun openUri(uri: String) {
|
||||
|
@ -20,7 +20,7 @@ class UrlLauncher(private val context: Context) : UriHandler {
|
|||
customTabsIntent.launchUrl(context, Uri.parse(uri))
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
val error = "Failed to open URL: $uri"
|
||||
Log.d("UrlLauncher", error)
|
||||
Napier.d(tag = "UrlLauncher") { error }
|
||||
Toast.makeText(context, error, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package dev.msfjarvis.claw.common.urllauncher
|
||||
|
||||
import androidx.compose.ui.platform.UriHandler
|
||||
import io.github.aakira.napier.Napier
|
||||
import java.awt.Desktop
|
||||
import java.io.IOException
|
||||
import java.net.URI
|
||||
|
@ -13,7 +14,7 @@ class UrlLauncher : UriHandler {
|
|||
try {
|
||||
desktop.browse(URI(uri))
|
||||
} catch (e: IOException) {
|
||||
println("Failed to open URL: $uri")
|
||||
Napier.d(tag = "UrlLauncher") { "Failed to open URL: $uri" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue