feat(client): デバイスの種類を手動指定できるように
This commit is contained in:
parent
71a7165ed7
commit
190b47aad2
9 changed files with 38 additions and 7 deletions
10
packages/client/src/scripts/device-kind.ts
Normal file
10
packages/client/src/scripts/device-kind.ts
Normal 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';
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
const ua = navigator.userAgent.toLowerCase();
|
||||
export const isMobile = /mobile|iphone|ipad|android/.test(ua);
|
||||
Loading…
Add table
Add a link
Reference in a new issue