diff --git a/js/background.js b/js/background.js index 6e87a7062..933d9d21c 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()); @@ -323,7 +326,7 @@ const ttl = Number.isNaN(intValue) ? 24 : intValue; storage.put('message-ttl', ttl); }, - + getReadReceiptSetting: () => storage.get('read-receipt-setting'), setReadReceiptSetting: value => storage.put('read-receipt-setting', value), diff --git a/js/modules/loki_app_dot_net_api.js b/js/modules/loki_app_dot_net_api.js index 293d6a522..c9664abef 100644 --- a/js/modules/loki_app_dot_net_api.js +++ b/js/modules/loki_app_dot_net_api.js @@ -614,7 +614,9 @@ class LokiAppDotNetServerAPI { `serverRequest ${mode} error`, e.code, e.message, - `json: ${txtResponse}`, 'attempting connection to', url + `json: ${txtResponse}`, + 'attempting connection to', + url ); } else { log.info( diff --git a/main.js b/main.js index 9f774569a..3fba1821e 100644 --- a/main.js +++ b/main.js @@ -836,7 +836,6 @@ async function showMainWindow(sqlKey, passwordAttempt = false) { createWindow(); - if (usingTrayIcon) { tray = createTrayIcon(getMainWindow, locale.messages); } @@ -1026,7 +1025,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 144a02b2a..bfc96b3c4 100644 --- a/preload.js +++ b/preload.js @@ -3,7 +3,7 @@ const path = require('path'); const electron = require('electron'); -const {webFrame} = electron; +const { webFrame } = electron; const semver = require('semver'); const { deferredToPromise } = require('./js/modules/deferred_to_promise'); @@ -71,7 +71,6 @@ window.CONSTANTS = { MAX_CONNECTION_DURATION: 5000, }; - window.versionInfo = { environment: window.getEnvironment(), version: window.getVersion(), @@ -84,15 +83,18 @@ window.wrapDeferred = deferredToPromise; const ipc = electron.ipcRenderer; const localeMessages = ipc.sendSync('locale-data'); - -window.setZoomFactor = (number) => { - return webFrame.setZoomFactor(number); +window.updateZoomFactor = () => { + const zoomFactor = window.getSettingValue('zoom-factor-setting') || 100; + window.setZoomFactor(zoomFactor / 100); } -window.getZoomFactor = () => { - return webFrame.getZoomFactor(); -} +window.setZoomFactor = number => { + webFrame.setZoomFactor(number); +}; +window.getZoomFactor = () => { + webFrame.getZoomFactor(); +}; window.setBadgeCount = count => ipc.send('set-badge-count', count); @@ -173,9 +175,6 @@ ipc.on('on-unblock-number', (event, number) => { window.closeAbout = () => ipc.send('close-about'); window.readyForUpdates = () => ipc.send('ready-for-updates'); - - - window.updateTrayIcon = unreadCount => ipc.send('update-tray-icon', unreadCount); @@ -193,9 +192,6 @@ ipc.on('set-up-as-standalone', () => { // Settings-related events - - - window.showSettings = () => ipc.send('show-settings'); window.showPermissionsPopup = () => ipc.send('show-permissions-popup'); @@ -231,14 +227,13 @@ window.getSettingValue = (settingID, comparisonValue = null) => { return comparisonValue ? !!settingVal === comparisonValue : settingVal; }; - - 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/SessionToggle.tsx b/ts/components/session/SessionToggle.tsx index 038129681..b9df7c319 100644 --- a/ts/components/session/SessionToggle.tsx +++ b/ts/components/session/SessionToggle.tsx @@ -36,10 +36,6 @@ export class SessionToggle extends React.PureComponent { }; } - - - - public render() { return (
{ this.handleSlider(sliderValue); }} /> - +

{`${currentSliderValue} Hours`}

- ):type === SessionSettingType.Slider && title === "Zoom Factor" ? ( + ) : type === SessionSettingType.Slider && title === 'Zoom Factor' ? (
- { onChange={sliderValue => { this.handleSlider(sliderValue); }} - /> + /> -
-

{`% ${currentSliderValue} Zoom Level`}

-
+
+

{`% ${currentSliderValue} Zoom Level`}

+
- ): - - null} + ) : null} ); @@ -145,10 +143,6 @@ export class SessionSettingListItem extends React.Component { sliderValue: value, }); - if(this.props.title === 'Zoom Factor' && this.state.sliderValue!==null) { - window.setZoomFactor(this.state.sliderValue/100) - } - - + } } diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index 2ac98361a..1cae11c29 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -8,7 +8,6 @@ import { SessionButtonType, } from '../SessionButton'; - export enum SessionSettingCategory { Appearance = 'appearance', Account = 'account', @@ -76,7 +75,6 @@ export class SettingsView extends React.Component { } public componentDidMount() { - console.log(this.state, 'Print state of SessionSettings'); setTimeout(() => $('#password-lock-input').focus(), 100); window.Whisper.events.on('refreshLinkedDeviceList', async () => { @@ -85,8 +83,6 @@ export class SettingsView extends React.Component { }, 1000); }); this.refreshLinkedDevice(); - - } public componentWillUnmount() { @@ -110,8 +106,6 @@ export class SettingsView extends React.Component { settings = this.getLocalSettings(); } - - return ( <> {this.state.hasPassword !== null && @@ -227,27 +221,22 @@ export class SettingsView extends React.Component { } public render() { - - console.log(this.props, 'From SessionSettings'); const { category } = this.props; const shouldRenderPasswordLock = this.state.shouldLockSettings && this.state.hasPassword; return (
- -
- {shouldRenderPasswordLock ? ( this.renderPasswordLock() - // ) : ( + //
{this.renderSettingInCategory()} {/* what gets rendered back from calling renderSettingInCategory */} @@ -318,9 +307,6 @@ export class SettingsView extends React.Component { } } - - - private getPubkeyName(pubKey: string | null) { if (!pubKey) { return {}; @@ -563,7 +549,7 @@ export class SettingsView extends React.Component { onSuccess: this.onPasswordUpdated, }), confirmationDialogParams: undefined, - } + }, ]; } diff --git a/ts/global.d.ts b/ts/global.d.ts index fbc071720..74c71bb6e 100644 --- a/ts/global.d.ts +++ b/ts/global.d.ts @@ -59,7 +59,6 @@ interface Window { lokiFeatureFlags: any; resetDatabase: any; - } interface Promise {