Merge branch 'develop' into travis/pinned-room-list
This commit is contained in:
commit
103ed71eb5
284 changed files with 17463 additions and 12849 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
Copyright 2017 Travis Ralston
|
||||
Copyright 2018 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.
|
||||
|
@ -20,7 +21,7 @@ import {
|
|||
NotificationBodyEnabledController,
|
||||
NotificationsEnabledController,
|
||||
} from "./controllers/NotificationControllers";
|
||||
|
||||
import LazyLoadingController from "./controllers/LazyLoadingController";
|
||||
|
||||
// These are just a bunch of helper arrays to avoid copy/pasting a bunch of times
|
||||
const LEVELS_ROOM_SETTINGS = ['device', 'room-device', 'room-account', 'account', 'config'];
|
||||
|
@ -76,23 +77,18 @@ export const SETTINGS = {
|
|||
// // level is always appended to the end.
|
||||
// supportedLevelsAreOrdered: false,
|
||||
// },
|
||||
"feature_rich_quoting": {
|
||||
isFeature: true,
|
||||
displayName: _td("Message Replies"),
|
||||
supportedLevels: LEVELS_FEATURE,
|
||||
default: false,
|
||||
},
|
||||
"feature_pinning": {
|
||||
isFeature: true,
|
||||
displayName: _td("Message Pinning"),
|
||||
supportedLevels: LEVELS_FEATURE,
|
||||
default: false,
|
||||
},
|
||||
"feature_tag_panel": {
|
||||
"feature_lazyloading": {
|
||||
isFeature: true,
|
||||
displayName: _td("Tag Panel"),
|
||||
displayName: _td("Increase performance by only loading room members on first view"),
|
||||
supportedLevels: LEVELS_FEATURE,
|
||||
default: false,
|
||||
controller: new LazyLoadingController(),
|
||||
default: true,
|
||||
},
|
||||
"MessageComposerInput.dontSuggestEmoji": {
|
||||
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
||||
|
@ -201,6 +197,10 @@ export const SETTINGS = {
|
|||
displayName: _td('Disable Peer-to-Peer for 1:1 calls'),
|
||||
default: false,
|
||||
},
|
||||
"webrtc_audiooutput": {
|
||||
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
||||
default: null,
|
||||
},
|
||||
"webrtc_audioinput": {
|
||||
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
||||
default: null,
|
||||
|
@ -246,6 +246,13 @@ export const SETTINGS = {
|
|||
},
|
||||
default: true,
|
||||
},
|
||||
"urlPreviewsEnabled_e2ee": {
|
||||
supportedLevels: ['room-device', 'room-account'],
|
||||
displayName: {
|
||||
"room-account": _td("Enable URL previews for this room (only affects you)"),
|
||||
},
|
||||
default: false,
|
||||
},
|
||||
"roomColor": {
|
||||
supportedLevels: LEVELS_ROOM_SETTINGS_WITH_ROOM,
|
||||
displayName: _td("Room Colour"),
|
||||
|
@ -284,4 +291,13 @@ export const SETTINGS = {
|
|||
displayName: _td('Enable widget screenshots on supported widgets'),
|
||||
default: false,
|
||||
},
|
||||
"PinnedEvents.isOpen": {
|
||||
supportedLevels: ['room-device'],
|
||||
default: false,
|
||||
},
|
||||
"RoomSubList.showEmpty": {
|
||||
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
||||
displayName: _td('Show empty room list headings'),
|
||||
default: true,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -248,7 +248,7 @@ export default class SettingsStore {
|
|||
if (actualValue !== undefined && actualValue !== null) return actualValue;
|
||||
return calculatedValue;
|
||||
}
|
||||
|
||||
/* eslint-disable valid-jsdoc */ //https://github.com/eslint/eslint/issues/7307
|
||||
/**
|
||||
* Sets the value for a setting. The room ID is optional if the setting is not being
|
||||
* set for a particular room, otherwise it should be supplied. The value may be null
|
||||
|
@ -260,7 +260,8 @@ export default class SettingsStore {
|
|||
* @param {*} value The new value of the setting, may be null.
|
||||
* @return {Promise} Resolves when the setting has been changed.
|
||||
*/
|
||||
static setValue(settingName, roomId, level, value) {
|
||||
/* eslint-enable valid-jsdoc */
|
||||
static async setValue(settingName, roomId, level, value) {
|
||||
// Verify that the setting is actually a setting
|
||||
if (!SETTINGS[settingName]) {
|
||||
throw new Error("Setting '" + settingName + "' does not appear to be a setting.");
|
||||
|
@ -275,11 +276,12 @@ export default class SettingsStore {
|
|||
throw new Error("User cannot set " + settingName + " at " + level + " in " + roomId);
|
||||
}
|
||||
|
||||
return handler.setValue(settingName, roomId, value).then(() => {
|
||||
const controller = SETTINGS[settingName].controller;
|
||||
if (!controller) return;
|
||||
await handler.setValue(settingName, roomId, value);
|
||||
|
||||
const controller = SETTINGS[settingName].controller;
|
||||
if (controller) {
|
||||
controller.onChange(level, roomId, value);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
29
src/settings/controllers/LazyLoadingController.js
Normal file
29
src/settings/controllers/LazyLoadingController.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
Copyright 2018 New Vector
|
||||
|
||||
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 SettingController from "./SettingController";
|
||||
import MatrixClientPeg from "../../MatrixClientPeg";
|
||||
import PlatformPeg from "../../PlatformPeg";
|
||||
|
||||
export default class LazyLoadingController extends SettingController {
|
||||
async onChange(level, roomId, newValue) {
|
||||
if (!PlatformPeg.get()) return;
|
||||
|
||||
MatrixClientPeg.get().stopClient();
|
||||
await MatrixClientPeg.get().store.deleteAllData();
|
||||
PlatformPeg.get().reload();
|
||||
}
|
||||
}
|
|
@ -74,7 +74,7 @@ export default class RoomAccountSettingsHandler extends SettingsHandler {
|
|||
return cli !== undefined && cli !== null;
|
||||
}
|
||||
|
||||
_getSettings(roomId, eventType = "im.vector.settings") {
|
||||
_getSettings(roomId, eventType = "im.vector.web.settings") {
|
||||
const room = MatrixClientPeg.get().getRoom(roomId);
|
||||
if (!room) return null;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue