update macos wifi refresh and logout clear

This commit is contained in:
2026-07-01 10:10:49 +07:00
parent b702287cfb
commit 0d1e240227
2 changed files with 13 additions and 7 deletions

View File

@@ -662,14 +662,20 @@ func (a *App) authStorageScanner() {
// monitorLoop định kỳ 10s: check wifi, ping backend, cập nhật online/offline seconds và đồng bộ lên server
func (a *App) monitorLoop() {
ticker := time.NewTicker(10 * time.Second)
defer ticker.Stop()
a.runMonitorTick()
for {
<-ticker.C
a.runMonitorTick()
a.mu.Lock()
wifiEmpty := a.wifiSSID == "" || strings.Contains(a.wifiSSID, "Chưa cấp quyền") || strings.Contains(a.wifiSSID, "redacted")
expecting := a.expectingLogin
a.mu.Unlock()
sleepInterval := 10 * time.Second
if wifiEmpty && !expecting {
sleepInterval = 2 * time.Second
}
time.Sleep(sleepInterval)
}
}