T4.7: Remove forbidden platform imports from src/ui

src/ui now imports only src/app, src/domain, and Fyne.
Three violations were fixed:

- src/scheduler (NewRealClock): Service.Start() now creates the real
  clock internally; StartWith(clock) is the injectable seam for tests.
- src/platform/desktop (InstallDesktopIntegration): moved into
  Service.InstallDesktopIcon in new src/app/platform.go.
- src/platform/autostart (AutostartStatus, SetAutostart): moved into
  Service.AutostartStatus and Service.ApplyAutostart in platform.go.

go test -race ./... green.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mixeme
2026-06-22 00:00:24 +03:00
parent 93b57979ec
commit 21a93517eb
6 changed files with 52 additions and 19 deletions
+2 -5
View File
@@ -8,7 +8,6 @@ import (
"strings"
"gitea.mixdep.ru/mix/gosentry/src/app"
"gitea.mixdep.ru/mix/gosentry/src/platform/autostart"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
@@ -28,7 +27,7 @@ func settingsView(w fyne.Window, svc *app.Service) fyne.CanvasObject {
startOnLogin.SetChecked(store.Config.StartOnLogin)
autostartStatus := widget.NewLabel("")
refreshAutostartStatus := func() {
ok, message := autostart.AutostartStatus(store.Config.StartOnLogin, store.Paths.ExecutablePath)
ok, message := svc.AutostartStatus()
if ok {
autostartStatus.SetText("OK: " + message)
return
@@ -97,9 +96,7 @@ func settingsView(w fyne.Window, svc *app.Service) fyne.CanvasObject {
settingsStatus.SetText("Save failed: " + err.Error())
return
}
// Autostart is platform integration the Service leaves to the caller (until
// T5.2 introduces an injectable autostart.Manager), so apply it here.
if err := autostart.SetAutostart(store.Config.StartOnLogin, store.Paths.ExecutablePath, store.Paths.DesktopIcon); err != nil {
if err := svc.ApplyAutostart(); err != nil {
refreshAutostartStatus()
settingsStatus.SetText("Saved, autostart failed: " + err.Error())
return