diff --git a/app/constants/view.js b/app/constants/view.js
index b90031ef4..6851ccf95 100644
--- a/app/constants/view.js
+++ b/app/constants/view.js
@@ -35,7 +35,10 @@ const ViewTypes = keyMirror({
SET_CHANNEL_LOADER: null,
- SET_LAST_CHANNEL_FOR_TEAM: null
+ SET_LAST_CHANNEL_FOR_TEAM: null,
+
+ GITLAB: null,
+ SAML: null
});
export default ViewTypes;
diff --git a/app/mattermost.js b/app/mattermost.js
index 44d7785aa..854071e22 100644
--- a/app/mattermost.js
+++ b/app/mattermost.js
@@ -15,7 +15,7 @@ import {
import DeviceInfo from 'react-native-device-info';
import semver from 'semver';
-import {setAppState, setDeviceToken} from 'mattermost-redux/actions/general';
+import {setAppState, setDeviceToken, setServerVersion} from 'mattermost-redux/actions/general';
import {logout} from 'mattermost-redux/actions/users';
import {Client4} from 'mattermost-redux/client';
import {General} from 'mattermost-redux/constants';
@@ -64,14 +64,17 @@ export default class Mattermost {
}]
);
} else {
+ setServerVersion('')(dispatch, getState);
loadConfigAndLicense(serverVersion)(dispatch, getState);
}
}
};
handleReset = () => {
+ const {dispatch, getState} = store;
Client4.serverVersion = '';
PushNotification.cancelAllLocalNotifications();
+ setServerVersion('')(dispatch, getState);
this.startApp('fade');
};
diff --git a/app/reducers/navigation/index.js b/app/reducers/navigation/index.js
index 47847dfc6..b6dc942f7 100644
--- a/app/reducers/navigation/index.js
+++ b/app/reducers/navigation/index.js
@@ -8,7 +8,9 @@ import EventEmitter from 'mattermost-redux/utils/event_emitter';
export default function(state = '', action) {
switch (action.type) {
case UserTypes.LOGOUT_SUCCESS:
- EventEmitter.emit(NavigationTypes.NAVIGATION_RESET);
+ setTimeout(() => {
+ EventEmitter.emit(NavigationTypes.NAVIGATION_RESET);
+ });
break;
}
diff --git a/app/screens/index.js b/app/screens/index.js
index 028f079cc..f5980dbad 100644
--- a/app/screens/index.js
+++ b/app/screens/index.js
@@ -23,7 +23,7 @@ import MoreDirectMessages from 'app/screens/more_dms';
import Notification from 'app/screens/notification';
import OptionsModal from 'app/screens/options_modal';
import Root from 'app/screens/root';
-import Saml from 'app/screens/saml';
+import SSO from 'app/screens/sso';
import SelectServer from 'app/screens/select_server';
import SelectTeam from 'app/screens/select_team';
import Settings from 'app/screens/settings';
@@ -63,10 +63,10 @@ export function registerScreens(store, Provider) {
Navigation.registerComponent('OptionsModal', () => wrapWithContextProvider(OptionsModal), store, Provider);
Navigation.registerComponent('Notification', () => Notification, store, Provider);
Navigation.registerComponent('Root', () => Root, store, Provider);
- Navigation.registerComponent('SAML', () => wrapWithContextProvider(Saml), store, Provider);
Navigation.registerComponent('SelectServer', () => wrapWithContextProvider(SelectServer), store, Provider);
Navigation.registerComponent('SelectTeam', () => wrapWithContextProvider(SelectTeam), store, Provider);
Navigation.registerComponent('Settings', () => wrapWithContextProvider(Settings), store, Provider);
+ Navigation.registerComponent('SSO', () => wrapWithContextProvider(SSO), store, Provider);
Navigation.registerComponent('Thread', () => wrapWithContextProvider(Thread), store, Provider);
Navigation.registerComponent('UserProfile', () => wrapWithContextProvider(UserProfile), store, Provider);
}
diff --git a/app/screens/login_options/index.js b/app/screens/login_options/index.js
index f18df6ffd..79ea4d866 100644
--- a/app/screens/login_options/index.js
+++ b/app/screens/login_options/index.js
@@ -8,11 +8,12 @@ import {getTheme} from 'app/selectors/preferences';
import LoginOptions from './login_options';
function mapStateToProps(state, ownProps) {
- const {config, license} = state.entities.general;
+ const {config, license, serverVersion} = state.entities.general;
return {
...ownProps,
config,
license,
+ serverVersion,
theme: getTheme(state)
};
}
diff --git a/app/screens/login_options/login_options.js b/app/screens/login_options/login_options.js
index 768a246cd..6a6f147f9 100644
--- a/app/screens/login_options/login_options.js
+++ b/app/screens/login_options/login_options.js
@@ -10,12 +10,15 @@ import {
Text,
View
} from 'react-native';
-
import Button from 'react-native-button';
+import semver from 'semver';
+
+import {ViewTypes} from 'app/constants';
import FormattedText from 'app/components/formatted_text';
import {GlobalStyles} from 'app/styles';
import {preventDoubleTap} from 'app/utils/tap';
+import gitlab from 'assets/images/gitlab.png';
import logo from 'assets/images/logo.png';
class LoginOptions extends PureComponent {
@@ -24,6 +27,7 @@ class LoginOptions extends PureComponent {
navigator: PropTypes.object,
config: PropTypes.object.isRequired,
license: PropTypes.object.isRequired,
+ serverVersion: PropTypes.string.isRequired,
theme: PropTypes.object
};
@@ -43,11 +47,11 @@ class LoginOptions extends PureComponent {
});
};
- goToSaml = () => {
+ goToSSO = (ssoType) => {
const {intl, navigator, theme} = this.props;
navigator.push({
- screen: 'SAML',
- title: intl.formatMessage({id: 'mobile.routes.saml', defaultMessage: 'Single SignOn'}),
+ screen: 'SSO',
+ title: intl.formatMessage({id: 'mobile.routes.sso', defaultMessage: 'Single Sign-On'}),
animated: true,
backButtonTitle: '',
navigatorStyle: {
@@ -55,6 +59,9 @@ class LoginOptions extends PureComponent {
navBarBackgroundColor: theme.sidebarHeaderBg,
navBarButtonColor: theme.sidebarHeaderTextColor,
screenBackgroundColor: theme.centerChannelBg
+ },
+ passProps: {
+ ssoType
}
});
};
@@ -80,13 +87,39 @@ class LoginOptions extends PureComponent {
return null;
};
+ renderGitlabOption = () => {
+ const {config, serverVersion} = this.props;
+ const version = serverVersion.match(/^[0-9]*.[0-9]*.[0-9]*(-[a-zA-Z0-9.-]*)?/g)[0];
+ if (config.EnableSignUpWithGitLab === 'true' && semver.valid(version) && semver.gte(version, 'v3.10.0')) {
+ return (
+
+ );
+ }
+
+ return null;
+ };
+
renderSamlOption = () => {
const {config, license} = this.props;
if (config.EnableSaml === 'true' && license.IsLicensed === 'true' && license.SAML === 'true') {
return (