Refactor menu functions and streamline devtools toggle across systems

This update adds implementation to several menu item functions, replacing their previous 'not implemented' state. This includes actions for close, reload, forcing reload, toggling of fullscreen, reset zoom, and others. The update also includes modifications for the handling of developer tools toggle under different build configurations. This refactoring is aimed to standardize devtools configuration across different operating systems.
This commit is contained in:
Lea Anthony
2024-01-21 20:52:32 +11:00
parent c82facd6ff
commit 6522657893
27 changed files with 326 additions and 165 deletions
+15 -3
View File
@@ -3,16 +3,18 @@
package application
import (
"errors"
"github.com/wailsapp/wails/v3/internal/assetserver"
"net/http"
"time"
)
var devMode = false
func (a *App) preRun() error {
// Check for frontend server url
frontendURL := assetserver.GetDevServerURL()
if frontendURL != "" {
devMode = true
// We want to check if the frontend server is running by trying to http get the url
// and if it is not, we wait 500ms and try again for a maximum of 10 times. If it is
// still not available, we return an error.
@@ -31,8 +33,18 @@ func (a *App) preRun() error {
a.Logger.Info("Retrying...")
}
}
a.Logger.Info("failed!")
return errors.New("unable to connect to frontend server. Please check it is running")
a.fatal("unable to connect to frontend server. Please check it is running", "FRONTEND_DEVSERVER_URL", frontendURL)
}
return nil
}
func (a *App) postQuit() {
if devMode {
a.Logger.Info("The application has terminated, but the watcher is still running.")
a.Logger.Info("To terminate the watcher, press CTRL+C")
}
}
func (a *App) enableDevTools() {
}