mirror of
https://github.com/element-hq/element-web
synced 2024-11-25 18:55:58 +03:00
port over low_bandwidth mode to develop
This commit is contained in:
parent
a6914274b0
commit
ce24165e19
8 changed files with 30 additions and 6 deletions
|
@ -31,6 +31,7 @@ import Modal from './Modal';
|
||||||
import sdk from './index';
|
import sdk from './index';
|
||||||
import ActiveWidgetStore from './stores/ActiveWidgetStore';
|
import ActiveWidgetStore from './stores/ActiveWidgetStore';
|
||||||
import PlatformPeg from "./PlatformPeg";
|
import PlatformPeg from "./PlatformPeg";
|
||||||
|
import SettingsStore from "./settings/SettingsStore";
|
||||||
import {sendLoginRequest} from "./Login";
|
import {sendLoginRequest} from "./Login";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -440,7 +441,9 @@ async function startMatrixClient() {
|
||||||
|
|
||||||
Notifier.start();
|
Notifier.start();
|
||||||
UserActivity.start();
|
UserActivity.start();
|
||||||
Presence.start();
|
if (!SettingsStore.getValue("lowBandwidth")) {
|
||||||
|
Presence.start();
|
||||||
|
}
|
||||||
DMRoomMap.makeShared().start();
|
DMRoomMap.makeShared().start();
|
||||||
ActiveWidgetStore.start();
|
ActiveWidgetStore.start();
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ class MatrixClientPeg {
|
||||||
// try to initialise e2e on the new client
|
// try to initialise e2e on the new client
|
||||||
try {
|
try {
|
||||||
// check that we have a version of the js-sdk which includes initCrypto
|
// check that we have a version of the js-sdk which includes initCrypto
|
||||||
if (this.matrixClient.initCrypto) {
|
if (!SettingsStore.getValue("lowBandwidth") && this.matrixClient.initCrypto) {
|
||||||
await this.matrixClient.initCrypto();
|
await this.matrixClient.initCrypto();
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -584,6 +584,8 @@ var TimelinePanel = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
sendReadReceipt: function() {
|
sendReadReceipt: function() {
|
||||||
|
if (SettingsStore.getValue("lowBandwidth")) return;
|
||||||
|
|
||||||
if (!this.refs.messagePanel) return;
|
if (!this.refs.messagePanel) return;
|
||||||
if (!this.props.manageReadReceipts) return;
|
if (!this.props.manageReadReceipts) return;
|
||||||
// This happens on user_activity_end which is delayed, and it's
|
// This happens on user_activity_end which is delayed, and it's
|
||||||
|
|
|
@ -84,6 +84,13 @@ const SIMPLE_SETTINGS = [
|
||||||
{ id: "enableWidgetScreenshots" },
|
{ id: "enableWidgetScreenshots" },
|
||||||
{ id: "pinMentionedRooms" },
|
{ id: "pinMentionedRooms" },
|
||||||
{ id: "pinUnreadRooms" },
|
{ id: "pinUnreadRooms" },
|
||||||
|
{
|
||||||
|
id: "lowBandwidth",
|
||||||
|
fn: () => {
|
||||||
|
PlatformPeg.get().reload();
|
||||||
|
},
|
||||||
|
level: SettingLevel.DEVICE,
|
||||||
|
},
|
||||||
{ id: "showDeveloperTools" },
|
{ id: "showDeveloperTools" },
|
||||||
{ id: "promptBeforeInviteUnknownUsers" },
|
{ id: "promptBeforeInviteUnknownUsers" },
|
||||||
];
|
];
|
||||||
|
@ -644,7 +651,7 @@ module.exports = React.createClass({
|
||||||
<div className="mx_UserSettings_toggle" key={setting.id}>
|
<div className="mx_UserSettings_toggle" key={setting.id}>
|
||||||
<SettingsFlag name={setting.id}
|
<SettingsFlag name={setting.id}
|
||||||
label={setting.label}
|
label={setting.label}
|
||||||
level={SettingLevel.ACCOUNT}
|
level={setting.level ? setting.level : SettingLevel.ACCOUNT}
|
||||||
onChange={setting.fn} />
|
onChange={setting.fn} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -20,6 +20,7 @@ import PropTypes from 'prop-types';
|
||||||
import { MatrixClient } from 'matrix-js-sdk';
|
import { MatrixClient } from 'matrix-js-sdk';
|
||||||
import AvatarLogic from '../../../Avatar';
|
import AvatarLogic from '../../../Avatar';
|
||||||
import sdk from '../../../index';
|
import sdk from '../../../index';
|
||||||
|
import SettingsStore from "../../../settings/SettingsStore";
|
||||||
import AccessibleButton from '../elements/AccessibleButton';
|
import AccessibleButton from '../elements/AccessibleButton';
|
||||||
|
|
||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
|
@ -104,9 +105,13 @@ module.exports = React.createClass({
|
||||||
// work out the full set of urls to try to load. This is formed like so:
|
// work out the full set of urls to try to load. This is formed like so:
|
||||||
// imageUrls: [ props.url, props.urls, default image ]
|
// imageUrls: [ props.url, props.urls, default image ]
|
||||||
|
|
||||||
const urls = props.urls || [];
|
let urls = [];
|
||||||
if (props.url) {
|
if (!SettingsStore.getValue("lowBandwidth")) {
|
||||||
urls.unshift(props.url); // put in urls[0]
|
urls = props.urls || [];
|
||||||
|
|
||||||
|
if (props.url) {
|
||||||
|
urls.unshift(props.url); // put in urls[0]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let defaultImageUrl = null;
|
let defaultImageUrl = null;
|
||||||
|
|
|
@ -487,6 +487,7 @@ export default class MessageComposerInput extends React.Component {
|
||||||
|
|
||||||
sendTyping(isTyping) {
|
sendTyping(isTyping) {
|
||||||
if (!SettingsStore.getValue('sendTypingNotifications')) return;
|
if (!SettingsStore.getValue('sendTypingNotifications')) return;
|
||||||
|
if (SettingsStore.getValue('lowBandwidth')) return;
|
||||||
MatrixClientPeg.get().sendTyping(
|
MatrixClientPeg.get().sendTyping(
|
||||||
this.props.room.roomId,
|
this.props.room.roomId,
|
||||||
this.isTyping, TYPING_SERVER_TIMEOUT,
|
this.isTyping, TYPING_SERVER_TIMEOUT,
|
||||||
|
|
|
@ -300,6 +300,7 @@
|
||||||
"Enable widget screenshots on supported widgets": "Enable widget screenshots on supported widgets",
|
"Enable widget screenshots on supported widgets": "Enable widget screenshots on supported widgets",
|
||||||
"Prompt before sending invites to potentially invalid matrix IDs": "Prompt before sending invites to potentially invalid matrix IDs",
|
"Prompt before sending invites to potentially invalid matrix IDs": "Prompt before sending invites to potentially invalid matrix IDs",
|
||||||
"Show developer tools": "Show developer tools",
|
"Show developer tools": "Show developer tools",
|
||||||
|
"Low Bandwidth Mode": "Low Bandwidth Mode",
|
||||||
"Collecting app version information": "Collecting app version information",
|
"Collecting app version information": "Collecting app version information",
|
||||||
"Collecting logs": "Collecting logs",
|
"Collecting logs": "Collecting logs",
|
||||||
"Uploading report": "Uploading report",
|
"Uploading report": "Uploading report",
|
||||||
|
|
|
@ -362,4 +362,9 @@ export const SETTINGS = {
|
||||||
displayName: _td('Show developer tools'),
|
displayName: _td('Show developer tools'),
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
"lowBandwidth": {
|
||||||
|
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
|
||||||
|
displayName: _td('Low Bandwidth Mode'),
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue