Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ransome1 committed Oct 31, 2023
2 parents ca87dcb + af6f18c commit 1b53d45
Showing 1 changed file with 44 additions and 51 deletions.
95 changes: 44 additions & 51 deletions src/main/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,53 +17,6 @@ if (!fs.existsSync(userDataDirectory)) fs.mkdirSync(userDataDirectory)
console.log('config.ts: sleek userdata is located at: ' + userDataDirectory);

const customStylesPath = path.join(userDataDirectory, 'customStyles.css');

const defaultConfigData = {
sorting: [
{ id: '1', value: 'priority', invert: false },
{ id: '2', value: 'projects', invert: false },
{ id: '3', value: 'contexts', invert: false },
{ id: '4', value: 'due', invert: false },
{ id: '5', value: 't', invert: false },
{ id: '6', value: 'completed', invert: false },
{ id: '7', value: 'created', invert: false },
{ id: '8', value: 'rec', invert: false },
{ id: '9', value: 'pm', invert: false },
],
accordionOpenState: [
true,
true,
true,
false,
false,
false,
false,
false,
false
],
files: [],
appendCreationDate: false,
showCompleted: true,
showHidden: false,
windowMaximized: false,
fileSorting: false,
convertRelativeToAbsoluteDates: true,
thresholdDateInTheFuture: true,
dueDateInTheFuture: true,
colorTheme: 'system',
shouldUseDarkColors: false,
notificationsAllowed: true,
notificationThreshold: 2,
showFileTabs: true,
isNavigationOpen: true,
customStylesPath: customStylesPath,
tray: false,
zoom: 100,
multilineTextField: false,
useMultilineForBulkTodoCreation: false,
matomo: true,
};

const configPath = path.join(userDataDirectory, 'config.json');
const configStorage = new Store<ConfigData>({
cwd: userDataDirectory,
Expand All @@ -72,6 +25,50 @@ const configStorage = new Store<ConfigData>({
console.log(`[config.json] migrating from ${context.fromVersion}${context.toVersion}`);
},
migrations: {
'2.0.0': store => {
store.set('sorting', [
{ id: '1', value: 'priority', invert: false },
{ id: '2', value: 'projects', invert: false },
{ id: '3', value: 'contexts', invert: false },
{ id: '4', value: 'due', invert: false },
{ id: '5', value: 't', invert: false },
{ id: '6', value: 'completed', invert: false },
{ id: '7', value: 'created', invert: false },
{ id: '8', value: 'rec', invert: false },
{ id: '9', value: 'pm', invert: false },
]);
store.set('accordionOpenState', [
true,
true,
true,
false,
false,
false,
false,
false,
false
]);
store.set('files', []);
store.set('appendCreationDate', false);
store.set('showCompleted', true);
store.set('showHidden', false);
store.set('windowMaximized', false);
store.set('fileSorting', false);
store.set('convertRelativeToAbsoluteDates', true);
store.set('thresholdDateInTheFuture', true);
store.set('colorTheme', 'system');
store.set('shouldUseDarkColors', false);
store.set('notificationsAllowed', true);
store.set('notificationThreshold', 2);
store.set('showFileTabs', true);
store.set('isNavigationOpen', true);
store.set('customStylesPath', customStylesPath);
store.set('tray', false);
store.set('zoom', 100);
store.set('multilineTextField', false);
store.set('useMultilineForBulkTodoCreation', false);
store.set('matomo', true);
},
'2.0.1': store => {
store.set('anonymousUserId', anonymousUserId);
},
Expand All @@ -80,10 +77,6 @@ const configStorage = new Store<ConfigData>({
const filtersPath = path.join(userDataDirectory, 'filters.json');
const filterStorage = new Store<{}>({ cwd: userDataDirectory, name: 'filters' });

if (!fs.existsSync(configPath)) {
fs.writeFileSync(configPath, JSON.stringify(defaultConfigData, null, 2));
}

if (!fs.existsSync(filtersPath)) {
const defaultFilterData = {};
fs.writeFileSync(filtersPath, JSON.stringify(defaultFilterData));
Expand Down

0 comments on commit 1b53d45

Please sign in to comment.