From d7651b78b3277da0b74109df6629256889a49c74 Mon Sep 17 00:00:00 2001 From: Harsh Vakharia Date: Mon, 13 Mar 2017 13:23:04 +0530 Subject: [PATCH] Persist coin and currency setting --- gulpfile.js | 22 +--------------------- package.json | 1 - src/app/stores/CurrencyStore.js | 10 ++++++++-- src/package.json | 3 ++- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 6d481c6..2bfb482 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,7 +1,6 @@ const gulp = require('gulp') const browserify = require('browserify') -const envify = require('envify/custom') const source = require('vinyl-source-stream') const sass = require('gulp-sass') @@ -60,26 +59,7 @@ gulp.task('jsx', () => { .pipe(gulp.dest(config.jsx.destination)) }) -gulp.task('jsx:build', () => { - return browserify({ - entries: config.jsx.source, - browserField: false, - builtins: false, - commondir: false, - insertGlobalVars: { - process: undefined, - global: undefined, - 'Buffer.isBuffer': undefined, - Buffer: undefined - } - }) - .transform('babelify') - .transform(envify({ NODE_ENV: 'production' })) - .transform({ global: true }, 'uglifyify') - .bundle() - .pipe(source(config.jsx.name)) - .pipe(gulp.dest(config.jsx.destination)) -}) +gulp.task('jsx:build', [ 'jsx' ]) gulp.task('sass', () => { return gulp diff --git a/package.json b/package.json index 2f42ec7..bf57c79 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,6 @@ "babel-plugin-transform-class-properties": "^6.16.0", "babel-preset-es2015": "^6.16.0", "babel-preset-react": "^6.16.0", - "babel-preset-stage-0": "^6.16.0", "babelify": "^7.3.0", "bower": "^1.7.9", "browserify": "^13.3.0", diff --git a/src/app/stores/CurrencyStore.js b/src/app/stores/CurrencyStore.js index f9611bc..42159ef 100644 --- a/src/app/stores/CurrencyStore.js +++ b/src/app/stores/CurrencyStore.js @@ -2,12 +2,14 @@ import BaseStore from './BaseStore' import AppDispatcher from '../dispatcher/Dispatcher' import ActionTypes from '../constants/ActionTypes' +const settings = window.require('electron-settings') + class CurrencyStoreClass extends BaseStore { constructor () { super() this.currencyMap = {} - this.selectedCurrency = 'USD' - this.selectedCoin = 'BTC' + this.selectedCurrency = settings.getSync('selectedCurrency') || 'USD' + this.selectedCoin = settings.getSync('selectedCoin') || 'BTC' } getCurrencies () { @@ -27,10 +29,14 @@ class CurrencyStoreClass extends BaseStore { setSelectedCoin (coin) { this.selectedCoin = coin + + settings.setSync('selectedCoin', coin) } setSelectedCurrency (currency) { this.selectedCurrency = currency + + settings.setSync('selectedCurrency', currency) } getSelectedCurrency () { diff --git a/src/package.json b/src/package.json index 6faef5d..11f7a82 100644 --- a/src/package.json +++ b/src/package.json @@ -4,7 +4,7 @@ "description": "Cross platform cryptocurrency tracker", "homepage": "https://harshjv.github.io/donut/", "license": "MIT", - "version": "2.3.1", + "version": "2.4.0", "main": "main.js", "repository": "https://github.com/harshjv/donut", "keywords": [ @@ -22,6 +22,7 @@ "url": "https://harshjv.github.io" }, "dependencies": { + "electron-settings": "^2.2.2", "menubar": "^5.1.0" } }