Ariver
2026-07-11 015f1089ea875a153dd2a18ef42c25145d4868f5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package services
 
import (
    "os/exec"
    "runtime"
    "voicesnap/internal/config"
)
 
// AppOrchestrator is the interface for app-level orchestration callbacks.
type AppOrchestrator interface {
    SetRecordingHotkey(recording bool)
    UpdateHotkeyVK(vk int)
}
 
// AppService provides application lifecycle methods to the frontend.
type AppService struct {
    cfg     *config.Config
    version string
    app     AppOrchestrator
}
 
func NewAppService(cfg *config.Config, version string) *AppService {
    return &AppService{cfg: cfg, version: version}
}
 
// SetApp sets the orchestrator reference (called after creation).
func (s *AppService) SetApp(app AppOrchestrator) {
    s.app = app
}
 
// GetVersion returns the application version string.
func (s *AppService) GetVersion() string {
    return s.version
}
 
// GetAppName returns the application name.
func (s *AppService) GetAppName() string {
    return "PrivateVoice Dictation"
}
 
// OpenURL opens a URL in the default browser.
func (s *AppService) OpenURL(url string) {
    switch runtime.GOOS {
    case "darwin":
        exec.Command("open", url).Start()
    case "windows":
        exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
    default:
        exec.Command("xdg-open", url).Start()
    }
}