1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 16:02:51 -05:00

Restore Wifi Services UI

This commit is contained in:
purian23
2025-07-29 22:20:06 -04:00
parent 35c6efdcc5
commit d8ab38a0af
2 changed files with 10 additions and 7 deletions

View File

@@ -66,6 +66,7 @@ Item {
// Auto-enable WiFi auto-refresh when network tab is visible // Auto-enable WiFi auto-refresh when network tab is visible
Component.onCompleted: { Component.onCompleted: {
NetworkService.addRef();
NetworkService.autoRefreshEnabled = true; NetworkService.autoRefreshEnabled = true;
if (NetworkService.wifiEnabled) if (NetworkService.wifiEnabled)
NetworkService.scanWifi(); NetworkService.scanWifi();
@@ -73,6 +74,11 @@ Item {
wifiMonitorTimer.start(); wifiMonitorTimer.start();
} }
Component.onDestruction: {
NetworkService.removeRef();
NetworkService.autoRefreshEnabled = false;
}
// Two-column layout for WiFi and Ethernet (WiFi on left, Ethernet on right) // Two-column layout for WiFi and Ethernet (WiFi on left, Ethernet on right)
Row { Row {
anchors.fill: parent anchors.fill: parent

View File

@@ -46,18 +46,15 @@ Singleton {
function addRef() { function addRef() {
refCount++; refCount++;
console.log("NetworkService: addRef, refCount now:", refCount); console.log("NetworkService: addRef, refCount now:", refCount);
if (refCount === 1) { // Reference counting affects WiFi scanning operations only
// Start monitoring when first consumer appears // Basic network status monitoring always runs
networkStatusChecker.running = true;
}
} }
function removeRef() { function removeRef() {
refCount = Math.max(0, refCount - 1); refCount = Math.max(0, refCount - 1);
console.log("NetworkService: removeRef, refCount now:", refCount); console.log("NetworkService: removeRef, refCount now:", refCount);
// Stop intensive WiFi operations when no consumers
if (refCount === 0) { if (refCount === 0) {
// Stop monitoring when no consumers
networkStatusChecker.running = false;
autoRefreshTimer.running = false; autoRefreshTimer.running = false;
} }
} }
@@ -78,7 +75,7 @@ Singleton {
Process { Process {
id: networkStatusChecker id: networkStatusChecker
command: ["sh", "-c", "nmcli -t -f DEVICE,TYPE,STATE device | grep -E '(ethernet|wifi)' && echo '---' && ip link show | grep -E '^[0-9]+:.*ethernet.*state UP'"] command: ["sh", "-c", "nmcli -t -f DEVICE,TYPE,STATE device | grep -E '(ethernet|wifi)' && echo '---' && ip link show | grep -E '^[0-9]+:.*ethernet.*state UP'"]
running: false running: true
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {