From 9964b31626f0a7afd48238ef1fc2e8d0b8b456d3 Mon Sep 17 00:00:00 2001 From: amsyarasyiq <82711525+amsyarasyiq@users.noreply.github.com> Date: Wed, 5 Apr 2023 17:43:33 +0800 Subject: [PATCH] Last.fm: GAHH --- plugins/Last.fm/src/Settings.tsx | 2 +- plugins/Last.fm/src/index.ts | 2 +- plugins/Last.fm/src/types.ts | 36 -------------------------------- plugins/Last.fm/src/utils.ts | 7 +++++++ plugins/defs.d.ts | 21 +++++++++++++++++++ 5 files changed, 30 insertions(+), 38 deletions(-) delete mode 100644 plugins/Last.fm/src/types.ts diff --git a/plugins/Last.fm/src/Settings.tsx b/plugins/Last.fm/src/Settings.tsx index 8c96d71..4bbeed2 100644 --- a/plugins/Last.fm/src/Settings.tsx +++ b/plugins/Last.fm/src/Settings.tsx @@ -34,7 +34,7 @@ function UpdateButton() { } export default function Settings() { - const settings = useProxy(storage) as PluginSettings; + const settings = useProxy(storage) as LFMSettings; const navigation = NavigationNative.useNavigation(); useEffect(() => { diff --git a/plugins/Last.fm/src/index.ts b/plugins/Last.fm/src/index.ts index c45c718..e568ba5 100644 --- a/plugins/Last.fm/src/index.ts +++ b/plugins/Last.fm/src/index.ts @@ -13,7 +13,7 @@ export const global = {} as { }; plugin.storage.ignoreSpotify ??= true; -export const currentSettings = { ...plugin.storage } as PluginSettings; +export const currentSettings = { ...plugin.storage } as LFMSettings; // Discord modules that we need export const UserStore = findByStoreName("UserStore"); diff --git a/plugins/Last.fm/src/types.ts b/plugins/Last.fm/src/types.ts deleted file mode 100644 index 72668c3..0000000 --- a/plugins/Last.fm/src/types.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -type PluginSettings = { - /** Application's name */ - appName: string; - /** User's last.fm username */ - username: string; - /** Whether or not to show the timestamp */ - showTimestamp: boolean; - /** The time interval between each update */ - timeInterval: number; - /** Whether or not to show "Listening to" */ - listeningTo: boolean; - /** Ignore when Spotify is running */ - ignoreSpotify: boolean; - /** Whether or not to show verbose logging */ - verboseLogging: boolean; -}; - -enum ActivityType { - PLAYING = 0, - STREAMING = 1, - LISTENING = 2, - COMPETING = 5 -} - -// Last.fm track -type Track = { - name: string; - artist: string; - album: string; - albumArt: string; - url: string; - date: string; - nowPlaying: boolean; - loved: boolean; -} diff --git a/plugins/Last.fm/src/utils.ts b/plugins/Last.fm/src/utils.ts index 4ca4aef..e65698c 100644 --- a/plugins/Last.fm/src/utils.ts +++ b/plugins/Last.fm/src/utils.ts @@ -8,6 +8,13 @@ import Constants from "./constants"; const AssetManager = findByProps("getAssetIds"); const PresenceStore = findByStoreName("PresenceStore"); +enum ActivityType { + PLAYING = 0, + STREAMING = 1, + LISTENING = 2, + COMPETING = 5 +} + /** Fetches the latest user's scrobble */ async function fetchLatestScrobble(): Promise { const params = new URLSearchParams({ diff --git a/plugins/defs.d.ts b/plugins/defs.d.ts index e1dde06..e855bca 100644 --- a/plugins/defs.d.ts +++ b/plugins/defs.d.ts @@ -24,3 +24,24 @@ type ActivityAssets = { small_image?: string; small_text?: string; }; + +type LFMSettings = { + appName: string; + username: string; + showTimestamp: boolean; + timeInterval: number; + listeningTo: boolean; + ignoreSpotify: boolean; + verboseLogging: boolean; +}; + +type Track = { + name: string; + artist: string; + album: string; + albumArt: string; + url: string; + date: string; + nowPlaying: boolean; + loved: boolean; +}