1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-07 22:15:38 -05:00

net: add auto connect option for wifi networks

fixes #597
This commit is contained in:
bbedward
2025-11-03 14:56:49 -05:00
parent 21e7ae3dfd
commit 5cd1167b28
3 changed files with 61 additions and 1 deletions

View File

@@ -869,4 +869,22 @@ Singleton {
getState()
}
}
function setWifiAutoconnect(ssid, autoconnect) {
if (!networkAvailable || DMSService.apiVersion <= 13) return
const params = {
ssid: ssid,
autoconnect: autoconnect
}
DMSService.sendRequest("network.wifi.setAutoconnect", params, response => {
if (response.error) {
ToastService.showError(I18n.tr("Failed to update autoconnect"))
} else {
ToastService.showInfo(autoconnect ? I18n.tr("Autoconnect enabled") : I18n.tr("Autoconnect disabled"))
Qt.callLater(() => getState())
}
})
}
}

View File

@@ -283,4 +283,10 @@ Singleton {
activeService.cancelCredentials(token)
}
}
function setWifiAutoconnect(ssid, autoconnect) {
if (activeService && activeService.setWifiAutoconnect) {
activeService.setWifiAutoconnect(ssid, autoconnect)
}
}
}