Skip to content

Commit

Permalink
Merge branch 'Expensify:main' into fix-infinite-loading-when-navigate…
Browse files Browse the repository at this point in the history
…d-before-plaid
  • Loading branch information
huzaifa-99 authored May 9, 2023
2 parents a7a4f41 + 7fb641e commit ceb5661
Show file tree
Hide file tree
Showing 26 changed files with 165 additions and 36 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001031102
versionName "1.3.11-2"
versionCode 1001031200
versionName "1.3.12-0"
}

splits {
Expand Down
4 changes: 2 additions & 2 deletions ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3.11</string>
<string>1.3.12</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.3.11.2</string>
<string>1.3.12.0</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
4 changes: 2 additions & 2 deletions ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.3.11</string>
<string>1.3.12</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.3.11.2</string>
<string>1.3.12.0</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.3.11-2",
"version": "1.3.12-0",
"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.",
Expand Down
4 changes: 2 additions & 2 deletions src/components/ArrowKeyFocusManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ArrowKeyFocusManager extends Component {
}

this.props.onFocusedIndexChanged(newFocusedIndex);
}, arrowUpConfig.descriptionKey, arrowUpConfig.modifiers, true, false, 1, true, [this.props.shouldExcludeTextAreaNodes && 'TEXTAREA']);
}, arrowUpConfig.descriptionKey, arrowUpConfig.modifiers, true, false, 0, true, [this.props.shouldExcludeTextAreaNodes && 'TEXTAREA']);

this.unsubscribeArrowDownKey = KeyboardShortcut.subscribe(arrowDownConfig.shortcutKey, () => {
if (this.props.maxIndex < 0) {
Expand All @@ -70,7 +70,7 @@ class ArrowKeyFocusManager extends Component {
}

this.props.onFocusedIndexChanged(newFocusedIndex);
}, arrowDownConfig.descriptionKey, arrowDownConfig.modifiers, true, false, 1, true, [this.props.shouldExcludeTextAreaNodes && 'TEXTAREA']);
}, arrowDownConfig.descriptionKey, arrowDownConfig.modifiers, true, false, 0, true, [this.props.shouldExcludeTextAreaNodes && 'TEXTAREA']);
}

componentWillUnmount() {
Expand Down
1 change: 0 additions & 1 deletion src/components/ButtonWithMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class ButtonWithMenu extends PureComponent {
text={selectedItem.text}
onPress={event => this.props.onPress(event, this.props.options[0].value)}
pressOnEnter
enterKeyEventListenerPriority={1}
/>
)}
{this.props.options.length > 1 && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const customHTMLElementModels = {
tagName: 'strong',
mixedUAStyles: {whiteSpace: 'pre'},
}),
'mention-user': defaultHTMLElementModels.span.extend({tagName: 'mention-user'}),
};

// We are using the explicit composite architecture for performance gains.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from 'react';
import _ from 'underscore';
import {
TNodeChildrenRenderer,
} from 'react-native-render-html';
import Navigation from '../../../libs/Navigation/Navigation';
import ROUTES from '../../../ROUTES';
import Text from '../../Text';
import Tooltip from '../../Tooltip';
import htmlRendererPropTypes from './htmlRendererPropTypes';
import withCurrentUserPersonalDetails from '../../withCurrentUserPersonalDetails';
import personalDetailsPropType from '../../../pages/personalDetailsPropType';
import * as StyleUtils from '../../../styles/StyleUtils';

const propTypes = {
...htmlRendererPropTypes,

/**
* Current user personal details
*/
currentUserPersonalDetails: personalDetailsPropType.isRequired,
};

/**
* Navigates to user details screen based on email
* @param {String} email
* @returns {void}
* */
const showUserDetails = email => Navigation.navigate(ROUTES.getDetailsRoute(email));

const MentionUserRenderer = (props) => {
const defaultRendererProps = _.omit(props, ['TDefaultRenderer', 'style']);

// We need to remove the leading @ from data as it is not part of the login
const loginWhithoutLeadingAt = props.tnode.data.slice(1);

const isOurMention = loginWhithoutLeadingAt === props.currentUserPersonalDetails.login;

return (
<Text>
<Tooltip absolute text={loginWhithoutLeadingAt}>
<Text
// eslint-disable-next-line react/jsx-props-no-spreading
{...defaultRendererProps}
color={StyleUtils.getUserMentionTextColor(isOurMention)}
style={StyleUtils.getUserMentionStyle(isOurMention)}
onPress={() => showUserDetails(loginWhithoutLeadingAt)}
>
<TNodeChildrenRenderer tnode={props.tnode} />
</Text>
</Tooltip>
</Text>
);
};

MentionUserRenderer.propTypes = propTypes;
MentionUserRenderer.displayName = 'MentionUserRenderer';

export default withCurrentUserPersonalDetails(MentionUserRenderer);
2 changes: 2 additions & 0 deletions src/components/HTMLEngineProvider/HTMLRenderers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import AnchorRenderer from './AnchorRenderer';
import CodeRenderer from './CodeRenderer';
import EditedRenderer from './EditedRenderer';
import ImageRenderer from './ImageRenderer';
import MentionUserRenderer from './MentionUserRenderer';
import PreRenderer from './PreRenderer';

/**
Expand All @@ -16,4 +17,5 @@ export default {
// Custom tag renderers
edited: EditedRenderer,
pre: PreRenderer,
'mention-user': MentionUserRenderer,
};
9 changes: 8 additions & 1 deletion src/components/KeyboardShortcutsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class KeyboardShortcutsModal extends React.Component {

const openShortcutModalConfig = CONST.KEYBOARD_SHORTCUTS.SHORTCUT_MODAL;
this.unsubscribeShortcutModal = KeyboardShortcut.subscribe(openShortcutModalConfig.shortcutKey, () => {
if (this.props.isShortcutsModalOpen) {
return;
}

ModalActions.close();
KeyboardShortcutsActions.showKeyboardShortcutModal();
}, openShortcutModalConfig.descriptionKey, openShortcutModalConfig.modifiers, true);
Expand Down Expand Up @@ -161,6 +165,9 @@ export default compose(
withWindowDimensions,
withLocalize,
withOnyx({
isShortcutsModalOpen: {key: ONYXKEYS.IS_SHORTCUTS_MODAL_OPEN},
isShortcutsModalOpen: {
key: ONYXKEYS.IS_SHORTCUTS_MODAL_OPEN,
initWithStoredValues: false,
},
}),
)(KeyboardShortcutsModal);
3 changes: 2 additions & 1 deletion src/components/Onfido/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import onfidoPropTypes from './onfidoPropTypes';
import CONST from '../../CONST';
import withLocalize, {withLocalizePropTypes} from '../withLocalize';
import Log from '../../libs/Log';
import FullscreenLoadingIndicator from '../FullscreenLoadingIndicator';

const propTypes = {
...withLocalizePropTypes,
Expand Down Expand Up @@ -88,7 +89,7 @@ class Onfido extends React.Component {
}

render() {
return null;
return <FullscreenLoadingIndicator />;
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/components/OptionsSelector/BaseOptionsSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class BaseOptionsSelector extends Component {
enterConfig.modifiers,
true,
() => !this.state.allOptions[this.state.focusedIndex],
1,
);

const CTRLEnterConfig = CONST.KEYBOARD_SHORTCUTS.CTRL_ENTER;
Expand Down Expand Up @@ -360,7 +359,7 @@ class BaseOptionsSelector extends Component {
text={defaultConfirmButtonText}
onPress={this.props.onConfirmSelection}
pressOnEnter
enterKeyEventListenerPriority={2}
enterKeyEventListenerPriority={1}
/>
)}
{this.props.footerContent}
Expand Down
16 changes: 14 additions & 2 deletions src/components/ReportActionItem/IOUPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import lodashGet from 'lodash/get';
import _ from 'underscore';
import Str from 'expensify-common/lib/str';
import compose from '../../libs/compose';
import styles from '../../styles/styles';
import ONYXKEYS from '../../ONYXKEYS';
Expand Down Expand Up @@ -85,6 +86,13 @@ const propTypes = {
/** True if the IOU Preview card is hovered */
isHovered: PropTypes.bool,

/** All of the personal details for everyone */
personalDetails: PropTypes.objectOf(PropTypes.shape({

/** This is either the user's full name, or their login if full name is an empty string */
displayName: PropTypes.string.isRequired,
})),

/** Session info for the currently logged in user. */
session: PropTypes.shape({
/** Currently logged in user email */
Expand Down Expand Up @@ -117,6 +125,7 @@ const defaultProps = {
walletTerms: {},
pendingAction: null,
isHovered: false,
personalDetails: {},
session: {
email: null,
},
Expand All @@ -138,7 +147,7 @@ const IOUPreview = (props) => {
// When displaying within a IOUDetailsModal we cannot guarentee that participants are included in the originalMessage data
// Because an IOUPreview of type split can never be rendered within the IOUDetailsModal, manually building the email array is only needed for non-billSplit ious
const participantEmails = props.isBillSplit ? props.action.originalMessage.participants : [managerEmail, ownerEmail];
const participantAvatars = OptionsListUtils.getAvatarsForLogins(participantEmails);
const participantAvatars = OptionsListUtils.getAvatarsForLogins(participantEmails, props.personalDetails);

// Pay button should only be visible to the manager of the report.
const isCurrentUserManager = managerEmail === sessionEmail;
Expand Down Expand Up @@ -210,7 +219,7 @@ const IOUPreview = (props) => {
</Text>
)}

<Text>{lodashGet(props.action, 'originalMessage.comment', '')}</Text>
<Text>{Str.htmlDecode(lodashGet(props.action, 'originalMessage.comment', ''))}</Text>

{(isCurrentUserManager
&& !props.shouldHidePayButton
Expand Down Expand Up @@ -254,6 +263,9 @@ IOUPreview.displayName = 'IOUPreview';
export default compose(
withLocalize,
withOnyx({
personalDetails: {
key: ONYXKEYS.PERSONAL_DETAILS,
},
iouReport: {
key: ({iouReportID}) => `${ONYXKEYS.COLLECTION.REPORT}${iouReportID}`,
},
Expand Down
6 changes: 4 additions & 2 deletions src/components/TextInput/BaseTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class BaseTextInput extends Component {
super(props);

const value = props.value || props.defaultValue || '';
const activeLabel = props.forceActiveLabel || value.length > 0 || props.prefixCharacter;
const activeLabel = props.forceActiveLabel || value.length > 0 || Boolean(props.prefixCharacter);

this.state = {
isFocused: false,
Expand Down Expand Up @@ -212,14 +212,15 @@ class BaseTextInput extends Component {
const isEditable = _.isUndefined(this.props.editable) ? !this.props.disabled : this.props.editable;
const inputHelpText = this.props.errorText || this.props.hint;
const placeholder = (this.props.prefixCharacter || this.state.isFocused || !hasLabel || (hasLabel && this.props.forceActiveLabel)) ? this.props.placeholder : null;
const maxHeight = StyleSheet.flatten(this.props.containerStyles).maxHeight;
const textInputContainerStyles = _.reduce([
styles.textInputContainer,
...this.props.textInputContainerStyles,
this.props.autoGrow && StyleUtils.getWidthStyle(this.state.textInputWidth),
!this.props.hideFocusedState && this.state.isFocused && styles.borderColorFocus,
(this.props.hasError || this.props.errorText) && styles.borderColorDanger,
this.props.autoGrowHeight && ({scrollPaddingTop: 2 * maxHeight}),
], (finalStyles, s) => ({...finalStyles, ...s}), {});
const maxHeight = StyleSheet.flatten(this.props.containerStyles).maxHeight;
const isMultiline = this.props.multiline || this.props.autoGrowHeight;

return (
Expand Down Expand Up @@ -262,6 +263,7 @@ class BaseTextInput extends Component {
to prevent text overlapping with label when scrolling */}
{isMultiline && <View style={styles.textInputLabelBackground} pointerEvents="none" />}
<TextInputLabel
isLabelActive={this.isLabelActive}
label={this.props.label}
labelTranslateY={this.state.labelTranslateY}
labelScale={this.state.labelScale}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const propTypes = {
/** Label scale */
labelScale: PropTypes.instanceOf(Animated.Value).isRequired,

/** Whether the label is currently active or not */
isLabelActive: PropTypes.bool.isRequired,

/** For attribute for label */
for: PropTypes.string,
};
Expand Down
7 changes: 7 additions & 0 deletions src/components/TextInput/TextInputLabel/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ class TextInputLabel extends PureComponent {
}),
this.props.labelScale,
),

// If the label is active but the width is not ready yet, the above translateX value will be 0,
// making the label sits at the top center instead of the top left of the input. To solve it
// move the label by a percentage value with left style as translateX doesn't support percentage value.
(this.state.width === 0 && this.props.isLabelActive) && {
left: `${-((1 - styleConst.ACTIVE_LABEL_SCALE) * 100) / 2}%`,
},
]}
>
{this.props.label}
Expand Down
1 change: 1 addition & 0 deletions src/libs/actions/KeyboardShortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ let isShortcutsModalOpen;
Onyx.connect({
key: ONYXKEYS.IS_SHORTCUTS_MODAL_OPEN,
callback: flag => isShortcutsModalOpen = flag,
initWithStoredValues: false,
});

/**
Expand Down
Loading

0 comments on commit ceb5661

Please sign in to comment.