Update network manager to utilize gonetworkmanager for an easier life...

This commit is contained in:
NeilClack
2026-06-26 18:40:56 -05:00
parent 4dd78b5ade
commit fc5c1dfe6d
6 changed files with 896 additions and 1127 deletions
+3 -12
View File
@@ -204,25 +204,16 @@ func (app *Application) checkState() {
// Check if there is an internet connection, and if not, force the WiFi page
if !networkIsUp {
if lastNetworkCheckTime.IsZero() || time.Since(lastNetworkCheckTime) >= time.Second {
networkManager, err := network.New()
if err != nil {
logger.Error("error obtaining a network manager %v", err)
return
}
lastNetworkCheckTime = time.Now()
status, err := networkManager.CheckInternetConnection()
if err != nil {
logger.Error("error checking for internet connection %v", err)
return
}
if status.StatusCode != network.StatusWifiConnectedInternetUp &&
status.StatusCode != network.StatusEthernetConnectedInternetUp {
if !network.HasInternet() {
if app.state != NEEDS_INTERNET {
app.PageRouter.NavigateTo(page.WIFI)
app.state = NEEDS_INTERNET
}
return
}
networkIsUp = true // internet confirmed, don't check again
} else {
return // throttled, and we don't yet know if network is up — can't proceed