2022-02-08 10:46:39 +01:00
|
|
|
import { defaultStore } from '@/store';
|
|
|
|
|
|
|
|
const ua = navigator.userAgent.toLowerCase();
|
|
|
|
const isTablet = /ipad/.test(ua) || (/mobile|iphone|android/.test(ua) && window.innerWidth > 700);
|
|
|
|
const isSmartphone = !isTablet && /mobile|iphone|android/.test(ua);
|
|
|
|
|
2023-01-27 03:16:22 +01:00
|
|
|
export const deviceKind: 'smartphone' | 'tablet' | 'desktop' = defaultStore.state.overridedDeviceKind ? defaultStore.state.overridedDeviceKind
|
2022-02-08 10:46:39 +01:00
|
|
|
: isSmartphone ? 'smartphone'
|
|
|
|
: isTablet ? 'tablet'
|
|
|
|
: 'desktop';
|