Skip to content

Commit

Permalink
Merge branch 'v3-alpha' into v3/linux-packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
leaanthony authored Nov 30, 2024
2 parents 0f2bd0e + 43659cc commit c778b72
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 10 deletions.
4 changes: 2 additions & 2 deletions v3/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ require (
github.com/pterm/pterm v0.12.51
github.com/samber/lo v1.38.1
github.com/tc-hib/winres v0.3.1
github.com/wailsapp/go-webview2 v1.0.17
github.com/wailsapp/go-webview2 v1.0.18-0.20241130004144-dd8667af33c1
github.com/wailsapp/mimetype v1.4.1
golang.org/x/sys v0.26.0
golang.org/x/term v0.25.0
golang.org/x/tools v0.23.0
golang.org/x/sys v0.27.0
gopkg.in/yaml.v3 v3.0.1
modernc.org/sqlite v1.21.0
)
Expand Down
10 changes: 4 additions & 6 deletions v3/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ github.com/tc-hib/winres v0.3.1 h1:CwRjEGrKdbi5CvZ4ID+iyVhgyfatxFoizjPhzez9Io4=
github.com/tc-hib/winres v0.3.1/go.mod h1:C/JaNhH3KBvhNKVbvdlDWkbMDO9H4fKKDaN7/07SSuk=
github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/wailsapp/go-webview2 v1.0.17 h1:DkLnUKqW7J///OBXkInMq1fzC88G6ZjHwKuHXThuaco=
github.com/wailsapp/go-webview2 v1.0.17/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
github.com/wailsapp/go-webview2 v1.0.18-0.20241130004144-dd8667af33c1 h1:El7t3J32//oQIsdvXAmbgeNKqgmKfKzU2SVp50yn0UM=
github.com/wailsapp/go-webview2 v1.0.18-0.20241130004144-dd8667af33c1/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc=
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
github.com/whilp/git-urls v1.0.0 h1:95f6UMWN5FKW71ECsXRUd3FVYiXdrE7aX4NZKcPmIjU=
Expand Down Expand Up @@ -438,10 +438,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.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.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.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-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down
11 changes: 11 additions & 0 deletions v3/pkg/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,13 @@ type App struct {
wailsEventListeners []WailsEventListener
}

func (a *App) handleWarning(msg string) {
if a.options.WarningHandler != nil {
a.options.WarningHandler(msg)
} else {
a.Logger.Warn(msg)
}
}
func (a *App) handleError(err error) {
if a.options.ErrorHandler != nil {
a.options.ErrorHandler(err)
Expand Down Expand Up @@ -508,6 +515,10 @@ func (a *App) fatal(message string, args ...any) {
err := fmt.Errorf(message, args...)
a.handleFatalError(err)
}
func (a *App) warning(message string, args ...any) {
msg := fmt.Sprintf(message, args...)
a.handleWarning(msg)
}

func (a *App) error(message string, args ...any) {
a.handleError(fmt.Errorf(message, args...))
Expand Down
3 changes: 3 additions & 0 deletions v3/pkg/application/application_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ type Options struct {
// This is useful for implementing custom frontend-to-backend communication.
RawMessageHandler func(window Window, message string)

// WarningHandler is called when a warning occurs
WarningHandler func(string)

// ErrorHandler is called when an error occurs
ErrorHandler func(err error)

Expand Down
13 changes: 11 additions & 2 deletions v3/pkg/application/webview_window_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -1503,14 +1503,23 @@ func (w *windowsWebviewWindow) setupChromium() {
if opts.GeneralAutofillEnabled {
err = chromium.PutIsGeneralAutofillEnabled(true)
if err != nil {
globalApplication.error(err.Error())
if errors.Is(edge.UnsupportedCapabilityError, err) {
// warning
globalApplication.warning("unsupported capability: GeneralAutofillEnabled")
} else {
globalApplication.fatal(err.Error())
}
}
}

if opts.PasswordAutosaveEnabled {
err = chromium.PutIsPasswordAutosaveEnabled(true)
if err != nil {
globalApplication.error(err.Error())
if errors.Is(edge.UnsupportedCapabilityError, err) {
globalApplication.warning("unsupported capability: PasswordAutosaveEnabled")
} else {
globalApplication.fatal(err.Error())
}
}
}

Expand Down

0 comments on commit c778b72

Please sign in to comment.