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:
+10
-5
@@ -91,11 +91,16 @@ func NewService(store *storage.Store, jobs []domain.Job) *Service {
|
||||
return s
|
||||
}
|
||||
|
||||
// Start begins scheduling. It installs a cancelable run context and a timing
|
||||
// loop driven by the given clock; every tick calls RunDue. Pass
|
||||
// scheduler.NewRealClock() in production. Start is expected once, during setup,
|
||||
// before any concurrent use.
|
||||
func (s *Service) Start(clock scheduler.Clock) {
|
||||
// Start begins scheduling with the real wall clock. It is the production entry
|
||||
// point; tests should call StartWith and supply a fake clock instead. Start is
|
||||
// expected once, during setup, before any concurrent use.
|
||||
func (s *Service) Start() {
|
||||
s.StartWith(scheduler.NewRealClock())
|
||||
}
|
||||
|
||||
// StartWith begins scheduling driven by the given clock; every tick calls
|
||||
// RunDue. Used by tests to inject a fake clock.
|
||||
func (s *Service) StartWith(clock scheduler.Clock) {
|
||||
s.mu.Lock()
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
s.ctx = ctx
|
||||
|
||||
Reference in New Issue
Block a user