MusicControls: Migrate Settings

This commit is contained in:
thororen1234 2025-08-12 20:02:25 -04:00
parent 553c4adc5e
commit 348261b1e8
No known key found for this signature in database
2 changed files with 11 additions and 25 deletions

View file

@ -102,7 +102,15 @@ export default definePlugin({
},
async start() {
if (Settings.plugins?.SpotifyControls?.enabled) {
settings.store.showSpotifyControls = true;
Settings.plugins.SpotifyControls.enabled = false;
}
if (Settings.plugins?.SpotifyLyrics?.enabled) {
settings.store.showSpotifyLyrics = true;
Settings.plugins.SpotifyLyrics.enabled = false;
}
await migrateOldLyrics();
toggleHoverControls(Settings.plugins.MusicControls.hoverControls);
toggleHoverControls(settings.store.hoverControls);
},
});

View file

@ -6,13 +6,11 @@
import { definePluginSettings } from "@api/Settings";
import { disableStyle, enableStyle } from "@api/Styles";
import { useAwaiter } from "@utils/react";
import { makeRange, OptionType } from "@utils/types";
import { Button, Forms, MaskedLink, showToast, Text, Toasts, useMemo } from "@webpack/common";
import { Button, Forms, MaskedLink, showToast, Toasts } from "@webpack/common";
import hoverOnlyStyle from "./hoverOnly.css?managed";
import { clearLyricsCache, getLyricsCount } from "./spotify/lyrics/api";
import { useLyrics } from "./spotify/lyrics/components/util";
import { clearLyricsCache } from "./spotify/lyrics/api";
import { Provider } from "./spotify/lyrics/providers/types";
const sliderOptions = {
@ -24,26 +22,6 @@ export function toggleHoverControls(value: boolean) {
(value ? enableStyle : disableStyle)(hoverOnlyStyle);
}
function Details() {
const { lyricsInfo } = useLyrics();
const [count, error, loading] = useAwaiter(
useMemo(() => getLyricsCount, []),
{
onError: () => console.error("Failed to get lyrics count"),
fallbackValue: null,
}
);
return (
<>
<Text>Current lyrics provider: {lyricsInfo?.useLyric || "None"}</Text>
{loading ? <Text>Loading lyrics count...</Text> : error ? <Text>Failed to get lyrics count</Text> : <Text>Lyrics count: {count}</Text>}
</>
);
}
function InstallInstructions() {
return (
<Forms.FormSection>