From c8951b4928a18ee5b935c4a170f72f17f89d304c Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Wed, 5 Apr 2023 10:58:13 -0300 Subject: [PATCH 01/19] Add optional parameter showPopoverMenu to Welcome.show --- src/libs/actions/Welcome.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Welcome.js b/src/libs/actions/Welcome.js index d3795ad825a3..85a450fc0ca4 100644 --- a/src/libs/actions/Welcome.js +++ b/src/libs/actions/Welcome.js @@ -98,9 +98,10 @@ Onyx.connect({ * * @param {Object} params * @param {Object} params.routes - * @param {Function} params.showCreateMenu + * @param {Function} [params.showCreateMenu] + * @param {Function} [params.showPopoverMenu] */ -function show({routes, showCreateMenu}) { +function show({routes, showCreateMenu = () => {}, showPopoverMenu = () => {}}) { isReadyPromise.then(() => { if (!isFirstTimeNewExpensifyUser) { return; @@ -121,6 +122,7 @@ function show({routes, showCreateMenu}) { const workspaceChatReport = _.find(allReports, report => ReportUtils.isPolicyExpenseChat(report) && report.ownerEmail === email); if (workspaceChatReport && !isDisplayingWorkspaceRoute) { Navigation.navigate(ROUTES.getReportRoute(workspaceChatReport.reportID)); + showPopoverMenu(); return; } From 612317f5451dff1a9bf38b8fa805b67ce45e63e1 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Wed, 5 Apr 2023 11:11:05 -0300 Subject: [PATCH 02/19] Call welcome show method to check for welcome popover when opening reportActionCompose --- src/pages/home/report/ReportActionCompose.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index b85cb03f8e40..6284bddb55dc 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -42,12 +42,14 @@ import * as DeviceCapabilities from '../../../libs/DeviceCapabilities'; import toggleReportActionComposeView from '../../../libs/toggleReportActionComposeView'; import OfflineIndicator from '../../../components/OfflineIndicator'; import ExceededCommentLength from '../../../components/ExceededCommentLength'; +import withNavigation from '../../../components/withNavigation'; import withNavigationFocus from '../../../components/withNavigationFocus'; import * as EmojiUtils from '../../../libs/EmojiUtils'; import ReportDropUI from './ReportDropUI'; import DragAndDrop from '../../../components/DragAndDrop'; import reportPropTypes from '../../reportPropTypes'; import EmojiSuggestions from '../../../components/EmojiSuggestions'; +import * as Welcome from '../../../libs/actions/Welcome'; import withKeyboardState, {keyboardStatePropTypes} from '../../../components/withKeyboardState'; import ArrowKeyFocusManager from '../../../components/ArrowKeyFocusManager'; import KeyboardShortcut from '../../../libs/KeyboardShortcut'; @@ -221,6 +223,12 @@ class ReportActionCompose extends React.Component { this.setMaxLines(); this.updateComment(this.comment); + + // Show popover on Workspace Welcome + Welcome.show({ + routes: lodashGet(this.props.navigation.getState(), 'routes', []), + showPopoverMenu: this.showPopoverMenu + }); } componentDidUpdate(prevProps) { @@ -672,6 +680,14 @@ class ReportActionCompose extends React.Component { this.props.onSubmit(comment); } + /** + * Used by Welcome.show to show Popover on Workspace Welcome + * + */ + showPopoverMenu() { + this.setMenuVisibility(true); + } + render() { const reportParticipants = _.without(lodashGet(this.props.report, 'participants', []), this.props.currentUserPersonalDetails.login); const participantsWithoutExpensifyEmails = _.difference(reportParticipants, CONST.EXPENSIFY_EMAILS); @@ -933,6 +949,7 @@ ReportActionCompose.defaultProps = defaultProps; export default compose( withWindowDimensions, withDrawerState, + withNavigation, withNavigationFocus, withLocalize, withNetwork(), From 78d1062298dfb6729ec8d3dd81838258eeafcc5d Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Wed, 5 Apr 2023 16:43:42 -0300 Subject: [PATCH 03/19] Bind showPopoverMenu to this so it updates the correct state --- src/pages/home/report/ReportActionCompose.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index 6284bddb55dc..b1eb24e46cd7 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -170,6 +170,7 @@ class ReportActionCompose extends React.Component { this.insertSelectedEmoji = this.insertSelectedEmoji.bind(this); this.setExceededMaxCommentLength = this.setExceededMaxCommentLength.bind(this); this.updateNumberOfLines = this.updateNumberOfLines.bind(this); + this.showPopoverMenu = this.showPopoverMenu.bind(this); this.comment = props.comment; // React Native will retain focus on an input for native devices but web/mWeb behave differently so we have some focus management From 910cf23b117328b60f5a8affae2e697b52d843ee Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Wed, 5 Apr 2023 17:03:51 -0300 Subject: [PATCH 04/19] Not take closed/archived workspace chats in consideration for new users --- src/libs/actions/Welcome.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Welcome.js b/src/libs/actions/Welcome.js index 85a450fc0ca4..ac78aed67d59 100644 --- a/src/libs/actions/Welcome.js +++ b/src/libs/actions/Welcome.js @@ -119,7 +119,10 @@ function show({routes, showCreateMenu = () => {}, showPopoverMenu = () => {}}) { const isDisplayingWorkspaceRoute = isWorkspaceRoute || exitingToWorkspaceRoute; // We want to display the Workspace chat first since that means a user is already in a Workspace and doesn't need to create another one - const workspaceChatReport = _.find(allReports, report => ReportUtils.isPolicyExpenseChat(report) && report.ownerEmail === email); + const workspaceChatReport = _.find( + allReports, + report => ReportUtils.isPolicyExpenseChat(report) && report.ownerEmail === email && report.statusNum !== CONST.REPORT.STATUS.CLOSED + ); if (workspaceChatReport && !isDisplayingWorkspaceRoute) { Navigation.navigate(ROUTES.getReportRoute(workspaceChatReport.reportID)); showPopoverMenu(); From 904cdbedb7d418ebfe61215d9a20795e08c0d103 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Wed, 5 Apr 2023 17:22:18 -0300 Subject: [PATCH 05/19] Linting Welcome --- src/libs/actions/Welcome.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Welcome.js b/src/libs/actions/Welcome.js index ac78aed67d59..8b244bce4297 100644 --- a/src/libs/actions/Welcome.js +++ b/src/libs/actions/Welcome.js @@ -121,7 +121,7 @@ function show({routes, showCreateMenu = () => {}, showPopoverMenu = () => {}}) { // We want to display the Workspace chat first since that means a user is already in a Workspace and doesn't need to create another one const workspaceChatReport = _.find( allReports, - report => ReportUtils.isPolicyExpenseChat(report) && report.ownerEmail === email && report.statusNum !== CONST.REPORT.STATUS.CLOSED + report => ReportUtils.isPolicyExpenseChat(report) && report.ownerEmail === email && report.statusNum !== CONST.REPORT.STATUS.CLOSED, ); if (workspaceChatReport && !isDisplayingWorkspaceRoute) { Navigation.navigate(ROUTES.getReportRoute(workspaceChatReport.reportID)); From 304abe3453a89bd4ee336e066d8e14cd892e8f45 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Thu, 6 Apr 2023 14:07:49 -0300 Subject: [PATCH 06/19] Add missing trailing comma to ReportActionCompose --- src/pages/home/report/ReportActionCompose.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index b1eb24e46cd7..c11244bf912c 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -228,7 +228,7 @@ class ReportActionCompose extends React.Component { // Show popover on Workspace Welcome Welcome.show({ routes: lodashGet(this.props.navigation.getState(), 'routes', []), - showPopoverMenu: this.showPopoverMenu + showPopoverMenu: this.showPopoverMenu, }); } From 29f9ad7afbb47dbcf5b1945a16cd60a186218a83 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Wed, 12 Apr 2023 16:12:28 -0300 Subject: [PATCH 07/19] Add missing reference to CONST --- src/libs/actions/Welcome.js | 1 + src/pages/home/report/ReportActionCompose/index.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libs/actions/Welcome.js b/src/libs/actions/Welcome.js index 744db4e3ff3d..19f2e36a126f 100644 --- a/src/libs/actions/Welcome.js +++ b/src/libs/actions/Welcome.js @@ -7,6 +7,7 @@ import ROUTES from '../../ROUTES'; import * as Policy from './Policy'; import ONYXKEYS from '../../ONYXKEYS'; import SCREENS from '../../SCREENS'; +import CONST from '../../CONST'; let resolveIsReadyPromise; let isReadyPromise = new Promise((resolve) => { diff --git a/src/pages/home/report/ReportActionCompose/index.js b/src/pages/home/report/ReportActionCompose/index.js index 9817d259a569..e8066b11cc29 100644 --- a/src/pages/home/report/ReportActionCompose/index.js +++ b/src/pages/home/report/ReportActionCompose/index.js @@ -52,6 +52,7 @@ import withKeyboardState, {keyboardStatePropTypes} from '../../../../components/ import ArrowKeyFocusManager from '../../../../components/ArrowKeyFocusManager'; import KeyboardShortcut from '../../../../libs/KeyboardShortcut'; import KeyDownAction from './keyDownAction'; +import CONST from '../../../../CONST'; const propTypes = { /** Beta features list */ From ae34acfa06980712e07552bcfe8fe43c44d06519 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Wed, 12 Apr 2023 16:17:34 -0300 Subject: [PATCH 08/19] Remove extra CONST import --- src/pages/home/report/ReportActionCompose/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose/index.js b/src/pages/home/report/ReportActionCompose/index.js index e8066b11cc29..9817d259a569 100644 --- a/src/pages/home/report/ReportActionCompose/index.js +++ b/src/pages/home/report/ReportActionCompose/index.js @@ -52,7 +52,6 @@ import withKeyboardState, {keyboardStatePropTypes} from '../../../../components/ import ArrowKeyFocusManager from '../../../../components/ArrowKeyFocusManager'; import KeyboardShortcut from '../../../../libs/KeyboardShortcut'; import KeyDownAction from './keyDownAction'; -import CONST from '../../../../CONST'; const propTypes = { /** Beta features list */ From 576b196c258457381b81c2361767def62233e35b Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Wed, 12 Apr 2023 16:20:05 -0300 Subject: [PATCH 09/19] Remove remaining reference to withwithNavigation --- src/pages/home/report/ReportActionCompose/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose/index.js b/src/pages/home/report/ReportActionCompose/index.js index 9817d259a569..564b1b89defc 100644 --- a/src/pages/home/report/ReportActionCompose/index.js +++ b/src/pages/home/report/ReportActionCompose/index.js @@ -995,7 +995,6 @@ ReportActionCompose.defaultProps = defaultProps; export default compose( withWindowDimensions, withDrawerState, - withNavigation, withNavigationFocus, withLocalize, withNetwork(), From 5d70fed090200fbf2bbf7b9a84755ebae4db5cbd Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Wed, 12 Apr 2023 16:23:41 -0300 Subject: [PATCH 10/19] Add imports to Welcome and withNavigation removed during merge with main --- src/pages/home/report/ReportActionCompose/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pages/home/report/ReportActionCompose/index.js b/src/pages/home/report/ReportActionCompose/index.js index 564b1b89defc..858d7d09e68c 100644 --- a/src/pages/home/report/ReportActionCompose/index.js +++ b/src/pages/home/report/ReportActionCompose/index.js @@ -43,6 +43,7 @@ import toggleReportActionComposeView from '../../../../libs/toggleReportActionCo import OfflineIndicator from '../../../../components/OfflineIndicator'; import ExceededCommentLength from '../../../../components/ExceededCommentLength'; import withNavigationFocus from '../../../../components/withNavigationFocus'; +import withNavigation from '../../../../components/withNavigation'; import * as EmojiUtils from '../../../../libs/EmojiUtils'; import ReportDropUI from '../ReportDropUI'; import DragAndDrop from '../../../../components/DragAndDrop'; @@ -51,6 +52,7 @@ import EmojiSuggestions from '../../../../components/EmojiSuggestions'; import withKeyboardState, {keyboardStatePropTypes} from '../../../../components/withKeyboardState'; import ArrowKeyFocusManager from '../../../../components/ArrowKeyFocusManager'; import KeyboardShortcut from '../../../../libs/KeyboardShortcut'; +import * as Welcome from '../../../../libs/actions/Welcome'; import KeyDownAction from './keyDownAction'; const propTypes = { @@ -995,6 +997,7 @@ ReportActionCompose.defaultProps = defaultProps; export default compose( withWindowDimensions, withDrawerState, + withNavigation, withNavigationFocus, withLocalize, withNetwork(), From b4bcbf092f2414f345ab2eae96f0df4dbdb47788 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Wed, 12 Apr 2023 19:17:12 -0300 Subject: [PATCH 11/19] Clear NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER after opening Popover menu on first sign-in --- src/libs/actions/Welcome.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/actions/Welcome.js b/src/libs/actions/Welcome.js index 19f2e36a126f..b56622c5b3aa 100644 --- a/src/libs/actions/Welcome.js +++ b/src/libs/actions/Welcome.js @@ -120,6 +120,8 @@ function show({routes, showCreateMenu = () => {}, showPopoverMenu = () => {}}) { report => ReportUtils.isPolicyExpenseChat(report) && report.ownerEmail === email && report.statusNum !== CONST.REPORT.STATUS.CLOSED, ); if (workspaceChatReport && !isDisplayingWorkspaceRoute) { + // This key is only updated when we call ReconnectApp, setting it to false now allows the user to navigate normally instead of always redirecting to the workspace chat + Onyx.set(ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER, false); Navigation.navigate(ROUTES.getReportRoute(workspaceChatReport.reportID)); showPopoverMenu(); return; From 7065e944286d66318fd9c6a8f820d0c763417f20 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Wed, 12 Apr 2023 19:41:02 -0300 Subject: [PATCH 12/19] Update showPopoverMenu comments --- src/pages/home/report/ReportActionCompose/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/index.js b/src/pages/home/report/ReportActionCompose/index.js index 858d7d09e68c..05412b1e7647 100644 --- a/src/pages/home/report/ReportActionCompose/index.js +++ b/src/pages/home/report/ReportActionCompose/index.js @@ -236,7 +236,7 @@ class ReportActionCompose extends React.Component { this.setMaxLines(); this.updateComment(this.comment); - // Show popover on Workspace Welcome + // Shows Popover Menu on Workspace Chat at first sign-in Welcome.show({ routes: lodashGet(this.props.navigation.getState(), 'routes', []), showPopoverMenu: this.showPopoverMenu, @@ -725,8 +725,7 @@ class ReportActionCompose extends React.Component { } /** - * Used by Welcome.show to show Popover on Workspace Welcome - * + * Used to show Popover menu on Workspace chat at first sign-in */ showPopoverMenu() { this.setMenuVisibility(true); From d21d32ad39570478b1da84f5ef5c1fce419d1d85 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Thu, 13 Apr 2023 19:17:50 -0300 Subject: [PATCH 13/19] Refactor Welcome logic to control the state of isFirstTimeNewExpensifyUser instead of receiving updates from Onyx --- src/libs/actions/Welcome.js | 17 +++++++++++++++-- .../home/report/ReportActionCompose/index.js | 2 ++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Welcome.js b/src/libs/actions/Welcome.js index b56622c5b3aa..c4175767d925 100644 --- a/src/libs/actions/Welcome.js +++ b/src/libs/actions/Welcome.js @@ -37,7 +37,11 @@ Onyx.connect({ key: ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER, initWithStoredValues: false, callback: (val) => { - isFirstTimeNewExpensifyUser = val; + // If this is a first time new expensify user, let's only update the state of isFirstTimeNewExpensifyUser from true to false + // after running all Welcome related logic in Welcome.show + if (!isFirstTimeNewExpensifyUser) { + isFirstTimeNewExpensifyUser = val; + } checkOnReady(); }, }); @@ -123,7 +127,13 @@ function show({routes, showCreateMenu = () => {}, showPopoverMenu = () => {}}) { // This key is only updated when we call ReconnectApp, setting it to false now allows the user to navigate normally instead of always redirecting to the workspace chat Onyx.set(ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER, false); Navigation.navigate(ROUTES.getReportRoute(workspaceChatReport.reportID)); - showPopoverMenu(); + + // If showPopoverMenu exists and returns true then it opened the Popover Menu succesfully and we can update the state of isFirstTimeNewExpensifyUser + // so the Welcome logic doesn't run again + if (showPopoverMenu && showPopoverMenu()) { + isFirstTimeNewExpensifyUser = false; + } + return; } @@ -132,6 +142,9 @@ function show({routes, showCreateMenu = () => {}, showPopoverMenu = () => {}}) { if (!Policy.isAdminOfFreePolicy(allPolicies) && !isDisplayingWorkspaceRoute) { showCreateMenu(); } + + // Update state of isFirstTimeNewExpensifyUser so the Welcome logic doesn't run again + isFirstTimeNewExpensifyUser = false; }); } diff --git a/src/pages/home/report/ReportActionCompose/index.js b/src/pages/home/report/ReportActionCompose/index.js index 3ced4c8fc0a9..99c5bf0726fc 100644 --- a/src/pages/home/report/ReportActionCompose/index.js +++ b/src/pages/home/report/ReportActionCompose/index.js @@ -731,9 +731,11 @@ class ReportActionCompose extends React.Component { /** * Used to show Popover menu on Workspace chat at first sign-in + * @returns {Boolean} */ showPopoverMenu() { this.setMenuVisibility(true); + return true; } render() { From 70db7a6d431e343055c7fab683c61995ba01a536 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Thu, 13 Apr 2023 19:54:04 -0300 Subject: [PATCH 14/19] Only call Welcome.show at first-sign in from the correct enabled composer box --- src/pages/home/report/ReportActionCompose/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/index.js b/src/pages/home/report/ReportActionCompose/index.js index 99c5bf0726fc..26341a330b70 100644 --- a/src/pages/home/report/ReportActionCompose/index.js +++ b/src/pages/home/report/ReportActionCompose/index.js @@ -237,10 +237,12 @@ class ReportActionCompose extends React.Component { this.updateComment(this.comment); // Shows Popover Menu on Workspace Chat at first sign-in - Welcome.show({ - routes: lodashGet(this.props.navigation.getState(), 'routes', []), - showPopoverMenu: this.showPopoverMenu, - }); + if (!this.props.disabled) { + Welcome.show({ + routes: lodashGet(this.props.navigation.getState(), 'routes', []), + showPopoverMenu: this.showPopoverMenu, + }); + } } componentDidUpdate(prevProps) { From 32f0299df2b1901c91b8e863c6368fafe4043da6 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Mon, 17 Apr 2023 11:15:51 -0300 Subject: [PATCH 15/19] Remove unecessary showPopoverMenu check --- src/libs/actions/Welcome.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Welcome.js b/src/libs/actions/Welcome.js index c4175767d925..384cd43f9416 100644 --- a/src/libs/actions/Welcome.js +++ b/src/libs/actions/Welcome.js @@ -130,7 +130,7 @@ function show({routes, showCreateMenu = () => {}, showPopoverMenu = () => {}}) { // If showPopoverMenu exists and returns true then it opened the Popover Menu succesfully and we can update the state of isFirstTimeNewExpensifyUser // so the Welcome logic doesn't run again - if (showPopoverMenu && showPopoverMenu()) { + if (showPopoverMenu()) { isFirstTimeNewExpensifyUser = false; } From 820fbafe15a213885a471c35300c7b0d60b6e5e0 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Mon, 17 Apr 2023 16:32:36 -0300 Subject: [PATCH 16/19] Add missing imports removed in last merge with main --- src/pages/home/report/ReportActionCompose.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index 14a846fedc78..0b9c4777c70b 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -43,6 +43,7 @@ import toggleReportActionComposeView from '../../../libs/toggleReportActionCompo import OfflineIndicator from '../../../components/OfflineIndicator'; import ExceededCommentLength from '../../../components/ExceededCommentLength'; import withNavigationFocus from '../../../components/withNavigationFocus'; +import withNavigation from '../../../components/withNavigation'; import * as EmojiUtils from '../../../libs/EmojiUtils'; import ReportDropUI from './ReportDropUI'; import DragAndDrop from '../../../components/DragAndDrop'; @@ -52,6 +53,7 @@ import withKeyboardState, {keyboardStatePropTypes} from '../../../components/wit import ArrowKeyFocusManager from '../../../components/ArrowKeyFocusManager'; import OfflineWithFeedback from '../../../components/OfflineWithFeedback'; import KeyboardShortcut from '../../../libs/KeyboardShortcut'; +import * as Welcome from '../../../libs/actions/Welcome'; const propTypes = { /** Beta features list */ From 2bc4c59e637675c7099dee6fd7b9400cc3c4e316 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Wed, 19 Apr 2023 14:40:10 -0300 Subject: [PATCH 17/19] Remove mentions of state from stateless Welcome.js component comments --- src/libs/actions/Welcome.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Welcome.js b/src/libs/actions/Welcome.js index 384cd43f9416..031cf4282d12 100644 --- a/src/libs/actions/Welcome.js +++ b/src/libs/actions/Welcome.js @@ -37,7 +37,7 @@ Onyx.connect({ key: ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER, initWithStoredValues: false, callback: (val) => { - // If this is a first time new expensify user, let's only update the state of isFirstTimeNewExpensifyUser from true to false + // If this is a first time new Expensify user, let's only update isFirstTimeNewExpensifyUser from true to false // after running all Welcome related logic in Welcome.show if (!isFirstTimeNewExpensifyUser) { isFirstTimeNewExpensifyUser = val; @@ -143,7 +143,7 @@ function show({routes, showCreateMenu = () => {}, showPopoverMenu = () => {}}) { showCreateMenu(); } - // Update state of isFirstTimeNewExpensifyUser so the Welcome logic doesn't run again + // Update isFirstTimeNewExpensifyUser so the Welcome logic doesn't run again isFirstTimeNewExpensifyUser = false; }); } From af0539e00bd3c97723ad55abebbfbb18d343fb05 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Wed, 19 Apr 2023 14:46:07 -0300 Subject: [PATCH 18/19] Rephrase NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER callback logic comment --- src/libs/actions/Welcome.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Welcome.js b/src/libs/actions/Welcome.js index 031cf4282d12..5bc877f758b4 100644 --- a/src/libs/actions/Welcome.js +++ b/src/libs/actions/Welcome.js @@ -37,8 +37,8 @@ Onyx.connect({ key: ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER, initWithStoredValues: false, callback: (val) => { - // If this is a first time new Expensify user, let's only update isFirstTimeNewExpensifyUser from true to false - // after running all Welcome related logic in Welcome.show + // If isFirstTimeNewExpensifyUser was true do not update it to false. We update it to false inside the Welcome.show logic + // More context here https://github.com/Expensify/App/pull/16962#discussion_r1167351359 if (!isFirstTimeNewExpensifyUser) { isFirstTimeNewExpensifyUser = val; } From 64c4b7c7cb0f58a2a8ed705979d1e35736889894 Mon Sep 17 00:00:00 2001 From: Paulo Vale Date: Wed, 19 Apr 2023 14:49:15 -0300 Subject: [PATCH 19/19] Remove last mention of state from Welcome.js comments --- src/libs/actions/Welcome.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Welcome.js b/src/libs/actions/Welcome.js index 5bc877f758b4..50c5ed3c6ab7 100644 --- a/src/libs/actions/Welcome.js +++ b/src/libs/actions/Welcome.js @@ -128,7 +128,7 @@ function show({routes, showCreateMenu = () => {}, showPopoverMenu = () => {}}) { Onyx.set(ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER, false); Navigation.navigate(ROUTES.getReportRoute(workspaceChatReport.reportID)); - // If showPopoverMenu exists and returns true then it opened the Popover Menu succesfully and we can update the state of isFirstTimeNewExpensifyUser + // If showPopoverMenu exists and returns true then it opened the Popover Menu successfully, and we can update isFirstTimeNewExpensifyUser // so the Welcome logic doesn't run again if (showPopoverMenu()) { isFirstTimeNewExpensifyUser = false;