Skip to content

Commit

Permalink
close #4 - remember the state of refresh button
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Synowiec committed Feb 17, 2018
1 parent 4065cb6 commit 782cab9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { AIRLY_API_URL, IAirlyCurrentMeasurement, IArilyNearestSensorMeasurement
import { getCAQIMeta } from '../caqi';
import { isEmptyObject } from '../helpers';
import IPC_EVENTS from '../ipc-events';
import { shouldNotifyAbout } from '../user-settings';
import { shouldNotifyAbout, userSettings } from '../user-settings';

interface IAppProps {
airlyToken: string;
Expand Down Expand Up @@ -50,7 +50,7 @@ class App extends React.Component<IAppProps, IAppState> {
super(props);

this.state = {
isAutoRefreshEnabled: true,
isAutoRefreshEnabled: userSettings.get('refreshMeasurements'),
connectionStatus: false,
tokens: {
airly: this.props.airlyToken,
Expand Down Expand Up @@ -258,6 +258,8 @@ class App extends React.Component<IAppProps, IAppState> {

handleRefreshClick() {
this.setState({ isAutoRefreshEnabled: !this.state.isAutoRefreshEnabled }, () => {
userSettings.set('refreshMeasurements', this.state.isAutoRefreshEnabled);

if (this.state.isAutoRefreshEnabled) {
this.enableRefreshTimer();
} else {
Expand Down

0 comments on commit 782cab9

Please sign in to comment.