using existing getOs

This commit is contained in:
Maksym Dudnik 2023-08-18 14:33:39 +03:00
parent 78679c917c
commit 056deef193

View File

@ -22,6 +22,7 @@ import { TranslateService } from '@ngx-translate/core';
import { ActionNotificationShow } from '@core/notification/notification.actions'; import { ActionNotificationShow } from '@core/notification/notification.actions';
import { DeviceService } from '@core/http/device.service'; import { DeviceService } from '@core/http/device.service';
import { helpBaseUrl } from '@shared/models/constants'; import { helpBaseUrl } from '@shared/models/constants';
import { getOS } from '@core/utils';
@Component({ @Component({
@ -60,16 +61,19 @@ export class DeviceGatewayCommandComponent implements OnInit {
this.cd.detectChanges(); this.cd.detectChanges();
}); });
} }
// @ts-ignore const currentOS = getOS();
const platform = window.navigator?.userAgentData?.platform || window.navigator.platform, switch (currentOS) {
macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], case 'linux':
windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE']; case 'android':
if (macosPlatforms.indexOf(platform) !== -1) { case 'macos':
this.tabIndex = 1; case 'ios':
} else if (windowsPlatforms.indexOf(platform) !== -1) { this.tabIndex = 1;
this.tabIndex = 0; break;
} else if (/Linux/.test(platform)) { case 'windows':
this.tabIndex = 1; this.tabIndex = 0;
break;
default:
this.tabIndex = 1;
} }
} }