From 0daf41a339f37da612bc7e86e658ababf96a786b Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Tue, 18 Feb 2020 14:47:59 +1100 Subject: [PATCH 01/22] check the state when the SessionSettings get rendered --- ts/components/session/settings/SessionSettingListItem.tsx | 4 ++++ ts/components/session/settings/SessionSettings.tsx | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/ts/components/session/settings/SessionSettingListItem.tsx b/ts/components/session/settings/SessionSettingListItem.tsx index 0713a6068..db80bb296 100644 --- a/ts/components/session/settings/SessionSettingListItem.tsx +++ b/ts/components/session/settings/SessionSettingListItem.tsx @@ -100,12 +100,16 @@ export class SessionSettingListItem extends React.Component { this.handleSlider(sliderValue); }} /> +

{`${currentSliderValue} Hours`}

)} +
+ See me in here +
); } diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index 692a0efbd..5a4623619 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -83,6 +83,7 @@ export class SettingsView extends React.Component { }, 1000); }); this.refreshLinkedDevice(); + console.log(this.state, 'from SessionSettings'); } public componentWillUnmount() { @@ -151,6 +152,10 @@ export class SettingsView extends React.Component { ); })} + +
+ +
); } From cc915fadbc02948af8cdd18dda3e1ca30f0ef58a Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Tue, 18 Feb 2020 16:15:10 +1100 Subject: [PATCH 02/22] add sliderbar and state control in fe --- .../session/settings/SessionSettings.tsx | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index 5a4623619..8dfe17652 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -8,6 +8,7 @@ import { SessionButtonType, } from '../SessionButton'; + export enum SessionSettingCategory { Appearance = 'appearance', Account = 'account', @@ -34,6 +35,7 @@ interface State { pwdLockError: string | null; shouldLockSettings: boolean | null; linkedPubKeys: Array; + scaleValue: number; } interface LocalSettingType { @@ -61,6 +63,7 @@ export class SettingsView extends React.Component { pwdLockError: null, shouldLockSettings: true, linkedPubKeys: new Array(), + scaleValue: 200 }; this.settingsViewRef = React.createRef(); @@ -71,10 +74,12 @@ export class SettingsView extends React.Component { this.refreshLinkedDevice = this.refreshLinkedDevice.bind(this); this.onKeyUp = this.onKeyUp.bind(this); + this.handleScaleChange = this.handleScaleChange.bind(this) window.addEventListener('keyup', this.onKeyUp); } public componentDidMount() { + console.log(this.state, 'Print state of SessionSettings'); setTimeout(() => $('#password-lock-input').focus(), 100); window.Whisper.events.on('refreshLinkedDeviceList', async () => { @@ -83,7 +88,8 @@ export class SettingsView extends React.Component { }, 1000); }); this.refreshLinkedDevice(); - console.log(this.state, 'from SessionSettings'); + + } public componentWillUnmount() { @@ -107,6 +113,8 @@ export class SettingsView extends React.Component { settings = this.getLocalSettings(); } + + return ( <> {this.state.hasPassword !== null && @@ -154,8 +162,9 @@ export class SettingsView extends React.Component { })}
- +
+
Scale: {this.state.scaleValue}
); } @@ -250,6 +259,16 @@ export class SettingsView extends React.Component { ); } + + public handleScaleChange(event:any):any { + const {value} = event.target; + let scaleVal:number = parseInt(value,10); + this.setState({ + scaleValue:scaleVal + }) + } + + public renderSessionInfo(): JSX.Element { return (
@@ -307,6 +326,9 @@ export class SettingsView extends React.Component { } } + + + private getPubkeyName(pubKey: string | null) { if (!pubKey) { return {}; From 1038a306ce56ed11fd94d8ef91909f4633c9083c Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Wed, 19 Feb 2020 20:47:37 +1100 Subject: [PATCH 03/22] add comment to view logic --- ts/components/session/SessionToggle.tsx | 13 +++++++++++++ .../session/settings/SessionSettings.tsx | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/ts/components/session/SessionToggle.tsx b/ts/components/session/SessionToggle.tsx index b9df7c319..54083e151 100644 --- a/ts/components/session/SessionToggle.tsx +++ b/ts/components/session/SessionToggle.tsx @@ -34,9 +34,17 @@ export class SessionToggle extends React.PureComponent { this.state = { active: active, }; + console.log('it is the constructor runs the first') } + + + + public render() { + + console.log(this.props, 'from Session Toggle') + return (
{ } }; + + //what does the following piece of code do? // + + //what is the window.comfirmationDialog doing in here? + if ( this.props.confirmationDialogParams && this.props.confirmationDialogParams.shouldShowConfirm() diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index 8dfe17652..0d6d6c3b2 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -140,6 +140,10 @@ export class SettingsView extends React.Component { this.updateSetting(setting); }); + //define a bunch of function that will be used in the setting list. + //since setting elem itself is an array elem, this either becomes, onlick function + // or a function returned by others. + return (
{shouldRenderSettings && @@ -235,24 +239,38 @@ 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 ( + + //this is the section where the actually setting group of components gets render!
+ + {/* header is always rendered */} + +
+ + {/* some show lock logic is put in here to make sure that every time if you want to change the appearance */} {shouldRenderPasswordLock ? ( this.renderPasswordLock() + // ) : (
{this.renderSettingInCategory()} + {/* what gets rendered back from calling renderSettingInCategory */}
)} + + {/* session info is always shown in here */} {this.renderSessionInfo()}
@@ -266,6 +284,7 @@ export class SettingsView extends React.Component { this.setState({ scaleValue:scaleVal }) + window.setSettingValue('') } From 96e9a68abdaa1438d94cd442d3b1dd9e986a4cd6 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 20 Feb 2020 00:08:47 +1100 Subject: [PATCH 04/22] add zoomfactor to main --- js/background.js | 9 +++++++++ main.js | 3 +++ preload.js | 5 +++++ .../session/settings/SessionSettings.tsx | 17 ++++++++++++++++- 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/js/background.js b/js/background.js index 123dca978..983afc0c0 100644 --- a/js/background.js +++ b/js/background.js @@ -324,6 +324,15 @@ 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'), setReadReceiptSetting: value => storage.put('read-receipt-setting', value), diff --git a/main.js b/main.js index 2eb625db8..86866b1bd 100644 --- a/main.js +++ b/main.js @@ -577,6 +577,7 @@ let settingsWindow; async function showSettingsWindow() { if (settingsWindow) { settingsWindow.show(); + console.log(window.getSettingValue('zoom-factor-setting'), 'from settingsWindow') return; } if (!mainWindow) { @@ -836,6 +837,7 @@ async function showMainWindow(sqlKey, passwordAttempt = false) { createWindow(); + if (usingTrayIcon) { tray = createTrayIcon(getMainWindow, locale.messages); } @@ -1025,6 +1027,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 8fb3936d1..78ec9a2a6 100644 --- a/preload.js +++ b/preload.js @@ -228,6 +228,11 @@ window.getMessageTTL = () => window.storage.get('message-ttl', 24); 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'); + installGetter('read-receipt-setting', 'getReadReceiptSetting'); installSetter('read-receipt-setting', 'setReadReceiptSetting'); diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index 0d6d6c3b2..4524fd167 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -490,6 +490,21 @@ export class SettingsView extends React.Component { }, 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', title: window.i18n('readReceiptSettingTitle'), @@ -575,7 +590,7 @@ export class SettingsView extends React.Component { onSuccess: this.onPasswordUpdated, }), confirmationDialogParams: undefined, - }, + } ]; } From b2322bae022c2a0f8ff4854e8fc7ef94f69658ed Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Thu, 20 Feb 2020 14:46:54 +1100 Subject: [PATCH 05/22] 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'); From 7a0f2c9ce314f3f9ebef95434ab4cae34e8e29fe Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Thu, 20 Feb 2020 17:15:39 +1100 Subject: [PATCH 06/22] add electron webFrame API to preloadJS --- preload.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/preload.js b/preload.js index 7f2c54bbb..927ac7b32 100644 --- a/preload.js +++ b/preload.js @@ -2,6 +2,7 @@ /* 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'); @@ -69,6 +70,7 @@ window.CONSTANTS = { MAX_CONNECTION_DURATION: 5000, }; + window.versionInfo = { environment: window.getEnvironment(), version: window.getVersion(), @@ -82,10 +84,15 @@ const ipc = electron.ipcRenderer; const localeMessages = ipc.sendSync('locale-data'); -Window.updateScaling = (number) => { - ipc.s +window.setScaling = (number) => { + return webFrame.setZoomFactor(number); +} + +window.getScaling = () => { + return webFrame.getZoomFactor(); } + window.setBadgeCount = count => ipc.send('set-badge-count', count); // Set the password for the database @@ -185,7 +192,7 @@ 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'); @@ -229,6 +236,9 @@ window.setSettingValue = (settingID, value) => { window.storage.put(settingID, value); }; + + + installGetter('device-name', 'getDeviceName'); installGetter('theme-setting', 'getThemeSetting'); From cb7289d3d868c813fedaf9d2572d98798d581eb1 Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Fri, 21 Feb 2020 10:37:58 +1100 Subject: [PATCH 07/22] working but buggy --- preload.js | 4 +-- .../settings/SessionSettingListItem.tsx | 31 ++++++++++++++++--- .../session/settings/SessionSettings.tsx | 19 ------------ ts/global.d.ts | 2 ++ 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/preload.js b/preload.js index 927ac7b32..3637bf4ea 100644 --- a/preload.js +++ b/preload.js @@ -84,11 +84,11 @@ const ipc = electron.ipcRenderer; const localeMessages = ipc.sendSync('locale-data'); -window.setScaling = (number) => { +window.setZoomFactor = (number) => { return webFrame.setZoomFactor(number); } -window.getScaling = () => { +window.getZoomFactor = () => { return webFrame.getZoomFactor(); } diff --git a/ts/components/session/settings/SessionSettingListItem.tsx b/ts/components/session/settings/SessionSettingListItem.tsx index db80bb296..667928d5c 100644 --- a/ts/components/session/settings/SessionSettingListItem.tsx +++ b/ts/components/session/settings/SessionSettingListItem.tsx @@ -88,7 +88,7 @@ export class SessionSettingListItem extends React.Component { /> )} - {type === SessionSettingType.Slider && ( + {type === SessionSettingType.Slider && title === 'messageTTL' ? (
{

{`${currentSliderValue} Hours`}

- )} -
-
- See me in here + ):type === SessionSettingType.Slider ? ( +
+ + { + this.handleSlider(sliderValue); + }} + /> +
+

{`% ${currentSliderValue} Zoom Level`}

+
+
+ ): + null}
); @@ -128,5 +143,11 @@ export class SessionSettingListItem extends React.Component { this.setState({ sliderValue: value, }); + + if(this.props.title !== 'messageTTL' && 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 4524fd167..1a88ada2d 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -35,7 +35,6 @@ interface State { pwdLockError: string | null; shouldLockSettings: boolean | null; linkedPubKeys: Array; - scaleValue: number; } interface LocalSettingType { @@ -63,7 +62,6 @@ export class SettingsView extends React.Component { pwdLockError: null, shouldLockSettings: true, linkedPubKeys: new Array(), - scaleValue: 200 }; this.settingsViewRef = React.createRef(); @@ -74,7 +72,6 @@ export class SettingsView extends React.Component { this.refreshLinkedDevice = this.refreshLinkedDevice.bind(this); this.onKeyUp = this.onKeyUp.bind(this); - this.handleScaleChange = this.handleScaleChange.bind(this) window.addEventListener('keyup', this.onKeyUp); } @@ -164,11 +161,6 @@ export class SettingsView extends React.Component { ); })} - -
- -
-
Scale: {this.state.scaleValue}
); } @@ -277,17 +269,6 @@ export class SettingsView extends React.Component { ); } - - public handleScaleChange(event:any):any { - const {value} = event.target; - let scaleVal:number = parseInt(value,10); - this.setState({ - scaleValue:scaleVal - }) - window.setSettingValue('') - } - - public renderSessionInfo(): JSX.Element { return (
diff --git a/ts/global.d.ts b/ts/global.d.ts index 882a32e3f..fbc071720 100644 --- a/ts/global.d.ts +++ b/ts/global.d.ts @@ -11,6 +11,7 @@ interface Window { mnemonic: any; clipboard: any; attemptConnection: any; + setZoomFactor: any; passwordUtil: any; userConfig: any; @@ -58,6 +59,7 @@ interface Window { lokiFeatureFlags: any; resetDatabase: any; + } interface Promise { From a80c6e30e20fd1e8b10530b344ceff8c0b262f44 Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Fri, 21 Feb 2020 10:53:57 +1100 Subject: [PATCH 08/22] add slider title to message.json --- _locales/en/messages.json | 4 ++++ ts/components/session/settings/SessionSettingListItem.tsx | 2 +- ts/components/session/settings/SessionSettings.tsx | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 34a519aa4..b7155a8b0 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1471,6 +1471,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/ts/components/session/settings/SessionSettingListItem.tsx b/ts/components/session/settings/SessionSettingListItem.tsx index 667928d5c..c84c047e5 100644 --- a/ts/components/session/settings/SessionSettingListItem.tsx +++ b/ts/components/session/settings/SessionSettingListItem.tsx @@ -114,7 +114,7 @@ export class SessionSettingListItem extends React.Component { min={60} max={200} defaultValue={currentSliderValue} - onAfterChange={sliderValue => { + onChange={sliderValue => { this.handleSlider(sliderValue); }} /> diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index 1a88ada2d..8d493ef5a 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -474,7 +474,7 @@ export class SettingsView extends React.Component { { id: 'zoom-factor-setting', title: window.i18n('zoomFactorSettingTitle'), - description: window.i18n('zoomFactorSettingTitleDescription'), + description: undefined, hidden: false, type: SessionSettingType.Slider, category: SessionSettingCategory.Appearance, From b877dab7de8145ae552d2746ae1bdde8ba5cadd7 Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Mon, 24 Feb 2020 10:46:27 +1100 Subject: [PATCH 09/22] refactor the code related to checking slider type --- .../session/settings/SessionSettingListItem.tsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ts/components/session/settings/SessionSettingListItem.tsx b/ts/components/session/settings/SessionSettingListItem.tsx index c84c047e5..e7bc66e4a 100644 --- a/ts/components/session/settings/SessionSettingListItem.tsx +++ b/ts/components/session/settings/SessionSettingListItem.tsx @@ -88,7 +88,7 @@ export class SessionSettingListItem extends React.Component { /> )} - {type === SessionSettingType.Slider && title === 'messageTTL' ? ( + {type === SessionSettingType.Slider && title === 'Message TTL' ? (
{

{`${currentSliderValue} Hours`}

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

{`% ${currentSliderValue} Zoom Level`}

-
-
+

{`% ${currentSliderValue} Zoom Level`}

+ + ): + null} @@ -144,7 +145,9 @@ export class SessionSettingListItem extends React.Component { sliderValue: value, }); - if(this.props.title !== 'messageTTL' && this.state.sliderValue!==null) { + console.log(this.props.title, 'from here') + + if(this.props.title === 'Zoom Factor' && this.state.sliderValue!==null) { window.setZoomFactor(this.state.sliderValue/100) } From 23da1831c29855c8b150ebc7c7995372d14f5a7b Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Wed, 26 Feb 2020 11:54:44 +1100 Subject: [PATCH 10/22] removed unnecessary comments after review --- js/background.js | 11 +---------- main.js | 1 - preload.js | 6 +----- ts/components/session/SessionToggle.tsx | 9 --------- .../session/settings/SessionSettingListItem.tsx | 2 -- ts/components/session/settings/SessionSettings.tsx | 8 -------- 6 files changed, 2 insertions(+), 35 deletions(-) diff --git a/js/background.js b/js/background.js index c690013fc..6e87a7062 100644 --- a/js/background.js +++ b/js/background.js @@ -323,16 +323,7 @@ const ttl = Number.isNaN(intValue) ? 24 : intValue; 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'), setReadReceiptSetting: value => storage.put('read-receipt-setting', value), diff --git a/main.js b/main.js index 86866b1bd..9f774569a 100644 --- a/main.js +++ b/main.js @@ -577,7 +577,6 @@ let settingsWindow; async function showSettingsWindow() { if (settingsWindow) { settingsWindow.show(); - console.log(window.getSettingValue('zoom-factor-setting'), 'from settingsWindow') return; } if (!mainWindow) { diff --git a/preload.js b/preload.js index 3637bf4ea..144a02b2a 100644 --- a/preload.js +++ b/preload.js @@ -2,6 +2,7 @@ /* global window: false */ const path = require('path'); const electron = require('electron'); + const {webFrame} = electron; const semver = require('semver'); @@ -251,11 +252,6 @@ window.getMessageTTL = () => window.storage.get('message-ttl', 24); 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'); - installGetter('read-receipt-setting', 'getReadReceiptSetting'); installSetter('read-receipt-setting', 'setReadReceiptSetting'); diff --git a/ts/components/session/SessionToggle.tsx b/ts/components/session/SessionToggle.tsx index 54083e151..038129681 100644 --- a/ts/components/session/SessionToggle.tsx +++ b/ts/components/session/SessionToggle.tsx @@ -34,7 +34,6 @@ export class SessionToggle extends React.PureComponent { this.state = { active: active, }; - console.log('it is the constructor runs the first') } @@ -42,9 +41,6 @@ export class SessionToggle extends React.PureComponent { public render() { - - console.log(this.props, 'from Session Toggle') - return (
{ } }; - - //what does the following piece of code do? // - - //what is the window.comfirmationDialog doing in here? - if ( this.props.confirmationDialogParams && this.props.confirmationDialogParams.shouldShowConfirm() diff --git a/ts/components/session/settings/SessionSettingListItem.tsx b/ts/components/session/settings/SessionSettingListItem.tsx index e7bc66e4a..56ebe9c94 100644 --- a/ts/components/session/settings/SessionSettingListItem.tsx +++ b/ts/components/session/settings/SessionSettingListItem.tsx @@ -145,8 +145,6 @@ export class SessionSettingListItem extends React.Component { sliderValue: value, }); - console.log(this.props.title, 'from here') - 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 8d493ef5a..2ac98361a 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -137,10 +137,6 @@ export class SettingsView extends React.Component { this.updateSetting(setting); }); - //define a bunch of function that will be used in the setting list. - //since setting elem itself is an array elem, this either becomes, onlick function - // or a function returned by others. - return (
{shouldRenderSettings && @@ -238,11 +234,8 @@ export class SettingsView extends React.Component { this.state.shouldLockSettings && this.state.hasPassword; return ( - - //this is the section where the actually setting group of components gets render!
- {/* header is always rendered */} {
- {/* some show lock logic is put in here to make sure that every time if you want to change the appearance */} {shouldRenderPasswordLock ? ( this.renderPasswordLock() // From 203d3142548bf0bbc29ee1fef03d948171727e54 Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Wed, 26 Feb 2020 13:30:56 +1100 Subject: [PATCH 11/22] fix the slider bug --- js/background.js | 5 ++- js/modules/loki_app_dot_net_api.js | 4 ++- main.js | 3 +- preload.js | 33 ++++++++----------- ts/components/session/SessionToggle.tsx | 4 --- .../settings/SessionSettingListItem.tsx | 24 +++++--------- .../session/settings/SessionSettings.tsx | 18 ++-------- ts/global.d.ts | 1 - 8 files changed, 33 insertions(+), 59 deletions(-) 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 { From ccb470207a3db93802074836691c270d916e90f0 Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Wed, 26 Feb 2020 15:08:41 +1100 Subject: [PATCH 12/22] use storage instead of component state to store the zoom setting --- preload.js | 2 +- ts/components/session/settings/SessionSettingListItem.tsx | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/preload.js b/preload.js index bfc96b3c4..58f8c9b55 100644 --- a/preload.js +++ b/preload.js @@ -86,7 +86,7 @@ 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); diff --git a/ts/components/session/settings/SessionSettingListItem.tsx b/ts/components/session/settings/SessionSettingListItem.tsx index ef5746c65..062da0ee3 100644 --- a/ts/components/session/settings/SessionSettingListItem.tsx +++ b/ts/components/session/settings/SessionSettingListItem.tsx @@ -142,7 +142,5 @@ export class SessionSettingListItem extends React.Component { this.setState({ sliderValue: value, }); - - } } From 0daaa0459632a89fdc8e390c81f16ee9f896c008 Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Fri, 28 Feb 2020 10:20:56 +1100 Subject: [PATCH 13/22] fully working; all comments removed; put slider setting into content object --- .../settings/SessionSettingListItem.tsx | 24 ++++++++++--------- .../session/settings/SessionSettings.tsx | 12 +++++++++- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/ts/components/session/settings/SessionSettingListItem.tsx b/ts/components/session/settings/SessionSettingListItem.tsx index 062da0ee3..4820d3287 100644 --- a/ts/components/session/settings/SessionSettingListItem.tsx +++ b/ts/components/session/settings/SessionSettingListItem.tsx @@ -88,13 +88,14 @@ export class SessionSettingListItem extends React.Component { /> )} - {type === SessionSettingType.Slider && title === 'Message TTL' ? ( + {type === SessionSettingType.Slider && + content.sliderCategory === 'messageTTLSlider' ? (
{ this.handleSlider(sliderValue); @@ -105,13 +106,14 @@ export class SessionSettingListItem extends React.Component {

{`${currentSliderValue} Hours`}

- ) : type === SessionSettingType.Slider && title === 'Zoom Factor' ? ( + ) : type === SessionSettingType.Slider && + content.sliderCategory === 'zoomFactorSlider' ? (
{ this.handleSlider(sliderValue); @@ -119,7 +121,7 @@ export class SessionSettingListItem extends React.Component { />
-

{`% ${currentSliderValue} Zoom Level`}

+

{`Zoom Level: %${currentSliderValue}`}

) : null} diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index 1cae11c29..38bb56b4e 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -445,6 +445,11 @@ export class SettingsView extends React.Component { comparisonValue: undefined, onClick: undefined, content: { + dotsEnabled: true, + step: 6, + min: 12, + max: 96, + sliderCategory: 'messageTTLSlider', defaultValue: 24, }, confirmationDialogParams: undefined, @@ -460,7 +465,12 @@ export class SettingsView extends React.Component { comparisonValue: undefined, onClick: undefined, content: { - defaultValue: 24, + dotsEnabled: true, + step: 20, + min: 60, + max: 200, + sliderCategory: 'zoomFactorSlider', + defaultValue: 100, }, confirmationDialogParams: undefined, }, From 75f5d5743f5a61d76e040f0d634ba13e52aef16f Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Fri, 28 Feb 2020 10:54:21 +1100 Subject: [PATCH 14/22] remove all the conditional rendering logic to make code cleaner --- .../settings/SessionSettingListItem.tsx | 25 +++---------------- .../session/settings/SessionSettings.tsx | 6 ++--- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/ts/components/session/settings/SessionSettingListItem.tsx b/ts/components/session/settings/SessionSettingListItem.tsx index 4820d3287..517ad205e 100644 --- a/ts/components/session/settings/SessionSettingListItem.tsx +++ b/ts/components/session/settings/SessionSettingListItem.tsx @@ -88,8 +88,7 @@ export class SessionSettingListItem extends React.Component { /> )} - {type === SessionSettingType.Slider && - content.sliderCategory === 'messageTTLSlider' ? ( + {type === SessionSettingType.Slider && (
{ />
-

{`${currentSliderValue} Hours`}

+

{content.info(currentSliderValue)}

- ) : type === SessionSettingType.Slider && - content.sliderCategory === 'zoomFactorSlider' ? ( -
- { - this.handleSlider(sliderValue); - }} - /> - -
-

{`Zoom Level: %${currentSliderValue}`}

-
-
- ) : null} + )}
); diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index 38bb56b4e..d5f391975 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -236,14 +236,10 @@ export class SettingsView extends React.Component { {shouldRenderPasswordLock ? ( this.renderPasswordLock() ) : ( - //
{this.renderSettingInCategory()} - {/* what gets rendered back from calling renderSettingInCategory */}
)} - - {/* session info is always shown in here */} {this.renderSessionInfo()}
@@ -451,6 +447,7 @@ export class SettingsView extends React.Component { max: 96, sliderCategory: 'messageTTLSlider', defaultValue: 24, + info: (value: number) => `${value} Hours`, }, confirmationDialogParams: undefined, }, @@ -471,6 +468,7 @@ export class SettingsView extends React.Component { max: 200, sliderCategory: 'zoomFactorSlider', defaultValue: 100, + info: (value: number) => `Zoom Factor: ${value}%` }, confirmationDialogParams: undefined, }, From fd764a2aa70cc1569a80db14174e8c357b7a5b5e Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Fri, 28 Feb 2020 10:58:55 +1100 Subject: [PATCH 15/22] match the slider value prop with currentSliderValue --- ts/components/session/settings/SessionSettingListItem.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ts/components/session/settings/SessionSettingListItem.tsx b/ts/components/session/settings/SessionSettingListItem.tsx index 517ad205e..76ee76d39 100644 --- a/ts/components/session/settings/SessionSettingListItem.tsx +++ b/ts/components/session/settings/SessionSettingListItem.tsx @@ -95,7 +95,8 @@ export class SessionSettingListItem extends React.Component { step={content.step} min={content.min} max={content.max} - defaultValue={currentSliderValue} + value={currentSliderValue} + defaultValue={content.defaultValue} onAfterChange={sliderValue => { this.handleSlider(sliderValue); }} From 70100a0ef595309575f8c4a6e6386859ee1c6685 Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Fri, 28 Feb 2020 12:07:45 +1100 Subject: [PATCH 16/22] remove value prop in slider and global var setZoomFactor --- ts/components/session/settings/SessionSettingListItem.tsx | 1 - ts/components/session/settings/SessionSettings.tsx | 2 -- 2 files changed, 3 deletions(-) diff --git a/ts/components/session/settings/SessionSettingListItem.tsx b/ts/components/session/settings/SessionSettingListItem.tsx index 76ee76d39..127a881ab 100644 --- a/ts/components/session/settings/SessionSettingListItem.tsx +++ b/ts/components/session/settings/SessionSettingListItem.tsx @@ -95,7 +95,6 @@ export class SessionSettingListItem extends React.Component { step={content.step} min={content.min} max={content.max} - value={currentSliderValue} defaultValue={content.defaultValue} onAfterChange={sliderValue => { this.handleSlider(sliderValue); diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index d5f391975..2a81b77de 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -445,7 +445,6 @@ export class SettingsView extends React.Component { step: 6, min: 12, max: 96, - sliderCategory: 'messageTTLSlider', defaultValue: 24, info: (value: number) => `${value} Hours`, }, @@ -466,7 +465,6 @@ export class SettingsView extends React.Component { step: 20, min: 60, max: 200, - sliderCategory: 'zoomFactorSlider', defaultValue: 100, info: (value: number) => `Zoom Factor: ${value}%` }, From ac8d0aa441917b5e8faf486e9e1d0e682b75a13a Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Fri, 28 Feb 2020 12:09:25 +1100 Subject: [PATCH 17/22] remove the global var setZoomFacotr --- ts/global.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/ts/global.d.ts b/ts/global.d.ts index 74c71bb6e..882a32e3f 100644 --- a/ts/global.d.ts +++ b/ts/global.d.ts @@ -11,7 +11,6 @@ interface Window { mnemonic: any; clipboard: any; attemptConnection: any; - setZoomFactor: any; passwordUtil: any; userConfig: any; From f92cb95f5c447ee1dd0b5ec625de6053db2b956a Mon Sep 17 00:00:00 2001 From: jian10au <48778096+jian10au@users.noreply.github.com> Date: Fri, 28 Feb 2020 13:55:52 +1100 Subject: [PATCH 18/22] Update ts/components/session/settings/SessionSettingListItem.tsx Accept the change Co-Authored-By: Mikunj Varsani --- ts/components/session/settings/SessionSettingListItem.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ts/components/session/settings/SessionSettingListItem.tsx b/ts/components/session/settings/SessionSettingListItem.tsx index 127a881ab..517ad205e 100644 --- a/ts/components/session/settings/SessionSettingListItem.tsx +++ b/ts/components/session/settings/SessionSettingListItem.tsx @@ -95,7 +95,7 @@ export class SessionSettingListItem extends React.Component { step={content.step} min={content.min} max={content.max} - defaultValue={content.defaultValue} + defaultValue={currentSliderValue} onAfterChange={sliderValue => { this.handleSlider(sliderValue); }} From ed5533b21f457ebf3d572eebc19b573d2d0443db Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Fri, 28 Feb 2020 14:32:45 +1100 Subject: [PATCH 19/22] lint the code again and ready for review --- ts/components/session/settings/SessionSettings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index 2a81b77de..0d885f85f 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -466,7 +466,7 @@ export class SettingsView extends React.Component { min: 60, max: 200, defaultValue: 100, - info: (value: number) => `Zoom Factor: ${value}%` + info: (value: number) => `Zoom Factor: ${value}%`, }, confirmationDialogParams: undefined, }, From d9dd1f4340a970831f8d14022abb5a084e21f72e Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Fri, 28 Feb 2020 16:26:42 +1100 Subject: [PATCH 20/22] hard dots enabled as true --- ts/components/session/settings/SessionSettingListItem.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ts/components/session/settings/SessionSettingListItem.tsx b/ts/components/session/settings/SessionSettingListItem.tsx index 517ad205e..101162c49 100644 --- a/ts/components/session/settings/SessionSettingListItem.tsx +++ b/ts/components/session/settings/SessionSettingListItem.tsx @@ -25,6 +25,7 @@ interface State { } export class SessionSettingListItem extends React.Component { + public static defaultProps = { inline: true, }; @@ -40,7 +41,7 @@ export class SessionSettingListItem extends React.Component { public render(): JSX.Element { const { title, description, type, value, content } = this.props; - + console.log(content.dotsEnable, 'dotenable?'); const inline = !!type && ![SessionSettingType.Options, SessionSettingType.Slider].includes(type); @@ -91,7 +92,7 @@ export class SessionSettingListItem extends React.Component { {type === SessionSettingType.Slider && (
Date: Fri, 28 Feb 2020 16:38:55 +1100 Subject: [PATCH 21/22] lint the code again and ready for merge --- ts/components/session/settings/SessionSettingListItem.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/ts/components/session/settings/SessionSettingListItem.tsx b/ts/components/session/settings/SessionSettingListItem.tsx index 101162c49..fd7ea27d9 100644 --- a/ts/components/session/settings/SessionSettingListItem.tsx +++ b/ts/components/session/settings/SessionSettingListItem.tsx @@ -25,7 +25,6 @@ interface State { } export class SessionSettingListItem extends React.Component { - public static defaultProps = { inline: true, }; @@ -41,7 +40,6 @@ export class SessionSettingListItem extends React.Component { public render(): JSX.Element { const { title, description, type, value, content } = this.props; - console.log(content.dotsEnable, 'dotenable?'); const inline = !!type && ![SessionSettingType.Options, SessionSettingType.Slider].includes(type); From eff2eeb119ecf1c6b4d6405dcc1bcf6c7d825c3e Mon Sep 17 00:00:00 2001 From: Brian Jian Zhao Date: Mon, 2 Mar 2020 11:35:42 +1100 Subject: [PATCH 22/22] remove zoom factor text next to % --- ts/components/session/settings/SessionSettings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index 0d885f85f..233ef340e 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -466,7 +466,7 @@ export class SettingsView extends React.Component { min: 60, max: 200, defaultValue: 100, - info: (value: number) => `Zoom Factor: ${value}%`, + info: (value: number) => `${value}%`, }, confirmationDialogParams: undefined, },