Merge branch 'main' of gitlab.com:agenceminuit/musicland
This commit is contained in:
+49
-48
@@ -1,32 +1,32 @@
|
||||
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 * as WebBrowser from 'expo-web-browser';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
import { useGlobal } from 'reactn';
|
||||
import { background } from '../assets';
|
||||
import GradientButton from '../components/GradientButton.js';
|
||||
import { Input } from '../components/Input.js';
|
||||
import ItemContainer from '../components/ItemContainer/ItemContainer.js';
|
||||
import firebase, { usersRef } from '../config/firebase';
|
||||
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 * as WebBrowser from "expo-web-browser";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Pressable, Text, View } from "react-native";
|
||||
import { useGlobal } from "reactn";
|
||||
import { background } from "../assets";
|
||||
import GradientButton from "../components/GradientButton.js";
|
||||
import { Input } from "../components/Input.js";
|
||||
import firebase, { usersRef } from "../config/firebase";
|
||||
import {
|
||||
GOOGLE_ANDROID_CLIENT_ID,
|
||||
GOOGLE_IOS_CLIENT_ID,
|
||||
GOOGLE_WEB_CLIENT_ID,
|
||||
} from '../data/keys';
|
||||
import { isWeb } from '../hooks/useLayoutType';
|
||||
import Page from '../layouts/Page.js';
|
||||
import { Routes } from '../navigation';
|
||||
import { navigate } from '../navigation/NavigationService.js';
|
||||
import { FONT_FAMILY } from '../styles/Fonts.js';
|
||||
import Palette from '../styles/Palette.js';
|
||||
} from "../data/keys";
|
||||
import { isWeb } from "../hooks/useLayoutType";
|
||||
import Page from "../layouts/Page.js";
|
||||
import { Routes } from "../navigation";
|
||||
import { navigate } from "../navigation/NavigationService.js";
|
||||
import { FONT_FAMILY } from "../styles/Fonts.js";
|
||||
import Palette from "../styles/Palette.js";
|
||||
import ItemContainer from "../components/ItemContainer/ItemContainer";
|
||||
|
||||
export default ({ navigation }) => {
|
||||
WebBrowser.maybeCompleteAuthSession();
|
||||
const [, setTooltip] = useGlobal('_tooltip');
|
||||
const [email, setEmail] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
const [, setTooltip] = useGlobal("_tooltip");
|
||||
const [email, setEmail] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
// Let the provider compute a compliant redirect URI for native (com.googleusercontent.apps.<client-id>:/oauth2redirect)
|
||||
// Avoid forcing a custom scheme like musicland:// which Google can reject for native apps.
|
||||
@@ -39,12 +39,12 @@ export default ({ navigation }) => {
|
||||
// Use Authorization Code + PKCE to comply with Google OAuth for native apps
|
||||
responseType: AuthSession.ResponseType.Code,
|
||||
usePKCE: true,
|
||||
scopes: ['openid', 'profile', 'email'],
|
||||
scopes: ["openid", "profile", "email"],
|
||||
});
|
||||
|
||||
const afterLoginNavigate = async () => {
|
||||
const uid = firebase.auth().currentUser?.uid;
|
||||
if (!uid) throw new Error('Aucun utilisateur après connexion');
|
||||
if (!uid) throw new Error("Aucun utilisateur après connexion");
|
||||
const snap = await usersRef.doc(uid).get();
|
||||
const hasUserName = !!snap.data()?.userName;
|
||||
if (hasUserName) {
|
||||
@@ -60,8 +60,8 @@ export default ({ navigation }) => {
|
||||
await firebase.auth().signInWithEmailAndPassword(email.trim(), password);
|
||||
await afterLoginNavigate();
|
||||
} catch (e) {
|
||||
console.log('Login error', e?.message);
|
||||
setTooltip({ text: e?.message || 'Connexion impossible', type: 'error' });
|
||||
console.log("Login error", e?.message);
|
||||
setTooltip({ text: e?.message || "Connexion impossible", type: "error" });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -72,24 +72,24 @@ export default ({ navigation }) => {
|
||||
setLoading(true);
|
||||
if (isWeb) {
|
||||
const provider = new firebase.auth.GoogleAuthProvider();
|
||||
provider.addScope('profile');
|
||||
provider.addScope('email');
|
||||
provider.addScope("profile");
|
||||
provider.addScope("email");
|
||||
await firebase.auth().signInWithPopup(provider);
|
||||
await afterLoginNavigate();
|
||||
setLoading(false);
|
||||
} else {
|
||||
// Use defaults from the request; don't override with proxy here
|
||||
const result = await promptAsync();
|
||||
if (result?.type !== 'success') {
|
||||
if (result?.type !== "success") {
|
||||
// Cancelled or errored during the browser flow
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Google Login error', e?.message);
|
||||
console.log("Google Login error", e?.message);
|
||||
setTooltip({
|
||||
text: e?.message || 'Connexion Google impossible. Merci de réessayer.',
|
||||
type: 'error',
|
||||
text: e?.message || "Connexion Google impossible. Merci de réessayer.",
|
||||
type: "error",
|
||||
});
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -99,7 +99,7 @@ export default ({ navigation }) => {
|
||||
useEffect(() => {
|
||||
const handleNativeGoogleResponse = async () => {
|
||||
try {
|
||||
if (response?.type === 'success') {
|
||||
if (response?.type === "success") {
|
||||
// If using Expo proxy, tokens can be present already.
|
||||
let idToken =
|
||||
response?.authentication?.idToken || response?.params?.id_token;
|
||||
@@ -114,13 +114,13 @@ export default ({ navigation }) => {
|
||||
const clientId = request?.clientId;
|
||||
const discovery = {
|
||||
authorizationEndpoint:
|
||||
'https://accounts.google.com/o/oauth2/v2/auth',
|
||||
tokenEndpoint: 'https://oauth2.googleapis.com/token',
|
||||
revocationEndpoint: 'https://oauth2.googleapis.com/revoke',
|
||||
"https://accounts.google.com/o/oauth2/v2/auth",
|
||||
tokenEndpoint: "https://oauth2.googleapis.com/token",
|
||||
revocationEndpoint: "https://oauth2.googleapis.com/revoke",
|
||||
};
|
||||
|
||||
// Light debug: helps identify redirect/client mismatches in dev.
|
||||
console.log('Google token exchange', {
|
||||
console.log("Google token exchange", {
|
||||
clientId,
|
||||
redirectUri: request?.redirectUri,
|
||||
hasCodeVerifier: !!request?.codeVerifier,
|
||||
@@ -139,7 +139,7 @@ export default ({ navigation }) => {
|
||||
}
|
||||
|
||||
if (!idToken)
|
||||
throw new Error('Jeton Google manquant (échange/retour)');
|
||||
throw new Error("Jeton Google manquant (échange/retour)");
|
||||
|
||||
const credential =
|
||||
firebase.auth.GoogleAuthProvider.credential(idToken);
|
||||
@@ -147,10 +147,10 @@ export default ({ navigation }) => {
|
||||
await afterLoginNavigate();
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Google native sign-in error', e?.message);
|
||||
console.log("Google native sign-in error", e?.message);
|
||||
setTooltip({
|
||||
text: e?.message || 'Connexion Google impossible',
|
||||
type: 'error',
|
||||
text: e?.message || "Connexion Google impossible",
|
||||
type: "error",
|
||||
});
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -165,13 +165,14 @@ export default ({ navigation }) => {
|
||||
|
||||
return (
|
||||
<Page
|
||||
backgroundImg={background.homeBG}
|
||||
width={isWeb ? 600 : null}
|
||||
backgroundImg={isWeb ? background.loginBgWeb : background.homeBG}
|
||||
headerType="NAVIGATION"
|
||||
title="Connexion"
|
||||
hideBackButton
|
||||
>
|
||||
<View style={{ flex: 1, paddingTop: 20 }}>
|
||||
<ItemContainer height={600} disableKeyboardHeight>
|
||||
<ItemContainer height={600} width={800} disableKeyboardHeight>
|
||||
<View style={{ gap: 30, paddingTop: 5, paddingHorizontal: 5 }}>
|
||||
<View style={{ gap: 2 }}>
|
||||
<Text
|
||||
@@ -181,7 +182,7 @@ export default ({ navigation }) => {
|
||||
fontFamily: FONT_FAMILY.InterSemiBold,
|
||||
}}
|
||||
>
|
||||
Bonjour !
|
||||
{"Bonjour !"}
|
||||
</Text>
|
||||
<Text
|
||||
style={{
|
||||
@@ -228,8 +229,8 @@ export default ({ navigation }) => {
|
||||
<GradientButton
|
||||
title="Se connecter"
|
||||
containerStyle={{
|
||||
width: '80%',
|
||||
alignSelf: 'center',
|
||||
width: "80%",
|
||||
alignSelf: "center",
|
||||
}}
|
||||
onPress={onLogin}
|
||||
disabled={loading || !email || !password}
|
||||
@@ -252,7 +253,7 @@ export default ({ navigation }) => {
|
||||
|
||||
<View
|
||||
style={{
|
||||
alignItems: 'center',
|
||||
alignItems: "center",
|
||||
gap: 4,
|
||||
}}
|
||||
>
|
||||
@@ -264,7 +265,7 @@ export default ({ navigation }) => {
|
||||
fontFamily: FONT_FAMILY.HelveticaNeueRegular,
|
||||
}}
|
||||
>
|
||||
Pas encore de compte?{' '}
|
||||
Pas encore de compte?{" "}
|
||||
<Text
|
||||
style={{
|
||||
fontFamily: FONT_FAMILY.InterSemiBold,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { BlurView } from 'expo-blur';
|
||||
import React from 'react';
|
||||
import { BlurView } from "expo-blur";
|
||||
import React from "react";
|
||||
import {
|
||||
Image,
|
||||
Platform,
|
||||
@@ -7,38 +7,39 @@ import {
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import useMinuit from 'react-native-minuit/src/hooks/useMinuit.js';
|
||||
import { responsiveHeight } from 'react-native-responsive-dimensions';
|
||||
import { background, img } from '../../assets';
|
||||
import MusicLandHeader from '../../components/MusicLandHeader';
|
||||
import { projectsRef, serverTimestamp } from '../../config/firebase';
|
||||
import { uploadFileToFirebase } from '../../helpers/uploadToFirebase';
|
||||
import Page from '../../layouts/Page';
|
||||
import { Routes } from '../../navigation';
|
||||
import { goBack, navigate } from '../../navigation/NavigationService';
|
||||
import { Palette } from '../../styles';
|
||||
import { FONT_FAMILY } from '../../styles/Fonts';
|
||||
} from "react-native";
|
||||
import useMinuit from "react-native-minuit/src/hooks/useMinuit.js";
|
||||
import { responsiveHeight } from "react-native-responsive-dimensions";
|
||||
import { background, img } from "../../assets";
|
||||
import MusicLandHeader from "../../components/MusicLandHeader";
|
||||
import { projectsRef, serverTimestamp } from "../../config/firebase";
|
||||
import { uploadFileToFirebase } from "../../helpers/uploadToFirebase";
|
||||
import Page from "../../layouts/Page";
|
||||
import { Routes } from "../../navigation";
|
||||
import { goBack, navigate } from "../../navigation/NavigationService";
|
||||
import { Palette } from "../../styles";
|
||||
import { FONT_FAMILY } from "../../styles/Fonts";
|
||||
import { size } from "../../styles/Style";
|
||||
import CreateLyricsHeader from "../Writing/components/CreateLyricsHeader";
|
||||
import { useUserData } from "../../providers/UserDataProvider";
|
||||
|
||||
import { size } from '../../styles/Style';
|
||||
import CreateLyricsHeader from '../Writing/components/CreateLyricsHeader';
|
||||
const DownloadSongs = ({ route }) => {
|
||||
// const params = useRoute().params;
|
||||
const { currentUID } = useUserData();
|
||||
const { action, uri, project } = route.params || {};
|
||||
console.log('project id', project?.id);
|
||||
console.log("project id", project?.id);
|
||||
const { setIsLoading, setTooltip } = useMinuit();
|
||||
|
||||
const handleDownloadUri = async () => {
|
||||
if (action === 'playback' && project?.id) {
|
||||
if (action === "playback" && project?.id) {
|
||||
// Publication du playback
|
||||
console.log('project id : ', project.id);
|
||||
console.log("project id : ", project.id);
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const { resultURI = null } = await uploadFileToFirebase({
|
||||
uri: uri,
|
||||
path: `musics/${project.id}/source.mp4`,
|
||||
path: `users/${currentUID}/projects/${project.id}/playback.mp4`,
|
||||
shouldCompress: true,
|
||||
fileType: 'VIDEO',
|
||||
fileType: "VIDEO",
|
||||
});
|
||||
|
||||
if (!resultURI) throw new Error("Téléversement de l'image impossible");
|
||||
@@ -49,23 +50,23 @@ const DownloadSongs = ({ route }) => {
|
||||
playbackUrl: resultURI,
|
||||
updatedAt: serverTimestamp(),
|
||||
},
|
||||
{ merge: true }
|
||||
{ merge: true },
|
||||
);
|
||||
setTooltip({
|
||||
type: 'success',
|
||||
text: 'Vidéo uploadée, conversion HLS en cours…',
|
||||
type: "success",
|
||||
text: "Vidéo uploadée, conversion HLS en cours…",
|
||||
});
|
||||
} else {
|
||||
setTooltip({
|
||||
type: 'error',
|
||||
text: 'Erreur lors de la publication du playback',
|
||||
type: "error",
|
||||
text: "Erreur lors de la publication du playback",
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('error upload playback', error);
|
||||
console.log("error upload playback", error);
|
||||
setTooltip({
|
||||
type: 'error',
|
||||
text: 'Erreur lors de la publication du playback',
|
||||
type: "error",
|
||||
text: "Erreur lors de la publication du playback",
|
||||
});
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
@@ -78,37 +79,39 @@ const DownloadSongs = ({ route }) => {
|
||||
return (
|
||||
<Page
|
||||
backgroundImg={
|
||||
action === 'playback'
|
||||
action === "playback"
|
||||
? background.playbackBG2
|
||||
: background.productionBG2
|
||||
}
|
||||
headerType='NONE'>
|
||||
headerType="NONE"
|
||||
>
|
||||
<MusicLandHeader onPressBack={goBack} progress={50} />
|
||||
<View style={{ flex: 1, paddingTop: responsiveHeight(15) }}>
|
||||
<CreateLyricsHeader
|
||||
gradientProps={{
|
||||
start: { x: 0, y: 0 },
|
||||
end: { x: 0, y: 1 },
|
||||
}}>
|
||||
}}
|
||||
>
|
||||
<Image
|
||||
source={img.placeholder2}
|
||||
style={{
|
||||
...size({ size: 158 }),
|
||||
borderRadius: 13,
|
||||
alignSelf: 'center',
|
||||
alignSelf: "center",
|
||||
}}
|
||||
/>
|
||||
<View style={{ gap: 12, paddingVertical: 12 }}>
|
||||
<Text style={styles.title}>
|
||||
Prêt à télécharger{' '}
|
||||
{action === 'playback' ? 'ton Playback' : 'ta chanson'} ?
|
||||
Prêt à télécharger{" "}
|
||||
{action === "playback" ? "ton Playback" : "ta chanson"} ?
|
||||
</Text>
|
||||
<View style={{ gap: 10 }}>
|
||||
<Pressable
|
||||
style={styles.itemContainer}
|
||||
onPress={
|
||||
() => {
|
||||
console.log('test');
|
||||
console.log("test");
|
||||
handleDownloadUri();
|
||||
}
|
||||
|
||||
@@ -116,18 +119,19 @@ const DownloadSongs = ({ route }) => {
|
||||
// action,
|
||||
// uri,
|
||||
// })
|
||||
}>
|
||||
}
|
||||
>
|
||||
<BlurView
|
||||
style={styles.blurView}
|
||||
intensity={Platform.OS !== 'ios' ? 10 : 40}
|
||||
tint='dark'
|
||||
intensity={Platform.OS !== "ios" ? 10 : 40}
|
||||
tint="dark"
|
||||
// experimentalBlurMethod={
|
||||
// Platform.OS !== "ios" ? "dimezisBlurView" : "none"
|
||||
// }
|
||||
>
|
||||
<Text style={styles.label}>
|
||||
Télécharger{' '}
|
||||
{action === 'playback' ? 'mon Playback' : 'ma chanson'}
|
||||
Télécharger{" "}
|
||||
{action === "playback" ? "mon Playback" : "ma chanson"}
|
||||
</Text>
|
||||
<Text style={styles.description}>Pour moi uniquement</Text>
|
||||
</BlurView>
|
||||
@@ -138,25 +142,26 @@ const DownloadSongs = ({ route }) => {
|
||||
navigate(Routes.StreamSong, {
|
||||
action,
|
||||
})
|
||||
}>
|
||||
}
|
||||
>
|
||||
<BlurView
|
||||
style={styles.blurView}
|
||||
intensity={Platform.OS !== 'ios' ? 10 : 40}
|
||||
tint='dark'
|
||||
intensity={Platform.OS !== "ios" ? 10 : 40}
|
||||
tint="dark"
|
||||
// experimentalBlurMethod={
|
||||
// Platform.OS !== "ios" ? "dimezisBlurView" : "none"
|
||||
// }
|
||||
>
|
||||
<Text style={styles.label}>
|
||||
Diffuser{' '}
|
||||
{action === 'playback' ? 'mon Playback' : 'ma chanson'} sur
|
||||
Diffuser{" "}
|
||||
{action === "playback" ? "mon Playback" : "ma chanson"} sur
|
||||
la plateforme de MusicLand (+ réseaux sociaux) et participer
|
||||
au concours
|
||||
</Text>
|
||||
<Text style={styles.description}>
|
||||
Top 3: 1er 15% du CA ML - 2ème 10% du CA ML - 3ème 5% du CA
|
||||
ML (catégorie{' '}
|
||||
{action === 'playback' ? 'Playback' : 'chanson'})
|
||||
ML (catégorie{" "}
|
||||
{action === "playback" ? "Playback" : "chanson"})
|
||||
</Text>
|
||||
</BlurView>
|
||||
</Pressable>
|
||||
@@ -193,9 +198,9 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
itemContainer: {
|
||||
borderRadius: 12,
|
||||
overflow: 'hidden',
|
||||
backgroundColor: '#FFFFFF03',
|
||||
shadowColor: '#0000001A',
|
||||
overflow: "hidden",
|
||||
backgroundColor: "#FFFFFF03",
|
||||
shadowColor: "#0000001A",
|
||||
shadowOffset: {
|
||||
width: 0,
|
||||
height: 2,
|
||||
|
||||
@@ -65,7 +65,7 @@ const Profile = () => {
|
||||
setFollowers(
|
||||
Array.isArray(currentUserData?.followedBy)
|
||||
? currentUserData.followedBy.length
|
||||
: 0
|
||||
: 0,
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -263,7 +263,12 @@ const Profile = () => {
|
||||
// }
|
||||
>
|
||||
{isWeb && (
|
||||
<Pressable onPress={() => SheetManager.show("ProfileSettings")}>
|
||||
<Pressable
|
||||
style={{
|
||||
zIndex: 2,
|
||||
}}
|
||||
onPress={() => SheetManager.show("ProfileSettings")}
|
||||
>
|
||||
<Image
|
||||
source={icons.more}
|
||||
style={{
|
||||
|
||||
@@ -9,13 +9,15 @@ import BorderGradientButton from "../components/BorderGradientButton";
|
||||
import { navigate } from "../navigation/NavigationService";
|
||||
import { Routes } from "../navigation";
|
||||
import ItemContainer from "../components/ItemContainer/ItemContainer";
|
||||
import { isWeb } from "../hooks/useLayoutType";
|
||||
|
||||
const Register = () => {
|
||||
const [email, setEmail] = useState("");
|
||||
|
||||
return (
|
||||
<Page
|
||||
backgroundImg={background.homeBG}
|
||||
width={isWeb ? 600 : null}
|
||||
backgroundImg={isWeb ? background.loginBgWeb : background.homeBG}
|
||||
headerType="NAVIGATION"
|
||||
title="Inscription"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user