From 27c27f46a75d70eb892de355889335eee597d350 Mon Sep 17 00:00:00 2001 From: amsyarasyiq <82711525+amsyarasyiq@users.noreply.github.com> Date: Mon, 24 Jul 2023 00:24:41 +0800 Subject: [PATCH] Publish BetterSpotifyIntegration --- .../BetterSpotifyIntegration/manifest.json | 6 +++ .../src/components/ListenAlongButton.tsx | 38 +++++++++++++++++++ .../BetterSpotifyIntegration/src/index.tsx | 30 +++++++++++++++ .../src/utils/useListeningParty.ts | 15 ++++++++ 4 files changed, 89 insertions(+) create mode 100644 plugins/BetterSpotifyIntegration/manifest.json create mode 100644 plugins/BetterSpotifyIntegration/src/components/ListenAlongButton.tsx create mode 100644 plugins/BetterSpotifyIntegration/src/index.tsx create mode 100644 plugins/BetterSpotifyIntegration/src/utils/useListeningParty.ts diff --git a/plugins/BetterSpotifyIntegration/manifest.json b/plugins/BetterSpotifyIntegration/manifest.json new file mode 100644 index 0000000..011e41c --- /dev/null +++ b/plugins/BetterSpotifyIntegration/manifest.json @@ -0,0 +1,6 @@ +{ + "name": "BetterSpotifyIntegration", + "description": "Shrimply better integration with Spotify", + "vendetta": { }, + "main": "src/index.tsx" +} diff --git a/plugins/BetterSpotifyIntegration/src/components/ListenAlongButton.tsx b/plugins/BetterSpotifyIntegration/src/components/ListenAlongButton.tsx new file mode 100644 index 0000000..6e5b677 --- /dev/null +++ b/plugins/BetterSpotifyIntegration/src/components/ListenAlongButton.tsx @@ -0,0 +1,38 @@ +import { findByProps, findByStoreName } from "@vendetta/metro"; +import { getAssetIDByName } from "@vendetta/ui/assets"; +import { Image, View } from "react-native"; + +const FluxUtils = findByProps("useStateFromStores"); +const SpotifyStore = findByStoreName("SpotifyStore"); + +const Button = findByProps("Sizes", "Looks") as any; +const SpotifySyncUtil = findByProps("play", "sync"); + +interface ListenAlongButtonProps { + activity: any; + user: any; + isCurrentUser: boolean; + activityButtonColor: string; +} + +export default function ListenAlongButton(props: ListenAlongButtonProps) { + const currentPartyId = FluxUtils.useStateFromStores([SpotifyStore], () => SpotifyStore.getActivity()?.party?.id); + const alreadySync = props.isCurrentUser || props.activity?.party?.id === currentPartyId; + + return +