Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(chat): Edit last message hotkey on macOS #13658

Merged
merged 5 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/FilesSidebarTabApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 1 addition & 1 deletion src/PublicShareAuthRequestPasswordButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion src/PublicShareSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/components/NewMessage/NewMessage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
dir="auto"
@keydown.esc="handleInputEsc"
@keydown.ctrl.up="handleEditLastMessage"
@keydown.meta.up="handleEditLastMessage"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meta is a 'Windows' key also. maybe replace it with useHotKey()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meta is a 'Windows' key also

It is not a problem, it is ignored on Windows and, afaik, all (most?) Linux DEs (Checked on GNOME, KDE, xfce, Cinnamon)

maybe replace it with useHotKey()?

I'd avoid having a global listener here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: xfce handles meta key with default settings.

But this doesn't lead to an issue:

  • If a user has desktop environment to handle this hotkey, e.g., for window management - it has no affect in talk
  • If a user doesn't have it in DE, and presses this hotkey while the focus is in the message input - it enables the last message editing
    • In the best case - a user get used to macOS is happy
    • In the worst case - some other (bot not desktop environment level) hotkey lead to a harmless action in talk - edit mode

@input="handleTyping"
@paste="handlePastedFiles"
@submit="handleSubmit" />
Expand Down
7 changes: 5 additions & 2 deletions src/components/SettingsDialog/SettingsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
</dd>
</div>
<div>
<dt><kbd>Ctrl</kbd> + <kbd>↑</kbd></dt>
<dt><kbd>{{ CmdOrCtrl }}</kbd> + <kbd>↑</kbd></dt>
<dd class="shortcut-description">
{{ t('spreed', 'Edit your last message') }}
</dd>
Expand All @@ -156,7 +156,7 @@
</dd>
</div>
<div>
<dt><kbd>Ctrl</kbd> + <kbd>F</kbd></dt>
<dt><kbd>{{ CmdOrCtrl }}</kbd> + <kbd>F</kbd></dt>
<dd class="shortcut-description">
{{ t('spreed', 'Search') }}
</dd>
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/components/TopBar/CallButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
7 changes: 7 additions & 0 deletions src/utils/browserCheck.js → src/utils/browserCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we update in the meantime?
https://docs.uaparser.dev/intro/whats-new.html#version-2-0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then let's follow-up, if you don't want to mix PRs


/**
* Per-browser flags and a major version
Expand Down
2 changes: 1 addition & 1 deletion src/utils/media/pipeline/MediaDevicesSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'

/**
Expand Down
2 changes: 1 addition & 1 deletion src/utils/webrtc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/utils/webrtc/simplewebrtc/peer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading