Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add full screen engagement modal to NewDot #32154

Merged
merged 108 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
71aaa5a
Create new component
stitesExpensify Nov 28, 2023
38f9c59
Fix imports
stitesExpensify Nov 28, 2023
d387417
Fix header
stitesExpensify Nov 28, 2023
94aa8f8
Add english copy and fix key errors
stitesExpensify Nov 28, 2023
01629a2
Switch to IllustratedHeaderPageLayout
stitesExpensify Nov 28, 2023
96dc71e
Use text instead of the header component for better styling
stitesExpensify Nov 28, 2023
2e6ab73
Fix imports
stitesExpensify Nov 28, 2023
39b3593
Change illustration
stitesExpensify Nov 28, 2023
2c21559
add scan asset and update row
stitesExpensify Nov 29, 2023
cc9aead
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Nov 29, 2023
7f32222
ReplaceillustratedHeaderPageLayout with views to make it work on mobile
stitesExpensify Dec 4, 2023
1d2ff01
Add new method for completing engagement modal
stitesExpensify Dec 5, 2023
5fb78b8
Add new nvp keys and add to the optimistic data
stitesExpensify Dec 5, 2023
877efb9
Add copy that concierge will send
stitesExpensify Dec 5, 2023
5f921af
Update copy and send message
stitesExpensify Dec 5, 2023
cfad7cc
Aso close the modal when submitting an option
stitesExpensify Dec 5, 2023
0ef6e32
Re-order elements, add overlay param, and rename poorly named prop
stitesExpensify Dec 5, 2023
d31d697
Add padding and remove unnecessary view
stitesExpensify Dec 5, 2023
6ac457b
Fix copy
stitesExpensify Dec 6, 2023
91120f9
Always get the conciergeChatReport because sometimes it won't be set
stitesExpensify Dec 6, 2023
0def96f
Fix coloring
stitesExpensify Dec 6, 2023
e5ef2b4
Fix x color
stitesExpensify Dec 6, 2023
9e49cee
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Dec 6, 2023
73fb919
Lint
stitesExpensify Dec 6, 2023
01ce5e3
fix background color after merge
stitesExpensify Dec 6, 2023
e8296c4
add modal to set dismissed NVP
stitesExpensify Dec 6, 2023
60c13dc
Use the concierge accountID so that the message comes from them
stitesExpensify Dec 6, 2023
6855f21
Remove auto-show for create menu
stitesExpensify Dec 7, 2023
bb36f6e
Move the engagement modal to the sidebarScreen so that it is in the s…
stitesExpensify Dec 7, 2023
f7dcb5e
Update modal to use welcome.ts
stitesExpensify Dec 7, 2023
9abcb6d
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Dec 7, 2023
dabb866
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Dec 12, 2023
a1e53cc
Fix import of style utils
stitesExpensify Dec 13, 2023
0a81573
Update for typescript
stitesExpensify Dec 14, 2023
0773d9e
Create new type and fix welcome.ts
stitesExpensify Dec 14, 2023
e52c81e
Don't check for isLoading and default to hidden
stitesExpensify Dec 14, 2023
08e8843
Also check for nvps before showing modal
stitesExpensify Dec 14, 2023
14f532a
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Dec 15, 2023
4d70303
fix import order
stitesExpensify Dec 19, 2023
c68d728
Check for number of policies
stitesExpensify Dec 19, 2023
17dbbe6
Style
stitesExpensify Dec 19, 2023
7b31ef9
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Dec 19, 2023
356db31
import order
stitesExpensify Dec 19, 2023
2ba2966
Prettier
stitesExpensify Dec 19, 2023
1f3420c
Remove unnecessary file
stitesExpensify Dec 19, 2023
874543f
Add prop type
stitesExpensify Dec 19, 2023
728e215
Fix typescript
stitesExpensify Dec 19, 2023
30ea7b5
Remove white padding
stitesExpensify Dec 20, 2023
ca904e0
Redirect to concierge chat after completing modal
stitesExpensify Dec 20, 2023
489b148
Add new param to show backdrop for modals
stitesExpensify Dec 20, 2023
4de8c5b
Allow all options to be on 2 lines
stitesExpensify Dec 20, 2023
d6d06ce
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Dec 20, 2023
cf1a9ec
Revert background changes
stitesExpensify Dec 20, 2023
82b26ad
Fix name
stitesExpensify Dec 20, 2023
30f88f8
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Dec 20, 2023
4e0eb0d
Re-add backdrop
stitesExpensify Dec 20, 2023
37e1e78
Add custom backdrop
stitesExpensify Dec 21, 2023
fdf8429
Add proper spanish translations
stitesExpensify Dec 21, 2023
23b3f89
only use custom backdrop for large screens
stitesExpensify Dec 21, 2023
6176876
Shrink image when screen is small
stitesExpensify Dec 21, 2023
9adf07d
Revert resizing changes
stitesExpensify Dec 21, 2023
daf05b6
Scrollview
stitesExpensify Dec 21, 2023
998c2e9
Style
stitesExpensify Dec 21, 2023
8f15ee3
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Dec 21, 2023
eb0d5cc
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Jan 4, 2024
3ca872a
Change keys'
stitesExpensify Jan 5, 2024
5bdc2c6
Style
stitesExpensify Jan 5, 2024
cf23709
Fix props
stitesExpensify Jan 5, 2024
4df4d3a
Fix import error
stitesExpensify Jan 5, 2024
8ac48cb
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Jan 9, 2024
6cc3f5c
Move message copy outside of component lifecycle
stitesExpensify Jan 9, 2024
aa6398a
Add view for max height
stitesExpensify Jan 10, 2024
37ff12a
Prettier
stitesExpensify Jan 10, 2024
c0a737b
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Jan 10, 2024
cbd3db5
Convert to ts
stitesExpensify Jan 11, 2024
69ccc51
Remove old file and fix menuitem type
stitesExpensify Jan 11, 2024
a02c8ae
More typescript chages
stitesExpensify Jan 11, 2024
a248b46
remove unused imports
stitesExpensify Jan 11, 2024
6d260df
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Jan 11, 2024
1569ef6
Fix background on mobile web
stitesExpensify Jan 11, 2024
d571914
Fix typing
stitesExpensify Jan 11, 2024
50ce52a
Add undefined link to fix types
stitesExpensify Jan 11, 2024
f216232
More types
stitesExpensify Jan 12, 2024
6f8ccf0
Style
stitesExpensify Jan 12, 2024
bca21af
Style
stitesExpensify Jan 12, 2024
0055dee
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Jan 12, 2024
8c59d64
Fix types
stitesExpensify Jan 13, 2024
6ca99b0
Remove bad routing logic
stitesExpensify Jan 13, 2024
58a4e52
Fix typing and consolidate logic
stitesExpensify Jan 15, 2024
4e9d290
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Jan 15, 2024
b41489d
Merge branch 'stites-purposeForExpensify' of github.com:Expensify/App…
stitesExpensify Jan 15, 2024
fe2625e
Fix merge
stitesExpensify Jan 15, 2024
189bae9
Comments
stitesExpensify Jan 15, 2024
9e86e8e
Fix copy pasta
stitesExpensify Jan 15, 2024
7edb569
Style
stitesExpensify Jan 15, 2024
9ec0c2a
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Jan 17, 2024
0b6bf56
Call the name directly after checking for currentRoute so that we don…
stitesExpensify Jan 18, 2024
eda0fe7
Merge branch 'main' of github.com:Expensify/App into stites-purposeFo…
stitesExpensify Jan 18, 2024
47c32f4
Fix types
stitesExpensify Jan 19, 2024
82b5552
Remove unnecessary type change and fix copy
stitesExpensify Jan 19, 2024
a526027
Memoize and callback
stitesExpensify Jan 19, 2024
cf5f181
Use const and condense menuitem logic
stitesExpensify Jan 19, 2024
2502778
Style
stitesExpensify Jan 19, 2024
49b6915
Fix type
stitesExpensify Jan 19, 2024
9bd6e2e
More types
stitesExpensify Jan 19, 2024
5fa2403
More style
stitesExpensify Jan 19, 2024
a313c40
Fix type
stitesExpensify Jan 19, 2024
da884be
Remove bad comments and copy/pasted code
stitesExpensify Jan 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions assets/images/scan.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/universal-darwin21
6 changes: 6 additions & 0 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ const ONYXKEYS = {
/** This NVP holds to most recent waypoints that a person has used when creating a distance request */
NVP_RECENT_WAYPOINTS: 'expensify_recentWaypoints',

NVP_HAS_DISMISSED_IDLE_PANEL: 'hasDismissedIdlePanel',

NVP_INTRO_SELECTED: 'introSelected',
stitesExpensify marked this conversation as resolved.
Show resolved Hide resolved

/** Does this user have push notifications enabled for this device? */
PUSH_NOTIFICATIONS_ENABLED: 'pushNotificationsEnabled',

Expand Down Expand Up @@ -393,6 +397,8 @@ type OnyxValues = {
[ONYXKEYS.FOCUS_MODE_NOTIFICATION]: boolean;
[ONYXKEYS.NVP_LAST_PAYMENT_METHOD]: Record<string, string>;
[ONYXKEYS.NVP_RECENT_WAYPOINTS]: OnyxTypes.RecentWaypoint[];
[ONYXKEYS.NVP_HAS_DISMISSED_IDLE_PANEL]: boolean;
[ONYXKEYS.NVP_INTRO_SELECTED]: OnyxTypes.IntroSelected;
[ONYXKEYS.PUSH_NOTIFICATIONS_ENABLED]: boolean;
[ONYXKEYS.PLAID_DATA]: OnyxTypes.PlaidData;
[ONYXKEYS.IS_PLAID_DISABLED]: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/components/AttachmentModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ function AttachmentModal(props) {
shouldShowThreeDotsButton={shouldShowThreeDotsButton}
threeDotsAnchorPosition={styles.threeDotsPopoverOffsetAttachmentModal(windowWidth)}
threeDotsMenuItems={threeDotsMenuItems}
shouldOverlay
shouldOverlayDots
/>
<View style={styles.imageModalImageCenterContainer}>
{!_.isEmpty(props.report) && !props.isReceiptAttachment ? (
Expand Down
7 changes: 4 additions & 3 deletions src/components/HeaderWithBackButton/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import {Keyboard, View} from 'react-native';
import {Keyboard, StyleSheet, View} from 'react-native';
import AvatarWithDisplayName from '@components/AvatarWithDisplayName';
import Header from '@components/Header';
import Icon from '@components/Icon';
Expand Down Expand Up @@ -51,6 +51,7 @@ function HeaderWithBackButton({
threeDotsMenuItems = [],
shouldEnableDetailPageNavigation = false,
children = null,
shouldOverlayDots = false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing propTypes definition

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

shouldOverlay = false,
singleExecution = (func) => func,
shouldNavigateToTopMostReport = false,
Expand All @@ -66,7 +67,7 @@ function HeaderWithBackButton({
// Hover on some part of close icons will not work on Electron if dragArea is true
// https://github.com/Expensify/App/issues/29598
dataSet={{dragArea: false}}
style={[styles.headerBar, shouldShowBorderBottom && styles.borderBottom, shouldShowBackButton && styles.pl2]}
style={[styles.headerBar, shouldShowBorderBottom && styles.borderBottom, shouldShowBackButton && styles.pl2, shouldOverlay && StyleSheet.absoluteFillObject]}
>
<View style={[styles.dFlex, styles.flexRow, styles.alignItemsCenter, styles.flexGrow1, styles.justifyContentBetween, styles.overflowHidden]}>
{shouldShowBackButton && (
Expand Down Expand Up @@ -160,7 +161,7 @@ function HeaderWithBackButton({
menuItems={threeDotsMenuItems}
onIconPress={onThreeDotsButtonPress}
anchorPosition={threeDotsAnchorPosition}
shouldOverlay={shouldOverlay}
shouldOverlay={shouldOverlayDots}
/>
)}
{shouldShowCloseButton && (
Expand Down
2 changes: 2 additions & 0 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ import Receipt from '@assets/images/receipt.svg';
import Rotate from '@assets/images/rotate-image.svg';
import RotateLeft from '@assets/images/rotate-left.svg';
import Send from '@assets/images/send.svg';
import Scan from '@assets/images/scan.svg';
import Shield from '@assets/images/shield.svg';
import AppleLogo from '@assets/images/signIn/apple-logo.svg';
import GoogleLogo from '@assets/images/signIn/google-logo.svg';
Expand Down Expand Up @@ -241,6 +242,7 @@ export {
ReceiptSearch,
Rotate,
RotateLeft,
Scan,
Send,
Shield,
Sync,
Expand Down
208 changes: 208 additions & 0 deletions src/components/PurposeForUsingExpensifyModal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
import PropTypes from 'prop-types';
import React, {useState, useCallback, useEffect} from 'react';
import {withOnyx} from 'react-native-onyx';
import useLocalize from '@hooks/useLocalize';
import compose from '@libs/compose';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import useThemeStyles from "@hooks/useThemeStyles";
import useTheme from '@hooks/useTheme';
import useWindowDimensions from "@hooks/useWindowDimensions";
import * as Report from '@userActions/Report';
import useStyleUtils from "@hooks/useStyleUtils";
import SCREENS from "@src/SCREENS";
import {View} from "react-native";
import NAVIGATORS from "@src/NAVIGATORS";
import * as Welcome from "@userActions/Welcome";
import lodashGet from "lodash/get";
import withNavigation from "./withNavigation";
import LottieAnimations from "./LottieAnimations";
import Text from "./Text";
import Lottie from "./Lottie";
import HeaderWithBackButton from "./HeaderWithBackButton";
import MenuItemList from "./MenuItemList";
import withWindowDimensions, {windowDimensionsPropTypes} from './withWindowDimensions';
import Modal from "./Modal";
import * as Expensicons from './Icon/Expensicons';

const propTypes = {

/** Session info for the currently logged in user. */
session: PropTypes.shape({
/** Currently logged in user accountID */
accountID: PropTypes.number,
}),

...windowDimensionsPropTypes,
};

const defaultProps = {
session: {},
};

function PurposeForUsingExpensifyModal(props) {
const {translate} = useLocalize();
const StyleUtils = useStyleUtils();
const styles = useThemeStyles();
const {isSmallScreenWidth} = useWindowDimensions();
const [isModalOpen, setIsModalOpen] = useState(false);
const theme = useTheme();

useEffect(() => {
const navigationState = props.navigation.getState();
const routes = lodashGet(navigationState, 'routes', []);
const currentRoute = routes[navigationState.index];
if (currentRoute && ![NAVIGATORS.CENTRAL_PANE_NAVIGATOR, SCREENS.HOME].includes(currentRoute.name)) {
return;
}
if (lodashGet(props.demoInfo, 'money2020.isBeginningDemo', false)) {
return;
}
Welcome.show({routes, showEngagementModal: () => setIsModalOpen(true)});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

// This is not translated because it is a message coming from concierge, which only supports english
const messageCopy = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These static strings can be put out of component lifecycle

track: 'Great! To track your expenses, I suggest you create a workspace to keep everything contained:\n' +
'\n' +
'1. Press your avatar icon\n' +
'2. Choose Workspaces\n' +
'3. Choose New Workspace\n' +
'4. Name your workspace something meaningful (eg, "My Business Expenses")\n' +
'\n' +
'Once you have your workspace set up, you can add expenses to it as follows:\n' +
'\n' +
'1. Choose My Business Expenses (or whatever you named it) in the list of chat rooms\n' +
'2. Choose the + button in the chat compose window\n' +
'3. Choose Request money\n' +
'4. Choose what kind of expense you\'d like to log, whether a manual expense, scanned receipt, or tracked distance.\n' +
'\n' +
'That\'ll be stored in your My Business Expenses room for your later access. Thanks for asking, and let me know how it goes!',
submit: 'Hi there, to submit expenses for reimbursement, please:\n' +
'\n' +
'1. Press the big green + button\n' +
'2. Choose Request money\n' +
'3. Indicate how much to request, either manually, by scanning a receipt, or by tracking distance\n' +
'4. Enter the email address or phone number of your boss\n' +
'\n' +
'And we\'ll take it from there to get you paid back. Please give it a shot and let me know how it goes!',
business: 'Great! To manage your team\'s expenses, create a workspace to keep everything contained:\n' +
'\n' +
'1. Press your avatar icon\n' +
'2. Choose Workspaces\n' +
'3. Choose New Workspace\n' +
'4. Name your workspace something meaningful (eg, "Galaxy Food Inc.")\n' +
'\n' +
'Once you have your workspace set up, you can invite your team to it via the Members pane and connect a business bank account to reimburse them!',
chatSplit: 'Hi there, to split an expense such as with a friend, please:\n' +
'\n' +
'Press the big green + button\n' +
'Choose *Request money*\n' +
'Indicate how much was spent, either manually, by scanning a receipt, or by tracking distance\n' +
'Enter the email address or phone number of your friend\n' +
'Press *Split* next to their name\n' +
'Repeat as many times as you like for each of your friends\n' +
'Press *Add to split* when done adding friends\n' +
'Press Split to split the bill\n' +
'\n' +
'This will send a money request to each of your friends for however much they owe you, and we\'ll take care of getting you paid back. Thanks for asking, and let me know how it goes!',
}

const closeModal = useCallback(() => {
Report.dismissEngagementModal();
setIsModalOpen(false);
}, []);

const completeModalAndClose = (message, choice) => {
Report.completeEngagementModal(message, choice);
setIsModalOpen(false)
}

const menuItems = [
{
key: 'purposeForExpensify.track',
title: translate('purposeForExpensify.track'),
icon: Expensicons.ReceiptSearch,
iconRight: Expensicons.ArrowRight,
onPress: () => completeModalAndClose(messageCopy.track, 'trackNewDot'),
shouldShowRightIcon: true,
},
{
key: 'purposeForExpensify.submit',
title: translate('purposeForExpensify.submit'),
icon: Expensicons.Scan,
iconRight: Expensicons.ArrowRight,
onPress: () => completeModalAndClose(messageCopy.submit, 'submitNewDot'),
shouldShowRightIcon: true,
},
{
key: 'purposeForExpensify.business',
title: translate('purposeForExpensify.business'),
icon: Expensicons.MoneyBag,
iconRight: Expensicons.ArrowRight,
onPress: () => completeModalAndClose(messageCopy.business, 'businessNewDot'),
shouldShowRightIcon: true,
},
{
key: 'purposeForExpensify.chatSplit',
title: translate('purposeForExpensify.chatSplit'),
icon: Expensicons.Briefcase,
iconRight: Expensicons.ArrowRight,
onPress: () => completeModalAndClose(messageCopy.chatSplit, 'chatSplitNewDot'),
shouldShowRightIcon: true,
},
];

return (
<Modal
type={isSmallScreenWidth ? CONST.MODAL.MODAL_TYPE.BOTTOM_DOCKED : CONST.MODAL.MODAL_TYPE.RIGHT_DOCKED}
isVisible={isModalOpen}
onClose={closeModal}
stitesExpensify marked this conversation as resolved.
Show resolved Hide resolved
>
<View style={StyleUtils.getBackgroundColorStyle(theme.PAGE_THEMES[SCREENS.SETTINGS.WORKSPACES].backgroundColor)}>
<Lottie
source={LottieAnimations.Hands}
style={styles.w100}
webStyle={styles.w100}
autoPlay
loop
/>
<HeaderWithBackButton
shouldShowCloseButton
shouldShowBackButton={false}
onCloseButtonPress={closeModal}
shouldOverlay
iconFill={theme.iconColorfulBackground}
/>
</View>
<View style={[styles.w100, styles.ph5, styles.pv5]}>
<Text
style={[styles.textHeadline, styles.preWrap, styles.mb2]}
numberOfLines={2}
>
{translate('purposeForExpensify.welcomeMessage')}
</Text>
<Text style={styles.baseFontStyle}>{translate('purposeForExpensify.welcomeSubtitle')}</Text>
</View>
<MenuItemList
menuItems={menuItems}
shouldUseSingleExecution
/>
</Modal>
);
}

PurposeForUsingExpensifyModal.propTypes = propTypes;
PurposeForUsingExpensifyModal.defaultProps = defaultProps;
PurposeForUsingExpensifyModal.displayName = 'AddPaymentMethodMenu';

export default compose(
withWindowDimensions,
withNavigation,
withOnyx({
session: {
key: ONYXKEYS.SESSION,
},
}),
)(PurposeForUsingExpensifyModal);
8 changes: 8 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2018,6 +2018,14 @@ export default {
},
copyReferralLink: 'Copy invite link',
},
purposeForExpensify: {
track: 'Track my business expenses to file taxes',
submit: 'Submit expenses to my employer to get paid back',
business: 'Manage my team\'s expenses',
chatSplit: 'Chat and split expenses with friends',
welcomeMessage: 'Welcome to Expensify',
welcomeSubtitle: 'What\'s your main purpose for using Expensify?',
},
violations: {
allTagLevelsRequired: 'dummy.violations.allTagLevelsRequired',
autoReportedRejectedExpense: 'dummy.violations.autoReportedRejectedExpense',
Expand Down
8 changes: 8 additions & 0 deletions src/languages/es.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With my luck I'll be getting the BUG - purpose not translated to spanish GH in a few weeks :lolsob:

Original file line number Diff line number Diff line change
Expand Up @@ -2505,6 +2505,14 @@ export default {
},
copyReferralLink: 'Copiar enlace de invitación',
},
purposeForExpensify: {
track: 'Track my business expenses to file taxes',
submit: 'Submit expenses to my employer to get paid back',
business: 'Manage my team\'s expenses',
chatSplit: 'Chat and split expenses with friends',
welcomeMessage: 'Welcome to Expensify',
welcomeSubtitle: 'What\'s your main purpose for using Expensify?',
},
violations: {
allTagLevelsRequired: 'dummy.violations.allTagLevelsRequired',
autoReportedRejectedExpense: 'dummy.violations.autoReportedRejectedExpense',
Expand Down
9 changes: 5 additions & 4 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2432,12 +2432,13 @@ function getParsedComment(text: string): string {
return text.length <= CONST.MAX_MARKUP_LENGTH ? parser.replace(text) : lodashEscape(text);
}

function buildOptimisticAddCommentReportAction(text?: string, file?: File): OptimisticReportAction {
function buildOptimisticAddCommentReportAction(text?: string, file?: File, actorAccountID?: number): OptimisticReportAction {
const parser = new ExpensiMark();
const commentText = getParsedComment(text ?? '');
const isAttachment = !text && file !== undefined;
const attachmentInfo = isAttachment ? file : {};
const htmlForNewComment = isAttachment ? CONST.ATTACHMENT_UPLOADING_MESSAGE_HTML : commentText;
const accountID = actorAccountID ?? currentUserAccountID;

// Remove HTML from text when applying optimistic offline comment
const textForNewComment = isAttachment ? CONST.ATTACHMENT_MESSAGE_TEXT : parser.htmlToText(htmlForNewComment);
Expand All @@ -2446,16 +2447,16 @@ function buildOptimisticAddCommentReportAction(text?: string, file?: File): Opti
reportAction: {
reportActionID: NumberUtils.rand64(),
actionName: CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT,
actorAccountID: currentUserAccountID,
actorAccountID: accountID,
person: [
{
style: 'strong',
text: allPersonalDetails?.[currentUserAccountID ?? -1]?.displayName ?? currentUserEmail,
text: allPersonalDetails?.[accountID ?? -1]?.displayName ?? currentUserEmail,
type: 'TEXT',
},
],
automatic: false,
avatar: allPersonalDetails?.[currentUserAccountID ?? -1]?.avatar ?? UserUtils.getDefaultAvatarURL(currentUserAccountID),
avatar: allPersonalDetails?.[accountID ?? -1]?.avatar ?? UserUtils.getDefaultAvatarURL(accountID),
created: DateUtils.getDBTime(),
message: [
{
Expand Down
Loading
Loading