From 91d9c789a22aa4eef304fbc614a5eefe77309978 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Mon, 27 Jan 2025 04:18:46 +0100 Subject: [PATCH] simplify code --- src/plugins/lastfm/index.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/lastfm/index.tsx b/src/plugins/lastfm/index.tsx index 23a0edce..392bd90f 100644 --- a/src/plugins/lastfm/index.tsx +++ b/src/plugins/lastfm/index.tsx @@ -86,7 +86,7 @@ const placeholderId = "2a96cbd8b46e442fc41c2b86b821562f"; const logger = new Logger("LastFMRichPresence"); -const presenceStore = findByPropsLazy("getLocalPresence"); +const PresenceStore = findByPropsLazy("getLocalPresence"); async function getApplicationAsset(key: string): Promise { return (await ApplicationAssetUtils.fetchAssetIds(applicationId, [key]))[0]; @@ -280,13 +280,13 @@ export default definePlugin({ async getActivity(): Promise { if (settings.store.hideWithActivity) { - for (const activity of presenceStore.getActivities()) { - if (activity.application_id !== applicationId) { - return null; - } + if (PresenceStore.getActivities().some(a => a.application_id !== applicationId)) { + return null; } - } else if (settings.store.hideWithSpotify) { - for (const activity of presenceStore.getActivities()) { + } + + if (settings.store.hideWithSpotify) { + for (const activity of PresenceStore.getActivities()) { if (activity.type === ActivityType.LISTENING && activity.application_id !== applicationId) { // there is already music status because of Spotify or richerCider (probably more) return null;