From 7128c078fe85f8aeb87e496d122d66144729ca6e Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Mon, 27 Nov 2023 09:04:08 +0100 Subject: [PATCH 1/2] refactor: make browserCheck an util - There is no need to be a mixin, it has nothing Vue-related or reactive - Move to utils - Refactor computed and Vue component methods to exported constants and functions Signed-off-by: Grigorii K. Shartsev --- src/App.vue | 6 +- src/FilesSidebarTabApp.vue | 6 +- src/PublicShareAuthRequestPasswordButton.vue | 9 +- src/PublicShareSidebar.vue | 6 +- src/components/TopBar/CallButton.vue | 15 ++- src/mixins/browserCheck.js | 132 ------------------- src/utils/browserCheck.js | 93 +++++++++++++ 7 files changed, 113 insertions(+), 154 deletions(-) delete mode 100644 src/mixins/browserCheck.js create mode 100644 src/utils/browserCheck.js diff --git a/src/App.vue b/src/App.vue index c2ab6558c34..c3536a83f39 100644 --- a/src/App.vue +++ b/src/App.vue @@ -57,7 +57,6 @@ import SettingsDialog from './components/SettingsDialog/SettingsDialog.vue' import { useActiveSession } from './composables/useActiveSession.js' import { useIsInCall } from './composables/useIsInCall.js' import { CONVERSATION, PARTICIPANT } from './constants.js' -import browserCheck from './mixins/browserCheck.js' import participant from './mixins/participant.js' import sessionIssueHandler from './mixins/sessionIssueHandler.js' import talkHashCheck from './mixins/talkHashCheck.js' @@ -65,6 +64,7 @@ import Router from './router/router.js' import BrowserStorage from './services/BrowserStorage.js' import { EventBus } from './services/EventBus.js' import { leaveConversationSync } from './services/participantsService.js' +import { checkBrowser } from './utils/browserCheck.js' import { signalingKill } from './utils/webrtc/index.js' export default { @@ -81,7 +81,6 @@ export default { }, mixins: [ - browserCheck, talkHashCheck, sessionIssueHandler, participant, @@ -474,8 +473,7 @@ export default { async mounted() { if (!IS_DESKTOP) { - // see browserCheck mixin - this.checkBrowser() + checkBrowser() } // Check sidebar status in previous sessions if (BrowserStorage.getItem('sidebarOpen') === 'false') { diff --git a/src/FilesSidebarTabApp.vue b/src/FilesSidebarTabApp.vue index d92b62d1a86..749c5a095ae 100644 --- a/src/FilesSidebarTabApp.vue +++ b/src/FilesSidebarTabApp.vue @@ -52,13 +52,13 @@ import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' import LoadingComponent from './components/LoadingComponent.vue' -import browserCheck from './mixins/browserCheck.js' import sessionIssueHandler from './mixins/sessionIssueHandler.js' import { EventBus } from './services/EventBus.js' import { getFileConversation } from './services/filesIntegrationServices.js' import { leaveConversationSync, } from './services/participantsService.js' +import { checkBrowser } from './utils/browserCheck.js' import CancelableRequest from './utils/cancelableRequest.js' import { signalingKill } from './utils/webrtc/index.js' @@ -77,7 +77,6 @@ export default { }, mixins: [ - browserCheck, sessionIssueHandler, ], @@ -171,8 +170,7 @@ export default { methods: { async joinConversation() { - // see browserCheck mixin - this.checkBrowser() + checkBrowser() try { await this.getFileConversation() diff --git a/src/PublicShareAuthRequestPasswordButton.vue b/src/PublicShareAuthRequestPasswordButton.vue index 4fc1c47e4cb..fedf1ad5cba 100644 --- a/src/PublicShareAuthRequestPasswordButton.vue +++ b/src/PublicShareAuthRequestPasswordButton.vue @@ -41,8 +41,8 @@