Skip to content

Commit

Permalink
chore: add migration for new keybinds
Browse files Browse the repository at this point in the history
  • Loading branch information
marcincichocki authored Oct 15, 2022
1 parent 41f5db6 commit 207ed6b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/electron/main/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,32 @@ export class Store {
store.set(option.id, '');
}
},
'>=2.8.0': (store) => {
const newKeyBinds = options.filter(
(o) =>
o.id === 'keyBindWithPriority6' || o.id === 'keyBindWithPriority7'
);
const values = newKeyBinds.map(({ defaultValue }) =>
normalize(defaultValue as string)
);
const conflict = [
'keyBind',
'keyBindWithPriority1',
'keyBindWithPriority2',
'keyBindWithPriority3',
'keyBindWithPriority4',
'keyBindWithPriority5',
'keyBindAnalyze',
]
.map((k) => normalize(store.get(k)))
.some((v) => values.includes(v));

if (conflict) {
newKeyBinds.forEach((option) => {
store.set(option.id, '');
});
}
},
},
});

Expand Down

0 comments on commit 207ed6b

Please sign in to comment.