Fix WiFi page update
This commit is contained in:
@@ -394,22 +394,33 @@ func (p *WiFiSetupPage) handleConnectionStatusUpdate(status *network.ConnectionS
|
||||
return
|
||||
}
|
||||
|
||||
// NEW LOGIC: Any "Connected" status should clear the "isConnecting" flag
|
||||
// so the user knows the password worked and the hardware is associated.
|
||||
// milestone 1: We are associated with an AP (even if internet is still pending)
|
||||
isConnected := status.StatusCode == network.StatusWifiConnectedInternetUp ||
|
||||
status.StatusCode == network.StatusWifiConnectedNoInternet
|
||||
|
||||
if isConnected {
|
||||
activeSSID := p.getActiveSSID()
|
||||
|
||||
// We check if the SSID matches, OR if we've been trying long enough
|
||||
// that any active connection is likely ours.
|
||||
// If we see our SSID, OR if we're connected to anything while trying, call it a win.
|
||||
if activeSSID == p.pendingSSID || activeSSID != "" {
|
||||
logger.Info("WiFi successfully associated with %s", activeSSID)
|
||||
logger.Info("UI synced: Connected to %s", activeSSID)
|
||||
p.isConnecting = false
|
||||
p.pendingSSID = ""
|
||||
p.connectionError = ""
|
||||
p.refreshNetworkColors()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// milestone 2: Handle the "Not Connected" state during the handshake
|
||||
if status.StatusCode == network.StatusWifiAvailableNotConnected {
|
||||
// INCREASE THIS: 5 seconds is way too aggressive.
|
||||
// Give it at least 20 seconds before assuming the password was wrong.
|
||||
if time.Since(p.connectionAttemptTime) > 20*time.Second {
|
||||
p.isConnecting = false
|
||||
p.connectionError = "Connection failed - Check password or signal"
|
||||
p.isEnteringPassword = true
|
||||
p.enterPasswordMode()
|
||||
p.updatePasswordErrorTexture()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user