From e0006e1f4128476dac8bd0c75066a9e198e1e8f7 Mon Sep 17 00:00:00 2001 From: Ashish Aggarwal Date: Sun, 21 Jan 2024 22:17:35 -0500 Subject: [PATCH] Save "Don't show again" setting on splash screen close (#49) * add * version update * update --- package-lock.json | 2 +- package.json | 2 +- src/App.js | 10 +++++++++- src/Static.js | 12 +++++++----- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 37bfc40..c3e11d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@dynamods/splash-screen", - "version": "1.0.15", + "version": "1.0.16", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index 45ed551..7e05e38 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dynamods/splash-screen", - "version": "1.0.15", + "version": "1.0.16", "description": "Splash Screen maintained by Dynamo Team@Autodesk", "author": "Autodesk Inc.", "license": "MIT", diff --git a/src/App.js b/src/App.js index e734009..fc09aca 100644 --- a/src/App.js +++ b/src/App.js @@ -15,6 +15,7 @@ class App extends React.Component { super(); this.setBackgroundImage(); this.state = { + isChecked: false, welcomeToDynamoTitle: 'Welcome to Dynamo!', loadingDone: false, signInStatus: false @@ -24,6 +25,12 @@ class App extends React.Component { window.setLabels = this.setLabels.bind(this); window.setLoadingDone = this.setLoadingDone.bind(this); window.setSignInStatus = this.setSignInStatus.bind(this); + this.handleCheckedChange = this.handleCheckedChange.bind(this); + this.closeDynamo = this.closeDynamo.bind(this); + } + + handleCheckedChange = (checked) => { + this.setState({isChecked: checked}); } setBackgroundImage() { @@ -81,6 +88,7 @@ class App extends React.Component { showScreenAgainLabel={this.state.showScreenAgainLabel} importSettingsTitle={this.state.importSettingsTitle} importSettingsTooltipDescription={this.state.importSettingsTooltipDescription} + onCheckedChange={this.handleCheckedChange} /> : } @@ -127,7 +135,7 @@ class App extends React.Component { closeDynamo() { if (chrome.webview !== undefined) { - chrome.webview.hostObjects.scriptObject.CloseWindow(); + chrome.webview.hostObjects.scriptObject.CloseWindowPreserve(this.state.isChecked); } } } diff --git a/src/Static.js b/src/Static.js index 194d070..f858bfe 100644 --- a/src/Static.js +++ b/src/Static.js @@ -35,12 +35,19 @@ class Static extends React.Component { window.setTotalLoadingTime = this.setTotalLoadingTime.bind(this); window.setEnableSignInButton = this.setEnableSignInButton.bind(this); window.handleSignInStateChange = this.handleSignInStateChange.bind(this); + this.handleChange = this.handleChange.bind(this) } componentDidMount() { document.addEventListener('keydown', this.handleKeyDown); } + //Every time the checkbox is clicked, this method is called + handleChange() { + checked = !checked; + this.props.onCheckedChange(checked); + } + render() { return ( @@ -214,11 +221,6 @@ class Static extends React.Component { } } - //Every time the checkbox is clicked, this method is called - handleChange() { - checked = !checked; - } - handleKeyDown = (e) => { if (e.key === 'Enter') { // We check explicitly the lblImportSettings control due to it's a label that wraps inputs, it's no necessary for the launch and signing buttons because they receive the focus ready to are hit with the Enter key