Skip to content

Commit

Permalink
B"Spotify"I: Real fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pylixonly committed Jul 26, 2023
1 parent de52c10 commit 1843ff4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugins/BetterSpotifyIntegration/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { findByName } from "@vendetta/metro";
import { i18n } from "@vendetta/metro/common";
import { before } from "@vendetta/patcher";
import { findInReactTree } from "@vendetta/utils";

Expand All @@ -8,8 +9,10 @@ let sectionPatch: () => void;

export default {
onLoad() {
const getListeningHeader = () => i18n.Messages.USER_ACTIVITY_HEADER_LISTENING?.intlMessage?.format({ name: "Spotify" });

sectionPatch = before("default", findByName("UserProfileSection", false), ([props]) => {
if (props?.title?.includes?.("Spotify") || props?.activity?.type !== 2) return;
if (props.title !== getListeningHeader()) return;

const spotifyElement = findInReactTree(props.children, e => e?.style?.padding === 0);
const actionsIndex = spotifyElement?.children?.findIndex?.(e => e?.type?.name === "Actions");
Expand Down

0 comments on commit 1843ff4

Please sign in to comment.