リファクタ等

This commit is contained in:
syuilo 2021-02-17 21:34:20 +09:00
parent 10205d3a6a
commit 55548fd7c8
6 changed files with 15 additions and 12 deletions

View File

@ -99,7 +99,8 @@ import { faHeart, faFlag, faLaugh } from '@fortawesome/free-regular-svg-icons';
import MkModal from '@/components/ui/modal.vue'; import MkModal from '@/components/ui/modal.vue';
import Particle from '@/components/particle.vue'; import Particle from '@/components/particle.vue';
import * as os from '@/os'; import * as os from '@/os';
import { isDeviceTouch } from '../scripts/is-device-touch'; import { isDeviceTouch } from '@/scripts/is-device-touch';
import { isMobile } from '@/scripts/is-mobile';
import { emojiCategories } from '@/instance'; import { emojiCategories } from '@/instance';
export default defineComponent({ export default defineComponent({
@ -322,7 +323,7 @@ export default defineComponent({
}, },
mounted() { mounted() {
if (!os.isMobile) { if (!isMobile && !isDeviceTouch) {
this.$refs.search.focus({ this.$refs.search.focus({
preventScroll: true preventScroll: true
}); });

View File

@ -69,6 +69,7 @@ import { noteVisibilities } from '../../types';
import * as os from '@/os'; import * as os from '@/os';
import { selectFile } from '@/scripts/select-file'; import { selectFile } from '@/scripts/select-file';
import { notePostInterruptors, postFormActions } from '@/store'; import { notePostInterruptors, postFormActions } from '@/store';
import { isMobile } from '@/scripts/is-mobile';
export default defineComponent({ export default defineComponent({
components: { components: {
@ -554,7 +555,7 @@ export default defineComponent({
localOnly: this.localOnly, localOnly: this.localOnly,
visibility: this.visibility, visibility: this.visibility,
visibleUserIds: this.visibility == 'specified' ? this.visibleUsers.map(u => u.id) : undefined, visibleUserIds: this.visibility == 'specified' ? this.visibleUsers.map(u => u.id) : undefined,
viaMobile: os.isMobile viaMobile: isMobile
}; };
// plugin // plugin

View File

@ -49,15 +49,16 @@ import { router } from '@/router';
import { applyTheme } from '@/scripts/theme'; import { applyTheme } from '@/scripts/theme';
import { isDeviceDarkmode } from '@/scripts/is-device-darkmode'; import { isDeviceDarkmode } from '@/scripts/is-device-darkmode';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { stream, isMobile, dialog, post } from '@/os'; import { stream, dialog, post } from '@/os';
import * as sound from '@/scripts/sound'; import * as sound from '@/scripts/sound';
import { $i, refreshAccount, login, updateAccount, signout } from '@/account'; import { $i, refreshAccount, login, updateAccount, signout } from '@/account';
import { defaultStore, ColdDeviceStorage } from '@/store'; import { defaultStore, ColdDeviceStorage } from '@/store';
import { fetchInstance, instance } from '@/instance'; import { fetchInstance, instance } from '@/instance';
import { makeHotkey } from './scripts/hotkey'; import { makeHotkey } from '@/scripts/hotkey';
import { search } from './scripts/search'; import { search } from '@/scripts/search';
import { getThemes } from './theme-store'; import { isMobile } from '@/scripts/is-mobile';
import { initializeSw } from './scripts/initialize-sw'; import { getThemes } from '@/theme-store';
import { initializeSw } from '@/scripts/initialize-sw';
console.info(`Misskey v${version}`); console.info(`Misskey v${version}`);

View File

@ -9,9 +9,6 @@ import { resolve } from '@/router';
import { $i } from '@/account'; import { $i } from '@/account';
import { defaultStore } from '@/store'; import { defaultStore } from '@/store';
const ua = navigator.userAgent.toLowerCase();
export const isMobile = /mobile|iphone|ipad|android/.test(ua);
export const stream = markRaw(new Stream()); export const stream = markRaw(new Stream());
export const pendingApiRequestsCount = ref(0); export const pendingApiRequestsCount = ref(0);

View File

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

View File

@ -64,6 +64,7 @@ import { noteVisibilities } from '../../../types';
import * as os from '@/os'; import * as os from '@/os';
import { selectFile } from '@/scripts/select-file'; import { selectFile } from '@/scripts/select-file';
import { notePostInterruptors, postFormActions } from '@/store'; import { notePostInterruptors, postFormActions } from '@/store';
import { isMobile } from '@/scripts/is-mobile';
export default defineComponent({ export default defineComponent({
components: { components: {
@ -541,7 +542,7 @@ export default defineComponent({
localOnly: this.localOnly, localOnly: this.localOnly,
visibility: this.visibility, visibility: this.visibility,
visibleUserIds: this.visibility == 'specified' ? this.visibleUsers.map(u => u.id) : undefined, visibleUserIds: this.visibility == 'specified' ? this.visibleUsers.map(u => u.id) : undefined,
viaMobile: os.isMobile viaMobile: isMobile
}; };
// plugin // plugin