generated songs count
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import { View, Text, Modal } from "react-native";
|
||||
import React from "react";
|
||||
import { gutters, Palette } from "../../styles";
|
||||
import { BlurView } from "expo-blur";
|
||||
import { Modal, Text, View } from "react-native";
|
||||
import CreateLyricsHeader from "../../screens/Writing/components/CreateLyricsHeader";
|
||||
import { gutters, Palette } from "../../styles";
|
||||
import { FONT_FAMILY } from "../../styles/Fonts";
|
||||
import BorderGradientButton from "../BorderGradientButton";
|
||||
import GradientButton from "../GradientButton";
|
||||
import { FONT_FAMILY } from "../../styles/Fonts";
|
||||
|
||||
const ValidateModal = ({ visible, onClose, onPressValidate }) => {
|
||||
return (
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
/* eslint-disable react/display-name */
|
||||
import { GoogleSigninButton } from "@react-native-google-signin/google-signin";
|
||||
import * as AuthSession from "expo-auth-session";
|
||||
import * as GoogleAuth from "expo-auth-session/providers/google";
|
||||
import Constants from "expo-constants";
|
||||
import * as WebBrowser from "expo-web-browser";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import Constants from "expo-constants";
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Platform,
|
||||
@@ -12,6 +13,7 @@ import {
|
||||
Text,
|
||||
View,
|
||||
} from "react-native";
|
||||
import Svg, { Path } from "react-native-svg";
|
||||
import { useGlobal } from "reactn";
|
||||
import { background } from "../assets";
|
||||
import GradientButton from "../components/GradientButton.js";
|
||||
@@ -29,8 +31,6 @@ import { Routes } from "../navigation";
|
||||
import { navigate } from "../navigation/NavigationService.js";
|
||||
import { FONT_FAMILY } from "../styles/Fonts.js";
|
||||
import Palette from "../styles/Palette.js";
|
||||
import { GoogleSigninButton } from "@react-native-google-signin/google-signin";
|
||||
import Svg, { Path } from "react-native-svg";
|
||||
|
||||
export default ({ navigation }) => {
|
||||
WebBrowser.maybeCompleteAuthSession();
|
||||
@@ -150,7 +150,7 @@ export default ({ navigation }) => {
|
||||
redirectUri: request?.redirectUri,
|
||||
extraParams: { code_verifier: request?.codeVerifier },
|
||||
},
|
||||
discovery,
|
||||
discovery
|
||||
);
|
||||
idToken = tokenResponse?.id_token;
|
||||
}
|
||||
@@ -195,7 +195,7 @@ export default ({ navigation }) => {
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<ItemContainer height={500} width={800} disableKeyboardHeight>
|
||||
<ItemContainer height={550} width={800} disableKeyboardHeight>
|
||||
<View style={{ gap: 30, paddingTop: 5, paddingHorizontal: 5 }}>
|
||||
<View style={{ gap: 2 }}>
|
||||
<Text
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* global setInterval, clearInterval */
|
||||
import { useFocusEffect } from "@react-navigation/native";
|
||||
import useSharedAudioPlayer from "../../hooks/useSharedAudioPlayer";
|
||||
import { BlurView } from "expo-blur";
|
||||
import React, { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { Image, Platform, Pressable, Text, View } from "react-native";
|
||||
@@ -12,6 +11,7 @@ import ValidateModal from "../../components/modal/ValidateModal";
|
||||
import MusicLandHeader from "../../components/MusicLandHeader";
|
||||
import Slider from "../../components/Slider";
|
||||
import firebase from "../../config/firebase";
|
||||
import useSharedAudioPlayer from "../../hooks/useSharedAudioPlayer";
|
||||
import Page from "../../layouts/Page";
|
||||
import { Routes } from "../../navigation";
|
||||
import { navigate } from "../../navigation/NavigationService";
|
||||
@@ -25,6 +25,7 @@ const SongReady = () => {
|
||||
selectedProjectId: projectId,
|
||||
selectedProject,
|
||||
updateProjectData,
|
||||
updateUserData,
|
||||
} = useUser();
|
||||
const [showValidateModal, setShowValidateModal] = useState(false);
|
||||
const [musicUrls, setMusicUrls] = useState([]);
|
||||
@@ -41,7 +42,9 @@ const SongReady = () => {
|
||||
title:
|
||||
(Array.isArray(selectedProject?.musicTitles)
|
||||
? selectedProject?.musicTitles?.[0]
|
||||
: null) || selectedProject?.title || "Option 1",
|
||||
: null) ||
|
||||
selectedProject?.title ||
|
||||
"Option 1",
|
||||
artwork: selectedProject?.coverUrl || null,
|
||||
coverUrl: selectedProject?.coverUrl || null,
|
||||
metadata: { index: 0, projectId },
|
||||
@@ -54,7 +57,9 @@ const SongReady = () => {
|
||||
title:
|
||||
(Array.isArray(selectedProject?.musicTitles)
|
||||
? selectedProject?.musicTitles?.[1]
|
||||
: null) || selectedProject?.title || "Option 2",
|
||||
: null) ||
|
||||
selectedProject?.title ||
|
||||
"Option 2",
|
||||
artwork: selectedProject?.coverUrl || null,
|
||||
coverUrl: selectedProject?.coverUrl || null,
|
||||
metadata: { index: 1, projectId },
|
||||
@@ -149,6 +154,16 @@ const SongReady = () => {
|
||||
songUrl: url,
|
||||
updatedAt: firebase.firestore.FieldValue.serverTimestamp(),
|
||||
});
|
||||
|
||||
// Incrémenter le compteur de chansons générées
|
||||
const currentGeneratedSongs = selectedProject?.user?.generatedSongs || 0;
|
||||
await updateUserData({
|
||||
data: {
|
||||
generatedSongs: currentGeneratedSongs + 1,
|
||||
},
|
||||
shouldSetTooltip: false,
|
||||
});
|
||||
|
||||
await player0?.pause?.();
|
||||
await player1?.pause?.();
|
||||
navigate(Routes.Home);
|
||||
@@ -166,7 +181,7 @@ const SongReady = () => {
|
||||
player1?.pause?.();
|
||||
} catch {}
|
||||
};
|
||||
}, [player0, player1])
|
||||
}, [player0, player1]);
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -250,7 +265,7 @@ const SongReady = () => {
|
||||
} catch (e) {
|
||||
console.log(
|
||||
"SongReady pause on seek start",
|
||||
e?.message
|
||||
e?.message,
|
||||
);
|
||||
}
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user