Skip to content

Commit

Permalink
fix: use isMobile function from lib/display-mobile.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulDremanovich committed Feb 26, 2024
1 parent 895e583 commit abb6773
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/components/AChat/AChatForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
density="compact"
color="primary"
v-on="listeners"
autofocus
:autofocus="isDesktopDevice"
>
<template #prepend-inner>
<chat-emojis
Expand All @@ -41,6 +41,7 @@
<script>
import { nextTick } from 'vue'
import ChatEmojis from '@/components/Chat/ChatEmojis.vue'
import { isMobile } from '@/lib/display-mobile'
export default {
components: { ChatEmojis },
Expand Down Expand Up @@ -83,6 +84,7 @@ export default {
emojiPickerOpen: false
}),
computed: {
isDesktopDevice: () => !isMobile(),
className: () => 'a-chat',
classes() {
return [
Expand Down Expand Up @@ -136,8 +138,6 @@ export default {
if (this.messageText) {
this.message = this.messageText
this.focus()
} else if (!this.$isMobile) {
this.focus()
}
this.attachKeyCommandListener()
},
Expand Down
10 changes: 0 additions & 10 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@ import 'dayjs/locale/ru'
const app = createApp(App)

app.config.globalProperties.appVersion = packageJSON.version
const isTouchable = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
const isMobileUserAgent = navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)

app.config.globalProperties.$isMobile = isTouchable && isMobileUserAgent

app.use(router)
app.use(store)
Expand Down

0 comments on commit abb6773

Please sign in to comment.