fix message display and now using the API to get the correct melody url

This commit is contained in:
Clément Le Bihan
2024-01-07 16:59:22 +01:00
parent ddc97f0923
commit c79ae7c6e8
3 changed files with 7 additions and 3 deletions
+4
View File
@@ -779,4 +779,8 @@ export default class API {
public static getPartitionSvgUrl(songId: number): string { public static getPartitionSvgUrl(songId: number): string {
return `${API.baseUrl}/song/${songId}/assets/partition`; return `${API.baseUrl}/song/${songId}/assets/partition`;
} }
public static getPartitionMelodyUrl(songId: number): string {
return `${API.baseUrl}/song/${songId}/assets/melody`;
}
} }
+1 -1
View File
@@ -77,7 +77,7 @@ const PartitionMagic = ({
React.useEffect(() => { React.useEffect(() => {
if (!melodySound.current) { if (!melodySound.current) {
Audio.Sound.createAsync({ Audio.Sound.createAsync({
uri: 'https://cdn.discordapp.com/attachments/717080637038788731/1192502931681984622/melody.mp3?ex=65a94fe6&is=6596dae6&hm=af0879593154fb54b78a9b49c77ae27da9f11d59e676f01fa9eb2a8d5a997708&', uri: API.getPartitionMelodyUrl(songID),
}).then(({ sound }) => { }).then(({ sound }) => {
melodySound.current = sound; melodySound.current = sound;
}); });
+2 -2
View File
@@ -14,7 +14,7 @@ import { ColorSchemeType } from 'native-base/lib/typescript/components/types';
export type ScoreMessage = { export type ScoreMessage = {
content: string; content: string;
color?: ColorSchemeType; color?: ColorSchemeType;
id: number; id: number;
}; };
type PlayScoreProps = { type PlayScoreProps = {
@@ -90,7 +90,7 @@ export const PlayScore = ({ score, streak, message }: PlayScoreProps) => {
}} }}
> >
<Text color={textColor[900]} fontSize={20}> <Text color={textColor[900]} fontSize={20}>
{message} {message.content}
</Text> </Text>
{streak > 0 && ( {streak > 0 && (
<Text color={textColor[900]} fontSize={15} bold> <Text color={textColor[900]} fontSize={15} bold>