2023-07-27 05:31:52 +00:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-09-19 07:37:43 +00:00
|
|
|
import { defaultStore } from '@/store.js';
|
2022-02-08 09:46:39 +00:00
|
|
|
|
2023-02-02 07:43:56 +00:00
|
|
|
await defaultStore.ready;
|
|
|
|
|
2022-02-08 09:46:39 +00: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-27 02:16:22 +00:00
|
|
|
export const deviceKind: 'smartphone' | 'tablet' | 'desktop' = defaultStore.state.overridedDeviceKind ? defaultStore.state.overridedDeviceKind
|
2022-02-08 09:46:39 +00:00
|
|
|
: isSmartphone ? 'smartphone'
|
|
|
|
: isTablet ? 'tablet'
|
|
|
|
: 'desktop';
|