,
+ ));
+ tabs.push(new Tab(
+ _td("Visit old settings"),
+ "mx_UserSettingsDialog_helpIcon",
+ ,
+ ));
+
+ return tabs;
}
render() {
diff --git a/src/components/views/settings/tabs/LabsSettingsTab.js b/src/components/views/settings/tabs/LabsSettingsTab.js
new file mode 100644
index 0000000000..a815ddfdd4
--- /dev/null
+++ b/src/components/views/settings/tabs/LabsSettingsTab.js
@@ -0,0 +1,96 @@
+/*
+Copyright 2019 New Vector Ltd
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+import React from 'react';
+import {_t} from "../../../../languageHandler";
+import PropTypes from "prop-types";
+import SettingsStore from "../../../../settings/SettingsStore";
+import ToggleSwitch from "../../elements/ToggleSwitch";
+import MatrixClientPeg from "../../../../MatrixClientPeg";
+const Modal = require("../../../../Modal");
+const sdk = require("../../../../index");
+
+export class LabsSettingToggle extends React.Component {
+ static propTypes = {
+ featureId: PropTypes.string.isRequired,
+ };
+
+ async _onLazyLoadChanging(enabling) {
+ // don't prevent turning LL off when not supported
+ if (enabling) {
+ const supported = await MatrixClientPeg.get().doesServerSupportLazyLoading();
+ if (!supported) {
+ await new Promise((resolve) => {
+ const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
+ Modal.createDialog(QuestionDialog, {
+ title: _t("Lazy loading members not supported"),
+ description:
+
+ { _t("Lazy loading is not supported by your " +
+ "current homeserver.") }
+
,
+ button: _t("OK"),
+ onFinished: resolve,
+ });
+ });
+ return false;
+ }
+ }
+ return true;
+ }
+
+ _onChange = async (checked) => {
+ if (this.props.featureId === "feature_lazyloading") {
+ const confirmed = await this._onLazyLoadChanging(checked);
+ if (!confirmed) {
+ return;
+ }
+ }
+
+ await SettingsStore.setFeatureEnabled(this.props.featureId, checked);
+ this.forceUpdate();
+ };
+
+ render() {
+ // This is a minimal version of a SettingsFlag
+ const label = _t(SettingsStore.getDisplayName(this.props.featureId));
+ const value = SettingsStore.isFeatureEnabled(this.props.featureId);
+ return (
+
+ );
+ }
+}
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json
index b9b4684e08..e70f60c48b 100644
--- a/src/i18n/strings/en_EN.json
+++ b/src/i18n/strings/en_EN.json
@@ -439,6 +439,9 @@
"Deactivating your account is a permanent action - be careful!": "Deactivating your account is a permanent action - be careful!",
"Close Account": "Close Account",
"General": "General",
+ "Lazy loading members not supported": "Lazy loading members not supported",
+ "Lazy loading is not supported by your current homeserver.": "Lazy loading is not supported by your current homeserver.",
+ "Labs": "Labs",
"Cannot add any more widgets": "Cannot add any more widgets",
"The maximum permitted number of widgets have already been added to this room.": "The maximum permitted number of widgets have already been added to this room.",
"Add a widget": "Add a widget",
@@ -1281,11 +1284,8 @@
"Riot collects anonymous analytics to allow us to improve the application.": "Riot collects anonymous analytics to allow us to improve the application.",
"Privacy is important to us, so we don't collect any personal or identifiable data for our analytics.": "Privacy is important to us, so we don't collect any personal or identifiable data for our analytics.",
"Learn more about how we use analytics.": "Learn more about how we use analytics.",
- "Labs": "Labs",
"These are experimental features that may break in unexpected ways": "These are experimental features that may break in unexpected ways",
"Use with caution": "Use with caution",
- "Lazy loading members not supported": "Lazy loading members not supported",
- "Lazy loading is not supported by your current homeserver.": "Lazy loading is not supported by your current homeserver.",
"Deactivate my account": "Deactivate my account",
"Legal": "Legal",
"Clear Cache": "Clear Cache",