fix the finish add
This commit is contained in:
parent
72b6034d7f
commit
f7ef6c61cf
|
@ -5,7 +5,7 @@ import { connect } from 'react-redux';
|
|||
|
||||
import Navigation from './lib/Navigation';
|
||||
import { defaultHeader, getActiveRouteName, navigationTheme } from './utils/navigation';
|
||||
import { ROOT_INSIDE, ROOT_LOADING, ROOT_NEW_SERVER, ROOT_OUTSIDE, ROOT_SET_USERNAME } from './actions/app';
|
||||
import { ROOT_INSIDE, ROOT_LOADING, ROOT_OUTSIDE, ROOT_SET_USERNAME } from './actions/app';
|
||||
// Stacks
|
||||
import AuthLoadingView from './views/AuthLoadingView';
|
||||
// SetUsername Stack
|
||||
|
@ -56,9 +56,7 @@ const App = React.memo(({ root, isMasterDetail }: { root: string; isMasterDetail
|
|||
<Stack.Navigator screenOptions={{ headerShown: false, animationEnabled: false }}>
|
||||
<>
|
||||
{root === ROOT_LOADING ? <Stack.Screen name='AuthLoading' component={AuthLoadingView} /> : null}
|
||||
{root === ROOT_OUTSIDE || root === ROOT_NEW_SERVER ? (
|
||||
<Stack.Screen name='OutsideStack' component={OutsideStack} />
|
||||
) : null}
|
||||
{root === ROOT_OUTSIDE ? <Stack.Screen name='OutsideStack' component={OutsideStack} /> : null}
|
||||
{root === ROOT_INSIDE && isMasterDetail ? (
|
||||
<Stack.Screen name='MasterDetailStack' component={MasterDetailStack} />
|
||||
) : null}
|
||||
|
|
|
@ -3,7 +3,6 @@ import { APP } from './actionsTypes';
|
|||
export const ROOT_OUTSIDE = 'outside';
|
||||
export const ROOT_INSIDE = 'inside';
|
||||
export const ROOT_LOADING = 'loading';
|
||||
export const ROOT_NEW_SERVER = 'newServer';
|
||||
export const ROOT_SET_USERNAME = 'setUsername';
|
||||
|
||||
export function appStart({ root, ...args }) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { put, takeLatest } from 'redux-saga/effects';
|
||||
import { put, takeLatest, select } from 'redux-saga/effects';
|
||||
import { Alert } from 'react-native';
|
||||
import { sanitizedRaw } from '@nozbe/watermelondb/RawRecord';
|
||||
import { Q } from '@nozbe/watermelondb';
|
||||
|
@ -7,7 +7,7 @@ import coerce from 'semver/functions/coerce';
|
|||
|
||||
import Navigation from '../lib/Navigation';
|
||||
import { SERVER } from '../actions/actionsTypes';
|
||||
import { selectServerFailure, selectServerRequest, selectServerSuccess, serverFailure } from '../actions/server';
|
||||
import { selectServerFailure, selectServerRequest, selectServerSuccess, serverFailure, serverFinishAdd } from '../actions/server';
|
||||
import { clearSettings } from '../actions/settings';
|
||||
import { setUser } from '../actions/login';
|
||||
import RocketChat from '../lib/rocketchat';
|
||||
|
@ -136,6 +136,12 @@ const handleSelectServer = function* handleSelectServer({ server, version, fetch
|
|||
// we'll set serverVersion as metadata for bugsnag
|
||||
logServerVersion(serverVersion);
|
||||
yield put(selectServerSuccess(server, serverVersion));
|
||||
|
||||
// if the adding state is true, finish add server
|
||||
const adding = yield select(state => state.server.adding);
|
||||
if (adding) {
|
||||
yield put(serverFinishAdd());
|
||||
}
|
||||
} catch (e) {
|
||||
yield put(selectServerFailure());
|
||||
log(e);
|
||||
|
|
|
@ -10,7 +10,6 @@ import Orientation from 'react-native-orientation-locker';
|
|||
|
||||
import UserPreferences from '../../lib/userPreferences';
|
||||
import EventEmitter from '../../utils/events';
|
||||
import { ROOT_NEW_SERVER } from '../../actions/app';
|
||||
import { selectServerRequest, serverRequest } from '../../actions/server';
|
||||
import { inviteLinksClear as inviteLinksClearAction } from '../../actions/inviteLinks';
|
||||
import sharedStyles from '../Styles';
|
||||
|
@ -76,8 +75,7 @@ class NewServerView extends React.Component {
|
|||
selectServer: PropTypes.func.isRequired,
|
||||
adding: PropTypes.bool,
|
||||
previousServer: PropTypes.string,
|
||||
inviteLinksClear: PropTypes.func,
|
||||
root: PropTypes.string
|
||||
inviteLinksClear: PropTypes.func
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
|
@ -114,8 +112,8 @@ class NewServerView extends React.Component {
|
|||
}
|
||||
|
||||
setHeader = () => {
|
||||
const { adding, navigation, root } = this.props;
|
||||
if (adding && root === ROOT_NEW_SERVER) {
|
||||
const { adding, navigation } = this.props;
|
||||
if (adding) {
|
||||
return navigation.setOptions({
|
||||
headerTitle: I18n.t('Workspaces'),
|
||||
headerLeft: () => <HeaderButton.CloseModal navigation={navigation} onPress={this.close} testID='new-server-view-close' />
|
||||
|
@ -311,9 +309,9 @@ class NewServerView extends React.Component {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { connecting, theme, adding, root } = this.props;
|
||||
const { connecting, theme, adding } = this.props;
|
||||
const { text, connectingOpen, serversHistory } = this.state;
|
||||
const marginTopHeader = adding && root === ROOT_NEW_SERVER ? 25 : 70;
|
||||
const marginTopHeader = adding ? 25 : 70;
|
||||
|
||||
return (
|
||||
<FormContainer theme={theme} testID='new-server-view' keyboardShouldPersistTaps='never'>
|
||||
|
@ -392,8 +390,7 @@ class NewServerView extends React.Component {
|
|||
const mapStateToProps = state => ({
|
||||
connecting: state.server.connecting,
|
||||
adding: state.server.adding,
|
||||
previousServer: state.server.previousServer,
|
||||
root: state.app.root
|
||||
previousServer: state.server.previousServer
|
||||
});
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
|
|
Loading…
Reference in New Issue