From c46b05fdcc0edd1ed798aff5615b1c3b4495c5fa Mon Sep 17 00:00:00 2001 From: OSBotify <76178356+OSBotify@users.noreply.github.com> Date: Mon, 17 Apr 2023 14:43:14 -0400 Subject: [PATCH 1/3] Merge pull request #17526 from Expensify/version-BUILD-854C81FE-0D38-4227-B02B-AF0C7A8E1938 Update version to 1.3.0-2 on main (cherry picked from commit df39a905351289a4f0581a62f4fbc947465172c2) --- android/app/build.gradle | 4 ++-- ios/NewExpensify/Info.plist | 2 +- ios/NewExpensifyTests/Info.plist | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 5bd5feb9db6a6..fe081fdaf89be 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -106,8 +106,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1001030001 - versionName "1.3.0-1" + versionCode 1001030002 + versionName "1.3.0-2" } splits { diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index 84aa8cd47d568..14276c6c6433c 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -30,7 +30,7 @@ CFBundleVersion - 1.3.0.1 + 1.3.0.2 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/ios/NewExpensifyTests/Info.plist b/ios/NewExpensifyTests/Info.plist index 3e41767a8d702..ee626e3492c1b 100644 --- a/ios/NewExpensifyTests/Info.plist +++ b/ios/NewExpensifyTests/Info.plist @@ -19,6 +19,6 @@ CFBundleSignature ???? CFBundleVersion - 1.3.0.1 + 1.3.0.2 diff --git a/package-lock.json b/package-lock.json index 83151ae5beb2f..89b54543f149d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "1.3.0-1", + "version": "1.3.0-2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "1.3.0-1", + "version": "1.3.0-2", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index dd89d26fe7fa7..cd102b62b31b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "1.3.0-1", + "version": "1.3.0-2", "author": "Expensify, Inc.", "homepage": "https://new.expensify.com", "description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.", From f509aed92406f1a574ce2d7a4ee111bdf91c005e Mon Sep 17 00:00:00 2001 From: Paulo Gaspar Sena do Vale Date: Mon, 17 Apr 2023 15:32:17 -0300 Subject: [PATCH 2/3] Merge pull request #17475 from tienifr/revert/17138-17360-listen-keydown-from-user Revert: 17138 17360 listen keydown from user (cherry picked from commit 86f7effe543d4f844fe266c0ce4b49fc4ee28955) --- .../EmojiPicker/EmojiPickerButton.js | 2 +- .../index.js => ReportActionCompose.js} | 123 +++++++++++------- .../ReportActionCompose/keyDownAction.js | 10 -- .../keyDownAction.native.js | 5 - 4 files changed, 76 insertions(+), 64 deletions(-) rename src/pages/home/report/{ReportActionCompose/index.js => ReportActionCompose.js} (91%) delete mode 100644 src/pages/home/report/ReportActionCompose/keyDownAction.js delete mode 100644 src/pages/home/report/ReportActionCompose/keyDownAction.native.js diff --git a/src/components/EmojiPicker/EmojiPickerButton.js b/src/components/EmojiPicker/EmojiPickerButton.js index 57b391007eae7..58958d1fd360a 100644 --- a/src/components/EmojiPicker/EmojiPickerButton.js +++ b/src/components/EmojiPicker/EmojiPickerButton.js @@ -36,7 +36,7 @@ const EmojiPickerButton = (props) => { StyleUtils.getButtonBackgroundColorStyle(getButtonState(hovered, pressed)), ])} disabled={props.isDisabled} - onPress={() => EmojiPickerAction.showEmojiPicker(props.onModalHide, props.onEmojiSelected, emojiPopoverAnchor, undefined, props.onWillShow)} + onPress={() => EmojiPickerAction.showEmojiPicker(props.onModalHide, props.onEmojiSelected, emojiPopoverAnchor)} nativeID={props.nativeID} > {({hovered, pressed}) => ( diff --git a/src/pages/home/report/ReportActionCompose/index.js b/src/pages/home/report/ReportActionCompose.js similarity index 91% rename from src/pages/home/report/ReportActionCompose/index.js rename to src/pages/home/report/ReportActionCompose.js index 741bf50d10568..893e6d925ff54 100644 --- a/src/pages/home/report/ReportActionCompose/index.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -9,6 +9,7 @@ import { import _ from 'underscore'; import lodashGet from 'lodash/get'; import {withOnyx} from 'react-native-onyx'; +<<<<<<< HEAD:src/pages/home/report/ReportActionCompose/index.js import styles from '../../../../styles/styles'; import themeColors from '../../../../styles/themes/default'; import Composer from '../../../../components/Composer'; @@ -52,6 +53,51 @@ import withKeyboardState, {keyboardStatePropTypes} from '../../../../components/ import ArrowKeyFocusManager from '../../../../components/ArrowKeyFocusManager'; import KeyboardShortcut from '../../../../libs/KeyboardShortcut'; import KeyDownAction from './keyDownAction'; +======= +import styles from '../../../styles/styles'; +import themeColors from '../../../styles/themes/default'; +import Composer from '../../../components/Composer'; +import ONYXKEYS from '../../../ONYXKEYS'; +import Icon from '../../../components/Icon'; +import * as Expensicons from '../../../components/Icon/Expensicons'; +import AttachmentPicker from '../../../components/AttachmentPicker'; +import * as Report from '../../../libs/actions/Report'; +import ReportTypingIndicator from './ReportTypingIndicator'; +import AttachmentModal from '../../../components/AttachmentModal'; +import compose from '../../../libs/compose'; +import PopoverMenu from '../../../components/PopoverMenu'; +import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions'; +import withDrawerState from '../../../components/withDrawerState'; +import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize'; +import willBlurTextInputOnTapOutside from '../../../libs/willBlurTextInputOnTapOutside'; +import CONST from '../../../CONST'; +import Navigation from '../../../libs/Navigation/Navigation'; +import ROUTES from '../../../ROUTES'; +import reportActionPropTypes from './reportActionPropTypes'; +import * as ReportUtils from '../../../libs/ReportUtils'; +import ReportActionComposeFocusManager from '../../../libs/ReportActionComposeFocusManager'; +import participantPropTypes from '../../../components/participantPropTypes'; +import ParticipantLocalTime from './ParticipantLocalTime'; +import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsPropTypes, withCurrentUserPersonalDetailsDefaultProps} from '../../../components/withCurrentUserPersonalDetails'; +import {withNetwork, withPersonalDetails} from '../../../components/OnyxProvider'; +import * as User from '../../../libs/actions/User'; +import Tooltip from '../../../components/Tooltip'; +import EmojiPickerButton from '../../../components/EmojiPicker/EmojiPickerButton'; +import * as DeviceCapabilities from '../../../libs/DeviceCapabilities'; +import toggleReportActionComposeView from '../../../libs/toggleReportActionComposeView'; +import OfflineIndicator from '../../../components/OfflineIndicator'; +import ExceededCommentLength from '../../../components/ExceededCommentLength'; +import withNavigationFocus from '../../../components/withNavigationFocus'; +import * as EmojiUtils from '../../../libs/EmojiUtils'; +import ReportDropUI from './ReportDropUI'; +import DragAndDrop from '../../../components/DragAndDrop'; +import reportPropTypes from '../../reportPropTypes'; +import EmojiSuggestions from '../../../components/EmojiSuggestions'; +import withKeyboardState, {keyboardStatePropTypes} from '../../../components/withKeyboardState'; +import ArrowKeyFocusManager from '../../../components/ArrowKeyFocusManager'; +import OfflineWithFeedback from '../../../components/OfflineWithFeedback'; +import KeyboardShortcut from '../../../libs/KeyboardShortcut'; +>>>>>>> 86f7effe54 (Merge pull request #17475 from tienifr/revert/17138-17360-listen-keydown-from-user):src/pages/home/report/ReportActionCompose.js const propTypes = { /** Beta features list */ @@ -164,8 +210,6 @@ class ReportActionCompose extends React.Component { this.setIsFullComposerAvailable = this.setIsFullComposerAvailable.bind(this); this.focus = this.focus.bind(this); this.addEmojiToTextBox = this.addEmojiToTextBox.bind(this); - this.replaceSelectionWithInput = this.replaceSelectionWithInput.bind(this); - this.keydownListener = this.keydownListener.bind(this); this.onSelectionChange = this.onSelectionChange.bind(this); this.isEmojiCode = this.isEmojiCode.bind(this); this.setTextInputRef = this.setTextInputRef.bind(this); @@ -204,13 +248,10 @@ class ReportActionCompose extends React.Component { isEmojiPickerLarge: false, composerHeight: 0, hasExceededMaxCommentLength: false, - isEmojiPickerVisible: false, }; } componentDidMount() { - KeyDownAction.listenKeyDown(this.keydownListener); - // This callback is used in the contextMenuActions to manage giving focus back to the compose input. // TODO: we should clean up this convoluted code and instead move focus management to something like ReportFooter.js or another higher up component ReportActionComposeFocusManager.onComposerFocus(() => { @@ -266,9 +307,6 @@ class ReportActionCompose extends React.Component { } componentWillUnmount() { - if (this.keydownListener) { - KeyDownAction.removeListenKeyDown(this.keydownListener); - } ReportActionComposeFocusManager.clear(); if (this.unsubscribeEscapeKey) { @@ -474,45 +512,6 @@ class ReportActionCompose extends React.Component { return _.size(this.props.reportActions) === 1; } - keydownListener(e) { - if (this.state.isFocused || this.state.isEmojiPickerVisible || this.props.modal.isVisible || this.props.isSmallScreenWidth) { - return; - } - - // If the key pressed is non-character keys like Enter, Shift, ... do not focus - if (e.key.length > 1) { - return; - } - - // If a key is pressed in combination with Meta, Control or Alt do not focus - if (e.metaKey || e.ctrlKey || e.altKey) { - return; - } - - // If we're typing on another input/text area, do not focus - if (e.target.nodeName === 'INPUT' || e.target.nodeName === 'TEXTAREA') { - return; - } - - this.focus(); - this.replaceSelectionWithInput(e.key); - } - - /** - * @param {String} text - */ - replaceSelectionWithInput(text) { - const newComment = this.comment.slice(0, this.state.selection.start) - + text - + this.comment.slice(this.state.selection.end, this.comment.length); - this.setState(prevState => ({ - selection: { - start: prevState.selection.start + text.length, - end: prevState.selection.start + text.length, - }, - }), this.updateComment(newComment)); - } - /** * Callback for the emoji picker to add whatever emoji is chosen into the main input * @@ -520,7 +519,16 @@ class ReportActionCompose extends React.Component { */ addEmojiToTextBox(emoji) { const emojiWithSpace = `${emoji} `; - this.replaceSelectionWithInput(emojiWithSpace); + const newComment = this.comment.slice(0, this.state.selection.start) + + emojiWithSpace + + this.comment.slice(this.state.selection.end, this.comment.length); + this.setState(prevState => ({ + selection: { + start: prevState.selection.start + emojiWithSpace.length, + end: prevState.selection.start + emojiWithSpace.length, + }, + })); + this.updateComment(newComment); } /** @@ -840,6 +848,7 @@ class ReportActionCompose extends React.Component { }, ]} /> +<<<<<<< HEAD:src/pages/home/report/ReportActionCompose/index.js )} @@ -855,6 +864,24 @@ class ReportActionCompose extends React.Component { }} onDrop={(e) => { e.preventDefault(); +======= + + + + )} + + {DeviceCapabilities.canUseTouchScreen() && this.props.isMediumScreenWidth ? null : ( + { + this.focus(true); + }} + onEmojiSelected={this.addEmojiToTextBox} + /> + )} + >>>>>> 86f7effe54 (Merge pull request #17475 from tienifr/revert/17138-17360-listen-keydown-from-user):src/pages/home/report/ReportActionCompose.js const file = lodashGet(e, ['dataTransfer', 'files', 0]); diff --git a/src/pages/home/report/ReportActionCompose/keyDownAction.js b/src/pages/home/report/ReportActionCompose/keyDownAction.js deleted file mode 100644 index ecd82f79e51d8..0000000000000 --- a/src/pages/home/report/ReportActionCompose/keyDownAction.js +++ /dev/null @@ -1,10 +0,0 @@ -function listenKeyDown(callback) { - document.addEventListener('keydown', callback); -} - -function removeListenKeyDown(callback) { - document.removeEventListener('keydown', callback); -} - -export default {listenKeyDown, removeListenKeyDown}; - diff --git a/src/pages/home/report/ReportActionCompose/keyDownAction.native.js b/src/pages/home/report/ReportActionCompose/keyDownAction.native.js deleted file mode 100644 index 38244160ecb2c..0000000000000 --- a/src/pages/home/report/ReportActionCompose/keyDownAction.native.js +++ /dev/null @@ -1,5 +0,0 @@ -function listenKeyDown() {} -function removeListenKeyDown() {} - -export default {removeListenKeyDown, listenKeyDown}; - From 89375743faf7165af31603ef5d79a3e4f4a5cb18 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Mon, 17 Apr 2023 16:05:10 -0300 Subject: [PATCH 3/3] Resolving merge conflict to CP and revert #17138 and #17360 --- src/pages/home/report/ReportActionCompose.js | 67 -------------------- 1 file changed, 67 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index 893e6d925ff54..5dd7d8c942cb8 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -9,51 +9,6 @@ import { import _ from 'underscore'; import lodashGet from 'lodash/get'; import {withOnyx} from 'react-native-onyx'; -<<<<<<< HEAD:src/pages/home/report/ReportActionCompose/index.js -import styles from '../../../../styles/styles'; -import themeColors from '../../../../styles/themes/default'; -import Composer from '../../../../components/Composer'; -import ONYXKEYS from '../../../../ONYXKEYS'; -import Icon from '../../../../components/Icon'; -import * as Expensicons from '../../../../components/Icon/Expensicons'; -import AttachmentPicker from '../../../../components/AttachmentPicker'; -import * as Report from '../../../../libs/actions/Report'; -import ReportTypingIndicator from '../ReportTypingIndicator'; -import AttachmentModal from '../../../../components/AttachmentModal'; -import compose from '../../../../libs/compose'; -import PopoverMenu from '../../../../components/PopoverMenu'; -import withWindowDimensions, {windowDimensionsPropTypes} from '../../../../components/withWindowDimensions'; -import withDrawerState from '../../../../components/withDrawerState'; -import withLocalize, {withLocalizePropTypes} from '../../../../components/withLocalize'; -import willBlurTextInputOnTapOutside from '../../../../libs/willBlurTextInputOnTapOutside'; -import CONST from '../../../../CONST'; -import Navigation from '../../../../libs/Navigation/Navigation'; -import ROUTES from '../../../../ROUTES'; -import reportActionPropTypes from '../reportActionPropTypes'; -import * as ReportUtils from '../../../../libs/ReportUtils'; -import ReportActionComposeFocusManager from '../../../../libs/ReportActionComposeFocusManager'; -import participantPropTypes from '../../../../components/participantPropTypes'; -import ParticipantLocalTime from '../ParticipantLocalTime'; -import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsPropTypes, withCurrentUserPersonalDetailsDefaultProps} from '../../../../components/withCurrentUserPersonalDetails'; -import {withNetwork, withPersonalDetails} from '../../../../components/OnyxProvider'; -import * as User from '../../../../libs/actions/User'; -import Tooltip from '../../../../components/Tooltip'; -import EmojiPickerButton from '../../../../components/EmojiPicker/EmojiPickerButton'; -import * as DeviceCapabilities from '../../../../libs/DeviceCapabilities'; -import toggleReportActionComposeView from '../../../../libs/toggleReportActionComposeView'; -import OfflineIndicator from '../../../../components/OfflineIndicator'; -import ExceededCommentLength from '../../../../components/ExceededCommentLength'; -import withNavigationFocus from '../../../../components/withNavigationFocus'; -import * as EmojiUtils from '../../../../libs/EmojiUtils'; -import ReportDropUI from '../ReportDropUI'; -import DragAndDrop from '../../../../components/DragAndDrop'; -import reportPropTypes from '../../../reportPropTypes'; -import EmojiSuggestions from '../../../../components/EmojiSuggestions'; -import withKeyboardState, {keyboardStatePropTypes} from '../../../../components/withKeyboardState'; -import ArrowKeyFocusManager from '../../../../components/ArrowKeyFocusManager'; -import KeyboardShortcut from '../../../../libs/KeyboardShortcut'; -import KeyDownAction from './keyDownAction'; -======= import styles from '../../../styles/styles'; import themeColors from '../../../styles/themes/default'; import Composer from '../../../components/Composer'; @@ -97,7 +52,6 @@ import withKeyboardState, {keyboardStatePropTypes} from '../../../components/wit import ArrowKeyFocusManager from '../../../components/ArrowKeyFocusManager'; import OfflineWithFeedback from '../../../components/OfflineWithFeedback'; import KeyboardShortcut from '../../../libs/KeyboardShortcut'; ->>>>>>> 86f7effe54 (Merge pull request #17475 from tienifr/revert/17138-17360-listen-keydown-from-user):src/pages/home/report/ReportActionCompose.js const propTypes = { /** Beta features list */ @@ -848,7 +802,6 @@ class ReportActionCompose extends React.Component { }, ]} /> -<<<<<<< HEAD:src/pages/home/report/ReportActionCompose/index.js )} @@ -864,24 +817,6 @@ class ReportActionCompose extends React.Component { }} onDrop={(e) => { e.preventDefault(); -======= - - - - )} - - {DeviceCapabilities.canUseTouchScreen() && this.props.isMediumScreenWidth ? null : ( - { - this.focus(true); - }} - onEmojiSelected={this.addEmojiToTextBox} - /> - )} - >>>>>> 86f7effe54 (Merge pull request #17475 from tienifr/revert/17138-17360-listen-keydown-from-user):src/pages/home/report/ReportActionCompose.js const file = lodashGet(e, ['dataTransfer', 'files', 0]); @@ -938,10 +873,8 @@ class ReportActionCompose extends React.Component { isDisabled={isBlockedFromConcierge || this.props.disabled} onModalHide={() => { this.focus(true); - this.setState({isEmojiPickerVisible: false}); }} onEmojiSelected={this.addEmojiToTextBox} - onWillShow={() => this.setState({isEmojiPickerVisible: true})} /> )}