Skip to content

Commit

Permalink
Merge branch 'Expensify:main' into rm-setNativeProps-form
Browse files Browse the repository at this point in the history
  • Loading branch information
rushatgabhane authored Oct 7, 2022
2 parents aab173b + 44bf1ff commit c72e7ac
Show file tree
Hide file tree
Showing 47 changed files with 606 additions and 274 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001021103
versionName "1.2.11-3"
versionCode 1001021202
versionName "1.2.12-2"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

if (isNewArchitectureEnabled()) {
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.2.11</string>
<string>1.2.12</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.2.11.3</string>
<string>1.2.12.2</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.2.11</string>
<string>1.2.12</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.2.11.3</string>
<string>1.2.12.2</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.2.11-3",
"version": "1.2.12-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.",
Expand Down
5 changes: 5 additions & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ const CONST = {
},
REGEX: {
US_ACCOUNT_NUMBER: /^[0-9]{4,17}$/,

// If the account number length is from 4 to 13 digits, we show the last 4 digits and hide the rest with X
// If the length is longer than 13 digits, we show the first 6 and last 4 digits, hiding the rest with X
MASKED_US_ACCOUNT_NUMBER: /^[X]{0,9}[0-9]{4}$|^[0-9]{6}[X]{4,7}[0-9]{4}$/,
SWIFT_BIC: /^[A-Za-z0-9]{8,11}$/,
},
VERIFICATION_MAX_ATTEMPTS: 7,
Expand Down Expand Up @@ -801,6 +805,7 @@ const CONST = {
},
BRICK_ROAD_INDICATOR_STATUS: {
ERROR: 'error',
INFO: 'info',
},
REPORT_DETAILS_MENU_ITEM: {
MEMBERS: 'member',
Expand Down
6 changes: 0 additions & 6 deletions src/ONYXKEYS.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ export default {
// Stores current date
CURRENT_DATE: 'currentDate',

// Currently viewed reportID
CURRENTLY_VIEWED_REPORTID: 'currentlyViewedReportID',

// Credentials to authenticate the user
CREDENTIALS: 'credentials',

Expand Down Expand Up @@ -161,9 +158,6 @@ export default {
// Is policy data loading?
IS_LOADING_POLICY_DATA: 'isLoadingPolicyData',

// Are we loading the create policy room command
IS_LOADING_CREATE_POLICY_ROOM: 'isLoadingCratePolicyRoom',

// Is Keyboard shortcuts modal open?
IS_SHORTCUTS_MODAL_OPEN: 'isShortcutsModalOpen',

Expand Down
1 change: 0 additions & 1 deletion src/components/BigNumberPad.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ class BigNumberPad extends React.Component {
ControlSelection.unblock();
this.props.longPressHandlerStateChanged(false);
}}
textSelectable={false}
/>
);
})}
Expand Down
2 changes: 1 addition & 1 deletion src/components/BlockingViews/FullPageNotFoundView.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const FullPageNotFoundView = (props) => {
onBackButtonPress={props.onBackButtonPress}
onCloseButtonPress={() => Navigation.dismissModal()}
/>
<View style={styles.flex1}>
<View style={[styles.flex1, styles.blockingViewContainer]}>
<BlockingView
icon={Expensicons.QuestionMark}
title={props.translate(props.titleKey)}
Expand Down
6 changes: 1 addition & 5 deletions src/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ const propTypes = {

/** Id to use for this button */
nativeID: PropTypes.string,

/** Whether text in Button should selectable */
textSelectable: PropTypes.bool,
};

const defaultProps = {
Expand Down Expand Up @@ -139,7 +136,6 @@ const defaultProps = {
shouldRemoveLeftBorderRadius: false,
shouldEnableHapticFeedback: false,
nativeID: '',
textSelectable: true,
};

class Button extends Component {
Expand Down Expand Up @@ -183,7 +179,7 @@ class Button extends Component {

const textComponent = (
<Text
selectable={this.props.textSelectable}
selectable={false}
style={[
this.props.isLoading && styles.opacity0,
styles.pointerEventsNone,
Expand Down
1 change: 0 additions & 1 deletion src/components/KeyboardShortcutsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class KeyboardShortcutsModal extends React.Component {
<View
style={[
styles.keyboardShortcutTableRow,
styles.flex1,
isFirstRow && styles.keyboardShortcutTableFirstRow,
]}
key={shortcut.displayName}
Expand Down
31 changes: 22 additions & 9 deletions src/components/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const defaultProps = {
badgeText: undefined,
shouldShowRightIcon: false,
shouldShowSelectedState: false,
shouldShowBasicTitle: false,
shouldShowDescriptionOnTop: false,
wrapperStyle: [],
style: {},
success: false,
Expand All @@ -50,9 +52,10 @@ const MenuItem = (props) => {
const titleTextStyle = StyleUtils.combineStyles([
styles.popoverMenuText,
styles.ml3,
(props.shouldShowBasicTitle ? undefined : styles.textStrong),
(props.interactive && props.disabled ? styles.disabledText : undefined),
], props.style);
const descriptionTextStyle = StyleUtils.combineStyles([styles.textLabelSupporting, styles.ml3, styles.mt1, styles.breakAll], props.style);
const descriptionTextStyle = StyleUtils.combineStyles([styles.textLabelSupporting, styles.ml3, styles.breakAll], props.style);

return (
<Pressable
Expand Down Expand Up @@ -108,14 +111,24 @@ const MenuItem = (props) => {
/>
</View>
)}
<View style={[styles.justifyContentCenter, styles.menuItemTextContainer, styles.flex1]}>
<Text
style={titleTextStyle}
numberOfLines={1}
>
{props.title}
</Text>
{Boolean(props.description) && (
<View style={[styles.justifyContentCenter, styles.menuItemTextContainer, styles.flex1, styles.gap1]}>
{Boolean(props.description) && props.shouldShowDescriptionOnTop && (
<Text
style={descriptionTextStyle}
numberOfLines={2}
>
{props.description}
</Text>
)}
{Boolean(props.title) && (
<Text
style={titleTextStyle}
numberOfLines={1}
>
{props.title}
</Text>
)}
{Boolean(props.description) && !props.shouldShowDescriptionOnTop && (
<Text
style={descriptionTextStyle}
numberOfLines={2}
Expand Down
21 changes: 21 additions & 0 deletions src/components/MenuItemWithTopDescription.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import menuItemPropTypes from './menuItemPropTypes';
import MenuItem from './MenuItem';

const propTypes = {
...menuItemPropTypes,
};

const MenuItemWithTopDescription = props => (
<MenuItem
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
shouldShowBasicTitle
shouldShowDescriptionOnTop
/>
);

MenuItemWithTopDescription.propTypes = propTypes;
MenuItemWithTopDescription.displayName = 'MenuItemWithTopDescription';

export default MenuItemWithTopDescription;
4 changes: 2 additions & 2 deletions src/components/ReportActionItem/IOUAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const propTypes = {
action: PropTypes.shape(reportActionPropTypes).isRequired,

/** The associated chatReport */
chatReportID: PropTypes.number.isRequired,
chatReportID: PropTypes.string.isRequired,

/** Is this IOUACTION the most recent? */
isMostRecentIOUReportAction: PropTypes.bool.isRequired,
Expand Down Expand Up @@ -47,7 +47,7 @@ const IOUAction = (props) => {
{((props.isMostRecentIOUReportAction && Boolean(props.action.originalMessage.IOUReportID))
|| (props.action.originalMessage.type === 'pay')) && (
<IOUPreview
iouReportID={props.action.originalMessage.IOUReportID}
iouReportID={props.action.originalMessage.IOUReportID.toString()}
chatReportID={props.chatReportID}
onPayButtonPressed={launchDetailsModal}
onPreviewPressed={launchDetailsModal}
Expand Down
4 changes: 2 additions & 2 deletions src/components/ReportActionItem/IOUPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ const propTypes = {
onPayButtonPressed: PropTypes.func,

/** The active IOUReport, used for Onyx subscription */
iouReportID: PropTypes.number.isRequired,
iouReportID: PropTypes.string.isRequired,

/** The associated chatReport */
chatReportID: PropTypes.number.isRequired,
chatReportID: PropTypes.string.isRequired,

/** Callback for the preview pressed */
onPreviewPressed: PropTypes.func,
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReportActionsSkeletonView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const propTypes = {

const ReportActionsSkeletonView = (props) => {
// Determines the number of content items based on container height
const possibleVisibleContentItems = Math.floor(props.containerHeight / CONST.CHAT_SKELETON_VIEW.AVERAGE_ROW_HEIGHT);
const possibleVisibleContentItems = Math.ceil(props.containerHeight / CONST.CHAT_SKELETON_VIEW.AVERAGE_ROW_HEIGHT);
const skeletonViewLines = [];
for (let index = 0; index < possibleVisibleContentItems; index++) {
const iconIndex = (index + 1) % 4;
Expand Down
8 changes: 7 additions & 1 deletion src/components/menuItemPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ const propTypes = {
/** Should we make this selectable with a checkbox */
shouldShowSelectedState: PropTypes.bool,

/** Should the title show with normal font weight (not bold) */
shouldShowBasicTitle: PropTypes.bool,

/** Should the description be shown above the title (instead of the other way around) */
shouldShowDescriptionOnTop: PropTypes.bool,

/** Whether this item is selected */
isSelected: PropTypes.bool,

Expand Down Expand Up @@ -71,7 +77,7 @@ const propTypes = {
fallbackIcon: PropTypes.func,

/** The type of brick road indicator to show. */
brickRoadIndicator: PropTypes.oneOf([CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR, '']),
brickRoadIndicator: PropTypes.oneOf([CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR, CONST.BRICK_ROAD_INDICATOR_STATUS.INFO, '']),
};

export default propTypes;
1 change: 0 additions & 1 deletion src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,6 @@ export default {
renamedRoomAction: ({oldName, newName}) => ` renamed this room from ${oldName} to ${newName}`,
social: 'social',
selectAWorkspace: 'Select a workspace',
growlMessageOnError: 'Unable to create policy room, please check your connection and try again.',
growlMessageOnRenameError: 'Unable to rename policy room, please check your connection and try again.',
visibilityOptions: {
restricted: 'Restricted',
Expand Down
1 change: 0 additions & 1 deletion src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,6 @@ export default {
renamedRoomAction: ({oldName, newName}) => ` cambió el nombre de la sala de ${oldName} a ${newName}`,
social: 'social',
selectAWorkspace: 'Seleccionar un espacio de trabajo',
growlMessageOnError: 'No se pudo crear el espacio de trabajo, por favor comprueba tu conexión e inténtalo de nuevo.',
growlMessageOnRenameError: 'No se pudo cambiar el nomdre del espacio de trabajo, por favor comprueba tu conexión e inténtalo de nuevo.',
visibilityOptions: {
restricted: 'Restringida',
Expand Down
70 changes: 47 additions & 23 deletions src/libs/Navigation/AppNavigator/MainDrawerNavigator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import lodashGet from 'lodash/get';
import {withOnyx} from 'react-native-onyx';
Expand Down Expand Up @@ -54,31 +54,55 @@ const getInitialReportScreenParams = (reports, ignoreDefaultRooms, policies) =>
return {reportID: String(reportID)};
};

const MainDrawerNavigator = (props) => {
const initialParams = getInitialReportScreenParams(props.reports, !Permissions.canUseDefaultRooms(props.betas), props.policies);
class MainDrawerNavigator extends Component {
constructor(props) {
super(props);
this.initialParams = getInitialReportScreenParams(props.reports, !Permissions.canUseDefaultRooms(props.betas), props.policies);
}

shouldComponentUpdate(nextProps) {
const initialNextParams = getInitialReportScreenParams(nextProps.reports, !Permissions.canUseDefaultRooms(nextProps.betas), nextProps.policies);
if (this.initialParams.reportID === initialNextParams.reportID) {
return false;
}

// Wait until reports are fetched and there is a reportID in initialParams
if (!initialParams.reportID) {
return <FullScreenLoadingIndicator logDetail={{name: 'Main Drawer Loader', initialParams}} />;
this.initialParams = initialNextParams;
return true;
}

// After the app initializes and reports are available the home navigation is mounted
// This way routing information is updated (if needed) based on the initial report ID resolved.
// This is usually needed after login/create account and re-launches
return (
<BaseDrawerNavigator
drawerContent={() => <SidebarScreen />}
screens={[
{
name: SCREENS.REPORT,
component: ReportScreen,
initialParams,
},
]}
isMainScreen
/>
);
};
render() {
// Wait until reports are fetched and there is a reportID in initialParams
if (!this.initialParams.reportID) {
return <FullScreenLoadingIndicator logDetail={{name: 'Main Drawer Loader', initialParams: this.initialParams}} />;
}

// After the app initializes and reports are available the home navigation is mounted
// This way routing information is updated (if needed) based on the initial report ID resolved.
// This is usually needed after login/create account and re-launches
return (
<BaseDrawerNavigator
drawerContent={({navigation, state}) => {
// This state belongs to the drawer so it should always have the ReportScreen as it's initial (and only) route
const reportIDFromRoute = lodashGet(state, ['routes', 0, 'params', 'reportID']);
return (
<SidebarScreen
navigation={navigation}
reportIDFromRoute={reportIDFromRoute}
/>
);
}}
screens={[
{
name: SCREENS.REPORT,
component: ReportScreen,
initialParams: this.initialParams,
},
]}
isMainScreen
/>
);
}
}

MainDrawerNavigator.propTypes = propTypes;
MainDrawerNavigator.defaultProps = defaultProps;
Expand Down
Loading

0 comments on commit c72e7ac

Please sign in to comment.