make the redirect to login work

This commit is contained in:
Pablo Velez Vidal 2022-11-11 22:30:36 +01:00
parent 46b66a5baf
commit 5b09f03ac1
3 changed files with 8 additions and 10 deletions

View file

@ -104,7 +104,7 @@ const launchApp = async (props: LaunchProps, resetNavigation = true) => {
// redirect to the sign in
// return launchToOnboarding(props, goToLoginPage);
// }
console.log('\n\n first launch to onboarding \n\n', serverUrl);
return launchToOnboarding(props, resetNavigation, false, false, true, serverUrl);
let launchType = props.launchType;
@ -139,7 +139,7 @@ const launchApp = async (props: LaunchProps, resetNavigation = true) => {
// if (onboardingAlreadyShown) {
// // launchToServer(props, resetNavigation);
// }
console.log('\n\n second launch to onboarding \n\n', serverUrl);
return launchToOnboarding(props, resetNavigation);
};
@ -209,7 +209,7 @@ const launchToOnboarding = (
}
// if there is not an active session, pass the prop and redirect to the LOGIN page (keep in mind all the redirection login to check for SSO stuff)
return resetToOnboarding(props, goToLogIn);
return resetToOnboarding(props, true, serverUrl);
};
export const relaunchApp = (props: LaunchProps, resetNavigation = false) => {

View file

@ -281,7 +281,7 @@ export function resetToSelectServer(passProps: LaunchProps) {
});
}
export function resetToOnboarding(passProps: LaunchProps, goToLogIn: boolean) {
export function resetToOnboarding(passProps: LaunchProps, goToLogIn: boolean, serverUrl: string) {
const theme = getDefaultThemeByAppearance();
const isDark = tinyColor(theme.sidebarBg).isDark();
StatusBar.setBarStyle(isDark ? 'light-content' : 'dark-content');
@ -296,6 +296,7 @@ export function resetToOnboarding(passProps: LaunchProps, goToLogIn: boolean) {
...passProps,
theme,
goToLogIn,
serverUrl,
},
options: {
layout: {

View file

@ -5,7 +5,9 @@ import React, {useCallback, useEffect, useRef} from 'react';
import {View, ListRenderItemInfo, useWindowDimensions, SafeAreaView, ScrollView, Animated as AnimatedRN} from 'react-native';
import Animated, {Easing, useAnimatedRef, useAnimatedScrollHandler, useDerivedValue, useSharedValue} from 'react-native-reanimated';
import {fetchConfigAndLicense} from '@actions/remote/systems';
import {Screens} from '@app/constants';
import {loginOptions} from '@app/utils/server';
import Background from '@screens/background';
import {goToScreen, loginAnimationOptions} from '@screens/navigation';
import {makeStyleSheetFromTheme} from '@utils/theme';
@ -16,9 +18,6 @@ import SlideItem from './slide';
import useSlidesData, {OnboardingItem} from './slides_data';
import type {LaunchProps} from '@typings/launch';
import { loginOptions } from '@app/utils/server';
import { fetchConfigAndLicense } from '@actions/remote/systems';
import { queryServerByIdentifier } from '@app/queries/app/servers';
interface OnboardingProps extends LaunchProps {
theme: Theme;
@ -84,12 +83,10 @@ const Onboarding = ({
const displayLogin = (config: ClientConfig, license: ClientLicense) => {
const {enabledSSOs, hasLoginForm, numberSSOs, ssoOptions} = loginOptions(config, license);
const displayName = 'displayName';
const passProps = {
config,
extra,
hasLoginForm,
launchError,
launchType,
license,
serverDisplayName: displayName,
serverUrl,