mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-25 07:47:18 +00:00
Remove settings.getDefaults function
Change-type: patch
This commit is contained in:
parent
9caa42d257
commit
6fcd9e1595
@ -23,7 +23,8 @@ import * as localSettings from './local-settings';
|
||||
|
||||
const debug = _debug('etcher:models:settings');
|
||||
|
||||
const DEFAULT_SETTINGS: _.Dictionary<any> = {
|
||||
// exported for tests
|
||||
export const DEFAULT_SETTINGS: _.Dictionary<any> = {
|
||||
unsafeMode: false,
|
||||
errorReporting: true,
|
||||
unmountOnSuccess: true,
|
||||
@ -107,11 +108,3 @@ export function getAll() {
|
||||
debug('getAll');
|
||||
return _.cloneDeep(settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Get the default setting values
|
||||
*/
|
||||
export function getDefaults() {
|
||||
debug('getDefaults');
|
||||
return _.cloneDeep(DEFAULT_SETTINGS);
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ import * as settings from './app/models/settings';
|
||||
import * as analytics from './app/modules/analytics';
|
||||
import { buildWindowMenu } from './menu';
|
||||
|
||||
const config = settings.getDefaults();
|
||||
const configUrl =
|
||||
settings.get('configUrl') || 'https://balena.io/etcher/static/config.json';
|
||||
const updatablePackageTypes = ['appimage', 'nsis', 'dmg'];
|
||||
@ -58,17 +57,18 @@ async function checkForUpdates(interval: number) {
|
||||
}
|
||||
|
||||
function createMainWindow() {
|
||||
const fullscreen = Boolean(settings.get('fullscreen'));
|
||||
const mainWindow = new electron.BrowserWindow({
|
||||
width: parseInt(config.width, 10) || 800,
|
||||
height: parseInt(config.height, 10) || 480,
|
||||
frame: !config.fullscreen,
|
||||
width: parseInt(settings.get('width'), 10) || 800,
|
||||
height: parseInt(settings.get('height'), 10) || 480,
|
||||
frame: !fullscreen,
|
||||
useContentSize: false,
|
||||
show: false,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
fullscreen: Boolean(config.fullscreen),
|
||||
fullscreenable: Boolean(config.fullscreen),
|
||||
kiosk: Boolean(config.fullscreen),
|
||||
fullscreen,
|
||||
fullscreenable: fullscreen,
|
||||
kiosk: fullscreen,
|
||||
autoHideMenuBar: true,
|
||||
titleBarStyle: 'hiddenInset',
|
||||
icon: path.join(__dirname, '..', '..', 'assets', 'icon.png'),
|
||||
@ -149,8 +149,7 @@ electron.app.on('before-quit', () => {
|
||||
|
||||
async function main(): Promise<void> {
|
||||
try {
|
||||
const localSettings = await settings.load();
|
||||
Object.assign(config, localSettings);
|
||||
await settings.load();
|
||||
} catch (error) {
|
||||
// TODO: What do if loading the config fails?
|
||||
console.error('Error loading settings:');
|
||||
|
@ -36,7 +36,7 @@ describe('Browser: settings', function() {
|
||||
return settings.reset();
|
||||
});
|
||||
|
||||
const DEFAULT_SETTINGS = settings.getDefaults();
|
||||
const DEFAULT_SETTINGS = _.cloneDeep(settings.DEFAULT_SETTINGS);
|
||||
|
||||
it('should be able to set and read values', function() {
|
||||
expect(settings.get('foo')).to.be.undefined;
|
||||
|
Loading…
x
Reference in New Issue
Block a user