2022-02-08 01:46:39 -08:00
|
|
|
import { defaultStore } from '@/store';
|
|
|
|
|
2023-02-01 23:43:56 -08:00
|
|
|
await defaultStore.ready;
|
|
|
|
|
2022-02-08 01:46:39 -08:00
|
|
|
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-26 18:16:22 -08:00
|
|
|
export const deviceKind: 'smartphone' | 'tablet' | 'desktop' = defaultStore.state.overridedDeviceKind ? defaultStore.state.overridedDeviceKind
|
2022-02-08 01:46:39 -08:00
|
|
|
: isSmartphone ? 'smartphone'
|
|
|
|
: isTablet ? 'tablet'
|
|
|
|
: 'desktop';
|