mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-06 21:48:30 -04:00
network: avoid dropping to legacy service when loading
This commit is contained in:
@@ -100,14 +100,28 @@ Singleton {
|
|||||||
|
|
||||||
readonly property string socketPath: Quickshell.env("DMS_SOCKET")
|
readonly property string socketPath: Quickshell.env("DMS_SOCKET")
|
||||||
|
|
||||||
|
// Backend adoption must be state-checked here, not only edge-triggered below:
|
||||||
|
// with staged shell loading this singleton can be instantiated after
|
||||||
|
// DMSNetworkService already resolved its capabilities, so the change signal
|
||||||
|
// may never fire again.
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
log.info("Initializing...");
|
log.info("Initializing...");
|
||||||
if (!socketPath || socketPath.length === 0) {
|
if (!socketPath || socketPath.length === 0) {
|
||||||
log.info("DMS_SOCKET not set, using LegacyNetworkService");
|
log.info("DMS_SOCKET not set, using LegacyNetworkService");
|
||||||
useLegacyService();
|
useLegacyService();
|
||||||
} else {
|
return;
|
||||||
log.debug("DMS_SOCKET found, waiting for capabilities...");
|
|
||||||
}
|
}
|
||||||
|
if (DMSNetworkService.networkAvailable) {
|
||||||
|
log.info("Network capability already available, using DMSNetworkService");
|
||||||
|
useDMSService();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (DMSService.isConnected && DMSService.capabilities.length > 0) {
|
||||||
|
log.info("Network capability not available in DMS, using LegacyNetworkService");
|
||||||
|
useLegacyService();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log.debug("DMS_SOCKET found, waiting for capabilities...");
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
@@ -116,10 +130,7 @@ Singleton {
|
|||||||
function onNetworkAvailableChanged() {
|
function onNetworkAvailableChanged() {
|
||||||
if (!activeService && DMSNetworkService.networkAvailable) {
|
if (!activeService && DMSNetworkService.networkAvailable) {
|
||||||
log.info("Network capability detected, using DMSNetworkService");
|
log.info("Network capability detected, using DMSNetworkService");
|
||||||
activeService = DMSNetworkService;
|
useDMSService();
|
||||||
usingLegacy = false;
|
|
||||||
log.info("Switched to DMSNetworkService, networkAvailable:", networkAvailable);
|
|
||||||
connectSignals();
|
|
||||||
} else if (!activeService && !DMSNetworkService.networkAvailable && socketPath && socketPath.length > 0) {
|
} else if (!activeService && !DMSNetworkService.networkAvailable && socketPath && socketPath.length > 0) {
|
||||||
log.info("Network capability not available in DMS, using LegacyNetworkService");
|
log.info("Network capability not available in DMS, using LegacyNetworkService");
|
||||||
useLegacyService();
|
useLegacyService();
|
||||||
@@ -127,6 +138,13 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function useDMSService() {
|
||||||
|
activeService = DMSNetworkService;
|
||||||
|
usingLegacy = false;
|
||||||
|
log.info("Switched to DMSNetworkService, networkAvailable:", networkAvailable);
|
||||||
|
connectSignals();
|
||||||
|
}
|
||||||
|
|
||||||
function useLegacyService() {
|
function useLegacyService() {
|
||||||
activeService = LegacyNetworkService;
|
activeService = LegacyNetworkService;
|
||||||
usingLegacy = true;
|
usingLegacy = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user