|
|
|
@ -32,6 +32,7 @@ export interface SettingsViewProps {
|
|
|
|
|
interface State {
|
|
|
|
|
hasPassword: boolean | null;
|
|
|
|
|
pwdLockError: string | null;
|
|
|
|
|
mediaSetting: boolean | null;
|
|
|
|
|
shouldLockSettings: boolean | null;
|
|
|
|
|
linkedPubKeys: Array<any>;
|
|
|
|
|
}
|
|
|
|
@ -41,6 +42,7 @@ interface LocalSettingType {
|
|
|
|
|
description: string | undefined;
|
|
|
|
|
comparisonValue: string | undefined;
|
|
|
|
|
id: any;
|
|
|
|
|
value?: any;
|
|
|
|
|
content: any | undefined;
|
|
|
|
|
hidden: any;
|
|
|
|
|
title: string;
|
|
|
|
@ -59,6 +61,7 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
|
|
|
|
|
this.state = {
|
|
|
|
|
hasPassword: null,
|
|
|
|
|
pwdLockError: null,
|
|
|
|
|
mediaSetting: null,
|
|
|
|
|
shouldLockSettings: true,
|
|
|
|
|
linkedPubKeys: new Array(),
|
|
|
|
|
};
|
|
|
|
@ -74,6 +77,11 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
|
|
|
|
|
window.addEventListener('keyup', this.onKeyUp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async componentWillMount() {
|
|
|
|
|
const mediaSetting = await window.getMediaPermissions();
|
|
|
|
|
this.setState({mediaSetting});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public componentDidMount() {
|
|
|
|
|
setTimeout(() => $('#password-lock-input').focus(), 100);
|
|
|
|
|
|
|
|
|
@ -90,7 +98,7 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* tslint:disable-next-line:max-func-body-length */
|
|
|
|
|
public renderSettingInCategory(): JSX.Element {
|
|
|
|
|
public renderSettingInCategory() {
|
|
|
|
|
const { category } = this.props;
|
|
|
|
|
|
|
|
|
|
let settings: Array<LocalSettingType>;
|
|
|
|
@ -115,9 +123,15 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
|
|
|
|
|
const description = setting.description || '';
|
|
|
|
|
|
|
|
|
|
const comparisonValue = setting.comparisonValue || null;
|
|
|
|
|
const value =
|
|
|
|
|
|
|
|
|
|
let value;
|
|
|
|
|
if (setting.id === 'media-permissions'){
|
|
|
|
|
value = this.state.mediaSetting;
|
|
|
|
|
} else {
|
|
|
|
|
value =
|
|
|
|
|
window.getSettingValue(setting.id, comparisonValue) ||
|
|
|
|
|
(setting.content && setting.content.defaultValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const sliderFn =
|
|
|
|
|
setting.type === SessionSettingType.Slider
|
|
|
|
@ -416,19 +430,6 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
|
|
|
|
|
},
|
|
|
|
|
confirmationDialogParams: undefined,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'media-permissions',
|
|
|
|
|
title: window.i18n('mediaPermissionsTitle'),
|
|
|
|
|
description: window.i18n('mediaPermissionsDescription'),
|
|
|
|
|
hidden: false,
|
|
|
|
|
type: SessionSettingType.Toggle,
|
|
|
|
|
category: SessionSettingCategory.Permissions,
|
|
|
|
|
setFn: window.toggleMediaPermissions,
|
|
|
|
|
content: undefined,
|
|
|
|
|
comparisonValue: undefined,
|
|
|
|
|
onClick: undefined,
|
|
|
|
|
confirmationDialogParams: undefined,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'message-ttl',
|
|
|
|
|
title: window.i18n('messageTTL'),
|
|
|
|
@ -444,6 +445,19 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
|
|
|
|
|
},
|
|
|
|
|
confirmationDialogParams: undefined,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'media-permissions',
|
|
|
|
|
title: window.i18n('mediaPermissionsTitle'),
|
|
|
|
|
description: window.i18n('mediaPermissionsDescription'),
|
|
|
|
|
hidden: false,
|
|
|
|
|
type: SessionSettingType.Toggle,
|
|
|
|
|
category: SessionSettingCategory.Privacy,
|
|
|
|
|
setFn: window.toggleMediaPermissions,
|
|
|
|
|
content: undefined,
|
|
|
|
|
comparisonValue: undefined,
|
|
|
|
|
onClick: undefined,
|
|
|
|
|
confirmationDialogParams: undefined,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'read-receipt-setting',
|
|
|
|
|
title: window.i18n('readReceiptSettingTitle'),
|
|
|
|
|