mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-08 17:39:59 +02:00
Refactor ZenKeyboardShortcuts to use static method for default shortcuts retrieval
This commit is contained in:
parent
9a7f2fadf3
commit
cd2df06a10
1 changed files with 141 additions and 141 deletions
|
@ -578,9 +578,8 @@ class ZenKeyboardShortcutsLoader {
|
||||||
async remove() {
|
async remove() {
|
||||||
await IOUtils.remove(this.shortcutsFile);
|
await IOUtils.remove(this.shortcutsFile);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function zenGetDefaultShortcuts() {
|
static zenGetDefaultShortcuts() {
|
||||||
// DO NOT CHANGE ANYTHING HERE
|
// DO NOT CHANGE ANYTHING HERE
|
||||||
// For adding new default shortcuts, add them to inside the migration function
|
// For adding new default shortcuts, add them to inside the migration function
|
||||||
// and increment the version number.
|
// and increment the version number.
|
||||||
|
@ -728,6 +727,7 @@ function zenGetDefaultShortcuts() {
|
||||||
|
|
||||||
return newShortcutList;
|
return newShortcutList;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class ZenKeyboardShortcutsVersioner {
|
class ZenKeyboardShortcutsVersioner {
|
||||||
static LATEST_KBS_VERSION = 6;
|
static LATEST_KBS_VERSION = 6;
|
||||||
|
@ -789,7 +789,7 @@ class ZenKeyboardShortcutsVersioner {
|
||||||
// Migrate from 0 to 1
|
// Migrate from 0 to 1
|
||||||
// Here, we do a complet reset of the shortcuts,
|
// Here, we do a complet reset of the shortcuts,
|
||||||
// since nothing seems to work properly.
|
// since nothing seems to work properly.
|
||||||
data = zenGetDefaultShortcuts();
|
data = ZenKeyboardShortcutsLoader.zenGetDefaultShortcuts();
|
||||||
}
|
}
|
||||||
if (version < 2) {
|
if (version < 2) {
|
||||||
// Migrate from 1 to 2
|
// Migrate from 1 to 2
|
||||||
|
@ -819,7 +819,7 @@ class ZenKeyboardShortcutsVersioner {
|
||||||
// detection for internal keys was not working properly, so every internal
|
// detection for internal keys was not working properly, so every internal
|
||||||
// shortcut was being saved as a user-editable shortcut.
|
// shortcut was being saved as a user-editable shortcut.
|
||||||
// This migration will fix this issue.
|
// This migration will fix this issue.
|
||||||
const defaultShortcuts = zenGetDefaultShortcuts();
|
const defaultShortcuts = ZenKeyboardShortcutsLoader.zenGetDefaultShortcuts();
|
||||||
// Get the default shortcut, compare the id and set the internal flag if needed
|
// Get the default shortcut, compare the id and set the internal flag if needed
|
||||||
for (let shortcut of data) {
|
for (let shortcut of data) {
|
||||||
for (let defaultShortcut of defaultShortcuts) {
|
for (let defaultShortcut of defaultShortcuts) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue