diff --git a/src/components/left/settings/SettingsGeneral.tsx b/src/components/left/settings/SettingsGeneral.tsx index 52f9b7ac7..b06d6f424 100644 --- a/src/components/left/settings/SettingsGeneral.tsx +++ b/src/components/left/settings/SettingsGeneral.tsx @@ -8,7 +8,7 @@ import type { ISettings, TimeFormat } from '../../../types'; import { SettingsScreens } from '../../../types'; import { - getSystemTheme, IS_IOS, IS_MAC_OS, IS_TOUCH_ENV, + getSystemTheme, IS_ANDROID, IS_IOS, IS_MAC_OS, } from '../../../util/windowEnvironment'; import { pick } from '../../../util/iteratees'; import { setTimeFormat } from '../../../util/langProvider'; @@ -19,6 +19,7 @@ import ListItem from '../../ui/ListItem'; import RangeSlider from '../../ui/RangeSlider'; import type { IRadioOption } from '../../ui/RadioGroup'; import RadioGroup from '../../ui/RadioGroup'; +import useAppLayout from '../../../hooks/useAppLayout'; type OwnProps = { isActive?: boolean; @@ -61,7 +62,10 @@ const SettingsGeneral: FC = ({ const lang = useLang(); - const APPEARANCE_THEME_OPTIONS: IRadioOption[] = [{ + const { isMobile } = useAppLayout(); + const isMobileDevice = isMobile && (IS_IOS || IS_ANDROID); + + const appearanceThemeOptions: IRadioOption[] = [{ label: lang('EmptyChat.Appearance.Light'), value: 'light', }, { @@ -72,11 +76,11 @@ const SettingsGeneral: FC = ({ value: 'auto', }]; - const KEYBOARD_SEND_OPTIONS = !IS_TOUCH_ENV ? [ + const keyboardSendOptions = !isMobileDevice ? [ { value: 'enter', label: lang('lng_settings_send_enter'), subLabel: 'New line by Shift + Enter' }, { value: 'ctrl-enter', - label: lang(IS_MAC_OS ? 'lng_settings_send_cmdenter' : 'lng_settings_send_ctrlenter'), + label: lang(IS_MAC_OS || IS_IOS ? 'lng_settings_send_cmdenter' : 'lng_settings_send_ctrlenter'), subLabel: 'New line by Enter', }, ] : undefined; @@ -143,7 +147,7 @@ const SettingsGeneral: FC = ({ @@ -161,13 +165,13 @@ const SettingsGeneral: FC = ({ /> - {KEYBOARD_SEND_OPTIONS && ( + {keyboardSendOptions && (

{lang('VoiceOver.Keyboard')}

diff --git a/src/components/middle/composer/MessageInput.tsx b/src/components/middle/composer/MessageInput.tsx index 18dbf8030..6c3b3f130 100644 --- a/src/components/middle/composer/MessageInput.tsx +++ b/src/components/middle/composer/MessageInput.tsx @@ -154,6 +154,7 @@ const MessageInput: FC = ({ const [selectedRange, setSelectedRange] = useState(); const [isTextFormatterDisabled, setIsTextFormatterDisabled] = useState(false); const { isMobile } = useAppLayout(); + const isMobileDevice = isMobile && (IS_IOS || IS_ANDROID); useInputCustomEmojis( getHtml, @@ -363,7 +364,7 @@ const MessageInput: FC = ({ if (!isComposing && e.key === 'Enter' && !e.shiftKey) { if ( - !(IS_IOS || IS_ANDROID) + !isMobileDevice && ( (messageSendKeyCombo === 'enter' && !e.shiftKey) || (messageSendKeyCombo === 'ctrl-enter' && (e.ctrlKey || e.metaKey)) @@ -441,7 +442,7 @@ const MessageInput: FC = ({ !chatId || editableInputId !== EDITABLE_INPUT_ID || noFocusInterception - || (IS_TOUCH_ENV && isMobile) + || isMobileDevice || isSelectModeActive ) { return undefined; @@ -488,7 +489,7 @@ const MessageInput: FC = ({ return () => { document.removeEventListener('keydown', handleDocumentKeyDown, true); }; - }, [chatId, editableInputId, isMobile, isSelectModeActive, noFocusInterception]); + }, [chatId, editableInputId, isMobileDevice, isSelectModeActive, noFocusInterception]); useEffect(() => { const captureFirstTab = debounce((e: KeyboardEvent) => {