refactor(komga-tray): remove deprecated methods

This commit is contained in:
Gauthier Roebroeck 2025-07-15 12:27:08 +08:00
parent 0f74e6ec41
commit d56c3e3c8f
3 changed files with 6 additions and 5 deletions

View file

@ -36,6 +36,7 @@ dependencies {
implementation(project(":komga"))
implementation(compose.desktop.currentOs)
implementation(compose.components.resources)
linuxAmd64(compose.desktop.linux_x64)
macAmd64(compose.desktop.macos_x64)

View file

@ -16,7 +16,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.loadSvgPainter
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.DpSize
@ -27,6 +26,7 @@ import androidx.compose.ui.window.WindowPosition
import androidx.compose.ui.window.WindowState
import androidx.compose.ui.window.application
import org.gotson.komga.RB
import org.jetbrains.compose.resources.decodeToSvgPainter
import org.springframework.core.io.ClassPathResource
@Preview
@ -50,7 +50,7 @@ fun showErrorDialog(
Dp.Unspecified,
),
),
icon = loadSvgPainter(ClassPathResource("icons/komga-color.svg").inputStream, LocalDensity.current),
icon = ClassPathResource("icons/komga-color.svg").inputStream.readAllBytes().decodeToSvgPainter(LocalDensity.current),
) {
Column(
modifier = Modifier.padding(16.dp),
@ -60,7 +60,7 @@ fun showErrorDialog(
modifier = Modifier.padding(bottom = 16.dp),
) {
Image(
painter = loadSvgPainter(ClassPathResource("icons/komga-color.svg").inputStream, LocalDensity.current),
painter = ClassPathResource("icons/komga-color.svg").inputStream.readAllBytes().decodeToSvgPainter(LocalDensity.current),
contentDescription = "Komga logo",
modifier =
Modifier

View file

@ -1,13 +1,13 @@
package org.gotson.komga.application.gui
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.loadSvgPainter
import androidx.compose.ui.window.Tray
import androidx.compose.ui.window.application
import org.gotson.komga.RB
import org.gotson.komga.infrastructure.web.WebServerEffectiveSettings
import org.gotson.komga.openExplorer
import org.gotson.komga.openUrl
import org.jetbrains.compose.resources.decodeToSvgPainter
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.ApplicationArguments
import org.springframework.boot.ApplicationRunner
@ -39,7 +39,7 @@ class TrayIconRunner(
private fun runTray() {
application {
Tray(
icon = loadSvgPainter(ClassPathResource("icons/$iconFileName").inputStream, LocalDensity.current),
icon = ClassPathResource("icons/$iconFileName").inputStream.readAllBytes().decodeToSvgPainter(LocalDensity.current),
menu = {
Item(RB.getString("menu.open_komga"), onClick = { openUrl(komgaUrl) })
Item(RB.getString("menu.show_log"), onClick = { openExplorer(logFile) })