Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
marcaaron committed May 9, 2023
2 parents a8ea371 + 51e532e commit 93b5e7a
Show file tree
Hide file tree
Showing 37 changed files with 355 additions and 244 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 1001031105
versionName "1.3.11-5"
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.5</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.5</string>
<string>1.3.12.0</string>
</dict>
</plist>
16 changes: 8 additions & 8 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.3.11-5",
"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 Expand Up @@ -73,7 +73,7 @@
"babel-polyfill": "^6.26.0",
"dom-serializer": "^0.2.2",
"domhandler": "^4.3.0",
"expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#cb5836992710d910ab64f33895052074abdaa357",
"expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#d9c8b08ca67363e4442291ae283326d25f445cc5",
"fbjs": "^3.0.2",
"html-entities": "^1.3.1",
"htmlparser2": "^7.2.0",
Expand Down
8 changes: 8 additions & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ const keyInputEnter = lodashGet(KeyCommand, 'constants.keyInputEnter', 'keyInput
const keyInputUpArrow = lodashGet(KeyCommand, 'constants.keyInputUpArrow', 'keyInputUpArrow');
const keyInputDownArrow = lodashGet(KeyCommand, 'constants.keyInputDownArrow', 'keyInputDownArrow');

// describes if a shortcut key can cause navigation
const KEYBOARD_SHORTCUT_NAVIGATION_TYPE = 'NAVIGATION_SHORTCUT';

const CONST = {
ANDROID_PACKAGE_NAME,
ANIMATED_TRANSITION: 300,
Expand Down Expand Up @@ -255,6 +258,7 @@ const CONST = {
[PLATFORM_OS_MACOS]: {input: 'k', modifierFlags: keyModifierCommand},
[PLATFORM_IOS]: {input: 'k', modifierFlags: keyModifierCommand},
},
type: KEYBOARD_SHORTCUT_NAVIGATION_TYPE,
},
NEW_GROUP: {
descriptionKey: 'newGroup',
Expand All @@ -265,6 +269,7 @@ const CONST = {
[PLATFORM_OS_MACOS]: {input: 'k', modifierFlags: keyModifierShiftCommand},
[PLATFORM_IOS]: {input: 'k', modifierFlags: keyModifierShiftCommand},
},
type: KEYBOARD_SHORTCUT_NAVIGATION_TYPE,
},
SHORTCUT_MODAL: {
descriptionKey: 'openShortcutDialog',
Expand Down Expand Up @@ -342,6 +347,9 @@ const CONST = {
modifiers: [],
},
},
KEYBOARD_SHORTCUTS_TYPES: {
NAVIGATION_SHORTCUT: KEYBOARD_SHORTCUT_NAVIGATION_TYPE,
},
KEYBOARD_SHORTCUT_KEY_DISPLAY_NAME: {
CONTROL: 'CTRL',
ESCAPE: 'ESC',
Expand Down
36 changes: 36 additions & 0 deletions src/components/AddPlaidBankAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import getBankIcon from './Icon/BankIcons';
import Icon from './Icon';
import FullPageOfflineBlockingView from './BlockingViews/FullPageOfflineBlockingView';
import {withNetwork} from './OnyxProvider';
import CONST from '../CONST';
import KeyboardShortcut from '../libs/KeyboardShortcut';

const propTypes = {
/** Contains plaid data */
Expand Down Expand Up @@ -74,9 +76,12 @@ class AddPlaidBankAccount extends React.Component {
super(props);

this.getPlaidLinkToken = this.getPlaidLinkToken.bind(this);
this.subscribedKeyboardShortcuts = [];
}

componentDidMount() {
this.subscribeToNavigationShortcuts();

// If we're coming from Plaid OAuth flow then we need to reuse the existing plaidLinkToken
if (this.isAuthenticatedWithPlaid()) {
return;
Expand All @@ -94,6 +99,10 @@ class AddPlaidBankAccount extends React.Component {
BankAccounts.openPlaidBankLogin(this.props.allowDebit, this.props.bankAccountID);
}

componentWillUnmount() {
this.unsubscribeToNavigationShortcuts();
}

/**
* @returns {String}
*/
Expand All @@ -116,6 +125,33 @@ class AddPlaidBankAccount extends React.Component {
|| !_.isEmpty(lodashGet(this.props.plaidData, 'errors')));
}

/**
* Blocks the keyboard shortcuts that can navigate
*/
subscribeToNavigationShortcuts() {
// find and block the shortcuts
const shortcutsToBlock = _.filter(CONST.KEYBOARD_SHORTCUTS, x => x.type === CONST.KEYBOARD_SHORTCUTS_TYPES.NAVIGATION_SHORTCUT);
this.subscribedKeyboardShortcuts = _.map(
shortcutsToBlock,
shortcut => KeyboardShortcut.subscribe(
shortcut.shortcutKey,
() => {}, // do nothing
shortcut.descriptionKey,
shortcut.modifiers,
false,
() => lodashGet(this.props.plaidData, 'bankAccounts', []).length > 0, // start bubbling when there are bank accounts
),
);
}

/**
* Unblocks the keyboard shortcuts that can navigate
*/
unsubscribeToNavigationShortcuts() {
_.each(this.subscribedKeyboardShortcuts, unsubscribe => unsubscribe());
this.subscribedKeyboardShortcuts = [];
}

render() {
const plaidBankAccounts = lodashGet(this.props.plaidData, 'bankAccounts') || [];
const token = this.getPlaidLinkToken();
Expand Down
8 changes: 6 additions & 2 deletions src/components/CheckboxWithLabel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import {View, TouchableOpacity} from 'react-native';
import _ from 'underscore';
import styles from '../styles/styles';
import Checkbox from './Checkbox';
import Text from './Text';
Expand Down Expand Up @@ -75,7 +76,10 @@ class CheckboxWithLabel extends React.Component {
constructor(props) {
super(props);

this.isChecked = props.value || props.defaultValue || props.isChecked;
// We need to pick the first value that is strictly a boolean
// https://github.com/Expensify/App/issues/16885#issuecomment-1520846065
this.isChecked = _.find([props.value, props.defaultValue, props.isChecked], value => _.isBoolean(value));

this.LabelComponent = props.LabelComponent;

this.toggleCheckbox = this.toggleCheckbox.bind(this);
Expand All @@ -89,7 +93,7 @@ class CheckboxWithLabel extends React.Component {
render() {
return (
<View style={this.props.style}>
<View style={[styles.flexRow, styles.alignItemsCenter]}>
<View style={[styles.flexRow, styles.alignItemsCenter, styles.breakWord]}>
<Checkbox
isChecked={this.isChecked}
onPress={this.toggleCheckbox}
Expand Down
5 changes: 3 additions & 2 deletions src/components/ContextMenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ class ContextMenuItem extends Component {
* Method to call parent onPress and toggleDelayButtonState
*/
triggerPressAndUpdateSuccess() {
if (!this.props.isDelayButtonStateComplete) {
this.props.onPress();
if (this.props.isDelayButtonStateComplete) {
return;
}
this.props.onPress();

// We only set the success state when we have icon or text to represent the success state
// We may want to replace this check by checking the Result from OnPress Callback in future.
Expand Down
34 changes: 15 additions & 19 deletions src/components/CopyTextToClipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {Pressable} from 'react-native';
import PropTypes from 'prop-types';
import Text from './Text';
import * as Expensicons from './Icon/Expensicons';
import compose from '../libs/compose';
import Clipboard from '../libs/Clipboard';
import getButtonState from '../libs/getButtonState';
import Icon from './Icon';
Expand All @@ -11,6 +12,7 @@ import styles from '../styles/styles';
import * as StyleUtils from '../styles/StyleUtils';
import variables from '../styles/variables';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import withDelayToggleButtonState, {withDelayToggleButtonStatePropTypes} from './withDelayToggleButtonState';

const propTypes = {
/** The text to display and copy to the clipboard */
Expand All @@ -21,6 +23,8 @@ const propTypes = {
textStyles: PropTypes.arrayOf(PropTypes.object),

...withLocalizePropTypes,

...withDelayToggleButtonStatePropTypes,
};

const defaultProps = {
Expand All @@ -32,25 +36,14 @@ class CopyTextToClipboard extends React.Component {
super(props);

this.copyToClipboard = this.copyToClipboard.bind(this);

this.state = {
showCheckmark: false,
};
}

componentWillUnmount() {
// Clear the interval when the component unmounts so that if the user navigates
// away quickly, then setState() won't try to update a component that's been unmounted
clearInterval(this.showCheckmarkInterval);
}

copyToClipboard() {
if (this.props.isDelayButtonStateComplete) {
return;
}
Clipboard.setString(this.props.text);
this.setState({showCheckmark: true}, () => {
this.showCheckmarkInterval = setTimeout(() => {
this.setState({showCheckmark: false});
}, 2000);
});
this.props.toggleDelayButtonState(true);
}

render() {
Expand All @@ -61,12 +54,12 @@ class CopyTextToClipboard extends React.Component {
suppressHighlighting
>
<Text style={this.props.textStyles}>{`${this.props.text} `}</Text>
<Tooltip text={this.props.translate(`reportActionContextMenu.${this.state.showCheckmark ? 'copied' : 'copyToClipboard'}`)}>
<Tooltip text={this.props.translate(`reportActionContextMenu.${this.props.isDelayButtonStateComplete ? 'copied' : 'copyToClipboard'}`)}>
<Pressable onPress={this.copyToClipboard}>
{({hovered, pressed}) => (
<Icon
src={this.state.showCheckmark ? Expensicons.Checkmark : Expensicons.Copy}
fill={StyleUtils.getIconFillColor(getButtonState(hovered, pressed, this.state.showCheckmark))}
src={this.props.isDelayButtonStateComplete ? Expensicons.Checkmark : Expensicons.Copy}
fill={StyleUtils.getIconFillColor(getButtonState(hovered, pressed, this.props.isDelayButtonStateComplete))}
width={variables.iconSizeSmall}
height={variables.iconSizeSmall}
inline
Expand All @@ -82,4 +75,7 @@ class CopyTextToClipboard extends React.Component {
CopyTextToClipboard.propTypes = propTypes;
CopyTextToClipboard.defaultProps = defaultProps;

export default withLocalize(CopyTextToClipboard);
export default compose(
withLocalize,
withDelayToggleButtonState,
)(CopyTextToClipboard);
11 changes: 10 additions & 1 deletion src/components/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,16 @@ class Form extends React.Component {

// We clone the child passing down all form props
const inputID = child.props.inputID;
const defaultValue = this.props.draftValues[inputID] || child.props.defaultValue;
let defaultValue;

// We need to make sure that checkboxes have correct
// value assigned from the list of draft values
// https://github.com/Expensify/App/issues/16885#issuecomment-1520846065
if (_.isBoolean(this.props.draftValues[inputID])) {
defaultValue = this.props.draftValues[inputID];
} else {
defaultValue = this.props.draftValues[inputID] || child.props.defaultValue;
}

// We want to initialize the input value if it's undefined
if (_.isUndefined(this.state.inputValues[inputID])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const customHTMLElementModels = {
mixedUAStyles: {whiteSpace: 'pre'},
}),
'mention-user': defaultHTMLElementModels.span.extend({tagName: 'mention-user'}),
'mention-here': defaultHTMLElementModels.span.extend({tagName: 'mention-here'}),
};

// 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,23 @@
import React from 'react';
import {TNodeChildrenRenderer} from 'react-native-render-html';
import htmlRendererPropTypes from './htmlRendererPropTypes';
import Text from '../../Text';
import * as StyleUtils from '../../../styles/StyleUtils';

const MentionHereRenderer = props => (
<Text>
<Text

// Passing the true value to the function as here mention is always for the current user
color={StyleUtils.getMentionTextColor(true)}
style={StyleUtils.getMentionStyle(true)}
>
<TNodeChildrenRenderer tnode={props.tnode} />
</Text>
</Text>
);

MentionHereRenderer.propTypes = htmlRendererPropTypes;
MentionHereRenderer.displayName = 'HereMentionRenderer';

export default MentionHereRenderer;
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ const MentionUserRenderer = (props) => {
<Text
// eslint-disable-next-line react/jsx-props-no-spreading
{...defaultRendererProps}
color={StyleUtils.getUserMentionTextColor(isOurMention)}
style={StyleUtils.getUserMentionStyle(isOurMention)}
color={StyleUtils.getMentionTextColor(isOurMention)}
style={StyleUtils.getMentionStyle(isOurMention)}
onPress={() => showUserDetails(loginWhithoutLeadingAt)}
>
<TNodeChildrenRenderer tnode={props.tnode} />
Expand Down
Loading

0 comments on commit 93b5e7a

Please sign in to comment.