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