Minor fixes
Some checks are pending
Lint Test / build (20) (push) Waiting to run
MacOS Build / build (20) (push) Waiting to run
MacOS 12 - x64 DMG Build / build (20) (push) Waiting to run
Ubuntu 22.04 - AppImage Build / build (20) (push) Waiting to run
Ubuntu 22.04 - x64 DEB Build / build (20) (push) Waiting to run
Ubuntu 24.04 - x64 DEB Build / build (20) (push) Waiting to run
Windows Build / build (20) (push) Waiting to run

This commit is contained in:
everoddandeven 2024-11-12 00:26:17 +01:00
parent 25656f5fba
commit 3333beec5e
2 changed files with 26 additions and 15 deletions

View file

@ -306,22 +306,28 @@ const createSplashWindow = async (): Promise<BrowserWindow | undefined> => {
// #region WiFi
function isConnectedToWiFi(): Promise<boolean> {
return new Promise<boolean>((resolve, reject) => {
network.get_active_interface((err: any | null, obj: { name: string, ip_address: string, mac_address: string, type: string, netmask: string, gateway_ip: string }) => {
if (err) {
console.error("Errore durante il controllo della connessione Wi-Fi:", err);
reject(err);
}
else {
console.log('isConnectedToWifi:');
console.log(obj);
resolve(obj.type == 'Wireless');
}
})
});
try {
return new Promise<boolean>((resolve, reject) => {
network.get_active_interface((err: any | null, obj: { name: string, ip_address: string, mac_address: string, type: string, netmask: string, gateway_ip: string }) => {
if (err) {
console.error("Errore durante il controllo della connessione Wi-Fi:", err);
reject(err);
}
else {
console.log('isConnectedToWifi:');
console.log(obj);
resolve(obj.type == 'Wireless');
}
})
});
}
catch(error: any) {
return isConnectedToWiFiV2();
}
}
function isConnectedToWiFiOld(): Promise<boolean> {
function isConnectedToWiFiV2(): Promise<boolean> {
return new Promise((resolve, reject) => {
const platform = os.platform(); // Use os to get the platform

View file

@ -330,13 +330,18 @@ export class DaemonDataService {
public syncDisabledByWifiPolicy: boolean = false;
public syncDisabledByPeriodPolicy: boolean = false;
private osType?: { platform: string };
private async refresh(): Promise<void> {
if (this.refreshing || this.tooEarlyForRefresh || this.daemonService.stopping) {
return;
}
if (this._runningOnBattery === undefined) {
if (this.osType === undefined) {
this.osType = await this.electronService.getOsType();
}
if (this._runningOnBattery === undefined || this.osType.platform == 'linux') {
this._runningOnBattery = await this.electronService.isOnBatteryPower();
}