redirect to onboarding after deleting server; fix styles for server screen in IOS

This commit is contained in:
Pablo Velez Vidal 2022-11-15 14:37:09 +01:00
parent f1f43880a7
commit 9c1fd176f9
3 changed files with 21 additions and 11 deletions

View file

@ -60,8 +60,15 @@ const launchAppFromNotification = async (notification: NotificationWithData) =>
launchApp(props);
};
/**
*
* @param props set of properties used to determine how to launch the app depending on the containing values
* @param resetNavigation used when loading the add_server screen and remove all the navigation stack
* @returns a redirection to a screen, either onboarding, add_server, login or home depending on the scenario
*/
const launchApp = async (props: LaunchProps, resetNavigation = true) => {
const onboadingViewed = await onboadingViewedValue();
const onboardingViewed = LocalConfig.ShowOnboarding ? await onboadingViewedValue() : false;
let serverUrl: string | undefined;
switch (props?.launchType) {
case Launch.DeepLink:
@ -101,7 +108,7 @@ const launchApp = async (props: LaunchProps, resetNavigation = true) => {
}
// invert this logic for onboardingViewed
if (LocalConfig.ShowOnboarding && onboadingViewed) {
if ((LocalConfig.ShowOnboarding && onboardingViewed)) {
return resetToOnboarding({...props, goToLoginServerUrl: serverUrl});
}
@ -135,7 +142,7 @@ const launchApp = async (props: LaunchProps, resetNavigation = true) => {
}
// invert this logic for onboardingViewed
if (LocalConfig.ShowOnboarding && !onboadingViewed) {
if (LocalConfig.ShowOnboarding && !onboardingViewed) {
return launchToServer(props, resetNavigation);
}
return resetToOnboarding(props);

View file

@ -18,7 +18,7 @@ import NetworkManager from '@managers/network_manager';
import WebsocketManager from '@managers/websocket_manager';
import {queryServerName} from '@queries/app/servers';
import {getCurrentUser} from '@queries/servers/user';
import {getThemeFromState} from '@screens/navigation';
import {getThemeFromState, resetToOnboarding} from '@screens/navigation';
import EphemeralStore from '@store/ephemeral_store';
import {addNewServer} from '@utils/server';
@ -167,17 +167,15 @@ class SessionManager {
if (activeServerUrl === serverUrl) {
let displayName = '';
let launchType: LaunchType = Launch.AddServer;
const launchType: LaunchType = Launch.Normal;
if (!Object.keys(DatabaseManager.serverDatabases).length) {
EphemeralStore.theme = undefined;
launchType = Launch.Normal;
if (activeServerDisplayName) {
displayName = activeServerDisplayName;
}
}
relaunchApp({launchType, serverUrl, displayName}, true);
resetToOnboarding({launchType, serverUrl, displayName});
}
};

View file

@ -11,7 +11,7 @@ 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';
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
import FooterButtons from './footer_buttons';
import Paginator from './paginator';
@ -107,14 +107,19 @@ const Onboarding = ({
const topBar = {
visible: true,
drawBehind: true,
translucid: true,
noBorder: true,
elevation: 0,
background: {
color: 'transparent',
},
backButton: {
color: theme.centerChannelColor,
title: '',
color: changeOpacity(theme.centerChannelColor, 0.56),
},
scrollEdgeAppearance: {
active: true,
noBorder: true,
translucid: true,
},
};