feat: import ekey from Android db (#20)

This commit is contained in:
鲁树人 committed 2023-06-11 16:22:57 +01:00
1 parent ec27a6f699
commit b78399eddb
16 files changed
+1080 -108

No files matched your search

+6 -1
View File
@@ -36,7 +36,7 @@ const stagingToProduction = (staging: StagingSettings): ProductionSettings => ({
qmc2: {
keys: objectify(
staging.qmc2.keys,
(item) => item.name,
(item) => item.name.normalize(),
(item) => item.key
),
},
@@ -61,6 +61,10 @@ export const settingsSlice = createSlice({
qmc2AddKey(state) {
state.staging.qmc2.keys.push({ id: nanoid(), name: '', key: '' });
},
qmc2ImportKeys(state, { payload }: PayloadAction<{ name: string; key: string }[]>) {
const newItems = payload.map((item) => ({ id: nanoid(), ...item }));
state.staging.qmc2.keys.push(...newItems);
},
qmc2DeleteKey(state, { payload: { id } }: PayloadAction<{ id: string }>) {
const qmc2 = state.staging.qmc2;
qmc2.keys = qmc2.keys.filter((item) => item.id !== id);
@@ -102,6 +106,7 @@ export const {
qmc2UpdateKey,
qmc2DeleteKey,
qmc2ClearKeys,
qmc2ImportKeys,
commitStagingChange,
discardStagingChanges,