diff --git a/src/components/modal/ValidateModal.js b/src/components/modal/ValidateModal.js index 0d13b5e..4b4cac6 100644 --- a/src/components/modal/ValidateModal.js +++ b/src/components/modal/ValidateModal.js @@ -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 ( diff --git a/src/screens/Login.js b/src/screens/Login.js index 7855167..126c9f5 100644 --- a/src/screens/Login.js +++ b/src/screens/Login.js @@ -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", }} > - + { 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, ); } }}