feat(client): デバイスの種類を手動指定できるように

This commit is contained in:
syuilo
2022-02-08 18:46:39 +09:00
parent 71a7165ed7
commit 190b47aad2
9 changed files with 38 additions and 7 deletions

View File

@ -0,0 +1,10 @@
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';

View File

@ -1,2 +0,0 @@
const ua = navigator.userAgent.toLowerCase();
export const isMobile = /mobile|iphone|ipad|android/.test(ua);