update macos wifi refresh and logout clear
This commit is contained in:
@@ -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
|
// 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() {
|
func (a *App) monitorLoop() {
|
||||||
ticker := time.NewTicker(10 * time.Second)
|
|
||||||
defer ticker.Stop()
|
|
||||||
|
|
||||||
a.runMonitorTick()
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
<-ticker.C
|
|
||||||
a.runMonitorTick()
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ CWifiInfo GetCurrentWifiInfo() {
|
|||||||
info.bssid = NULL;
|
info.bssid = NULL;
|
||||||
|
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
CWWiFiClient *client = [CWWiFiClient sharedWiFiClient];
|
CWWiFiClient *client = [[CWWiFiClient alloc] init];
|
||||||
if (client != nil) {
|
if (client != nil) {
|
||||||
CWInterface *interface = [client interface];
|
CWInterface *interface = [client interface];
|
||||||
if (interface != nil) {
|
if (interface != nil) {
|
||||||
|
|||||||
Reference in New Issue
Block a user