feat: add basic instruction to paste device key from qtfm-device-id

This commit is contained in:
鲁树人
2023-12-21 19:34:37 +00:00
parent 4498ab6592
commit 83b06dbe60
10 changed files with 126 additions and 81 deletions

View File

@@ -2,11 +2,10 @@ import { debounce } from 'radash';
import { produce } from 'immer';
import type { AppStore } from '~/store';
import { settingsSlice, setProductionChanges, ProductionSettings, QINGTING_DEVICE_INFO_KEY } from './settingsSlice';
import { settingsSlice, setProductionChanges, ProductionSettings } from './settingsSlice';
import { enumObject } from '~/util/objects';
import { getLogger } from '~/util/logUtils';
import { parseKwm2ProductionKey } from './keyFormats';
import type { QingTingDeviceInfo } from '@jixun/libparakeet';
const DEFAULT_STORAGE_KEY = 'um-react-settings';
@@ -35,14 +34,8 @@ function mergeSettings(settings: ProductionSettings): ProductionSettings {
}
}
if (settings?.qtfm?.android) {
const qtfmAndroid = settings.qtfm.android;
draft.qtfm.android = Object.fromEntries(
QINGTING_DEVICE_INFO_KEY.map((key) => {
const value = qtfmAndroid[key];
return [key, typeof value === 'string' ? value : ''];
}),
) as unknown as QingTingDeviceInfo;
if (typeof settings?.qtfm?.android === 'string') {
draft.qtfm.android = settings.qtfm.android.replace(/[^0-9a-fA-F]/g, '');
}
});
}