feat: remove publish to youtube

This commit is contained in:
2026-09-02 16:08:48 +02:00
parent 4e14a38d4e
commit f4549b694f
18 changed files with 15 additions and 804 deletions
-1
View File
@@ -270,7 +270,6 @@ export const cardsImg = {
writing: require('./icons/writing.png'),
studio: require('./icons/studio.png'),
video: require('./icons/video.png'),
production: require('./icons/production.png'),
}
export const subBadges = {
@@ -2,7 +2,7 @@ import { BlurView } from 'expo-blur'
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { Animated, FlatList, Platform, StyleSheet, View, useWindowDimensions } from 'react-native'
import { responsiveHeight } from '../../actions/responsiveSizes'
import { ai, cardsImg } from '../../assets'
import { ai } from '../../assets'
import { gutters } from '../../styles'
import { getCreationStageStates } from '../../utils/projectStages'
import AnimatedPaginationDot from '../AnimatedPaginationDot/AnimatedPaginationDot'
@@ -27,12 +27,6 @@ const STAGE_CARD_CONTENT = [
description: "Theo t'accompagne pour créer ton playback.",
image: ai.rightIcon,
},
{
key: 'publisher',
title: 'Publication',
description: 'Ta vidéo est prête ? Direction YouTube !',
image: cardsImg.production,
},
]
const WEB_SCROLL_INACTIVE_DELTA = 0.05
@@ -8,7 +8,7 @@ import {
View,
useWindowDimensions,
} from 'react-native'
import { ai, cardsImg } from '../../assets'
import { ai } from '../../assets'
import { getCreationStageStates } from '../../utils/projectStages'
import AnimatedPaginationDot from '../AnimatedPaginationDot/AnimatedPaginationDot'
import PersonaCard from '../cards/PersonaCard/PersonaCard'
@@ -33,12 +33,6 @@ const STAGE_CARD_CONTENT = [
description: "Theo t'accompagne pour créer ton playback.",
image: ai.rightIcon,
},
{
key: 'publisher',
title: 'Publication',
description: 'Ta vidéo est prête ? Direction YouTube !',
image: cardsImg.production,
},
]
const WEB_SCROLL_INACTIVE_DELTA = 0.05
-5
View File
@@ -25,7 +25,6 @@ import PlaybackOnboarding from '../screens/Playback/PlaybackOnboarding'
import RecordPlayback from '../screens/Playback/RecordPlayback'
import RecordedPlayback from '../screens/Playback/RecordedPlayback'
import VideoFinalize from '../screens/Playback/VideoFinalize'
import PublishYoutube from '../screens/Publishing/PublishYoutube'
import PrivacyPolicy from '../screens/PrivacyPolicy'
import Subscriptions from '../screens/Subscriptions'
import DownloadPrices from '../screens/Production/DownloadPrices'
@@ -265,10 +264,6 @@ const baseScreens = [
name: Routes.VideoFinalize,
component: VideoFinalize,
},
{
name: Routes.PublishYoutube,
component: PublishYoutube,
},
{
name: Routes.AllMyPlaylist,
component: AllMyPlaylist,
-1
View File
@@ -65,7 +65,6 @@ export const Routes = {
ChooseDecor: 'ChooseDecor',
CreatingDecor: 'CreatingDecor',
VideoFinalize: 'VideoFinalize',
PublishYoutube: 'PublishYoutube',
Create: 'Create',
HitParade: 'HitParade',
-1
View File
@@ -44,7 +44,6 @@ const HIDDEN_ROUTE_NAMES = new Set([
Routes.ChooseDecor,
Routes.CreatingDecor,
Routes.VideoFinalize,
Routes.PublishYoutube,
Routes.FlowSelection,
Routes.ChooseCoverType,
Routes.Settings,
-10
View File
@@ -72,16 +72,6 @@ const STAGE_CARD_CONTENT = [
textAlign: 'left',
lockSide: 'right',
},
{
key: 'publisher',
step: 'ÉTAPE 4',
description:
'Je suis Mr Benhaï, Producteur de MusicLand, et je vais te faire une proposition qui pourrait tintéresser. On se retrouve à la sortie du studio !',
image: cardsImg.production,
imagePosition: 'right',
textAlign: 'right',
lockSide: 'left',
},
]
const ACTIVE_SUBSCRIPTION_STATUSES = new Set(['trialing', 'active', 'past_due', 'unpaid'])
+1 -9
View File
@@ -2,7 +2,7 @@ import FontAwesome from '@expo/vector-icons/FontAwesome'
import { BlurView } from 'expo-blur'
import React, { useCallback, useMemo } from 'react'
import { Image, Platform, Pressable, Text, View } from 'react-native'
import { ai, background, cardsImg } from '../assets'
import { ai, background } from '../assets'
import Page from '../layouts/Page'
import { navigate } from '../navigation/NavigationService'
import { useUserData } from '../providers/UserDataProvider'
@@ -36,14 +36,6 @@ const CREATE_DATA = [
desc: "Theo t'accompagne pour créer ton playback.",
type: 'Director',
},
{
stageKey: 'publisher',
img: cardsImg.production,
bg: background.productionBG2,
label: 'Publication',
desc: 'Publions ta vidéo sur YouTube !',
type: 'Producteur',
},
]
const NewMusicOptions = () => {
+5 -1
View File
@@ -407,7 +407,11 @@ const PlaybackDownload = ({ route }) => {
{ merge: true }
)
navigate(Routes.PublishYoutube, { projectId: projectForDownload.id })
setTooltip({
type: 'success',
text: 'Playback publié sur MusicLand !',
})
navigate(Routes.Home)
} catch (err) {
setTooltip({
type: 'error',
+2 -2
View File
@@ -42,7 +42,7 @@ const StreamSong = () => {
if (!hasAcceptedPublication) {
setTooltip({
type: 'error',
text: 'Confirme la diffusion sur Musicland et YouTube avant de publier',
text: 'Confirme la diffusion sur MusicLand avant de publier',
})
return
}
@@ -112,7 +112,7 @@ const StreamSong = () => {
<AppCheckbox
selected={hasAcceptedPublication}
onPress={() => setHasAcceptedPublication((prevState) => !prevState)}
label="J'accepte la diffusion de mon contenu sur Musicland et YouTube."
label="J'accepte la diffusion de mon contenu sur MusicLand."
/>
<Text
style={{
-327
View File
@@ -1,327 +0,0 @@
import { useRoute } from '@react-navigation/native'
import React, { useCallback, useMemo, useState } from 'react'
import { Linking, StyleSheet, Text, View } from 'react-native'
import useMinuit from 'react-native-minuit/src/hooks/useMinuit.js'
import { background } from '../../assets'
import AppCheckbox from '../../components/AppCheckbox'
import BackgroundVideo from '../../components/BackgroundVideo'
import BorderGradientButton from '../../components/BorderGradientButton'
import GradientButton from '../../components/GradientButton'
import MusicLandHeader from '../../components/MusicLandHeader'
import alert from '../../components/Alert'
import firebase, { projectsRef, serverTimestamp } from '../../config/firebase'
import Page from '../../layouts/Page'
import { goBack, navigate } from '../../navigation/NavigationService'
import { Routes } from '../../navigation'
import { useUser } from '../../providers/UserDataProvider'
import { Palette, gutters } from '../../styles'
import { FONT_FAMILY } from '../../styles/Fonts'
import { isWeb } from '../../hooks/useLayoutType'
const PublishYoutube = () => {
const route = useRoute()
const routeProjectId = route?.params?.projectId ?? null
const { userProjects = [], selectedProject, videos } = useUser()
const { setTooltip } = useMinuit()
const project = useMemo(() => {
if (routeProjectId) {
return userProjects.find((item) => item?.id === routeProjectId) || selectedProject || null
}
if (selectedProject?.id) {
return selectedProject
}
return userProjects.length ? userProjects[0] : null
}, [routeProjectId, selectedProject, userProjects])
const projectId = project?.id || routeProjectId || null
const introVideo = isWeb ? videos?.benhaiWeb : videos?.benhai
const [saving, setSaving] = useState(false)
const [hasAcceptedPublication, setHasAcceptedPublication] = useState(true)
const youtubeUrl = project?.youtubeUrl ?? null
const youtubeStatus = project?.youtubeStatus ?? null
const youtubeError = project?.youtubeError ?? null
const playbackReady = !!project?.playbackUrl
const hasYoutubePublication = !!youtubeUrl
const isPublishing = useMemo(
() => ['PUBLISHING', 'UPLOADING', 'PROCESSING', 'QUEUED'].includes(youtubeStatus),
[youtubeStatus]
)
const publishDisabled =
saving || isPublishing || !playbackReady || !projectId || !hasAcceptedPublication
const publishButtonLabel = isPublishing
? 'Publication en cours...'
: hasYoutubePublication
? 'Mettre à jour sur YouTube'
: 'Publier sur YouTube'
const statusMessage = useMemo(() => {
if (!playbackReady) {
return 'Termine la création de ton playback avec Theo pour débloquer la publication YouTube.'
}
if (isPublishing) {
return 'La publication de ta vidéo est en cours... Patiente un instant.'
}
if (youtubeError || youtubeStatus === 'FAILED') {
return 'La dernière tentative de publication a échoué. Tu peux réessayer ci-dessous.'
}
if (hasYoutubePublication) {
return 'Ta vidéo est publiée sur la chaîne YouTube MusicLand. Tu peux la partager dès maintenant.'
}
return 'Partage ton playback sur la chaîne YouTube MusicLand.'
}, [hasYoutubePublication, isPublishing, playbackReady, youtubeError, youtubeStatus])
const handleOpenYoutube = useCallback(async () => {
if (!youtubeUrl) {
return
}
try {
await Linking.openURL(youtubeUrl)
} catch (_error) {
setTooltip?.({
type: 'error',
text: "Impossible d'ouvrir le lien YouTube",
})
}
}, [setTooltip, youtubeUrl])
const handleMarkPublished = useCallback(async () => {
if (!projectId) {
setTooltip?.({
type: 'error',
text: 'Sélectionnez un projet avant de publier',
})
return
}
if (!playbackReady) {
setTooltip?.({
type: 'error',
text: "Aucun playback n'est disponible pour la publication",
})
return
}
setSaving(true)
try {
// publication sur youtube en standby
// const publishCallable = firebase.functions().httpsCallable('youtube-publishPlaybackToYoutube')
// await publishCallable({ projectId })
setTooltip?.({
type: 'success',
text: 'Publication lancée sur YouTube',
})
} catch (error) {
setTooltip?.({
type: 'error',
text: error?.message || 'Impossible de lancer la publication',
})
} finally {
setSaving(false)
}
}, [playbackReady, projectId, setTooltip])
const handleConfirmPublish = useCallback(() => {
if (!hasAcceptedPublication) {
setTooltip?.({
type: 'error',
text: 'Confirme la diffusion sur YouTube avant de publier',
})
return
}
if (publishDisabled) {
return
}
const confirmTitle = hasYoutubePublication
? 'Confirmer la mise à jour'
: 'Confirmer la publication'
const confirmDescription = hasYoutubePublication
? 'La vidéo existe déjà sur YouTube. Confirme que tu souhaites remplacer la version publiée.'
: 'Confirme que tu souhaites publier ce playback sur YouTube. Il sera visible publiquement.'
alert(confirmTitle, confirmDescription, [
{ text: 'Annuler', style: 'cancel' },
{
text: hasYoutubePublication ? 'Mettre à jour' : 'Je confirme',
onPress: handleMarkPublished,
},
])
}, [
handleMarkPublished,
hasAcceptedPublication,
hasYoutubePublication,
publishDisabled,
setTooltip,
])
const handleResetPublication = useCallback(async () => {
if (!projectId) {
setTooltip?.({
type: 'error',
text: 'Sélectionnez un projet avant de réinitialiser',
})
return
}
setSaving(true)
try {
await projectsRef.doc(projectId).set(
{
youtubePublished: false,
youtubeUrl: null,
youtubeVideoId: null,
youtubePublishedAt: null,
youtubeStatus: 'IDLE',
youtubeError: null,
updatedAt: serverTimestamp(),
},
{ merge: true }
)
setTooltip?.({
type: 'success',
text: 'Publication YouTube réinitialisée',
})
} catch (error) {
setTooltip?.({
type: 'error',
text: error?.message || 'Réinitialisation impossible',
})
} finally {
setSaving(false)
}
}, [projectId, setTooltip])
const handleGoHome = useCallback(() => {
navigate(Routes.BottomTab, {
screen: Routes.HomeStack,
params: {
screen: Routes.Home,
},
})
}, [])
return (
<Page
backgroundImg={background.playbackBG2}
backgroundContent={
<BackgroundVideo
source={introVideo}
soundButtonStyle={isWeb ? styles.rightSideControl : undefined}
/>
}
containerStyle={isWeb ? styles.videoPage : undefined}
headerType="NONE"
>
<MusicLandHeader progress={100} onPressBack={goBack} />
<View
style={{
flex: 1,
paddingHorizontal: gutters,
paddingBottom: gutters * 2,
justifyContent: 'space-between',
}}
>
<View style={{ alignItems: 'center', gap: 18 }}>
<Text
style={{
fontSize: 22,
fontFamily: FONT_FAMILY.InterSemiBold,
color: Palette.white,
textAlign: 'center',
}}
>
{hasYoutubePublication ? 'Ta vidéo est déjà sur YouTube' : 'Publier sur YouTube'}
</Text>
<Text
style={{
fontSize: 14,
fontFamily: FONT_FAMILY.InterRegular,
color: Palette.white,
opacity: 0.9,
textAlign: 'center',
lineHeight: 20,
}}
>
{statusMessage}
</Text>
{youtubeError && (
<Text
style={{
fontSize: 13,
fontFamily: FONT_FAMILY.InterRegular,
color: Palette.red,
textAlign: 'center',
}}
>
{youtubeError}
</Text>
)}
{hasYoutubePublication && youtubeUrl && (
<Text
style={{
fontSize: 13,
fontFamily: FONT_FAMILY.InterMedium,
color: Palette.white,
textAlign: 'center',
opacity: 0.8,
}}
numberOfLines={2}
>
{youtubeUrl}
</Text>
)}
</View>
<View style={{ gap: 14 }}>
<View style={styles.consentContainer}>
<AppCheckbox
selected={hasAcceptedPublication}
onPress={() => setHasAcceptedPublication((prevState) => !prevState)}
label="J'accepte la diffusion de mon contenu sur YouTube."
/>
<Text style={styles.consentDescription}>
Cette confirmation est requise avant toute publication sur YouTube.
</Text>
</View>
<GradientButton
title={publishButtonLabel}
onPress={handleConfirmPublish}
disabled={publishDisabled}
/>
{hasYoutubePublication && youtubeUrl && (
<BorderGradientButton
title="Voir la vidéo sur YouTube"
onPress={handleOpenYoutube}
disabled={saving || isPublishing}
/>
)}
{hasYoutubePublication && (
<BorderGradientButton
title="Réinitialiser la publication"
onPress={handleResetPublication}
disabled={saving || isPublishing}
/>
)}
<BorderGradientButton title="Retour à l'accueil" onPress={handleGoHome} />
</View>
</View>
</Page>
)
}
const styles = StyleSheet.create({
videoPage: {
alignSelf: 'center',
},
rightSideControl: {
right: 24,
left: 'auto',
},
consentContainer: {
gap: 6,
},
consentDescription: {
fontSize: 13,
fontFamily: FONT_FAMILY.InterRegular,
color: Palette.white,
opacity: 0.8,
},
})
export default PublishYoutube
@@ -437,7 +437,7 @@ const ShareAndCreditsModal = ({
<AppCheckbox
selected={hasAcceptedPublication}
onPress={() => setHasAcceptedPublication((prev) => !prev)}
label="J'accepte de diffuser mon contenu sur la plateforme de streaming de musicland et sur youtube"
label="J'accepte de diffuser mon contenu sur la plateforme de streaming de MusicLand"
/>
</View>
<GradientButton
+1 -44
View File
@@ -1,6 +1,6 @@
import { Routes } from '../navigation/Routes'
export const CREATION_STAGE_KEYS = ['songwriter', 'beatmaker', 'director', 'publisher']
export const CREATION_STAGE_KEYS = ['songwriter', 'beatmaker', 'director']
const getSectionLyrics = (section) => {
if (typeof section === 'string') {
@@ -36,13 +36,6 @@ const getStageMetadata = (project) => {
const hasCoverUrl = !!project?.coverUrl
const hasPlaybackAsset = !!project?.playbackUrl
const hasPlayback = hasPlaybackAsset || hasSongUrl
const youtubeUrl = project?.youtubeUrl ?? null
const youtubeStatus = project?.youtubeStatus ?? null
const youtubeError = project?.youtubeError ?? null
const hasYoutubePublication = !!youtubeUrl
const isYoutubePublishing = ['PUBLISHING', 'UPLOADING', 'PROCESSING', 'QUEUED'].includes(
youtubeStatus
)
const musicUrls = Array.isArray(project?.musicUrls) ? project.musicUrls.filter(Boolean) : []
const musicStatus = project?.musicStatus || null
const coverStatus = project?.coverStatus || null
@@ -65,13 +58,9 @@ const getStageMetadata = (project) => {
coverStatus,
playbackStatus,
isPlaybackDraftReady,
youtubeStatus,
youtubeError,
isMusicGenerating: musicStatus === 'GENERATING',
isCoverGenerating: coverStatus === 'GENERATING',
isPlaybackGenerating,
hasYoutubePublication,
isYoutubePublishing,
}
}
@@ -89,8 +78,6 @@ const getStageLockState = (key, metadata) => {
return true
}
return !metadata.hasCover
case 'publisher':
return !metadata.hasPlaybackAsset
default:
return true
}
@@ -151,20 +138,6 @@ const getStageDescription = (key, metadata) => {
return 'Modifier le playback généré'
}
return 'Commencer la création de votre playback'
case 'publisher':
if (!hasPlaybackAsset) {
return 'Créez un playback pour débloquer la publication'
}
if (metadata.isYoutubePublishing) {
return 'Publication de votre vidéo en cours'
}
if (metadata.youtubeError) {
return 'La publication a échoué, réessayez.'
}
if (metadata.hasYoutubePublication) {
return 'Votre vidéo est en ligne et prête à être partagée'
}
return 'Publier votre vidéo sur la chaîne YouTube MusicLand'
default:
return ''
}
@@ -181,11 +154,6 @@ const getStageLockedDescription = (key, metadata) => {
return metadata.lyricsCount > 0 ? undefined : 'Créez vos paroles pour débloquer le studio'
case 'director':
return metadata.hasPlaybackAsset ? 'Impossible de modifier le playback' : undefined
case 'publisher':
if (!metadata.hasPlaybackAsset) {
return 'Générez un playback pour débloquer la publication'
}
return metadata.hasYoutubePublication ? 'La vidéo est déjà publiée' : undefined
default:
return undefined
}
@@ -199,8 +167,6 @@ const getStageCompletionState = (key, metadata) => {
return metadata.hasSongUrl || metadata.musicStatus === 'GENERATED'
case 'director':
return metadata.hasPlaybackAsset
case 'publisher':
return metadata.hasYoutubePublication
default:
return false
}
@@ -268,15 +234,6 @@ export const getStageAction = (key, project) => {
route: Routes.Playback,
params: project ? { project } : undefined,
}
case 'publisher': {
if (!project?.id) {
return { route: Routes.PublishYoutube }
}
return {
route: Routes.PublishYoutube,
params: { projectId: project.id },
}
}
default:
return {}
}