From 15a87d88563bf5ec124b6be840c3c8654b59612d Mon Sep 17 00:00:00 2001 From: Anusha Date: Sun, 15 Sep 2024 19:57:19 +0500 Subject: [PATCH 1/8] migrate to useOnyx --- .../DeeplinkRedirectLoadingIndicator.tsx | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx b/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx index 154689df4ce8..96288d052fdb 100644 --- a/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx +++ b/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx @@ -1,7 +1,6 @@ import React from 'react'; import {View} from 'react-native'; -import type {OnyxEntry} from 'react-native-onyx'; -import {withOnyx} from 'react-native-onyx'; +import {useOnyx} from 'react-native-onyx'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import * as Illustrations from '@components/Icon/Illustrations'; @@ -12,23 +11,17 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; import ONYXKEYS from '@src/ONYXKEYS'; -import type * as OnyxTypes from '@src/types/onyx'; -type DeeplinkRedirectLoadingIndicatorOnyxProps = { - /** Current user session */ - session: OnyxEntry; -}; - -type DeeplinkRedirectLoadingIndicatorProps = DeeplinkRedirectLoadingIndicatorOnyxProps & { +type DeeplinkRedirectLoadingIndicatorProps = { /** Opens the link in the browser */ openLinkInBrowser: (value: boolean) => void; }; -function DeeplinkRedirectLoadingIndicator({openLinkInBrowser, session}: DeeplinkRedirectLoadingIndicatorProps) { +function DeeplinkRedirectLoadingIndicator({openLinkInBrowser}: DeeplinkRedirectLoadingIndicatorProps) { const {translate} = useLocalize(); const theme = useTheme(); const styles = useThemeStyles(); - + const [session] = useOnyx(ONYXKEYS.SESSION); return ( @@ -62,8 +55,4 @@ function DeeplinkRedirectLoadingIndicator({openLinkInBrowser, session}: Deeplink DeeplinkRedirectLoadingIndicator.displayName = 'DeeplinkRedirectLoadingIndicator'; -export default withOnyx({ - session: { - key: ONYXKEYS.SESSION, - }, -})(DeeplinkRedirectLoadingIndicator); +export default DeeplinkRedirectLoadingIndicator; From e656ec4fd61503250cb42b256ef361e890b14171 Mon Sep 17 00:00:00 2001 From: Anusha <93134676+Nodebrute@users.noreply.github.com> Date: Wed, 2 Oct 2024 17:14:41 +0500 Subject: [PATCH 2/8] Update src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com> --- .../DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx b/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx index 96288d052fdb..0f3d881c5f52 100644 --- a/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx +++ b/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx @@ -21,7 +21,7 @@ function DeeplinkRedirectLoadingIndicator({openLinkInBrowser}: DeeplinkRedirectL const {translate} = useLocalize(); const theme = useTheme(); const styles = useThemeStyles(); - const [session] = useOnyx(ONYXKEYS.SESSION); + const [email] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.email ?? ''}); return ( From bb654254ae4fb02abbd0dcd9d3617926efdd20bc Mon Sep 17 00:00:00 2001 From: Anusha Date: Wed, 2 Oct 2024 17:29:07 +0500 Subject: [PATCH 3/8] use email instead of session --- .../DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx b/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx index 0f3d881c5f52..0b5f7b82c547 100644 --- a/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx +++ b/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx @@ -34,7 +34,7 @@ function DeeplinkRedirectLoadingIndicator({openLinkInBrowser}: DeeplinkRedirectL {translate('deeplinkWrapper.launching')} - {translate('deeplinkWrapper.loggedInAs', {email: session?.email ?? ''})} + {translate('deeplinkWrapper.loggedInAs', {email})} {translate('deeplinkWrapper.doNotSeePrompt')} openLinkInBrowser(true)}>{translate('deeplinkWrapper.tryAgain')} {translate('deeplinkWrapper.or')} Navigation.goBack()}>{translate('deeplinkWrapper.continueInWeb')}. From ec5aacf6bb3b1c90eed169b9110574c07848660f Mon Sep 17 00:00:00 2001 From: Anusha Date: Wed, 2 Oct 2024 17:35:24 +0500 Subject: [PATCH 4/8] fix type error --- src/languages/types.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/languages/types.ts b/src/languages/types.ts index a7a11fafb27b..03f8d3d25334 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -1,3 +1,4 @@ +import {OnyxEntry} from 'react-native-onyx'; import type {OnyxInputOrEntry, ReportAction} from '@src/types/onyx'; import type {Unit} from '@src/types/onyx/Policy'; import type {ViolationDataType} from '@src/types/onyx/TransactionViolation'; @@ -16,7 +17,7 @@ type ZipCodeExampleFormatParams = { }; type LoggedInAsParams = { - email: string; + email: OnyxEntry; }; type SignUpNewFaceCodeParams = { From a5313b59bf67060ab50b49ae2c11497d52b16d5d Mon Sep 17 00:00:00 2001 From: Anusha Date: Wed, 2 Oct 2024 17:38:35 +0500 Subject: [PATCH 5/8] resolve conflicts --- src/languages/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/types.ts b/src/languages/types.ts index 03f8d3d25334..975df98d9c90 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -17,7 +17,7 @@ type ZipCodeExampleFormatParams = { }; type LoggedInAsParams = { - email: OnyxEntry; + email: string; }; type SignUpNewFaceCodeParams = { From 5c5d29f3c9b46bd1bb9e9a4089ac4a233e9bc95d Mon Sep 17 00:00:00 2001 From: Anusha Date: Wed, 2 Oct 2024 17:39:59 +0500 Subject: [PATCH 6/8] resolve --- src/languages/types.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/languages/types.ts b/src/languages/types.ts index 975df98d9c90..a7a11fafb27b 100644 --- a/src/languages/types.ts +++ b/src/languages/types.ts @@ -1,4 +1,3 @@ -import {OnyxEntry} from 'react-native-onyx'; import type {OnyxInputOrEntry, ReportAction} from '@src/types/onyx'; import type {Unit} from '@src/types/onyx/Policy'; import type {ViolationDataType} from '@src/types/onyx/TransactionViolation'; From 3329f6c8d603b5598bc7b52d27ab2ea9927cab07 Mon Sep 17 00:00:00 2001 From: Anusha Date: Wed, 2 Oct 2024 17:43:45 +0500 Subject: [PATCH 7/8] type error fixed --- src/languages/params.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/languages/params.ts b/src/languages/params.ts index 5560316d2ddd..744589c06f08 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -1,3 +1,4 @@ +import {OnyxEntry} from 'react-native-onyx'; import type {OnyxInputOrEntry, ReportAction} from '@src/types/onyx'; import type {DelegateRole} from '@src/types/onyx/Account'; import type {AllConnectionName, ConnectionName, PolicyConnectionSyncStage, SageIntacctMappingName, Unit} from '@src/types/onyx/Policy'; @@ -25,7 +26,7 @@ type ZipCodeExampleFormatParams = { }; type LoggedInAsParams = { - email: string; + email: OnyxEntry; }; type SignUpNewFaceCodeParams = { From c22556d8f5df18ea8386cbf7b45637f4cded0784 Mon Sep 17 00:00:00 2001 From: Anusha Date: Wed, 2 Oct 2024 18:24:15 +0500 Subject: [PATCH 8/8] fix userlogin --- .../DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx | 4 ++-- src/languages/params.ts | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx b/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx index 0b5f7b82c547..d2a622bf7d8d 100644 --- a/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx +++ b/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx @@ -21,7 +21,7 @@ function DeeplinkRedirectLoadingIndicator({openLinkInBrowser}: DeeplinkRedirectL const {translate} = useLocalize(); const theme = useTheme(); const styles = useThemeStyles(); - const [email] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.email ?? ''}); + const [currentUserLogin] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.email}); return ( @@ -34,7 +34,7 @@ function DeeplinkRedirectLoadingIndicator({openLinkInBrowser}: DeeplinkRedirectL {translate('deeplinkWrapper.launching')} - {translate('deeplinkWrapper.loggedInAs', {email})} + {translate('deeplinkWrapper.loggedInAs', {email: currentUserLogin ?? ''})} {translate('deeplinkWrapper.doNotSeePrompt')} openLinkInBrowser(true)}>{translate('deeplinkWrapper.tryAgain')} {translate('deeplinkWrapper.or')} Navigation.goBack()}>{translate('deeplinkWrapper.continueInWeb')}. diff --git a/src/languages/params.ts b/src/languages/params.ts index 744589c06f08..5560316d2ddd 100644 --- a/src/languages/params.ts +++ b/src/languages/params.ts @@ -1,4 +1,3 @@ -import {OnyxEntry} from 'react-native-onyx'; import type {OnyxInputOrEntry, ReportAction} from '@src/types/onyx'; import type {DelegateRole} from '@src/types/onyx/Account'; import type {AllConnectionName, ConnectionName, PolicyConnectionSyncStage, SageIntacctMappingName, Unit} from '@src/types/onyx/Policy'; @@ -26,7 +25,7 @@ type ZipCodeExampleFormatParams = { }; type LoggedInAsParams = { - email: OnyxEntry; + email: string; }; type SignUpNewFaceCodeParams = {