Skip to content

Commit

Permalink
update Onyx data in the function
Browse files Browse the repository at this point in the history
  • Loading branch information
c3024 committed Nov 25, 2024
1 parent f9f1207 commit 727b364
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
7 changes: 6 additions & 1 deletion src/libs/actions/Welcome/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,12 @@ function resetAllChecks() {
OnboardingFlow.clearInitialPath();
}

function setSelfTourViewed() {
function setSelfTourViewed(shouldUpdateOnyxDataOnlyLocally = false) {
if (shouldUpdateOnyxDataOnlyLocally) {
Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {selfTourViewed: true});
return;
}

const optimisticData: OnyxUpdate[] = [
{
onyxMethod: Onyx.METHOD.MERGE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {ForwardedRef} from 'react';
import React, {forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react';
import {View} from 'react-native';
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import Onyx, {useOnyx} from 'react-native-onyx';
import {useOnyx} from 'react-native-onyx';
import type {SvgProps} from 'react-native-svg';
import ConfirmModal from '@components/ConfirmModal';
import FloatingActionButton from '@components/FloatingActionButton';
Expand Down Expand Up @@ -562,14 +562,7 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu}: Fl
description: translate('tour.exploreExpensify'),
onSelected: () => {
Link.openExternalLink(navatticURL);
// Mark the tour as seen only locally for anonymous users visiting public rooms
if (Session.isAnonymousUser()) {
Onyx.merge(ONYXKEYS.NVP_ONBOARDING, {
selfTourViewed: true,
});
return;
}
Welcome.setSelfTourViewed();
Welcome.setSelfTourViewed(Session.isAnonymousUser());
if (viewTourTaskReport) {
Task.completeTask(viewTourTaskReport);
}
Expand Down

0 comments on commit 727b364

Please sign in to comment.