SpotifyIntegration: Fix crashes

This commit is contained in:
amsyarasyiq 2023-07-25 22:41:50 +08:00
parent 27c27f46a7
commit de52c10391
2 changed files with 4 additions and 3 deletions

View file

@ -8,12 +8,13 @@ const SpotifyStore = findByStoreName("SpotifyStore");
const Button = findByProps("Sizes", "Looks") as any;
const SpotifySyncUtil = findByProps("play", "sync");
interface ListenAlongButtonProps {
type ListenAlongButtonProps = Partial<{
activity: any;
user: any;
isCurrentUser: boolean;
activityButtonColor: string;
}
[key: string]: any;
}>
export default function ListenAlongButton(props: ListenAlongButtonProps) {
const currentPartyId = FluxUtils.useStateFromStores([SpotifyStore], () => SpotifyStore.getActivity()?.party?.id);

View file

@ -9,7 +9,7 @@ let sectionPatch: () => void;
export default {
onLoad() {
sectionPatch = before("default", findByName("UserProfileSection", false), ([props]) => {
if (props?.title?.includes?.("Spotify") || props.activity.type !== 2) return;
if (props?.title?.includes?.("Spotify") || props?.activity?.type !== 2) return;
const spotifyElement = findInReactTree(props.children, e => e?.style?.padding === 0);
const actionsIndex = spotifyElement?.children?.findIndex?.(e => e?.type?.name === "Actions");