From 7a22e0f8850b4f0389e7899839ebc2f6edf004ac Mon Sep 17 00:00:00 2001 From: Vadim Shchepotev Date: Sat, 10 Dec 2022 10:57:11 -0800 Subject: [PATCH] Add dummy systray_mac to fix unit tests (#2187) --- v2/internal/platform/systray.go | 2 - v2/internal/platform/systray/systray_mac.go | 91 +++++++++++++++++++++ 2 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 v2/internal/platform/systray/systray_mac.go diff --git a/v2/internal/platform/systray.go b/v2/internal/platform/systray.go index a74c191b..af79f427 100644 --- a/v2/internal/platform/systray.go +++ b/v2/internal/platform/systray.go @@ -1,5 +1,3 @@ -//go:build windows - package platform import ( diff --git a/v2/internal/platform/systray/systray_mac.go b/v2/internal/platform/systray/systray_mac.go new file mode 100644 index 00000000..6cb1009b --- /dev/null +++ b/v2/internal/platform/systray/systray_mac.go @@ -0,0 +1,91 @@ +//go:build darwin + +package systray + +import ( + "errors" + "github.com/wailsapp/wails/v2/pkg/menu" + "github.com/wailsapp/wails/v2/pkg/options" +) + +var NotImplementedSysTray = errors.New("not implemented") + +type Systray struct { +} + +func (p *Systray) Close() { + err := p.Stop() + if err != nil { + println(err.Error()) + } +} + +func (p *Systray) Update() error { + return NotImplementedSysTray +} + +func (p *Systray) SetTitle(_ string) {} + +func New() (*Systray, error) { + return nil, NotImplementedSysTray +} + +func (p *Systray) SetMenu(popupMenu *menu.Menu) (err error) { + return NotImplementedSysTray +} + +func (p *Systray) Stop() error { + return NotImplementedSysTray +} + +func (p *Systray) OnLeftClick(fn func()) { + +} + +func (p *Systray) OnRightClick(fn func()) { + +} + +func (p *Systray) OnLeftDoubleClick(fn func()) { + +} + +func (p *Systray) OnRightDoubleClick(fn func()) { + +} + +func (p *Systray) OnMenuClose(fn func()) { + +} + +func (p *Systray) OnMenuOpen(fn func()) { + +} + +func (p *Systray) SetTooltip(tooltip string) error { + return NotImplementedSysTray +} + +func (p *Systray) ShowMessage(title, msg string, bigIcon bool) error { + return NotImplementedSysTray +} + +func (p *Systray) Show() error { + return p.setVisible(true) +} + +func (p *Systray) Hide() error { + return p.setVisible(false) +} + +func (p *Systray) setVisible(visible bool) error { + return NotImplementedSysTray +} + +func (p *Systray) SetIcons(lightModeIcon, darkModeIcon *options.SystemTrayIcon) error { + return NotImplementedSysTray +} + +func (p *Systray) Run() error { + return NotImplementedSysTray +}