From db5794430cd1f490b301fc1286e6c5977582e5c3 Mon Sep 17 00:00:00 2001 From: Ishpaul Singh Date: Fri, 13 Dec 2024 18:52:54 +0530 Subject: [PATCH] add comments and api changes --- src/hooks/useBottomTabIsFocused.ts | 3 +++ src/libs/actions/Welcome/index.ts | 23 ++++++++++------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/hooks/useBottomTabIsFocused.ts b/src/hooks/useBottomTabIsFocused.ts index 33141e7ac4d8..085ff90325a8 100644 --- a/src/hooks/useBottomTabIsFocused.ts +++ b/src/hooks/useBottomTabIsFocused.ts @@ -11,12 +11,15 @@ const useBottomTabIsFocused = () => { const isFocused = useIsFocused(); const topmostFullScreenName = useNavigationState | undefined>(getTopmostFullScreenRoute); const topmostCentralPane = useNavigationState | undefined>(getTopmostCentralPaneRoute); + // if there is a full screen like worspace settings, not found screen, etc. then bottom tab should is not focused if (topmostFullScreenName) { return false; } + // on search screen, isFocused is returned false but it is focused if (shouldUseNarrowLayout) { return isFocused || topmostCentralPane?.name === SCREENS.SEARCH.CENTRAL_PANE; } + // on desktop screen size isFocused is always returned as false so we can't rely on it to determine if bottom tab is focused return isFocused || Object.keys(CENTRAL_PANE_SCREENS).includes(topmostCentralPane?.name ?? ''); }; diff --git a/src/libs/actions/Welcome/index.ts b/src/libs/actions/Welcome/index.ts index c33769ae2e28..f91ab98f7b1d 100644 --- a/src/libs/actions/Welcome/index.ts +++ b/src/libs/actions/Welcome/index.ts @@ -207,19 +207,16 @@ function setSelfTourViewed(shouldUpdateOnyxDataOnlyLocally = false) { function dismissProductTraining(elementName: string) { const date = new Date(); - // const optimisticData = [ - // { - // onyxMethod: Onyx.METHOD.MERGE, - // key: ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, - // value: { - // [elementName]: DateUtils.getDBTime(date.valueOf()), - // }, - // }, - // ]; - // API.write(WRITE_COMMANDS.DISMISS_PRODUCT_TRAINING, {name: elementName}, {optimisticData}); - Onyx.merge(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, { - [elementName]: DateUtils.getDBTime(date.valueOf()), - }); + const optimisticData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, + value: { + [elementName]: DateUtils.getDBTime(date.valueOf()), + }, + }, + ]; + API.write(WRITE_COMMANDS.DISMISS_PRODUCT_TRAINING, {name: elementName}, {optimisticData}); } export {