From b2322bae022c2a0f8ff4854e8fc7ef94f69658ed Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Thu, 20 Feb 2020 14:46:54 +1100 Subject: [PATCH] check to whether the zoomFactor is shown in preload.js --- js/background.js | 14 +++++++------- preload.js | 19 ++++++++++++++++--- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/js/background.js b/js/background.js index 983afc0c0..c690013fc 100644 --- a/js/background.js +++ b/js/background.js @@ -325,13 +325,13 @@ }, - 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); - }, + // 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'), setReadReceiptSetting: value => diff --git a/preload.js b/preload.js index 78ec9a2a6..7f2c54bbb 100644 --- a/preload.js +++ b/preload.js @@ -81,6 +81,11 @@ window.wrapDeferred = deferredToPromise; const ipc = electron.ipcRenderer; const localeMessages = ipc.sendSync('locale-data'); + +Window.updateScaling = (number) => { + ipc.s +} + window.setBadgeCount = count => ipc.send('set-badge-count', count); // Set the password for the database @@ -160,6 +165,9 @@ 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); @@ -177,6 +185,9 @@ ipc.on('set-up-as-standalone', () => { // Settings-related events +console.log(window.getSettingValue('zoom-factor-setting'), 'from preloadJS and get the setting value'); + + window.showSettings = () => ipc.send('show-settings'); window.showPermissionsPopup = () => ipc.send('show-permissions-popup'); @@ -212,6 +223,8 @@ window.getSettingValue = (settingID, comparisonValue = null) => { return comparisonValue ? !!settingVal === comparisonValue : settingVal; }; + + window.setSettingValue = (settingID, value) => { window.storage.put(settingID, value); }; @@ -229,9 +242,9 @@ installGetter('message-ttl', 'getMessageTTL'); 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'); +// window.getZoomFactor = () => window.storage.get('zoom-factor-setting',50) +// installGetter('zoom-factor-setting', 'getZoomFactor'); +// installSetter('zoom-factor-setting', 'setZoomFactor'); installGetter('read-receipt-setting', 'getReadReceiptSetting'); installSetter('read-receipt-setting', 'setReadReceiptSetting');