Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
luacmartins committed Oct 12, 2023
2 parents 1a51105 + 5606309 commit 69c0df9
Show file tree
Hide file tree
Showing 15 changed files with 98 additions and 37 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001038107
versionName "1.3.81-7"
versionCode 1001038109
versionName "1.3.81-9"
}

flavorDimensions "default"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.3.81.7</string>
<string>1.3.81.9</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.3.81.7</string>
<string>1.3.81.9</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.81-7",
"version": "1.3.81-9",
"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
14 changes: 11 additions & 3 deletions src/components/MoneyRequestConfirmationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ function MoneyRequestConfirmationList(props) {

const isTypeRequest = props.iouType === CONST.IOU.MONEY_REQUEST_TYPE.REQUEST;
const isSplitBill = props.iouType === CONST.IOU.MONEY_REQUEST_TYPE.SPLIT;
const isTypeSend = props.iouType === CONST.IOU.MONEY_REQUEST_TYPE.SEND;

const {unit, rate, currency} = props.mileageRate;
const distance = lodashGet(transaction, 'routes.route0.distance', 0);
Expand All @@ -206,7 +207,13 @@ function MoneyRequestConfirmationList(props) {

// A flag and a toggler for showing the rest of the form fields
const [shouldExpandFields, toggleShouldExpandFields] = useReducer((state) => !state, false);
const shouldShowAllFields = props.isDistanceRequest || shouldExpandFields || props.isEditingSplitBill || !props.shouldShowSmartScanFields;

// Do not hide fields in case of send money request
const shouldShowAllFields = props.isDistanceRequest || shouldExpandFields || !props.shouldShowSmartScanFields || isTypeSend || props.isEditingSplitBill;

// In Send Money flow, we don't allow the Merchant or Date to be edited.
const shouldShowDate = shouldShowAllFields && !isTypeSend;
const shouldShowMerchant = shouldShowAllFields && !isTypeSend;

// Fetches the first tag list of the policy
const policyTag = PolicyUtils.getTag(props.policyTags);
Expand Down Expand Up @@ -472,6 +479,7 @@ function MoneyRequestConfirmationList(props) {

const button = shouldShowSettlementButton ? (
<SettlementButton
pressOnEnter
isDisabled={shouldDisableButton}
onPress={confirm}
enablePaymentsRoute={ROUTES.IOU_SEND_ENABLE_PAYMENTS}
Expand Down Expand Up @@ -606,7 +614,7 @@ function MoneyRequestConfirmationList(props) {
)}
{shouldShowAllFields && (
<>
{props.shouldShowSmartScanFields && (
{shouldShowDate && (
<MenuItemWithTopDescription
shouldShowRightIcon={!props.isReadOnly}
title={props.iouCreated || format(new Date(), CONST.DATE.FNS_FORMAT_STRING)}
Expand Down Expand Up @@ -638,7 +646,7 @@ function MoneyRequestConfirmationList(props) {
interactive={!props.isReadOnly}
/>
)}
{props.shouldShowSmartScanFields && (
{shouldShowMerchant && (
<MenuItemWithTopDescription
shouldShowRightIcon={!props.isReadOnly}
title={props.iouMerchant}
Expand Down
6 changes: 6 additions & 0 deletions src/components/SettlementButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const propTypes = {
/** Callback to execute when this button is pressed. Receives a single payment type argument. */
onPress: PropTypes.func.isRequired,

/** Call the onPress function on main button when Enter key is pressed */
pressOnEnter: PropTypes.bool,

/** Settlement currency type */
currency: PropTypes.string,

Expand Down Expand Up @@ -75,6 +78,7 @@ const propTypes = {
const defaultProps = {
isLoading: false,
isDisabled: false,
pressOnEnter: false,
addBankAccountRoute: '',
addDebitCardRoute: '',
currency: CONST.CURRENCY.USD,
Expand Down Expand Up @@ -111,6 +115,7 @@ function SettlementButton({
formattedAmount,
nvp_lastPaymentMethod,
onPress,
pressOnEnter,
policyID,
shouldShowPaymentOptions,
style,
Expand Down Expand Up @@ -209,6 +214,7 @@ function SettlementButton({
isDisabled={isDisabled}
isLoading={isLoading}
onPress={(event, iouPaymentType) => selectPaymentType(event, iouPaymentType, triggerKYCFlow)}
pressOnEnter={pressOnEnter}
options={paymentButtonOptions}
style={style}
buttonSize={buttonSize}
Expand Down
1 change: 1 addition & 0 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2121,6 +2121,7 @@ function buildOptimisticIOUReport(payeeAccountID, payerAccountID, total, chatRep
reportID: generateReportID(),
state: CONST.REPORT.STATE.SUBMITTED,
stateNum: isSendingMoney ? CONST.REPORT.STATE_NUM.SUBMITTED : CONST.REPORT.STATE_NUM.PROCESSING,
statusNum: isSendingMoney ? CONST.REPORT.STATUS.REIMBURSED : CONST.REPORT.STATE_NUM.PROCESSING,
total,

// We don't translate reportName because the server response is always in English
Expand Down
4 changes: 4 additions & 0 deletions src/pages/iou/steps/MoneyRequestConfirmPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ function MoneyRequestConfirmPage(props) {
return props.translate('iou.split');
}

if (iouType.current === CONST.IOU.MONEY_REQUEST_TYPE.SEND) {
return props.translate('common.send');
}

return props.translate('tabSelector.manual');
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) {
const iouType = useRef(lodashGet(route, 'params.iouType', ''));
const reportID = useRef(lodashGet(route, 'params.reportID', ''));
const isDistanceRequest = MoneyRequestUtils.isDistanceRequest(iouType.current, selectedTab);
const isSendRequest = iouType.current === CONST.IOU.MONEY_REQUEST_TYPE.SEND;
const isScanRequest = MoneyRequestUtils.isScanRequest(selectedTab);
const isSplitRequest = iou.id === CONST.IOU.MONEY_REQUEST_TYPE.SPLIT;
const [headerTitle, setHeaderTitle] = useState();
Expand All @@ -60,8 +61,13 @@ function MoneyRequestParticipantsPage({iou, selectedTab, route}) {
return;
}

if (isSendRequest) {
setHeaderTitle(translate('common.send'));
return;
}

setHeaderTitle(_.isEmpty(iou.participants) ? translate('tabSelector.manual') : translate('iou.split'));
}, [iou.participants, isDistanceRequest, translate]);
}, [iou.participants, isDistanceRequest, isSendRequest, translate]);

const navigateToConfirmationStep = (moneyRequestType) => {
IOU.setMoneyRequestId(moneyRequestType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ function MoneyRequestParticipantsSelector({
// the app from crashing on native when you try to do this, we'll going to hide the button if you have a workspace and other participants
const hasPolicyExpenseChatParticipant = _.some(participants, (participant) => participant.isPolicyExpenseChat);
const shouldShowConfirmButton = !(participants.length > 1 && hasPolicyExpenseChatParticipant);
const isAllowedToSplit = !isDistanceRequest;
const isAllowedToSplit = !isDistanceRequest && iouType !== CONST.IOU.MONEY_REQUEST_TYPE.SEND;

return (
<View style={[styles.flex1, styles.w100, participants.length > 0 ? safeAreaPaddingBottomStyle : {}]}>
Expand Down
86 changes: 61 additions & 25 deletions src/pages/workspace/WorkspaceInvitePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function WorkspaceInvitePage(props) {
const [searchTerm, setSearchTerm] = useState('');
const [selectedOptions, setSelectedOptions] = useState([]);
const [personalDetails, setPersonalDetails] = useState([]);
const [userToInvite, setUserToInvite] = useState(null);
const [usersToInvite, setUsersToInvite] = useState([]);
const openWorkspaceInvitePage = () => {
const policyMemberEmailsToAccountIDs = PolicyUtils.getMemberAccountIDsForWorkspace(props.policyMembers, props.personalDetails);
Policy.openWorkspaceInvitePage(props.route.params.policyID, _.keys(policyMemberEmailsToAccountIDs));
Expand All @@ -84,19 +84,52 @@ function WorkspaceInvitePage(props) {
const excludedUsers = useMemo(() => PolicyUtils.getIneligibleInvitees(props.policyMembers, props.personalDetails), [props.policyMembers, props.personalDetails]);

useEffect(() => {
const inviteOptions = OptionsListUtils.getMemberInviteOptions(props.personalDetails, props.betas, searchTerm, excludedUsers);

// Update selectedOptions with the latest personalDetails and policyMembers information
const detailsMap = {};
_.forEach(inviteOptions.personalDetails, (detail) => (detailsMap[detail.login] = OptionsListUtils.formatMemberForList(detail)));
const newSelectedOptions = [];
_.forEach(selectedOptions, (option) => {
newSelectedOptions.push(_.has(detailsMap, option.login) ? {...detailsMap[option.login], isSelected: true} : option);
const emails = _.compact(
searchTerm
.trim()
.replace(/\s*,\s*/g, ',')
.split(','),
);

const newUsersToInviteDict = {};
const newPersonalDetailsDict = {};
const newSelectedOptionsDict = {};

_.each(emails, (email) => {
const inviteOptions = OptionsListUtils.getMemberInviteOptions(props.personalDetails, props.betas, email, excludedUsers);

// Update selectedOptions with the latest personalDetails and policyMembers information
const detailsMap = {};
_.each(inviteOptions.personalDetails, (detail) => (detailsMap[detail.login] = OptionsListUtils.formatMemberForList(detail)));

const newSelectedOptions = [];
_.each(selectedOptions, (option) => {
newSelectedOptions.push(_.has(detailsMap, option.login) ? {...detailsMap[option.login], isSelected: true} : option);
});

const userToInvite = inviteOptions.userToInvite;

// Only add the user to the invites list if it is valid
if (userToInvite) {
newUsersToInviteDict[userToInvite.accountID] = userToInvite;
}

// Add all personal details to the new dict
_.each(inviteOptions.personalDetails, (details) => {
newPersonalDetailsDict[details.accountID] = details;
});

// Add all selected options to the new dict
_.each(newSelectedOptions, (option) => {
newSelectedOptionsDict[option.accountID] = option;
});
});

setUserToInvite(inviteOptions.userToInvite);
setPersonalDetails(inviteOptions.personalDetails);
setSelectedOptions(newSelectedOptions);
// Strip out dictionary keys and update arrays
setUsersToInvite(_.values(newUsersToInviteDict));
setPersonalDetails(_.values(newPersonalDetailsDict));
setSelectedOptions(_.values(newSelectedOptionsDict));

// eslint-disable-next-line react-hooks/exhaustive-deps -- we don't want to recalculate when selectedOptions change
}, [props.personalDetails, props.policyMembers, props.betas, searchTerm, excludedUsers]);

Expand All @@ -116,7 +149,6 @@ function WorkspaceInvitePage(props) {
const selectedLogins = _.map(selectedOptions, ({login}) => login);
const personalDetailsWithoutSelected = _.filter(personalDetails, ({login}) => !_.contains(selectedLogins, login));
const personalDetailsFormatted = _.map(personalDetailsWithoutSelected, OptionsListUtils.formatMemberForList);
const hasUnselectedUserToInvite = userToInvite && !_.contains(selectedLogins, userToInvite.login);

sections.push({
title: translate('common.contacts'),
Expand All @@ -126,14 +158,18 @@ function WorkspaceInvitePage(props) {
});
indexOffset += personalDetailsFormatted.length;

if (hasUnselectedUserToInvite) {
sections.push({
title: undefined,
data: [OptionsListUtils.formatMemberForList(userToInvite)],
shouldShow: true,
indexOffset,
});
}
_.each(usersToInvite, (userToInvite) => {
const hasUnselectedUserToInvite = !_.contains(selectedLogins, userToInvite.login);

if (hasUnselectedUserToInvite) {
sections.push({
title: undefined,
data: [OptionsListUtils.formatMemberForList(userToInvite)],
shouldShow: true,
indexOffset: indexOffset++,
});
}
});

return sections;
};
Expand Down Expand Up @@ -188,14 +224,14 @@ function WorkspaceInvitePage(props) {

const headerMessage = useMemo(() => {
const searchValue = searchTerm.trim().toLowerCase();
if (!userToInvite && CONST.EXPENSIFY_EMAILS.includes(searchValue)) {
if (usersToInvite.length === 0 && CONST.EXPENSIFY_EMAILS.includes(searchValue)) {
return translate('messages.errorMessageInvalidEmail');
}
if (!userToInvite && excludedUsers.includes(searchValue)) {
if (usersToInvite.length === 0 && excludedUsers.includes(searchValue)) {
return translate('messages.userIsAlreadyMemberOfWorkspace', {login: searchValue, workspace: policyName});
}
return OptionsListUtils.getHeaderMessage(personalDetails.length !== 0, Boolean(userToInvite), searchValue);
}, [excludedUsers, translate, searchTerm, policyName, userToInvite, personalDetails]);
return OptionsListUtils.getHeaderMessage(personalDetails.length !== 0, usersToInvite.length > 0, searchValue);
}, [excludedUsers, translate, searchTerm, policyName, usersToInvite, personalDetails]);

return (
<ScreenWrapper
Expand Down

0 comments on commit 69c0df9

Please sign in to comment.