Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3383894
D11643.id39129.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D11643.id39129.diff
View Options
diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -47,6 +47,7 @@
import { EditModalProvider } from './chat/edit-message-provider.js';
import { MemberListSidebarProvider } from './chat/member-list-sidebar/member-list-sidebar-provider.react.js';
import NavigationArrows from './components/navigation-arrows.react.js';
+import MinVersionHandler from './components/version-handler.react.js';
import { olmAPI } from './crypto/olm-api.js';
import electron from './electron.js';
import InputStateContainer from './input/input-state-container.react.js';
@@ -226,6 +227,7 @@
<PushNotificationsHandler />
<InviteLinkHandler />
<InviteLinksRefresher />
+ <MinVersionHandler />
{content}
</ChatMentionContextProvider>
</MessageSearchStateProvider>
diff --git a/web/components/version-handler.css b/web/components/version-handler.css
new file mode 100644
--- /dev/null
+++ b/web/components/version-handler.css
@@ -0,0 +1,21 @@
+.modalContent {
+ color: var(--text-background-primary-default);
+ font-size: var(--s-font-14);
+ margin-top: 8px;
+ display: flex;
+}
+
+.wrapper {
+ display: flex;
+ flex-shrink: 1;
+ justify-content: center;
+}
+
+.ancestryContainer {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ height: 40px;
+ background-color: var(--frame-background-tertiary-default);
+ margin-top: 20px;
+}
diff --git a/web/components/version-handler.react.js b/web/components/version-handler.react.js
new file mode 100644
--- /dev/null
+++ b/web/components/version-handler.react.js
@@ -0,0 +1,78 @@
+// @flow
+
+import * as React from 'react';
+
+import { useModalContext } from 'lib/components/modal-provider.react.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';
+
+function VersionUnsupportedModal(): React.Node {
+ const { popModal } = useModalContext();
+
+ const actionRequestMessage = isDesktopPlatform(
+ getConfig().platformDetails.platform,
+ )
+ ? 'Please reload the app'
+ : 'Please refresh the page';
+
+ return (
+ <Modal name="App version unsupported" onClose={popModal} size="large">
+ <div className={css.modalContent}>
+ Your app version is pretty old, and the server doesn’t know how to speak
+ to it anymore. {actionRequestMessage}.
+ </div>
+ </Modal>
+ );
+}
+
+type Props = {
+ +keyserverID: string,
+};
+
+function SingleKeyserverMinVersionHandler(props: Props): null {
+ const { keyserverID } = props;
+
+ const connectionIssue = useSelector(
+ state =>
+ state.keyserverStore.keyserverInfos[keyserverID].connection
+ .connectionIssue,
+ );
+
+ const { pushModal } = useModalContext();
+
+ const prevConnectionIssueRef = React.useRef<?string>(null);
+
+ React.useEffect(() => {
+ if (
+ connectionIssue === 'client_version_unsupported' &&
+ connectionIssue !== prevConnectionIssueRef.current
+ ) {
+ prevConnectionIssueRef.current = connectionIssue;
+ pushModal(<VersionUnsupportedModal />);
+ }
+ }, [connectionIssue, keyserverID, pushModal]);
+
+ return null;
+}
+const MemoizedSingleKeyserverMinVersionHandler: React.ComponentType<Props> =
+ React.memo<Props>(SingleKeyserverMinVersionHandler);
+
+function MinVersionHandler(): React.Node {
+ const keyserverIDs = useSelector(state =>
+ Object.keys(state.keyserverStore.keyserverInfos),
+ );
+
+ return React.useMemo(
+ () =>
+ keyserverIDs.map(id => (
+ <MemoizedSingleKeyserverMinVersionHandler keyserverID={id} key={id} />
+ )),
+ [keyserverIDs],
+ );
+}
+
+export default MinVersionHandler;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 29, 6:12 PM (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2597742
Default Alt Text
D11643.id39129.diff (3 KB)
Attached To
Mode
D11643: [web] Show a popup when client_version_unsupported
Attached
Detach File
Event Timeline
Log In to Comment