feat: add KWMv2 support

This commit is contained in:
鲁树人
2023-06-17 14:29:50 +01:00
parent 6f1d1423fe
commit 32dbed45cb
8 changed files with 112 additions and 20 deletions

View File

@@ -5,6 +5,7 @@ import type { AppStore } from '~/store';
import { settingsSlice, setProductionChanges, ProductionSettings } from './settingsSlice';
import { enumObject } from '~/util/objects';
import { getLogger } from '~/util/logUtils';
import { parseKwm2ProductionKey } from './keyFormats';
const DEFAULT_STORAGE_KEY = 'um-react-settings';
@@ -22,6 +23,16 @@ function mergeSettings(settings: ProductionSettings): ProductionSettings {
draft.qmc2.allowFuzzyNameSearch = allowFuzzyNameSearch;
}
}
if (settings?.kwm2) {
const { keys } = settings.kwm2;
for (const [k, v] of enumObject(keys)) {
if (typeof v === 'string' && parseKwm2ProductionKey(k)) {
draft.kwm2.keys[k] = v;
}
}
}
});
}