将下载列表与我的列表分离存储
parent
0c63268df1
commit
e848fda4e3
|
@ -150,6 +150,9 @@ exports.initSetting = () => {
|
||||||
const electronStore_config = new Store({
|
const electronStore_config = new Store({
|
||||||
name: 'config',
|
name: 'config',
|
||||||
})
|
})
|
||||||
|
const electronStore_downloadList = new Store({
|
||||||
|
name: 'downloadList',
|
||||||
|
})
|
||||||
let setting = electronStore_config.get('setting')
|
let setting = electronStore_config.get('setting')
|
||||||
if (setting) {
|
if (setting) {
|
||||||
let version = electronStore_config.get('version')
|
let version = electronStore_config.get('version')
|
||||||
|
@ -165,7 +168,7 @@ exports.initSetting = () => {
|
||||||
}
|
}
|
||||||
const downloadList = electronStore_config.get('download')
|
const downloadList = electronStore_config.get('download')
|
||||||
if (downloadList) {
|
if (downloadList) {
|
||||||
if (downloadList.list) electronStore_list.set('downloadList', downloadList.list)
|
if (downloadList.list) electronStore_downloadList.set('list', downloadList.list)
|
||||||
electronStore_config.delete('download')
|
electronStore_config.delete('download')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,6 +184,13 @@ exports.initSetting = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 从我的列表分离下载列表 v1.7.0 后
|
||||||
|
let downloadList = electronStore_list.get('downloadList')
|
||||||
|
if (downloadList) {
|
||||||
|
electronStore_downloadList.set('list', downloadList)
|
||||||
|
electronStore_list.delete('downloadList')
|
||||||
|
}
|
||||||
|
|
||||||
const { version: settingVersion, setting: newSetting } = exports.mergeSetting(setting, electronStore_config.get('version'))
|
const { version: settingVersion, setting: newSetting } = exports.mergeSetting(setting, electronStore_config.get('version'))
|
||||||
|
|
||||||
// 重置 ^0.18.2 排行榜ID
|
// 重置 ^0.18.2 排行榜ID
|
||||||
|
|
|
@ -3,6 +3,7 @@ const { mainOn, NAMES: { mainWindow: ipcMainWindowNames }, mainHandle } = requir
|
||||||
|
|
||||||
|
|
||||||
let electronStore_list
|
let electronStore_list
|
||||||
|
let electronStore_downloadList
|
||||||
|
|
||||||
mainHandle(ipcMainWindowNames.get_playlist, async(event, isIgnoredError = false) => {
|
mainHandle(ipcMainWindowNames.get_playlist, async(event, isIgnoredError = false) => {
|
||||||
if (!electronStore_list) {
|
if (!electronStore_list) {
|
||||||
|
@ -11,13 +12,29 @@ mainHandle(ipcMainWindowNames.get_playlist, async(event, isIgnoredError = false)
|
||||||
clearInvalidConfig: !isIgnoredError,
|
clearInvalidConfig: !isIgnoredError,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if (!electronStore_downloadList) {
|
||||||
|
electronStore_downloadList = new Store({
|
||||||
|
name: 'downloadList',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
defaultList: electronStore_list.get('defaultList'),
|
defaultList: electronStore_list.get('defaultList'),
|
||||||
loveList: electronStore_list.get('loveList'),
|
loveList: electronStore_list.get('loveList'),
|
||||||
userList: electronStore_list.get('userList'),
|
userList: electronStore_list.get('userList'),
|
||||||
downloadList: electronStore_list.get('downloadList'),
|
downloadList: electronStore_downloadList.get('list'),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
mainOn(ipcMainWindowNames.save_playlist, (event, { type, data }) => electronStore_list && electronStore_list.set(type, data))
|
mainOn(ipcMainWindowNames.save_playlist, (event, { type, data }) => {
|
||||||
|
switch (type) {
|
||||||
|
case 'defaultList':
|
||||||
|
case 'loveList':
|
||||||
|
case 'userList':
|
||||||
|
electronStore_list && electronStore_list.set(type, data)
|
||||||
|
break
|
||||||
|
case 'downloadList':
|
||||||
|
electronStore_downloadList && electronStore_downloadList.set(type, data)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
Loading…
Reference in New Issue