From 2e68cfb9717f8cf074e245c6eebb76e184b72170 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Mon, 22 Apr 2024 13:21:46 +0200 Subject: [PATCH 1/9] fix nav options --- src/libs/Navigation/AppNavigator/AuthScreens.tsx | 8 ++++++-- .../getOnboardingModalScreenOptions/index.native.ts | 9 +++++++++ .../Navigation/getOnboardingModalScreenOptions/index.ts | 9 +++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 src/libs/Navigation/getOnboardingModalScreenOptions/index.native.ts create mode 100644 src/libs/Navigation/getOnboardingModalScreenOptions/index.ts diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index 096a88254eae..17f7b946c7ab 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -10,6 +10,7 @@ import useWindowDimensions from '@hooks/useWindowDimensions'; import KeyboardShortcut from '@libs/KeyboardShortcut'; import Log from '@libs/Log'; import getCurrentUrl from '@libs/Navigation/currentUrl'; +import getOnboardingModalScreenOptions from '@libs/Navigation/getOnboardingModalScreenOptions'; import Navigation from '@libs/Navigation/Navigation'; import type {AuthScreensParamList} from '@libs/Navigation/types'; import NetworkConnection from '@libs/NetworkConnection'; @@ -160,7 +161,10 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie const {isSmallScreenWidth} = useWindowDimensions(); const {shouldUseNarrowLayout} = useOnboardingLayout(); const screenOptions = getRootNavigatorScreenOptions(isSmallScreenWidth, styles, StyleUtils); - const onboardingScreenOptions = useMemo(() => screenOptions.onboardingModalNavigator(shouldUseNarrowLayout), [screenOptions, shouldUseNarrowLayout]); + const onboardingScreenOptions = useMemo( + () => getOnboardingModalScreenOptions(isSmallScreenWidth, styles, StyleUtils, shouldUseNarrowLayout), + [StyleUtils, isSmallScreenWidth, shouldUseNarrowLayout, styles], + ); const isInitialRender = useRef(true); if (isInitialRender.current) { @@ -369,7 +373,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie /> Date: Mon, 22 Apr 2024 13:22:14 +0200 Subject: [PATCH 2/9] fix reply counter --- src/libs/actions/Report.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 8b0dbf8a37a9..4bc72b59293c 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -3047,6 +3047,7 @@ function completeOnboarding( }; const tasksData = data.tasks.map((task, index) => { + const hasSubtitle = !!task.subtitle; const currentTask = ReportUtils.buildOptimisticTaskReport( actorAccountID, undefined, @@ -3066,13 +3067,13 @@ function completeOnboarding( actorAccountID, index + 3, { - childVisibleActionCount: 2, + childVisibleActionCount: hasSubtitle ? 2 : 1, childCommenterCount: 1, childLastVisibleActionCreated: DateUtils.getDBTime(), childOldestFourAccountIDs: `${actorAccountID}`, }, ); - const subtitleComment = task.subtitle ? ReportUtils.buildOptimisticAddCommentReportAction(task.subtitle, undefined, actorAccountID) : null; + const subtitleComment = hasSubtitle ? ReportUtils.buildOptimisticAddCommentReportAction(task.subtitle, undefined, actorAccountID) : null; const isTaskMessageFunction = typeof task.message === 'function'; const taskMessage = isTaskMessageFunction ? task.message({ From 0ef0b24fc8c14cd6e8999192e352aa76f8fc05aa Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Mon, 22 Apr 2024 14:00:03 +0200 Subject: [PATCH 3/9] fix subtitle bold texts --- src/CONST.ts | 48 +++++++++++++++++++------------------- src/libs/actions/Report.ts | 2 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index ab5a67274955..724e93bc740b 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -3624,24 +3624,24 @@ const CONST = { type: 'createWorkspace', autoCompleted: true, title: 'Create a workspace', - subtitle: 'Create a workspace to track expenses, scan receipts, chat, and more.', + subtitle: 'Create a workspace to track expenses, scan receipts, chat, and more.', message: 'Here’s how to create a workspace:\n' + '\n' + '1. Click your profile picture.\n' + '2. Click Workspaces > New workspace.\n' + '\n' + - 'Your new workspace is ready! It’ll keep all of your spend (and chats) in one place.', + 'Your new workspace is ready! It’ll keep all of your spend (and chats) in one place.', }, { type: 'trackExpense', autoCompleted: false, title: 'Track an expense', - subtitle: 'Track an expense in any currency, in just a few clicks.', + subtitle: 'Track an expense in any currency, in just a few clicks.', message: 'Here’s how to track an expense:\n' + '\n' + - '1. Click the green + button.\n' + + '1. Click the green + button.\n' + '2. Choose Track expense.\n' + '3. Enter an amount or scan a receipt.\n' + '4. Click Track.\n' + @@ -3664,11 +3664,11 @@ const CONST = { type: 'submitExpense', autoCompleted: false, title: 'Submit an expense', - subtitle: 'Submit an expense by entering an amount or scanning a receipt.', + subtitle: 'Submit an expense by entering an amount or scanning a receipt.', message: 'Here’s how to submit an expense:\n' + '\n' + - '1. Click the green + button.\n' + + '1. Click the green + button.\n' + '2. Choose Submit expense.\n' + '3. Enter an amount or scan a receipt.\n' + '4. Add your reimburser to the request.\n' + @@ -3679,7 +3679,7 @@ const CONST = { type: 'enableWallet', autoCompleted: false, title: 'Enable your wallet', - subtitle: 'You’ll need to enable your Expensify Wallet to get paid back. Don’t worry, it’s easy!', + subtitle: 'You’ll need to enable your Expensify Wallet to get paid back. Don’t worry, it’s easy!', message: 'Here’s how to set up your wallet:\n' + '\n' + @@ -3705,14 +3705,14 @@ const CONST = { type: 'createWorkspace', autoCompleted: true, title: 'Create a workspace', - subtitle: 'Create a workspace to track expenses, scan receipts, chat, and more.', + subtitle: 'Create a workspace to track expenses, scan receipts, chat, and more.', message: 'Here’s how to create a workspace:\n' + '\n' + '1. Click your profile picture.\n' + '2. Click Workspaces > New workspace.\n' + '\n' + - 'Your new workspace is ready! It’ll keep all of your spend (and chats) in one place.', + 'Your new workspace is ready! It’ll keep all of your spend (and chats) in one place.', }, { type: 'meetGuide', @@ -3728,7 +3728,7 @@ const CONST = { type: 'setupCategories', autoCompleted: false, title: 'Set up categories', - subtitle: 'Set up categories so your team can code expenses for easy reporting.', + subtitle: 'Set up categories so your team can code expenses for easy reporting.', message: 'Here’s how to set up categories:\n' + '\n' + @@ -3738,21 +3738,21 @@ const CONST = { '4. Enable and disable default categories.\n' + '5. Click Add categories to make your own.\n' + '\n' + - 'For more controls like requiring a category for every expense, click Settings.', + 'For more controls like requiring a category for every expense, click Settings.', }, { type: 'addExpenseApprovals', autoCompleted: false, title: 'Add expense approvals', - subtitle: 'Add expense approvals to review your team’s spend and keep it under control.', + subtitle: 'Add expense approvals to review your team’s spend and keep it under control.', message: 'Here’s how to add expense approvals:\n' + '\n' + '1. Click your profile picture.\n' + - '2. Go to Workspaces > [your workspace].\n' + + '2. Go to Workspaces > [your workspace].\n' + '3. Click More features.\n' + '4. Enable Workflows.\n' + - '5. In Workflows, enable Add approvals.\n' + + '5. In Workflows, enable Add approvals.\n' + '\n' + 'You’ll be set as the expense approver. You can change this to any admin once you invite your team.', }, @@ -3760,7 +3760,7 @@ const CONST = { type: 'inviteTeam', autoCompleted: false, title: 'Invite your team', - subtitle: 'Invite your team to Expensify so they can start tracking expenses today.', + subtitle: 'Invite your team to Expensify so they can start tracking expenses today.', message: 'Here’s how to invite your team:\n' + '\n' + @@ -3788,14 +3788,14 @@ const CONST = { type: 'trackExpense', autoCompleted: false, title: 'Track an expense', - subtitle: 'Track an expense in any currency, whether you have a receipt or not.', + subtitle: 'Track an expense in any currency, whether you have a receipt or not.', message: 'Here’s how to track an expense:\n' + '\n' + - '1. Click the green + button.\n' + + '1. Click the green + button.\n' + '2. Choose Track expense.\n' + '3. Enter an amount or scan a receipt.\n' + - '4. Click Track.\n' + + '4. Click Track.\n' + '\n' + 'And you’re done! Yep, it’s that easy.', }, @@ -3815,15 +3815,15 @@ const CONST = { type: 'startChat', autoCompleted: false, title: 'Start a chat', - subtitle: 'Start a chat with a friend or group using their email or phone number.', + subtitle: 'Start a chat with a friend or group using their email or phone number.', message: 'Here’s how to start a chat:\n' + '\n' + - '1. Click the green + button.\n' + + '1. Click the green + button.\n' + '2. Choose Start chat.\n' + '3. Enter emails or phone numbers.\n' + '\n' + - 'If any of your friends aren’t using Expensify already, they’ll be invited automatically. \n' + + 'If any of your friends aren’t using Expensify already, they’ll be invited automatically.\n' + '\n' + 'Every chat will also turn into an email or text that they can respond to directly.', }, @@ -3831,11 +3831,11 @@ const CONST = { type: 'splitExpense', autoCompleted: false, title: 'Split an expense', - subtitle: 'Split an expense right in your chat with one or more friends.', + subtitle: 'Split an expense right in your chat with one or more friends.', message: 'Here’s how to request money:\n' + '\n' + - '1. Click the green + button.\n' + + '1. Click the green + button.\n' + '2. Choose Split expense.\n' + '3. Scan a receipt or enter an amount.\n' + '4. Add your friend(s) to the request.\n' + @@ -3846,7 +3846,7 @@ const CONST = { type: 'enableWallet', autoCompleted: false, title: 'Enable your wallet', - subtitle: 'You’ll need to enable your Expensify Wallet to get paid back. Don’t worry, it’s easy!', + subtitle: 'You’ll need to enable your Expensify Wallet to get paid back. Don’t worry, it’s easy!', message: 'Here’s how to enable your wallet:\n' + '\n' + diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 4bc72b59293c..4f1f2c41b258 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -3073,7 +3073,7 @@ function completeOnboarding( childOldestFourAccountIDs: `${actorAccountID}`, }, ); - const subtitleComment = hasSubtitle ? ReportUtils.buildOptimisticAddCommentReportAction(task.subtitle, undefined, actorAccountID) : null; + const subtitleComment = hasSubtitle ? ReportUtils.buildOptimisticAddCommentReportAction(task.subtitle, undefined, actorAccountID, 0, false) : null; const isTaskMessageFunction = typeof task.message === 'function'; const taskMessage = isTaskMessageFunction ? task.message({ From 7ee2d7aefb90e3158a560a2aaa1bb3af0486f1a3 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Mon, 22 Apr 2024 18:35:33 +0200 Subject: [PATCH 4/9] implement failure data --- src/libs/actions/Report.ts | 75 +++++++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 4f1f2c41b258..bd3e749d0473 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -3220,6 +3220,33 @@ function completeOnboarding( [], ); + const tasksForFailureData = tasksData.reduce((acc, {currentTask, taskReportAction}) => { + const tasksForFailureDataAcc: OnyxUpdate[] = [ + ...acc, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetChatReportID}`, + value: { + [taskReportAction.reportAction.reportActionID]: { + errors: ErrorUtils.getMicroSecondOnyxError('report.genericAddCommentFailureMessage'), + } as ReportAction, + }, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${currentTask.reportID}`, + value: null, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${currentTask.reportID}`, + value: null, + }, + ]; + + return tasksForFailureDataAcc; + }, []); + const optimisticData: OnyxUpdate[] = [ ...tasksForOptimisticData, { @@ -3255,6 +3282,52 @@ function completeOnboarding( }, }, ]; + let failureReport: Partial = { + lastMessageTranslationKey: '', + lastMessageText: '', + lastVisibleActionCreated: '', + }; + const {lastMessageText = '', lastMessageTranslationKey = ''} = ReportActionsUtils.getLastVisibleMessage(targetChatReportID); + if (lastMessageText || lastMessageTranslationKey) { + const lastVisibleAction = ReportActionsUtils.getLastVisibleAction(targetChatReportID); + const lastVisibleActionCreated = lastVisibleAction?.created; + const lastActorAccountID = lastVisibleAction?.actorAccountID; + failureReport = { + lastMessageTranslationKey, + lastMessageText, + lastVisibleActionCreated, + lastActorAccountID, + }; + } + + const failureData: OnyxUpdate[] = [ + ...tasksForFailureData, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${targetChatReportID}`, + value: failureReport, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${targetChatReportID}`, + value: { + [mentionCommentAction.reportActionID]: { + errors: ErrorUtils.getMicroSecondOnyxError('report.genericAddCommentFailureMessage'), + } as ReportAction, + [textCommentAction.reportActionID]: { + errors: ErrorUtils.getMicroSecondOnyxError('report.genericAddCommentFailureMessage'), + } as ReportAction, + [videoCommentAction.reportActionID]: { + errors: ErrorUtils.getMicroSecondOnyxError('report.genericAddCommentFailureMessage'), + } as ReportAction, + }, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: ONYXKEYS.NVP_INTRO_SELECTED, + value: {choice: null}, + }, + ]; const guidedSetupData: GuidedSetupData = [ {type: 'message', ...mentionMessage}, @@ -3270,7 +3343,7 @@ function completeOnboarding( guidedSetupData: JSON.stringify(guidedSetupData), }; - API.write(WRITE_COMMANDS.COMPLETE_GUIDED_SETUP, parameters, {optimisticData, successData}); + API.write(WRITE_COMMANDS.COMPLETE_GUIDED_SETUP, parameters, {optimisticData, successData, failureData}); } /** From b1295523820d2a3b76c5b1fb6a6ec8ecf23ae5ad Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Tue, 23 Apr 2024 11:08:14 +0200 Subject: [PATCH 5/9] update translation --- src/languages/es.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 112993f848f6..97e716caeb44 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -313,7 +313,7 @@ export default { subtitleText2: 'o crea algo usando el botón', subtitleText3: '.', }, - businessName: 'Nombre del Negocio', + businessName: 'Nombre de la empresa', }, location: { useCurrent: 'Usar ubicación actual', From c3f41b33447b66fdf2618731e8cd9798297ab37d Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Wed, 24 Apr 2024 11:48:23 +0200 Subject: [PATCH 6/9] update text on welcome video modal --- src/components/OnboardingWelcomeVideo.tsx | 2 +- src/languages/en.ts | 3 +-- src/languages/es.ts | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/OnboardingWelcomeVideo.tsx b/src/components/OnboardingWelcomeVideo.tsx index 6858d29f4d3c..8c851a452eda 100644 --- a/src/components/OnboardingWelcomeVideo.tsx +++ b/src/components/OnboardingWelcomeVideo.tsx @@ -148,7 +148,7 @@ function OnboardingWelcomeVideo() { success pressOnEnter onPress={closeModal} - text={translate('onboarding.welcomeVideo.button')} + text={translate('footer.getStarted')} /> diff --git a/src/languages/en.ts b/src/languages/en.ts index d3ffbc9bb368..6dab9fb4d03d 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -1319,8 +1319,7 @@ export default { onboarding: { welcomeVideo: { title: 'Welcome to Expensify', - description: 'Getting paid is as easy as sending a message.', - button: "Let's go", + description: 'One app to handle all your business and personal spend in a chat. Built for your business, your team, and your friends.', }, whatsYourName: "What's your name?", whereYouWork: 'Where do you work?', diff --git a/src/languages/es.ts b/src/languages/es.ts index d2f6eb9df514..28b98f2ee4a6 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1318,8 +1318,7 @@ export default { onboarding: { welcomeVideo: { title: 'Bienvenido a Expensify', - description: 'Cobrar es tan fácil como enviar un mensaje.', - button: 'Vámonos', + description: 'Una aplicación para gestionar todos tus gastos empresariales y personales en un chat. Pensada para tu empresa, tu equipo y tus amigos.', }, whatsYourName: '¿Cómo te llamas?', whereYouWork: '¿Dónde trabajas?', From 6d6a26ea785c6707adc0d76e8657fd843d46d6c0 Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Wed, 24 Apr 2024 12:15:54 +0200 Subject: [PATCH 7/9] increase time --- src/styles/variables.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/styles/variables.ts b/src/styles/variables.ts index ff1b20893110..c7de01fdf6c6 100644 --- a/src/styles/variables.ts +++ b/src/styles/variables.ts @@ -203,7 +203,7 @@ export default { sectionIllustrationHeight: 220, photoUploadPopoverWidth: 335, onboardingModalWidth: 500, - welcomeVideoDelay: 500, + welcomeVideoDelay: 1000, // The height of the empty list is 14px (2px for borders and 12px for vertical padding) // This is calculated based on the values specified in the 'getGoogleListViewStyle' function of the 'StyleUtils' utility From 996886524b9b5d1201de3cb5ac2f989b4c06fadd Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Wed, 24 Apr 2024 12:49:12 +0200 Subject: [PATCH 8/9] fix translation --- src/languages/es.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 28b98f2ee4a6..5a19cae91e6c 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -1318,7 +1318,7 @@ export default { onboarding: { welcomeVideo: { title: 'Bienvenido a Expensify', - description: 'Una aplicación para gestionar todos tus gastos empresariales y personales en un chat. Pensada para tu empresa, tu equipo y tus amigos.', + description: 'Una aplicación para gestionar todos tus gastos de empresa y personales en un chat. Pensada para tu empresa, tu equipo y tus amigos.', }, whatsYourName: '¿Cómo te llamas?', whereYouWork: '¿Dónde trabajas?', From 2353824775b40a7cb71dcad1f90a20b13ece9e8f Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Wed, 24 Apr 2024 14:32:52 +0200 Subject: [PATCH 9/9] fix welcome video modal options --- src/libs/Navigation/AppNavigator/AuthScreens.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/Navigation/AppNavigator/AuthScreens.tsx b/src/libs/Navigation/AppNavigator/AuthScreens.tsx index 17f7b946c7ab..917f206cf4f0 100644 --- a/src/libs/Navigation/AppNavigator/AuthScreens.tsx +++ b/src/libs/Navigation/AppNavigator/AuthScreens.tsx @@ -161,6 +161,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie const {isSmallScreenWidth} = useWindowDimensions(); const {shouldUseNarrowLayout} = useOnboardingLayout(); const screenOptions = getRootNavigatorScreenOptions(isSmallScreenWidth, styles, StyleUtils); + const onboardingModalScreenOptions = useMemo(() => screenOptions.onboardingModalNavigator(shouldUseNarrowLayout), [screenOptions, shouldUseNarrowLayout]); const onboardingScreenOptions = useMemo( () => getOnboardingModalScreenOptions(isSmallScreenWidth, styles, StyleUtils, shouldUseNarrowLayout), [StyleUtils, isSmallScreenWidth, shouldUseNarrowLayout, styles], @@ -368,7 +369,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie />