Skip to content

Commit

Permalink
Persist coin and currency setting
Browse files Browse the repository at this point in the history
  • Loading branch information
harshjv committed Mar 13, 2017
1 parent 8c13f34 commit d7651b7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 25 deletions.
22 changes: 1 addition & 21 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -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')
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 8 additions & 2 deletions src/app/stores/CurrencyStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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 () {
Expand Down
3 changes: 2 additions & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -22,6 +22,7 @@
"url": "https://harshjv.github.io"
},
"dependencies": {
"electron-settings": "^2.2.2",
"menubar": "^5.1.0"
}
}

0 comments on commit d7651b7

Please sign in to comment.