mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-07-09 19:27:31 +08:00
refactor(playHistory): v1 旧 localStorage key 清理与调用方对齐
老用户升级后清掉 v1 时代独立 key 释放配额,调用方切到 store API。
- player.ts initializePlayState 调用从 migrateFromLocalStorage 切到
cleanupLegacyPlayHistoryStorage:不再做数据迁移(历史是低关键性
衍生数据,老用户重新听几次即可),仅清掉旧 musicHistory/podcastHistory/
playlistHistory/albumHistory/podcastRadioHistory/playHistory-migrated/
playMode 这 7 个旧 key,避免和新 play-history-store key 双倍占用
- SystemTab.vue 清缓存的 case 'history' 改走 usePlayHistoryStore().
clearMusicHistory(),与 v1 时代行为对齐(只清音乐历史,不动 podcast/
playlist/album/podcastRadio);移除 case 'settings' 里的
removeItem('playMode')——已并入 player-core-store
This commit is contained in:
@@ -124,6 +124,7 @@ import { useI18n } from 'vue-i18n';
|
||||
|
||||
import localData from '@/../main/set.json';
|
||||
import ClearCacheSettings from '@/components/settings/ClearCacheSettings.vue';
|
||||
import { usePlayHistoryStore } from '@/store/modules/playHistory';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
import { isElectron } from '@/utils';
|
||||
import { openDirectory, selectDirectory } from '@/utils/fileOperation';
|
||||
@@ -435,7 +436,10 @@ const clearCache = async (selectedCacheTypes: string[]) => {
|
||||
const clearTasks = selectedCacheTypes.map(async (type) => {
|
||||
switch (type) {
|
||||
case 'history':
|
||||
localStorage.removeItem('musicHistory');
|
||||
// 与旧版本行为对齐:只清音乐历史,不动 podcast/playlist/album/podcastRadio。
|
||||
// 数据已迁到 pinia store(key=play-history-store),老 musicHistory key 由
|
||||
// cleanupLegacyPlayHistoryStorage 在启动时清掉,这里不再需要 removeItem
|
||||
usePlayHistoryStore().clearMusicHistory();
|
||||
break;
|
||||
case 'favorite':
|
||||
localStorage.removeItem('favoriteList');
|
||||
@@ -451,7 +455,6 @@ const clearCache = async (selectedCacheTypes: string[]) => {
|
||||
localStorage.removeItem('theme');
|
||||
localStorage.removeItem('lyricData');
|
||||
localStorage.removeItem('lyricFontSize');
|
||||
localStorage.removeItem('playMode');
|
||||
break;
|
||||
case 'downloads':
|
||||
if (window.electron) {
|
||||
|
||||
Reference in New Issue
Block a user