disable Fyne thread checks, fix async for connect to server workflow

This commit is contained in:
Drew Weymouth
2025-02-11 17:09:03 -03:00
parent 513a9f53d0
commit 253c08cbf3
2 changed files with 26 additions and 18 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ build:
# so the last 3 cmds move it over manually. This is a bit fragile though
# since it assumes a specific location and version of the dependency
package_macos:
CGO_CFLAGS="-I/usr/local/include -I/opt/homebrew/include" CGO_LDFLAGS="-L/usr/local/lib -L/opt/homebrew/lib" fyne package -os darwin
CGO_CFLAGS="-I/usr/local/include -I/opt/homebrew/include" CGO_LDFLAGS="-L/usr/local/lib -L/opt/homebrew/lib" fyne package -os darwin -tags migrated_fynedo
bundledeps_macos_homebrew:
dylibbundler -od -b -x ./Supersonic.app/Contents/MacOS/supersonic -d ./Supersonic.app/Contents/Frameworks/ -p @executable_path/../Frameworks/
+9 -1
View File
@@ -438,7 +438,6 @@ func (c *Controller) DoConnectToServerWorkflow(server *backend.ServerConfig) {
// try connecting to last used server - set up cancelable modal dialog
canceled := false
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
dlg := dialog.NewCustom(lang.L("Connecting"), lang.L("Cancel"),
widget.NewLabel(fmt.Sprintf(lang.L("Connecting to")+" %s", server.Nickname)), c.MainWindow)
dlg.SetOnClosed(func() {
@@ -447,8 +446,13 @@ func (c *Controller) DoConnectToServerWorkflow(server *backend.ServerConfig) {
})
c.haveModal = true
dlg.Show()
// try to connect
go func() {
defer cancel() // make sure to free up ctx resources if user does not cancel
if err := c.tryConnectToServer(ctx, server, pass); err != nil {
fyne.Do(func() {
dlg.Hide()
c.haveModal = false
if canceled {
@@ -462,10 +466,14 @@ func (c *Controller) DoConnectToServerWorkflow(server *backend.ServerConfig) {
c.haveModal = true
dlg.Show()
}
})
} else {
fyne.Do(func() {
dlg.Hide()
c.haveModal = false
})
}
}()
}
func (m *Controller) PromptForLoginAndConnect() {