diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 516193f7d..eae029a62 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1474,6 +1474,10 @@ "Warning! Lowering the TTL could result in messages being lost if the recipient doesn't collect them in time!", "description": "Warning for the time to live setting" }, + "zoomFactorSettingTitle": { + "message": "Zoom Factor", + "description": "Title of the Zoom Factor setting" + }, "notificationSettingsDialog": { "message": "When messages arrive, display notifications that reveal...", "description": "Explain the purpose of the notification settings" diff --git a/js/background.js b/js/background.js index 7761fbe94..a2e83d285 100644 --- a/js/background.js +++ b/js/background.js @@ -286,6 +286,9 @@ } first = false; + // Update zoom + window.updateZoomFactor(); + const currentPoWDifficulty = storage.get('PoWDifficulty', null); if (!currentPoWDifficulty) { storage.put('PoWDifficulty', window.getDefaultPoWDifficulty()); diff --git a/main.js b/main.js index 07cf10bbd..b739026cf 100644 --- a/main.js +++ b/main.js @@ -1026,6 +1026,7 @@ ipc.on('password-window-login', async (event, passPhrase) => { const passwordAttempt = true; await showMainWindow(passPhrase, passwordAttempt); sendResponse(); + if (passwordWindow) { passwordWindow.close(); passwordWindow = null; diff --git a/preload.js b/preload.js index c9383e136..80e69d310 100644 --- a/preload.js +++ b/preload.js @@ -2,6 +2,8 @@ /* global window: false */ const path = require('path'); const electron = require('electron'); + +const { webFrame } = electron; const semver = require('semver'); const { deferredToPromise } = require('./js/modules/deferred_to_promise'); @@ -85,6 +87,19 @@ window.wrapDeferred = deferredToPromise; const ipc = electron.ipcRenderer; const localeMessages = ipc.sendSync('locale-data'); +window.updateZoomFactor = () => { + const zoomFactor = window.getSettingValue('zoom-factor-setting') || 100; + window.setZoomFactor(zoomFactor / 100); +}; + +window.setZoomFactor = number => { + webFrame.setZoomFactor(number); +}; + +window.getZoomFactor = () => { + webFrame.getZoomFactor(); +}; + window.setBadgeCount = count => ipc.send('set-badge-count', count); // Set the password for the database @@ -218,6 +233,10 @@ window.getSettingValue = (settingID, comparisonValue = null) => { window.setSettingValue = (settingID, value) => { window.storage.put(settingID, value); + + if (settingID === 'zoom-factor-setting') { + window.updateZoomFactor(); + } }; installGetter('device-name', 'getDeviceName'); diff --git a/ts/components/session/settings/SessionSettingListItem.tsx b/ts/components/session/settings/SessionSettingListItem.tsx index 97713ce35..c27a6eb77 100644 --- a/ts/components/session/settings/SessionSettingListItem.tsx +++ b/ts/components/session/settings/SessionSettingListItem.tsx @@ -40,7 +40,6 @@ export class SessionSettingListItem extends React.Component { public render(): JSX.Element { const { title, description, type, value, content } = this.props; - const inline = !!type && ![SessionSettingType.Options, SessionSettingType.Slider].includes(type); @@ -92,16 +91,17 @@ export class SessionSettingListItem extends React.Component {
{ this.handleSlider(sliderValue); }} /> +
-

{`${currentSliderValue} Hours`}

+

{content.info(currentSliderValue)}

)} diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index 692a0efbd..233ef340e 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -231,6 +231,7 @@ export class SettingsView extends React.Component { showLinkDeviceButton={!shouldRenderPasswordLock} category={category} /> +
{shouldRenderPasswordLock ? ( this.renderPasswordLock() @@ -440,7 +441,32 @@ export class SettingsView extends React.Component { comparisonValue: undefined, onClick: undefined, content: { + dotsEnabled: true, + step: 6, + min: 12, + max: 96, defaultValue: 24, + info: (value: number) => `${value} Hours`, + }, + confirmationDialogParams: undefined, + }, + { + id: 'zoom-factor-setting', + title: window.i18n('zoomFactorSettingTitle'), + description: undefined, + hidden: false, + type: SessionSettingType.Slider, + category: SessionSettingCategory.Appearance, + setFn: undefined, + comparisonValue: undefined, + onClick: undefined, + content: { + dotsEnabled: true, + step: 20, + min: 60, + max: 200, + defaultValue: 100, + info: (value: number) => `${value}%`, }, confirmationDialogParams: undefined, },