From cdc937eea5910014a7b32917443dab7175cd5f24 Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Tue, 29 Oct 2024 11:31:40 +0100 Subject: [PATCH 1/5] fix(chat): edit last message hotkey on macOS Signed-off-by: Grigorii K. Shartsev --- src/components/NewMessage/NewMessage.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/NewMessage/NewMessage.vue b/src/components/NewMessage/NewMessage.vue index e704f34e12f..bf753bf9a02 100644 --- a/src/components/NewMessage/NewMessage.vue +++ b/src/components/NewMessage/NewMessage.vue @@ -82,6 +82,7 @@ dir="auto" @keydown.esc="handleInputEsc" @keydown.ctrl.up="handleEditLastMessage" + @keydown.meta.up="handleEditLastMessage" @input="handleTyping" @paste="handlePastedFiles" @submit="handleSubmit" /> From 76d88fd8b3a531d1a132f4816d91c02b1665a639 Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Tue, 29 Oct 2024 11:15:30 +0100 Subject: [PATCH 2/5] feat(utils): add `isMac` check Signed-off-by: Grigorii K. Shartsev --- src/utils/browserCheck.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/utils/browserCheck.js b/src/utils/browserCheck.js index 2d1cf157d1b..3d98fa98395 100644 --- a/src/utils/browserCheck.js +++ b/src/utils/browserCheck.js @@ -10,6 +10,13 @@ import { t } from '@nextcloud/l10n' const parser = new UAParser() const browser = parser.getBrowser() +const os = parser.getOS() + +/** + * Per-OS flags + */ + +export const isMac = os.name === 'Mac OS' /** * Per-browser flags and a major version From 64622149776d62b088a4b64145d5a4b4901921fa Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Tue, 29 Oct 2024 11:17:14 +0100 Subject: [PATCH 3/5] refactor(utils): migrate browserCheck to TS Signed-off-by: Grigorii K. Shartsev --- src/App.vue | 2 +- src/FilesSidebarTabApp.vue | 2 +- src/PublicShareAuthRequestPasswordButton.vue | 2 +- src/PublicShareSidebar.vue | 2 +- src/components/TopBar/CallButton.vue | 2 +- src/utils/{browserCheck.js => browserCheck.ts} | 0 src/utils/media/pipeline/MediaDevicesSource.js | 2 +- src/utils/webrtc/index.js | 2 +- src/utils/webrtc/simplewebrtc/peer.js | 2 +- 9 files changed, 8 insertions(+), 8 deletions(-) rename src/utils/{browserCheck.js => browserCheck.ts} (100%) diff --git a/src/App.vue b/src/App.vue index 392f32b3e0b..d9faad79f8c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -50,7 +50,7 @@ import { leaveConversationSync } from './services/participantsService.js' import { useCallViewStore } from './stores/callView.js' import { useFederationStore } from './stores/federation.ts' import { useSidebarStore } from './stores/sidebar.js' -import { checkBrowser } from './utils/browserCheck.js' +import { checkBrowser } from './utils/browserCheck.ts' import { signalingKill } from './utils/webrtc/index.js' export default { diff --git a/src/FilesSidebarTabApp.vue b/src/FilesSidebarTabApp.vue index 69f8f36ffea..7b477a17632 100644 --- a/src/FilesSidebarTabApp.vue +++ b/src/FilesSidebarTabApp.vue @@ -43,7 +43,7 @@ import { getFileConversation } from './services/filesIntegrationServices.js' import { leaveConversationSync, } from './services/participantsService.js' -import { checkBrowser } from './utils/browserCheck.js' +import { checkBrowser } from './utils/browserCheck.ts' import CancelableRequest from './utils/cancelableRequest.js' import { signalingKill } from './utils/webrtc/index.js' diff --git a/src/PublicShareAuthRequestPasswordButton.vue b/src/PublicShareAuthRequestPasswordButton.vue index 10fd993e50f..3cd559b1f06 100644 --- a/src/PublicShareAuthRequestPasswordButton.vue +++ b/src/PublicShareAuthRequestPasswordButton.vue @@ -30,7 +30,7 @@ import { t } from '@nextcloud/l10n' import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' import { getPublicShareAuthConversationToken } from './services/publicShareAuthService.js' -import { checkBrowser } from './utils/browserCheck.js' +import { checkBrowser } from './utils/browserCheck.ts' export default { diff --git a/src/PublicShareSidebar.vue b/src/PublicShareSidebar.vue index 3997dc321f1..828c581348d 100644 --- a/src/PublicShareSidebar.vue +++ b/src/PublicShareSidebar.vue @@ -55,7 +55,7 @@ import { getPublicShareConversationData } from './services/filesIntegrationServi import { leaveConversationSync, } from './services/participantsService.js' -import { checkBrowser } from './utils/browserCheck.js' +import { checkBrowser } from './utils/browserCheck.ts' import { signalingKill } from './utils/webrtc/index.js' export default { diff --git a/src/components/TopBar/CallButton.vue b/src/components/TopBar/CallButton.vue index 594dbbac5f5..70190388d70 100644 --- a/src/components/TopBar/CallButton.vue +++ b/src/components/TopBar/CallButton.vue @@ -108,7 +108,7 @@ import { useCallViewStore } from '../../stores/callView.js' import { useSettingsStore } from '../../stores/settings.js' import { useSoundsStore } from '../../stores/sounds.js' import { useTalkHashStore } from '../../stores/talkHash.js' -import { blockCalls, unsupportedWarning } from '../../utils/browserCheck.js' +import { blockCalls, unsupportedWarning } from '../../utils/browserCheck.ts' export default { name: 'CallButton', diff --git a/src/utils/browserCheck.js b/src/utils/browserCheck.ts similarity index 100% rename from src/utils/browserCheck.js rename to src/utils/browserCheck.ts diff --git a/src/utils/media/pipeline/MediaDevicesSource.js b/src/utils/media/pipeline/MediaDevicesSource.js index 572f532f1bd..105d11b5054 100644 --- a/src/utils/media/pipeline/MediaDevicesSource.js +++ b/src/utils/media/pipeline/MediaDevicesSource.js @@ -4,7 +4,7 @@ */ import TrackSource from './TrackSource.js' -import { isChromium } from '../../browserCheck.js' +import { isChromium } from '../../browserCheck.ts' import { mediaDevicesManager } from '../../webrtc/index.js' /** diff --git a/src/utils/webrtc/index.js b/src/utils/webrtc/index.js index 6ec7275d5ec..cb9436daac3 100644 --- a/src/utils/webrtc/index.js +++ b/src/utils/webrtc/index.js @@ -21,7 +21,7 @@ import BrowserStorage from '../../services/BrowserStorage.js' import { getTalkConfig } from '../../services/CapabilitiesManager.ts' import { fetchSignalingSettings } from '../../services/signalingService.js' import store from '../../store/index.js' -import { isSafari } from '../browserCheck.js' +import { isSafari } from '../browserCheck.ts' import CancelableRequest from '../cancelableRequest.js' import Signaling from '../signaling.js' import SignalingTypingHandler from '../SignalingTypingHandler.js' diff --git a/src/utils/webrtc/simplewebrtc/peer.js b/src/utils/webrtc/simplewebrtc/peer.js index 6c6626131cc..95ab36adf47 100644 --- a/src/utils/webrtc/simplewebrtc/peer.js +++ b/src/utils/webrtc/simplewebrtc/peer.js @@ -9,7 +9,7 @@ import adapter from 'webrtc-adapter' import webrtcSupport from 'webrtcsupport' import WildEmitter from 'wildemitter' -import { isSafari } from '../../../utils/browserCheck.js' +import { isSafari } from '../../browserCheck.ts' /** * @param {object} stream the stream object. From fa2a3498be6b14ecee35119710a1d0f3e5db44b6 Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Tue, 29 Oct 2024 11:31:01 +0100 Subject: [PATCH 4/5] fix(settings): show correct hotkey with CMD on macOS Signed-off-by: Grigorii K. Shartsev --- src/components/SettingsDialog/SettingsDialog.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/SettingsDialog/SettingsDialog.vue b/src/components/SettingsDialog/SettingsDialog.vue index 72b54222923..135d71453e2 100644 --- a/src/components/SettingsDialog/SettingsDialog.vue +++ b/src/components/SettingsDialog/SettingsDialog.vue @@ -144,7 +144,7 @@
-
Ctrl +
+
{{ CmdOrCtrl }} +
{{ t('spreed', 'Edit your last message') }}
@@ -156,7 +156,7 @@
-
Ctrl + F
+
{{ CmdOrCtrl }} + F
{{ t('spreed', 'Search') }}
@@ -219,6 +219,7 @@ import { useCustomSettings } from '../../services/SettingsAPI.ts' import { setUserConfig } from '../../services/settingsService.js' import { useSettingsStore } from '../../stores/settings.js' import { useSoundsStore } from '../../stores/sounds.js' +import { isMac } from '../../utils/browserCheck.ts' import { satisfyVersion } from '../../utils/satisfyVersion.ts' const serverVersion = loadState('core', 'config', {}).version ?? '29.0.0.0' @@ -246,8 +247,10 @@ export default { const soundsStore = useSoundsStore() const { customSettingsSections } = useCustomSettings() const isBackgroundBlurred = ref(isBackgroundBlurredState) + const CmdOrCtrl = isMac ? 'Cmd' : 'Ctrl' return { + CmdOrCtrl, settingsStore, soundsStore, supportTypingStatus, From a8e04e7688b0ed80479b390d4508181e774414d4 Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Tue, 29 Oct 2024 13:31:18 +0100 Subject: [PATCH 5/5] chore(devDeps): add @types/ua-parser-js Signed-off-by: Grigorii K. Shartsev --- package-lock.json | 14 ++++++++++++++ package.json | 1 + 2 files changed, 15 insertions(+) diff --git a/package-lock.json b/package-lock.json index fb41542bce0..bd56b64dd21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -67,6 +67,7 @@ "@nextcloud/stylelint-config": "^3.0.1", "@nextcloud/webpack-vue-config": "^6.2.0", "@types/jest": "^29.5.14", + "@types/ua-parser-js": "^0.7.39", "@vue/test-utils": "^1.3.6", "@vue/tsconfig": "^0.5.1", "@vue/vue2-jest": "^29.2.6", @@ -4775,6 +4776,13 @@ "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==" }, + "node_modules/@types/ua-parser-js": { + "version": "0.7.39", + "resolved": "https://registry.npmjs.org/@types/ua-parser-js/-/ua-parser-js-0.7.39.tgz", + "integrity": "sha512-P/oDfpofrdtF5xw433SPALpdSchtJmY7nsJItf8h3KXqOslkbySh8zq4dSWXH2oTjRvJ5PczVEoCZPow6GicLg==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/unist": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz", @@ -24716,6 +24724,12 @@ "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==" }, + "@types/ua-parser-js": { + "version": "0.7.39", + "resolved": "https://registry.npmjs.org/@types/ua-parser-js/-/ua-parser-js-0.7.39.tgz", + "integrity": "sha512-P/oDfpofrdtF5xw433SPALpdSchtJmY7nsJItf8h3KXqOslkbySh8zq4dSWXH2oTjRvJ5PczVEoCZPow6GicLg==", + "dev": true + }, "@types/unist": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.6.tgz", diff --git a/package.json b/package.json index 927fcd996b5..a13f7284dfe 100644 --- a/package.json +++ b/package.json @@ -82,6 +82,7 @@ "@nextcloud/stylelint-config": "^3.0.1", "@nextcloud/webpack-vue-config": "^6.2.0", "@types/jest": "^29.5.14", + "@types/ua-parser-js": "^0.7.39", "@vue/test-utils": "^1.3.6", "@vue/tsconfig": "^0.5.1", "@vue/vue2-jest": "^29.2.6",