WIP - Information for locations.
Better configuration menu. Testing retrieving JSON from GitHub (uploading).
This commit is contained in:
+23
-3
@@ -12,7 +12,9 @@ export default class Preferences {
|
||||
|
||||
static get(key) {
|
||||
const config = this._getConfig();
|
||||
return config[key];
|
||||
const value = config[key];
|
||||
if (value === undefined) return this._getFromDefault(key);
|
||||
return value;
|
||||
}
|
||||
|
||||
static save(config) {
|
||||
@@ -33,15 +35,33 @@ export default class Preferences {
|
||||
return JSON.parse(storageConfig);
|
||||
}
|
||||
|
||||
static _getFromDefault(key) {
|
||||
const defaultPreferences = this._default();
|
||||
return defaultPreferences[key];
|
||||
}
|
||||
|
||||
static _default() {
|
||||
return {
|
||||
enabled: true,
|
||||
|
||||
'max-price': 120_000,
|
||||
'max-price-per-meter': 1_500,
|
||||
percentages: true,
|
||||
percentages_20: true,
|
||||
percentages_30: true,
|
||||
percentages_50: false,
|
||||
|
||||
garage: false,
|
||||
exterior: true,
|
||||
lift: true,
|
||||
'max-price': 120_000,
|
||||
'max-price-per-meter': 1_500
|
||||
|
||||
bus: false,
|
||||
train: false,
|
||||
supermarket: true,
|
||||
smoke: false,
|
||||
pharmacy: true,
|
||||
gym: false,
|
||||
pool: true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user