Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootsplash logic in hybridapp #132

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Expensify.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@
const isAuthenticated = useMemo(() => !!(session?.authToken ?? null), [session]);
const autoAuthState = useMemo(() => session?.autoAuthState ?? '', [session]);

const shouldInit = isNavigationReady && hasAttemptedToOpenPublicRoom;
const shouldInit = !!NativeModules.HybridAppModule

Check failure on line 120 in src/Expensify.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Redundant double negation

Check failure on line 120 in src/Expensify.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Redundant double negation
? !hybridApp?.loggedOutFromOldDot && isNavigationReady && hasAttemptedToOpenPublicRoom
: isNavigationReady && hasAttemptedToOpenPublicRoom;
const shouldHideSplash =
shouldInit &&
(NativeModules.HybridAppModule
(!!NativeModules.HybridAppModule

Check failure on line 125 in src/Expensify.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

Redundant double negation

Check failure on line 125 in src/Expensify.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Redundant double negation
? splashScreenState === CONST.BOOT_SPLASH_STATE.READY_TO_BE_HIDDEN && (isAuthenticated || !!hybridApp?.useNewDotSignInPage)
: splashScreenState === CONST.BOOT_SPLASH_STATE.VISIBLE);

Expand Down
6 changes: 5 additions & 1 deletion src/libs/actions/HybridApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ function setUseNewDotSignInPage(useNewDotSignInPage: boolean) {
Onyx.merge(ONYXKEYS.HYBRID_APP, {useNewDotSignInPage});
}

export {setOldDotSignInError, setIsSigningIn, setReadyToShowAuthScreens, setReadyToSwitchToClassicExperience, setShouldResetSigningInLogic, setUseNewDotSignInPage};
function setLoggedOutFromOldDot(loggedOutFromOldDot: boolean) {
Onyx.merge(ONYXKEYS.HYBRID_APP, {loggedOutFromOldDot});
}

export {setOldDotSignInError, setIsSigningIn, setReadyToShowAuthScreens, setReadyToSwitchToClassicExperience, setShouldResetSigningInLogic, setUseNewDotSignInPage, setLoggedOutFromOldDot};
7 changes: 4 additions & 3 deletions src/libs/actions/Session/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {hideContextMenu} from '@pages/home/report/ContextMenu/ReportActionContex
import * as App from '@userActions/App';
import {KEYS_TO_PRESERVE, openApp} from '@userActions/App';
import * as Device from '@userActions/Device';
import {setReadyToShowAuthScreens, setReadyToSwitchToClassicExperience, setUseNewDotSignInPage} from '@userActions/HybridApp';
import {setLoggedOutFromOldDot, setReadyToShowAuthScreens, setReadyToSwitchToClassicExperience, setUseNewDotSignInPage} from '@userActions/HybridApp';
import * as PriorityMode from '@userActions/PriorityMode';
import redirectToSignIn from '@userActions/SignInRedirect';
import Timing from '@userActions/Timing';
Expand Down Expand Up @@ -482,14 +482,14 @@ function signUpUser() {

function signInAfterTransitionFromOldDot(transitionURL: string) {
const [route, queryParams] = transitionURL.split('?');
const {useNewDotSignInPage, isSingleNewDotEntry} = queryParams
const {useNewDotSignInPage, isSingleNewDotEntry, loggedOutFromOldDot} = queryParams
? Object.fromEntries(
queryParams.split('&').map((param) => {
const [key, value] = param.split('=');
return [key, value];
}),
)
: {useNewDotSignInPage: undefined, isSingleNewDotEntry: undefined};
: {useNewDotSignInPage: undefined, isSingleNewDotEntry: undefined, loggedOutFromOldDot: undefined};

const clearOnyxBeforeSignIn = () => {
if (useNewDotSignInPage !== 'true') {
Expand All @@ -513,6 +513,7 @@ function signInAfterTransitionFromOldDot(transitionURL: string) {
clearOnyxBeforeSignIn()
.then(() => {
setUseNewDotSignInPage(useNewDotSignInPage === 'true');
setLoggedOutFromOldDot(loggedOutFromOldDot === 'true');
const useOldDot = 'true';
const dismissed = useNewDotSignInPage === 'true' ? useOldDot : 'false';
Onyx.multiSet({
Expand Down
3 changes: 3 additions & 0 deletions src/types/onyx/HybridApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ type HybridApp = {

/** */
shouldResetSigningInLogic?: boolean;

/** stores infromation if last log out was performed from OldDot */
loggedOutFromOldDot?: boolean;
};

export default HybridApp;
Loading