add old settings migration

This commit is contained in:
LenAnderson 2023-12-22 13:00:02 +00:00
parent f90e60783c
commit cbceb7d1e8
1 changed files with 10 additions and 7 deletions

View File

@ -13,11 +13,6 @@ import { SettingsUi } from './src/ui/SettingsUi.js';
//TODO move advanced QR options into own UI class
const _VERBOSE = true;
export const log = (...msg) => _VERBOSE ? console.log('[QR2]', ...msg) : null;
export const warn = (...msg) => _VERBOSE ? console.warn('[QR2]', ...msg) : null;
@ -123,9 +118,17 @@ const loadSets = async () => {
};
const loadSettings = async () => {
//TODO migrate old settings
if (!extension_settings.quickReplyV2) {
if (!extension_settings.quickReply) {
extension_settings.quickReplyV2 = defaultSettings;
} else {
extension_settings.quickReplyV2 = {
isEnabled: extension_settings.quickReply.quickReplyEnabled ?? false,
isCombined: false,
isPopout: false,
config: extension_settings.quickReply.selectedPreset ?? extension_settings.quickReply.name ?? 'Default',
};
}
}
try {
settings = QuickReplySettings.from(extension_settings.quickReplyV2);