add zoomfactor to main

pull/905/head
Brian 5 years ago
parent 1038a306ce
commit 96e9a68abd

@ -324,6 +324,15 @@
storage.put('message-ttl', ttl); storage.put('message-ttl', ttl);
}, },
getZoomFactor: () => storage.get('zoom-factor-setting', 48),
setZoomFactor: value => {
// Make sure the ttl is between a given range and is valid
const intValue = parseInt(value, 10);
const factor = Number.isNaN(intValue) ? 24 : intValue;
storage.put('zoom-factor-setting', factor);
},
getReadReceiptSetting: () => storage.get('read-receipt-setting'), getReadReceiptSetting: () => storage.get('read-receipt-setting'),
setReadReceiptSetting: value => setReadReceiptSetting: value =>
storage.put('read-receipt-setting', value), storage.put('read-receipt-setting', value),

@ -577,6 +577,7 @@ let settingsWindow;
async function showSettingsWindow() { async function showSettingsWindow() {
if (settingsWindow) { if (settingsWindow) {
settingsWindow.show(); settingsWindow.show();
console.log(window.getSettingValue('zoom-factor-setting'), 'from settingsWindow')
return; return;
} }
if (!mainWindow) { if (!mainWindow) {
@ -836,6 +837,7 @@ async function showMainWindow(sqlKey, passwordAttempt = false) {
createWindow(); createWindow();
if (usingTrayIcon) { if (usingTrayIcon) {
tray = createTrayIcon(getMainWindow, locale.messages); tray = createTrayIcon(getMainWindow, locale.messages);
} }
@ -1025,6 +1027,7 @@ ipc.on('password-window-login', async (event, passPhrase) => {
const passwordAttempt = true; const passwordAttempt = true;
await showMainWindow(passPhrase, passwordAttempt); await showMainWindow(passPhrase, passwordAttempt);
sendResponse(); sendResponse();
if (passwordWindow) { if (passwordWindow) {
passwordWindow.close(); passwordWindow.close();
passwordWindow = null; passwordWindow = null;

@ -228,6 +228,11 @@ window.getMessageTTL = () => window.storage.get('message-ttl', 24);
installGetter('message-ttl', 'getMessageTTL'); installGetter('message-ttl', 'getMessageTTL');
installSetter('message-ttl', 'setMessageTTL'); installSetter('message-ttl', 'setMessageTTL');
// Get the zoom Factor setting
window.getZoomFactor = () => window.storage.get('zoom-factor-setting',50)
installGetter('zoom-factor-setting', 'getZoomFactor');
installSetter('zoom-factor-setting', 'setZoomFactor');
installGetter('read-receipt-setting', 'getReadReceiptSetting'); installGetter('read-receipt-setting', 'getReadReceiptSetting');
installSetter('read-receipt-setting', 'setReadReceiptSetting'); installSetter('read-receipt-setting', 'setReadReceiptSetting');

@ -490,6 +490,21 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
}, },
confirmationDialogParams: undefined, confirmationDialogParams: undefined,
}, },
{
id: 'zoom-factor-setting',
title: window.i18n('zoomFactorSettingTitle'),
description: window.i18n('zoomFactorSettingTitleDescription'),
hidden: false,
type: SessionSettingType.Slider,
category: SessionSettingCategory.Appearance,
setFn: undefined,
comparisonValue: undefined,
onClick: undefined,
content: {
defaultValue: 24,
},
confirmationDialogParams: undefined,
},
{ {
id: 'read-receipt-setting', id: 'read-receipt-setting',
title: window.i18n('readReceiptSettingTitle'), title: window.i18n('readReceiptSettingTitle'),
@ -575,7 +590,7 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
onSuccess: this.onPasswordUpdated, onSuccess: this.onPasswordUpdated,
}), }),
confirmationDialogParams: undefined, confirmationDialogParams: undefined,
}, }
]; ];
} }

Loading…
Cancel
Save