mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-21 00:15:08 +01:00
11 lines
429 B
TypeScript
11 lines
429 B
TypeScript
|
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);
|
||
|
|
||
|
export const deviceKind = defaultStore.state.overridedDeviceKind ? defaultStore.state.overridedDeviceKind
|
||
|
: isSmartphone ? 'smartphone'
|
||
|
: isTablet ? 'tablet'
|
||
|
: 'desktop';
|