diff --git a/native/account/fullscreen-siwe-panel.react.js b/native/account/fullscreen-siwe-panel.react.js --- a/native/account/fullscreen-siwe-panel.react.js +++ b/native/account/fullscreen-siwe-panel.react.js @@ -2,7 +2,9 @@ import * as React from 'react'; import { Alert, ActivityIndicator, View } from 'react-native'; +import { useDispatch } from 'react-redux'; +import { setDataLoadedActionType } from 'lib/actions/client-db-store-actions.js'; import type { SIWEResult } from 'lib/types/siwe-types.js'; import { useSIWEServerCall } from './siwe-hooks.js'; @@ -39,12 +41,19 @@ const siweServerCall = useSIWEServerCall(siweServerCallParams); const successRef = React.useRef(false); + const dispatch = useDispatch(); const onSuccess = React.useCallback( - (result: SIWEResult) => { + async (result: SIWEResult) => { successRef.current = true; - return siweServerCall(result); + await siweServerCall(result); + dispatch({ + type: setDataLoadedActionType, + payload: { + dataLoaded: true, + }, + }); }, - [siweServerCall], + [siweServerCall, dispatch], ); const ifBeforeSuccessGoBackToPrompt = React.useCallback(() => { diff --git a/native/account/registration/existing-ethereum-account.react.js b/native/account/registration/existing-ethereum-account.react.js --- a/native/account/registration/existing-ethereum-account.react.js +++ b/native/account/registration/existing-ethereum-account.react.js @@ -2,7 +2,9 @@ import * as React from 'react'; import { Text, View, Alert } from 'react-native'; +import { useDispatch } from 'react-redux'; +import { setDataLoadedActionType } from 'lib/actions/client-db-store-actions.js'; import { siweAuthActionTypes } from 'lib/actions/siwe-actions.js'; import { useENSName } from 'lib/hooks/ens-cache.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; @@ -39,9 +41,16 @@ const siweServerCall = useSIWEServerCall(siweServerCallParams); const { params } = props.route; - const onProceedToLogIn = React.useCallback(() => { - siweServerCall(params); - }, [siweServerCall, params]); + const dispatch = useDispatch(); + const onProceedToLogIn = React.useCallback(async () => { + await siweServerCall(params); + dispatch({ + type: setDataLoadedActionType, + payload: { + dataLoaded: true, + }, + }); + }, [siweServerCall, params, dispatch]); const siweAuthCallLoading = useSelector( state => siweAuthLoadingStatusSelector(state) === 'loading', diff --git a/native/account/siwe-hooks.js b/native/account/siwe-hooks.js --- a/native/account/siwe-hooks.js +++ b/native/account/siwe-hooks.js @@ -63,15 +63,19 @@ const initialNotificationsEncryptedMessage = await getInitialNotificationsEncryptedMessage(); + const siwePromise = callSIWE(message, signature, { + ...extraInfo, + initialNotificationsEncryptedMessage, + }); + dispatchActionPromise( siweAuthActionTypes, - callSIWE(message, signature, { - ...extraInfo, - initialNotificationsEncryptedMessage, - }), + siwePromise, undefined, ({ calendarQuery: extraInfo.calendarQuery }: LogInStartingPayload), ); + + await siwePromise; }, [ logInExtraInfo,