Skip to content

Commit

Permalink
Refactor plugin code to replace ShowMsg with Notify method
Browse files Browse the repository at this point in the history
The commit changes the old `ShowMsg` method to the newer `Notify` method across various plugins for better semantics. The refactoring also includes handling errors during notification, as well as removing the unnecessary `iconPath` parameter from the method signature. Some minor version updates and dependency changes are also included.
  • Loading branch information
qianlifeng committed Dec 30, 2023
1 parent f67d189 commit 98f11eb
Show file tree
Hide file tree
Showing 15 changed files with 60 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Wox.Plugin.Host.Nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"typescript": "^5.2.2"
},
"dependencies": {
"@wox-launcher/wox-plugin": "^0.0.50",
"@wox-launcher/wox-plugin": "^0.0.54",
"dayjs": "^1.11.9",
"promise-deferred": "^2.0.4",
"winston": "^3.10.0",
Expand Down
8 changes: 4 additions & 4 deletions Wox.Plugin.Host.Nodejs/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions Wox.Plugin.Host.Nodejs/src/pluginAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class PluginAPI implements PublicAPI {
async ChangeQuery(query: ChangeQueryParam): Promise<void> {
await this.invokeMethod("ChangeQuery", {
queryType: query.QueryType,
queryText: query.QueryText,
queryText: query.QueryText === undefined ? "" : query.QueryText,
querySelection: JSON.stringify(query.QuerySelection)
})
}
Expand All @@ -64,11 +64,10 @@ export class PluginAPI implements PublicAPI {
await this.invokeMethod("ShowApp", {})
}

async ShowMsg(title: string, description: string | undefined, iconPath: string | undefined): Promise<void> {
await this.invokeMethod("ShowMsg", {
async Notify(title: string, description: string | undefined): Promise<void> {
await this.invokeMethod("Notify", {
title,
description: description === undefined ? "" : description,
iconPath: iconPath === undefined ? "" : iconPath
description: description === undefined ? "" : description
})
}

Expand Down
2 changes: 1 addition & 1 deletion Wox.Plugin.Nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wox-launcher/wox-plugin",
"version": "0.0.52",
"version": "0.0.54",
"description": "All nodejs plugin for Wox should use types in this package",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions Wox.Plugin.Nodejs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ export interface PublicAPI {
ShowApp: () => Promise<void>

/**
* Show message box
* Notify message
*/
ShowMsg: (title: string, description?: string, iconPath?: string) => Promise<void>
Notify: (title: string, description?: string) => Promise<void>

/**
* Write log
Expand Down
2 changes: 1 addition & 1 deletion Wox.UI.React/src/enums/WoxMessageRequestMethodEnum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class WoxMessageRequestMethodEnum extends BaseEnum {
static readonly HideApp = WoxMessageRequestMethodEnum.define("HideApp", "Hide App")
static readonly ShowApp = WoxMessageRequestMethodEnum.define("ShowApp", "Show App")
static readonly ToggleApp = WoxMessageRequestMethodEnum.define("ToggleApp", "Toggle App")
static readonly ShowMsg = WoxMessageRequestMethodEnum.define("ShowMsg", "Show Msg")
static readonly Notify = WoxMessageRequestMethodEnum.define("Notify", "Notify")
static readonly ChangeTheme = WoxMessageRequestMethodEnum.define("ChangeTheme", "Change Theme")
static readonly OpenSettingWindow = WoxMessageRequestMethodEnum.define("OpenSettingWindow", "Open Setting Dialog")
static readonly OpenDevTools = WoxMessageRequestMethodEnum.define("OpenDevTools", "Open Dev Tools")
Expand Down
7 changes: 6 additions & 1 deletion Wox/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,29 @@ require (
github.com/PuerkitoBio/goquery v1.8.1 // indirect
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gen2brain/beeep v0.0.0-20230907135156-1a38885a97fc // indirect
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 // indirect
github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7 // indirect
github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7 // indirect
github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7 // indirect
github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55 // indirect
github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/otiai10/copy v1.14.0 // indirect
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/saracen/zipextra v0.0.0-20220303013732-0187cb0159ea // indirect
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/vcaesar/keycode v0.10.1 // indirect
github.com/xeonx/timeago v1.0.0-rc5 // indirect
Expand All @@ -66,7 +71,7 @@ require (
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/protobuf v1.26.0 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
Expand Down
13 changes: 13 additions & 0 deletions Wox/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/gen2brain/beeep v0.0.0-20230907135156-1a38885a97fc h1:NNgdMgPX3j33uEAoVVxNxillDPnxT0xbGv8uh4CKIAo=
github.com/gen2brain/beeep v0.0.0-20230907135156-1a38885a97fc/go.mod h1:0W7dI87PvXJ1Sjs0QPvWXKcQmNERY77e8l7GFhZB/s4=
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 h1:NRUJuo3v3WGC/g5YiyF790gut6oQr5f3FBI88Wv0dx4=
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520/go.mod h1:L+mq6/vvYHKjCX2oez0CgEAJmbq1fbb/oNJIWQkBybY=
github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7 h1:6uJ+sZ/e03gkbqZ0kUG6mfKoqDb4XMAzMIwlajq19So=
Expand All @@ -32,6 +34,10 @@ github.com/go-resty/resty/v2 v2.9.1 h1:PIgGx4VrHvag0juCJ4dDv3MiFRlDmP0vicBucwf+g
github.com/go-resty/resty/v2 v2.9.1/go.mod h1:4/GYJVjh9nhkhGR6AUNW3XhpDYNUr+Uvy9gV/VGZIy4=
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 h1:qZNfIGkIANxGv/OqtnntR4DfOY2+BgwR60cAcu/i3SE=
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4/go.mod h1:kW3HQ4UdaAyrUCSSDR4xUzBKW6O2iA4uHhk7AtyYp10=
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
Expand Down Expand Up @@ -77,6 +83,8 @@ github.com/mozillazg/go-pinyin v0.20.0 h1:BtR3DsxpApHfKReaPO1fCqF4pThRwH9uwvXzm+
github.com/mozillazg/go-pinyin v0.20.0/go.mod h1:iR4EnMMRXkfpFVV5FMi4FNB6wGq9NV6uDWbUuPhP4Yc=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ=
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U=
github.com/olahol/melody v1.1.4 h1:RQHfKZkQmDxI0+SLZRNBCn4LiXdqxLKRGSkT8Dyoe/E=
github.com/olahol/melody v1.1.4/go.mod h1:GgkTl6Y7yWj/HtfD48Q5vLKPVoZOH+Qqgfa7CvJgJM4=
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
Expand Down Expand Up @@ -112,6 +120,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af h1:6yITBqGTE2lEeTPG04SN9W+iWHCRyHqlVYILiSXziwk=
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af/go.mod h1:4F09kP5F+am0jAwlQLddpoMDM+iewkxxt6nxUQ5nq5o=
github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM=
github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
Expand Down Expand Up @@ -183,10 +193,13 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
Expand Down
2 changes: 1 addition & 1 deletion Wox/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func main() {

t := hotkey.Hotkey{}
t.Register(ctx, "ctrl+ctrl", func() {
ui.GetUIManager().GetUI(ctx).ToggleApp(ctx)
ui.GetUIManager().GetUI(ctx).Notify(ctx, "Wox", "Wox is running")
})

if util.IsProd() {
Expand Down
6 changes: 3 additions & 3 deletions Wox/plugin/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type API interface {
ChangeQuery(ctx context.Context, query share.ChangedQuery)
HideApp(ctx context.Context)
ShowApp(ctx context.Context)
ShowMsg(ctx context.Context, title string, description string, icon string)
Notify(ctx context.Context, title string, description string)
Log(ctx context.Context, msg string)
GetTranslation(ctx context.Context, key string) string
GetSetting(ctx context.Context, key string) string
Expand Down Expand Up @@ -44,8 +44,8 @@ func (a *APIImpl) ShowApp(ctx context.Context) {
})
}

func (a *APIImpl) ShowMsg(ctx context.Context, title string, description string, icon string) {
GetPluginManager().GetUI().ShowMsg(ctx, title, description, icon)
func (a *APIImpl) Notify(ctx context.Context, title string, description string) {
GetPluginManager().GetUI().Notify(ctx, title, description)
}

func (a *APIImpl) Log(ctx context.Context, msg string) {
Expand Down
7 changes: 3 additions & 4 deletions Wox/plugin/host/host_websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,14 @@ func (w *WebsocketHost) handleRequestFromPlugin(ctx context.Context, data string
}

w.sendResponse(ctx, request, "")
case "ShowMsg":
case "Notify":
title, exist := request.Params["title"]
if !exist {
util.GetLogger().Error(ctx, fmt.Sprintf("[%s] ShowMsg method must have a title parameter", request.PluginName))
util.GetLogger().Error(ctx, fmt.Sprintf("[%s] Notify method must have a title parameter", request.PluginName))
return
}
description := request.Params["description"]
iconPath := request.Params["iconPath"]
pluginInstance.API.ShowMsg(ctx, title, description, iconPath)
pluginInstance.API.Notify(ctx, title, description)
w.sendResponse(ctx, request, "")
case "Log":
msg, exist := request.Params["msg"]
Expand Down
8 changes: 4 additions & 4 deletions Wox/plugin/system/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ func (c *BackupPlugin) backup(ctx context.Context, query plugin.Query) []plugin.
Action: func(actionContext plugin.ActionContext) {
backupErr := setting.GetSettingManager().Backup(ctx, setting.BackupTypeManual)
if backupErr != nil {
c.api.ShowMsg(ctx, "Error", backupErr.Error(), "")
c.api.Notify(ctx, "Error", backupErr.Error())
} else {
c.api.ShowMsg(ctx, "Success", "Wox settings backed up", "")
c.api.Notify(ctx, "Success", "Wox settings backed up")
}
},
},
Expand Down Expand Up @@ -109,9 +109,9 @@ func (c *BackupPlugin) restore(ctx context.Context, query plugin.Query) []plugin
Action: func(actionContext plugin.ActionContext) {
restoreErr := setting.GetSettingManager().Restore(ctx, backupDummy.Id)
if restoreErr != nil {
c.api.ShowMsg(ctx, "Error", restoreErr.Error(), "")
c.api.Notify(ctx, "Error", restoreErr.Error())
} else {
c.api.ShowMsg(ctx, "Success", "Wox settings restored", "")
c.api.Notify(ctx, "Success", "Wox settings restored")
}
},
},
Expand Down
16 changes: 10 additions & 6 deletions Wox/plugin/system/wpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ func (w *WPMPlugin) Query(ctx context.Context, query plugin.Query) []plugin.Quer
Preview: plugin.WoxPreview{
PreviewType: plugin.WoxPreviewTypeMarkdown,
PreviewData: fmt.Sprintf(`
- **Directory**: %s
- **Name**: %s
- **Description**: %s
- **Author**: %s
Expand All @@ -247,7 +248,7 @@ func (w *WPMPlugin) Query(ctx context.Context, query plugin.Query) []plugin.Quer
- **Commands**: %s
- **SupportedOS**: %s
- **Features**: %s
`, lp.metadata.Metadata.Name, lp.metadata.Metadata.Description, lp.metadata.Metadata.Author,
`, lp.metadata.Directory, lp.metadata.Metadata.Name, lp.metadata.Metadata.Description, lp.metadata.Metadata.Author,
lp.metadata.Metadata.Website, lp.metadata.Metadata.Version, lp.metadata.Metadata.MinWoxVersion,
lp.metadata.Metadata.Runtime, lp.metadata.Metadata.Entry, lp.metadata.Metadata.TriggerKeywords,
lp.metadata.Metadata.Commands, lp.metadata.Metadata.SupportedOS, lp.metadata.Metadata.Features),
Expand All @@ -265,7 +266,7 @@ func (w *WPMPlugin) Query(ctx context.Context, query plugin.Query) []plugin.Quer
Action: func(actionContext plugin.ActionContext) {
openErr := util.ShellOpen(lp.metadata.Directory)
if openErr != nil {
w.api.ShowMsg(ctx, "Failed to open plugin directory", openErr.Error(), wpmIcon.String())
w.api.Notify(ctx, "Failed to open plugin directory", openErr.Error())
}
},
},
Expand Down Expand Up @@ -453,28 +454,31 @@ func (w *WPMPlugin) saveLocalPluginDirectories(ctx context.Context) {
w.loadLocalPlugins(ctx)
}

func (w *WPMPlugin) reloadLocalPlugins(ctx context.Context, localPlugin plugin.MetadataWithDirectory) {
func (w *WPMPlugin) reloadLocalPlugins(ctx context.Context, localPlugin plugin.MetadataWithDirectory) error {
w.api.Log(ctx, fmt.Sprintf("Reloading plugin: %s", localPlugin.Metadata.Name))

// find dist directory, if not exist, prompt user to build it
distDirectory := path.Join(localPlugin.Directory, "dist")
_, statErr := os.Stat(distDirectory)
if statErr != nil {
w.api.Log(ctx, fmt.Sprintf("Failed to stat dist directory: %s", statErr.Error()))
return
return statErr
}

distPluginMetadata, err := w.loadLocalPluginsFromDirectory(ctx, distDirectory)
if err != nil {
w.api.Log(ctx, fmt.Sprintf("Failed to load local plugin: %s", err.Error()))
return
return err
}

reloadErr := plugin.GetPluginManager().ReloadPlugin(ctx, distPluginMetadata)
if reloadErr != nil {
w.api.Log(ctx, fmt.Sprintf("Failed to reload plugin: %s", reloadErr.Error()))
return
return reloadErr
} else {
w.api.Log(ctx, fmt.Sprintf("Reloaded plugin: %s", localPlugin.Metadata.Name))
}

w.api.Notify(ctx, "Reloaded dev plugin", localPlugin.Metadata.Name)
return nil
}
2 changes: 1 addition & 1 deletion Wox/share/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type UI interface {
HideApp(ctx context.Context)
ShowApp(ctx context.Context, showContext ShowContext)
ToggleApp(ctx context.Context)
ShowMsg(ctx context.Context, title string, description string, icon string)
Notify(ctx context.Context, title string, description string)
GetServerPort(ctx context.Context) int
ChangeTheme(ctx context.Context, theme Theme)
OpenSettingWindow(ctx context.Context)
Expand Down
12 changes: 6 additions & 6 deletions Wox/ui/ui_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/gen2brain/beeep"
"github.com/google/uuid"
"github.com/samber/lo"
"github.com/tidwall/gjson"
Expand Down Expand Up @@ -37,12 +38,11 @@ func (u *uiImpl) ToggleApp(ctx context.Context) {
u.send(ctx, "ToggleApp", getShowAppParams(ctx, true))
}

func (u *uiImpl) ShowMsg(ctx context.Context, title string, description string, icon string) {
u.send(ctx, "ShowMsg", map[string]any{
"Title": title,
"Description": description,
"Icon": icon,
})
func (u *uiImpl) Notify(ctx context.Context, title string, description string) {
err := beeep.Notify(title, description, "")
if err != nil {
logger.Error(ctx, fmt.Sprintf("notify error: %s", err.Error()))
}
}

func (u *uiImpl) GetServerPort(ctx context.Context) int {
Expand Down

0 comments on commit 98f11eb

Please sign in to comment.