mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-24 20:15:21 -04:00
fix(network): fix excessive network prompting on failures, add VPN
connection statuses
This commit is contained in:
@@ -84,6 +84,8 @@ Singleton {
|
||||
property string lastConnectedVpnUuid: ""
|
||||
property string pendingVpnUuid: ""
|
||||
property var vpnBusyStartTime: 0
|
||||
property string vpnError: ""
|
||||
property string vpnErrorUuid: ""
|
||||
|
||||
property var profiles: {
|
||||
const mergedProfiles = vpnProfiles ? vpnProfiles.slice() : [];
|
||||
@@ -137,6 +139,17 @@ Singleton {
|
||||
property alias isBusy: root.vpnIsBusy
|
||||
property alias connected: root.vpnConnected
|
||||
|
||||
function vpnStateForUuid(uuid) {
|
||||
if (!uuid)
|
||||
return "";
|
||||
const match = vpnActive.find(v => v.uuid === uuid);
|
||||
return match ? (match.state || "") : "";
|
||||
}
|
||||
|
||||
function isVpnConnectingUuid(uuid) {
|
||||
return vpnStateForUuid(uuid) === "activating" || (vpnIsBusy && pendingVpnUuid === uuid);
|
||||
}
|
||||
|
||||
property string networkInfoSSID: ""
|
||||
property string networkInfoDetails: ""
|
||||
property bool networkInfoLoading: false
|
||||
@@ -372,6 +385,17 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
const incomingVpnError = state.vpnError || "";
|
||||
if (incomingVpnError && incomingVpnError !== vpnError) {
|
||||
vpnIsBusy = false;
|
||||
pendingVpnUuid = "";
|
||||
vpnBusyStartTime = 0;
|
||||
const failedName = (vpnProfiles.find(p => p.uuid === state.vpnErrorUuid)?.name) || I18n.tr("VPN");
|
||||
ToastService.showError(I18n.tr("%1: %2").arg(failedName).arg(incomingVpnError));
|
||||
}
|
||||
vpnError = incomingVpnError;
|
||||
vpnErrorUuid = state.vpnErrorUuid || "";
|
||||
|
||||
isConnecting = state.isConnecting || false;
|
||||
connectingSSID = state.connectingSSID || "";
|
||||
connectionError = state.lastError || "";
|
||||
|
||||
Reference in New Issue
Block a user