diff --git a/web/components/version-handler.react.js b/web/components/version-handler.react.js --- a/web/components/version-handler.react.js +++ b/web/components/version-handler.react.js @@ -4,28 +4,18 @@ import { useModalContext } from 'lib/components/modal-provider.react.js'; import { allConnectionInfosSelector } from 'lib/selectors/keyserver-selectors.js'; -import { isDesktopPlatform } from 'lib/types/device-types.js'; -import { getConfig } from 'lib/utils/config.js'; import css from './version-handler.css'; import Modal from '../modals/modal.react.js'; import { useSelector } from '../redux/redux-utils.js'; +import { getVersionUnsupportedError } from '../utils/version-utils.js'; function VersionUnsupportedModal(): React.Node { const { popModal } = useModalContext(); - - const actionRequestMessage = isDesktopPlatform( - getConfig().platformDetails.platform, - ) - ? 'Please reload the app' - : 'Please refresh the page'; - + const message = getVersionUnsupportedError(); return ( -
- Your app version is pretty old, and the server doesn’t know how to speak - to it anymore. {actionRequestMessage}. -
+
{message}
); } diff --git a/web/utils/version-utils.js b/web/utils/version-utils.js new file mode 100644 --- /dev/null +++ b/web/utils/version-utils.js @@ -0,0 +1,18 @@ +// @flow + +import { isDesktopPlatform } from 'lib/types/device-types.js'; +import { getConfig } from 'lib/utils/config.js'; + +function getVersionUnsupportedError(): string { + const actionRequestMessage = isDesktopPlatform( + getConfig().platformDetails.platform, + ) + ? 'Please reload the app' + : 'Please refresh the page'; + return ( + 'Your app version is pretty old, and the server doesn’t know how ' + + `to speak to it anymore. ${actionRequestMessage}.` + ); +} + +export { getVersionUnsupportedError };