2017-11-04 08:19:45 +03:00
|
|
|
/*
|
|
|
|
Copyright 2017 Travis Ralston
|
2018-06-15 17:12:32 +03:00
|
|
|
Copyright 2018 New Vector Ltd
|
2017-11-04 08:19:45 +03:00
|
|
|
|
|
|
|
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 {_td} from '../languageHandler';
|
2017-11-05 08:28:35 +03:00
|
|
|
import {
|
|
|
|
AudioNotificationsEnabledController,
|
|
|
|
NotificationBodyEnabledController,
|
|
|
|
NotificationsEnabledController,
|
|
|
|
} from "./controllers/NotificationControllers";
|
2018-08-09 19:41:41 +03:00
|
|
|
import LazyLoadingController from "./controllers/LazyLoadingController";
|
2019-01-12 03:24:06 +03:00
|
|
|
import CustomStatusController from "./controllers/CustomStatusController";
|
2017-11-04 08:19:45 +03:00
|
|
|
|
|
|
|
// 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'];
|
|
|
|
const LEVELS_ROOM_SETTINGS_WITH_ROOM = ['device', 'room-device', 'room-account', 'account', 'config', 'room'];
|
|
|
|
const LEVELS_ACCOUNT_SETTINGS = ['device', 'account', 'config'];
|
|
|
|
const LEVELS_FEATURE = ['device', 'config'];
|
|
|
|
const LEVELS_DEVICE_ONLY_SETTINGS = ['device'];
|
|
|
|
const LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG = ['device', 'config'];
|
|
|
|
|
|
|
|
export const SETTINGS = {
|
|
|
|
// EXAMPLE SETTING:
|
|
|
|
// "my-setting": {
|
2017-11-05 00:44:01 +03:00
|
|
|
// // Must be set to true for features. Default is 'false'.
|
2017-11-04 08:19:45 +03:00
|
|
|
// isFeature: false,
|
|
|
|
//
|
2017-11-05 00:44:01 +03:00
|
|
|
// // Display names are strongly recommended for clarity.
|
2017-11-04 08:19:45 +03:00
|
|
|
// displayName: _td("Cool Name"),
|
|
|
|
//
|
2017-11-05 00:44:01 +03:00
|
|
|
// // Display name can also be an object for different levels.
|
|
|
|
// //displayName: {
|
|
|
|
// // "device": _td("Name for when the setting is used at 'device'"),
|
|
|
|
// // "room": _td("Name for when the setting is used at 'room'"),
|
|
|
|
// // "default": _td("The name for all other levels"),
|
|
|
|
// //}
|
|
|
|
//
|
|
|
|
// // The supported levels are required. Preferably, use the preset arrays
|
|
|
|
// // at the top of this file to define this rather than a custom array.
|
2017-11-04 08:19:45 +03:00
|
|
|
// supportedLevels: [
|
|
|
|
// // The order does not matter.
|
|
|
|
//
|
|
|
|
// "device", // Affects the current device only
|
|
|
|
// "room-device", // Affects the current room on the current device
|
|
|
|
// "room-account", // Affects the current room for the current account
|
|
|
|
// "account", // Affects the current account
|
|
|
|
// "room", // Affects the current room (controlled by room admins)
|
|
|
|
// "config", // Affects the current application
|
|
|
|
//
|
|
|
|
// // "default" is always supported and does not get listed here.
|
|
|
|
// ],
|
|
|
|
//
|
2017-11-05 00:44:01 +03:00
|
|
|
// // Required. Can be any data type. The value specified here should match
|
|
|
|
// // the data being stored (ie: if a boolean is used, the setting should
|
|
|
|
// // represent a boolean).
|
2017-11-04 08:19:45 +03:00
|
|
|
// default: {
|
|
|
|
// your: "value",
|
|
|
|
// },
|
2017-11-05 07:47:18 +03:00
|
|
|
//
|
|
|
|
// // Optional settings controller. See SettingsController for more information.
|
|
|
|
// controller: new MySettingController(),
|
2017-11-09 03:41:32 +03:00
|
|
|
//
|
|
|
|
// // Optional flag to make supportedLevels be respected as the order to handle
|
|
|
|
// // settings. The first element is treated as "most preferred". The "default"
|
|
|
|
// // level is always appended to the end.
|
|
|
|
// supportedLevelsAreOrdered: false,
|
2017-11-04 08:19:45 +03:00
|
|
|
// },
|
|
|
|
"feature_pinning": {
|
|
|
|
isFeature: true,
|
|
|
|
displayName: _td("Message Pinning"),
|
|
|
|
supportedLevels: LEVELS_FEATURE,
|
2017-11-05 00:44:01 +03:00
|
|
|
default: false,
|
2017-11-04 08:19:45 +03:00
|
|
|
},
|
2019-01-22 20:28:33 +03:00
|
|
|
"feature_tabbed_settings": {
|
|
|
|
isFeature: true,
|
|
|
|
displayName: _td("Tabbed settings"),
|
|
|
|
supportedLevels: LEVELS_FEATURE,
|
|
|
|
default: false,
|
|
|
|
},
|
2018-12-19 01:11:08 +03:00
|
|
|
"feature_custom_status": {
|
|
|
|
isFeature: true,
|
|
|
|
displayName: _td("Custom user status messages"),
|
|
|
|
supportedLevels: LEVELS_FEATURE,
|
|
|
|
default: false,
|
2019-01-12 03:24:06 +03:00
|
|
|
controller: new CustomStatusController(),
|
2018-12-19 01:11:08 +03:00
|
|
|
},
|
2018-07-16 16:07:53 +03:00
|
|
|
"feature_lazyloading": {
|
|
|
|
isFeature: true,
|
2018-08-13 12:24:32 +03:00
|
|
|
displayName: _td("Increase performance by only loading room members on first view"),
|
2018-07-16 16:07:53 +03:00
|
|
|
supportedLevels: LEVELS_FEATURE,
|
2018-08-09 19:41:41 +03:00
|
|
|
controller: new LazyLoadingController(),
|
2018-10-11 16:55:21 +03:00
|
|
|
default: true,
|
2018-07-16 16:07:53 +03:00
|
|
|
},
|
2018-09-13 19:11:46 +03:00
|
|
|
"feature_keybackup": {
|
|
|
|
isFeature: true,
|
|
|
|
displayName: _td("Backup of encryption keys to server"),
|
|
|
|
supportedLevels: LEVELS_FEATURE,
|
|
|
|
default: false,
|
|
|
|
},
|
2018-12-24 18:09:10 +03:00
|
|
|
"feature_state_counters": {
|
|
|
|
isFeature: true,
|
|
|
|
displayName: _td("Render simple counters in room header"),
|
|
|
|
supportedLevels: LEVELS_FEATURE,
|
|
|
|
default: false,
|
|
|
|
},
|
2017-11-04 08:19:45 +03:00
|
|
|
"MessageComposerInput.dontSuggestEmoji": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td('Disable Emoji suggestions while typing'),
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"useCompactLayout": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td('Use compact timeline layout'),
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"hideRedactions": {
|
|
|
|
supportedLevels: LEVELS_ROOM_SETTINGS_WITH_ROOM,
|
|
|
|
displayName: _td('Hide removed messages'),
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"hideJoinLeaves": {
|
|
|
|
supportedLevels: LEVELS_ROOM_SETTINGS_WITH_ROOM,
|
|
|
|
displayName: _td('Hide join/leave messages (invites/kicks/bans unaffected)'),
|
|
|
|
default: false,
|
|
|
|
},
|
2017-11-13 22:58:10 +03:00
|
|
|
"hideAvatarChanges": {
|
2017-11-04 08:19:45 +03:00
|
|
|
supportedLevels: LEVELS_ROOM_SETTINGS_WITH_ROOM,
|
2017-11-13 22:58:10 +03:00
|
|
|
displayName: _td('Hide avatar changes'),
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"hideDisplaynameChanges": {
|
|
|
|
supportedLevels: LEVELS_ROOM_SETTINGS_WITH_ROOM,
|
|
|
|
displayName: _td('Hide display name changes'),
|
2017-11-04 08:19:45 +03:00
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"hideReadReceipts": {
|
|
|
|
supportedLevels: LEVELS_ROOM_SETTINGS,
|
|
|
|
displayName: _td('Hide read receipts'),
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"showTwelveHourTimestamps": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td('Show timestamps in 12 hour format (e.g. 2:30pm)'),
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"alwaysShowTimestamps": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td('Always show message timestamps'),
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"autoplayGifsAndVideos": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td('Autoplay GIFs and videos'),
|
|
|
|
default: false,
|
|
|
|
},
|
2018-04-23 05:30:37 +03:00
|
|
|
"alwaysShowEncryptionIcons": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td('Always show encryption icons'),
|
|
|
|
default: true,
|
|
|
|
},
|
2018-12-07 00:39:59 +03:00
|
|
|
"showRoomRecoveryReminder": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td('Show a reminder to enable Secure Message Recovery in encrypted rooms'),
|
|
|
|
default: true,
|
|
|
|
},
|
2017-11-04 08:19:45 +03:00
|
|
|
"enableSyntaxHighlightLanguageDetection": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td('Enable automatic language detection for syntax highlighting'),
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"Pill.shouldHidePillAvatar": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td('Hide avatars in user and room mentions'),
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"TextualBody.disableBigEmoji": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td('Disable big emoji in chat'),
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"MessageComposerInput.isRichTextEnabled": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"MessageComposer.showFormatting": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"dontSendTypingNotifications": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td("Don't send typing notifications"),
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"MessageComposerInput.autoReplaceEmoji": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td('Automatically replace plain text Emoji'),
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"VideoView.flipVideoHorizontally": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td('Mirror local video feed'),
|
|
|
|
default: false,
|
|
|
|
},
|
2018-02-28 21:16:01 +03:00
|
|
|
"TagPanel.disableTagPanel": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td('Disable Community Filter Panel'),
|
|
|
|
default: false,
|
|
|
|
},
|
2017-11-04 08:19:45 +03:00
|
|
|
"theme": {
|
2018-12-16 22:49:41 +03:00
|
|
|
supportedLevels: ['config'],
|
|
|
|
default: "dharma",
|
2017-11-04 08:19:45 +03:00
|
|
|
},
|
|
|
|
"webRtcForceTURN": {
|
|
|
|
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
|
|
|
|
displayName: _td('Disable Peer-to-Peer for 1:1 calls'),
|
|
|
|
default: false,
|
|
|
|
},
|
2018-05-26 19:22:23 +03:00
|
|
|
"webrtc_audiooutput": {
|
|
|
|
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
|
|
|
default: null,
|
|
|
|
},
|
2017-11-04 08:19:45 +03:00
|
|
|
"webrtc_audioinput": {
|
|
|
|
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
2017-11-05 00:44:01 +03:00
|
|
|
default: null,
|
2017-11-04 08:19:45 +03:00
|
|
|
},
|
|
|
|
"webrtc_videoinput": {
|
|
|
|
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
2017-11-05 00:44:01 +03:00
|
|
|
default: null,
|
2017-11-04 08:19:45 +03:00
|
|
|
},
|
|
|
|
"language": {
|
|
|
|
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
|
2017-11-06 01:37:06 +03:00
|
|
|
default: "en",
|
2017-11-04 08:19:45 +03:00
|
|
|
},
|
2018-05-15 15:15:40 +03:00
|
|
|
"analyticsOptIn": {
|
2017-11-04 08:19:45 +03:00
|
|
|
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
|
2018-05-15 15:15:40 +03:00
|
|
|
displayName: _td('Send analytics data'),
|
2017-11-04 08:19:45 +03:00
|
|
|
default: false,
|
|
|
|
},
|
2018-05-15 15:15:40 +03:00
|
|
|
"showCookieBar": {
|
|
|
|
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
|
|
|
|
default: true,
|
|
|
|
},
|
2017-11-04 08:19:45 +03:00
|
|
|
"autocompleteDelay": {
|
|
|
|
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS_WITH_CONFIG,
|
|
|
|
default: 200,
|
|
|
|
},
|
|
|
|
"blacklistUnverifiedDevices": {
|
2017-11-09 03:41:32 +03:00
|
|
|
// We specifically want to have room-device > device so that users may set a device default
|
|
|
|
// with a per-room override.
|
|
|
|
supportedLevels: ['room-device', 'device'],
|
|
|
|
supportedLevelsAreOrdered: true,
|
2017-11-05 05:15:55 +03:00
|
|
|
displayName: {
|
|
|
|
"default": _td('Never send encrypted messages to unverified devices from this device'),
|
|
|
|
"room-device": _td('Never send encrypted messages to unverified devices in this room from this device'),
|
|
|
|
},
|
2017-11-04 08:19:45 +03:00
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"urlPreviewsEnabled": {
|
|
|
|
supportedLevels: LEVELS_ROOM_SETTINGS_WITH_ROOM,
|
|
|
|
displayName: {
|
|
|
|
"default": _td('Enable inline URL previews by default'),
|
|
|
|
"room-account": _td("Enable URL previews for this room (only affects you)"),
|
|
|
|
"room": _td("Enable URL previews by default for participants in this room"),
|
|
|
|
},
|
|
|
|
default: true,
|
|
|
|
},
|
2018-06-22 20:44:54 +03:00
|
|
|
"urlPreviewsEnabled_e2ee": {
|
|
|
|
supportedLevels: ['room-device', 'room-account'],
|
|
|
|
displayName: {
|
|
|
|
"room-account": _td("Enable URL previews for this room (only affects you)"),
|
|
|
|
},
|
|
|
|
default: false,
|
|
|
|
},
|
2017-11-05 01:10:25 +03:00
|
|
|
"roomColor": {
|
|
|
|
supportedLevels: LEVELS_ROOM_SETTINGS_WITH_ROOM,
|
|
|
|
displayName: _td("Room Colour"),
|
|
|
|
default: {
|
|
|
|
primary_color: null, // Hex string, eg: #000000
|
|
|
|
secondary_color: null, // Hex string, eg: #000000
|
|
|
|
},
|
|
|
|
},
|
2017-11-05 07:47:18 +03:00
|
|
|
"notificationsEnabled": {
|
|
|
|
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
|
|
|
default: false,
|
2017-11-05 08:28:35 +03:00
|
|
|
controller: new NotificationsEnabledController(),
|
2017-11-05 07:47:18 +03:00
|
|
|
},
|
|
|
|
"notificationBodyEnabled": {
|
|
|
|
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
2017-11-05 08:28:35 +03:00
|
|
|
default: true,
|
|
|
|
controller: new NotificationBodyEnabledController(),
|
2017-11-05 07:47:18 +03:00
|
|
|
},
|
|
|
|
"audioNotificationsEnabled": {
|
|
|
|
supportedLevels: LEVELS_DEVICE_ONLY_SETTINGS,
|
2017-11-05 08:28:35 +03:00
|
|
|
default: true,
|
|
|
|
controller: new AudioNotificationsEnabledController(),
|
2017-11-05 07:47:18 +03:00
|
|
|
},
|
2018-05-27 05:27:48 +03:00
|
|
|
"pinMentionedRooms": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td("Pin rooms I'm mentioned in to the top of the room list"),
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
"pinUnreadRooms": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td("Pin unread rooms to the top of the room list"),
|
|
|
|
default: false,
|
|
|
|
},
|
2018-05-12 23:29:37 +03:00
|
|
|
"enableWidgetScreenshots": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td('Enable widget screenshots on supported widgets'),
|
|
|
|
default: false,
|
|
|
|
},
|
2018-05-27 04:32:23 +03:00
|
|
|
"PinnedEvents.isOpen": {
|
|
|
|
supportedLevels: ['room-device'],
|
|
|
|
default: false,
|
|
|
|
},
|
2019-01-16 18:07:30 +03:00
|
|
|
"promptBeforeInviteUnknownUsers": {
|
2019-01-11 07:43:21 +03:00
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
2019-01-16 18:07:30 +03:00
|
|
|
displayName: _td('Prompt before sending invites to potentially invalid matrix IDs'),
|
|
|
|
default: true,
|
2019-01-11 07:43:21 +03:00
|
|
|
},
|
2018-10-24 20:15:25 +03:00
|
|
|
"showDeveloperTools": {
|
|
|
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
|
|
|
displayName: _td('Show developer tools'),
|
|
|
|
default: false,
|
|
|
|
},
|
2017-11-06 01:37:06 +03:00
|
|
|
};
|