Skip to content

Commit

Permalink
fix: nox import
Browse files Browse the repository at this point in the history
  • Loading branch information
lovegaoshi committed Nov 27, 2024
1 parent e1fb830 commit 82ab38a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/components/setting/SyncSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ export default () => {
title={t('Sync.SyncCheck')}
options={noxExtensionContent}
onClose={() => setSyncCheckVisible(false)}
onSubmit={syncPartialNoxExtension}
onSubmit={i => {
syncPartialNoxExtension(i);
setSyncCheckVisible(false);
}}
/>
</View>
);
Expand Down
8 changes: 7 additions & 1 deletion src/components/setting/sync/useSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ const useSync = () => {
const checkedPlaylists = checkedPlaylistIndexes
.map((val, index) =>
val
? cachedParsedContent[cachedParsedContent.MyFavList[index]]
? {
...cachedParsedContent[cachedParsedContent.MyFavList[index]],
songList:
cachedParsedContent[
`${cachedParsedContent.MyFavList[index]}-songList`
],
}
: undefined,
)
.filter(val => val);
Expand Down
9 changes: 5 additions & 4 deletions src/utils/ChromeStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,10 @@ const saveImportedPlaylist = async (playlists: any[]) => {
export const clearPlaylistNImport = async (parsedContent: any) => {
await clearPlaylists();
await saveImportedPlaylist(
parsedContent[StorageKeys.MY_FAV_LIST_KEY].map(
(val: string) => parsedContent[val],
),
parsedContent[StorageKeys.MY_FAV_LIST_KEY].map((val: string) => ({
...parsedContent[val],
songList: parsedContent[`${val}-songList`],
})),
);
await savePlaylistIds(parsedContent[StorageKeys.MY_FAV_LIST_KEY]);
};
Expand All @@ -262,7 +263,7 @@ export const addImportedPlaylist = async (playlists: any[]) => {
await saveImportedPlaylist(playlists);
await savePlaylistIds(
(await getItem(StorageKeys.MY_FAV_LIST_KEY)).concat(
playlists.map(val => val.info.id),
playlists.map(val => val.id),
),
);
};
Expand Down

0 comments on commit 82ab38a

Please sign in to comment.