-
Notifications
You must be signed in to change notification settings - Fork 579
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
862 additions
and
641 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,30 @@ | ||
import electron from 'electron'; | ||
import path from 'path'; | ||
|
||
const app = process.type === 'renderer' ? electron.remote.app : electron.app; | ||
|
||
export const CHECK_INTERVAL = 1000 * 3600; // How often should we perform checks | ||
export const LOCAL_API = 'http://localhost:3000'; | ||
export const DEV_API = 'https://dev.franzinfra.com'; | ||
export const LIVE_API = 'https://api.franzinfra.com'; | ||
export const GA_ID = 'UA-74126766-6'; | ||
|
||
export const DEFAULT_APP_SETTINGS = { | ||
autoLaunchOnStart: true, | ||
autoLaunchInBackground: false, | ||
runInBackground: true, | ||
enableSystemTray: true, | ||
minimizeToSystemTray: false, | ||
showDisabledServices: true, | ||
showMessageBadgeWhenMuted: true, | ||
enableSpellchecking: true, | ||
// spellcheckingLanguage: 'auto', | ||
locale: '', | ||
fallbackLocale: 'en-US', | ||
beta: false, | ||
isAppMuted: false, | ||
enableGPUAcceleration: true, | ||
}; | ||
|
||
export const FRANZ_SERVICE_REQUEST = 'http://bit.ly/franz-service-request'; | ||
export const FRANZ_TRANSLATION = 'http://bit.ly/franz-translate'; | ||
|
||
export const SETTINGS_PATH = path.join(app.getPath('userData'), 'config', 'settings.json'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,42 @@ | ||
import { observable } from 'mobx'; | ||
import { observable, toJS } from 'mobx'; | ||
import { pathExistsSync, outputJsonSync, readJsonSync } from 'fs-extra'; | ||
|
||
import { DEFAULT_APP_SETTINGS } from '../config'; | ||
import { SETTINGS_PATH, DEFAULT_APP_SETTINGS } from '../config'; | ||
|
||
const debug = require('debug')('Settings'); | ||
|
||
export default class Settings { | ||
@observable store = { | ||
autoLaunchOnStart: DEFAULT_APP_SETTINGS.autoLaunchOnStart, | ||
autoLaunchInBackground: DEFAULT_APP_SETTINGS.autoLaunchInBackground, | ||
runInBackground: DEFAULT_APP_SETTINGS.runInBackground, | ||
enableSystemTray: DEFAULT_APP_SETTINGS.enableSystemTray, | ||
minimizeToSystemTray: DEFAULT_APP_SETTINGS.minimizeToSystemTray, | ||
locale: DEFAULT_APP_SETTINGS.locale, | ||
beta: DEFAULT_APP_SETTINGS.beta, | ||
}; | ||
@observable store = DEFAULT_APP_SETTINGS; | ||
|
||
constructor() { | ||
if (!pathExistsSync(SETTINGS_PATH)) { | ||
this._writeFile(); | ||
} else { | ||
this._hydrate(); | ||
} | ||
} | ||
|
||
set(settings) { | ||
this.store = Object.assign(this.store, settings); | ||
|
||
this._writeFile(); | ||
} | ||
|
||
all() { | ||
get all() { | ||
return this.store; | ||
} | ||
|
||
get(key) { | ||
return this.store[key]; | ||
} | ||
|
||
_hydrate() { | ||
this.store = readJsonSync(SETTINGS_PATH); | ||
debug('Hydrate store', toJS(this.store)); | ||
} | ||
|
||
_writeFile() { | ||
outputJsonSync(SETTINGS_PATH, this.store); | ||
debug('Write settings file', toJS(this.store)); | ||
} | ||
} |
Oops, something went wrong.