feat: videos

This commit is contained in:
leon
2026-09-09 09:58:40 +02:00
parent 6e8b5ab66c
commit 24b267f2bf
7 changed files with 47 additions and 47 deletions
+3 -1
View File
@@ -420,9 +420,11 @@ export default ({ children }) => {
selectProject(fallbackProjectId) selectProject(fallbackProjectId)
}, [currentUserDoc?.selectedProjectId, selectProject, selectedProjectId, userProjects]) }, [currentUserDoc?.selectedProjectId, selectProject, selectedProjectId, userProjects])
const videoLanguage = currentUserDoc?.preferredLanguage === 'en' ? 'en' : 'fr'
const { data: videos } = useDataFromRef({ const { data: videos } = useDataFromRef({
ref: videosRef.doc('fr'), ref: videosRef.doc(videoLanguage),
simpleRef: true, simpleRef: true,
refreshArray: [videoLanguage],
}) })
const hasActiveSubscription = useMemo(() => { const hasActiveSubscription = useMemo(() => {
+2 -2
View File
@@ -375,8 +375,8 @@ const Home = ({ navigation, route }) => {
}, [hasLocalAdventureFlag, persistAdventureStarted, setTooltip]) }, [hasLocalAdventureFlag, persistAdventureStarted, setTooltip])
const handleStartVisit = useCallback(() => { const handleStartVisit = useCallback(() => {
setVideoUrl(isWeb ? videos?.landingWeb : videos?.landing) setVideoUrl(videos?.landing || null)
}, []) }, [videos?.landing])
const handleReturnToLanding = useCallback(() => { const handleReturnToLanding = useCallback(() => {
navigate(Routes.LandingPage) navigate(Routes.LandingPage)
+2 -3
View File
@@ -10,7 +10,6 @@ import { Routes } from '../../navigation'
import { goBack, navigate } from '../../navigation/NavigationService' import { goBack, navigate } from '../../navigation/NavigationService'
import { gutters } from '../../styles' import { gutters } from '../../styles'
import { useUserData } from '../../providers/UserDataProvider' import { useUserData } from '../../providers/UserDataProvider'
import { isWeb } from '../../hooks/useLayoutType'
const Compose = () => { const Compose = () => {
const { videos } = useUserData() const { videos } = useUserData()
@@ -21,8 +20,8 @@ const Compose = () => {
const [videoUrl, setVideoUrl] = useState(null) const [videoUrl, setVideoUrl] = useState(null)
useEffect(() => { useEffect(() => {
setVideoUrl(isWeb ? videos.malikWeb : videos?.malik) setVideoUrl(videos?.malik || null)
}, []) }, [videos?.malik])
const handleBack = () => { const handleBack = () => {
if (fromLyrics) { if (fromLyrics) {
+10 -1
View File
@@ -1,9 +1,10 @@
import React, { useMemo, useRef, useState } from 'react' import React, { useMemo, useRef, useState } from 'react'
import { useRoute } from '@react-navigation/native' import { useIsFocused, useRoute } from '@react-navigation/native'
import { Dimensions, Modal, Text, View } from 'react-native' import { Dimensions, Modal, Text, View } from 'react-native'
import SwiperFlatList from 'react-native-swiper-flatlist' import SwiperFlatList from 'react-native-swiper-flatlist'
import { background, icons } from '../../assets' import { background, icons } from '../../assets'
import BorderGradientButton from '../../components/BorderGradientButton' import BorderGradientButton from '../../components/BorderGradientButton'
import FullscreenIntroVideo from '../../components/FullscreenIntroVideo'
import GradientButton from '../../components/GradientButton' import GradientButton from '../../components/GradientButton'
import MusicLandHeader from '../../components/MusicLandHeader' import MusicLandHeader from '../../components/MusicLandHeader'
import AppAlert from '../../components/Alert' import AppAlert from '../../components/Alert'
@@ -36,6 +37,7 @@ const INSTRUMENT_STEP_INDEX = FIRST_VOICE_STEP_INDEX + VOICE_SECTION_TITLES.leng
const RHYTHM_STEP_INDEX = LAST_STEP_INDEX const RHYTHM_STEP_INDEX = LAST_STEP_INDEX
const ComposeSong = () => { const ComposeSong = () => {
const isFocused = useIsFocused()
const scrollRef = useRef(null) const scrollRef = useRef(null)
const [selectedIndex, setSelectedIndex] = useState(0) const [selectedIndex, setSelectedIndex] = useState(0)
const [progress, setProgress] = useState(18) const [progress, setProgress] = useState(18)
@@ -47,6 +49,7 @@ const ComposeSong = () => {
updateProjectData, updateProjectData,
currentUserData, currentUserData,
currentUID, currentUID,
videos,
} = useUser() } = useUser()
// Selections state // Selections state
@@ -58,6 +61,7 @@ const ComposeSong = () => {
const [isConfirmVisible, setIsConfirmVisible] = useState(false) const [isConfirmVisible, setIsConfirmVisible] = useState(false)
const [isProcessingConfirmation, setIsProcessingConfirmation] = useState(false) const [isProcessingConfirmation, setIsProcessingConfirmation] = useState(false)
const [showMalikVideo, setShowMalikVideo] = useState(true)
const isRegenerationFlow = route?.params?.isRegeneration === true const isRegenerationFlow = route?.params?.isRegeneration === true
const fromLyrics = route?.params?.fromLyrics === true const fromLyrics = route?.params?.fromLyrics === true
@@ -467,6 +471,11 @@ const ComposeSong = () => {
</CreateLyricsHeader> </CreateLyricsHeader>
</View> </View>
</Modal> </Modal>
<FullscreenIntroVideo
visible={isFocused && showMalikVideo && !!videos?.malik}
url={videos?.malik}
onClose={() => setShowMalikVideo(false)}
/>
</Page> </Page>
) )
} }
+7 -13
View File
@@ -2,8 +2,8 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { useIsFocused, useRoute } from '@react-navigation/native' import { useIsFocused, useRoute } from '@react-navigation/native'
import { FlatList, Modal, StyleSheet, Text, View, useWindowDimensions } from 'react-native' import { FlatList, Modal, StyleSheet, Text, View, useWindowDimensions } from 'react-native'
import { background } from '../../assets' import { background } from '../../assets'
import BackgroundVideo from '../../components/BackgroundVideo'
import BorderGradientButton from '../../components/BorderGradientButton' import BorderGradientButton from '../../components/BorderGradientButton'
import FullscreenIntroVideo from '../../components/FullscreenIntroVideo'
import GradientButton from '../../components/GradientButton' import GradientButton from '../../components/GradientButton'
import MusicLandHeader from '../../components/MusicLandHeader' import MusicLandHeader from '../../components/MusicLandHeader'
import AppAlert from '../../components/Alert' import AppAlert from '../../components/Alert'
@@ -64,6 +64,7 @@ const ComposeSong = () => {
const [rhythm, setRhythm] = useState(null) const [rhythm, setRhythm] = useState(null)
const [isConfirmVisible, setIsConfirmVisible] = useState(false) const [isConfirmVisible, setIsConfirmVisible] = useState(false)
const [isProcessingConfirmation, setIsProcessingConfirmation] = useState(false) const [isProcessingConfirmation, setIsProcessingConfirmation] = useState(false)
const [showMalikVideo, setShowMalikVideo] = useState(true)
const isRegenerationFlow = route?.params?.isRegeneration === true const isRegenerationFlow = route?.params?.isRegeneration === true
const fromLyrics = route?.params?.fromLyrics === true const fromLyrics = route?.params?.fromLyrics === true
@@ -309,14 +310,6 @@ const ComposeSong = () => {
return ( return (
<Page <Page
backgroundImg={background.studioBG2} backgroundImg={background.studioBG2}
backgroundContent={
isFocused ? (
<BackgroundVideo
source={videos?.malikWeb}
soundButtonStyle={styles.rightSideControl}
/>
) : null
}
coinBadgeContainerStyle={styles.rightSideCredits} coinBadgeContainerStyle={styles.rightSideCredits}
headerType="NONE" headerType="NONE"
> >
@@ -505,6 +498,11 @@ const ComposeSong = () => {
</CreateLyricsHeader> </CreateLyricsHeader>
</View> </View>
</Modal> </Modal>
<FullscreenIntroVideo
visible={isFocused && showMalikVideo && !!videos?.malik}
url={videos?.malik}
onClose={() => setShowMalikVideo(false)}
/>
</Page> </Page>
) )
} }
@@ -512,10 +510,6 @@ const ComposeSong = () => {
export default ComposeSong export default ComposeSong
const styles = StyleSheet.create({ const styles = StyleSheet.create({
rightSideControl: {
right: 24,
left: 'auto',
},
rightSideCredits: { rightSideCredits: {
right: 24, right: 24,
left: 'auto', left: 'auto',
+22 -4
View File
@@ -17,6 +17,7 @@ import { background, icons } from '../../assets'
import alert from '../../components/Alert' import alert from '../../components/Alert'
import BorderGradientButton from '../../components/BorderGradientButton' import BorderGradientButton from '../../components/BorderGradientButton'
import CreditAmount from '../../components/CreditAmount' import CreditAmount from '../../components/CreditAmount'
import FullscreenIntroVideo from '../../components/FullscreenIntroVideo'
import GradientButton from '../../components/GradientButton' import GradientButton from '../../components/GradientButton'
import ValidateModal from '../../components/modal/ValidateModal' import ValidateModal from '../../components/modal/ValidateModal'
import MusicLandHeader from '../../components/MusicLandHeader' import MusicLandHeader from '../../components/MusicLandHeader'
@@ -42,9 +43,11 @@ const SongReady = () => {
selectedProject, selectedProject,
updateProjectData, updateProjectData,
updateUserData, updateUserData,
videos,
} = useUser() } = useUser()
const [showValidateModal, setShowValidateModal] = useState(false) const [showValidateModal, setShowValidateModal] = useState(false)
const [showRegenerateModal, setShowRegenerateModal] = useState(false) const [showRegenerateModal, setShowRegenerateModal] = useState(false)
const [outroVideoUrl, setOutroVideoUrl] = useState(null)
const [musicUrls, setMusicUrls] = useState([]) const [musicUrls, setMusicUrls] = useState([])
const [selectedIndex, setSelectedIndex] = useState(0) const [selectedIndex, setSelectedIndex] = useState(0)
const playerRefs = useRef({}) const playerRefs = useRef({})
@@ -110,6 +113,14 @@ const SongReady = () => {
}) })
}, [selectedProject?.musicUrls]) }, [selectedProject?.musicUrls])
const navigateToCover = useCallback(() => {
setOutroVideoUrl(null)
reset({
index: 1,
routes: [{ name: Routes.BottomTab }, { name: Routes.ChooseCoverType }],
})
}, [])
const validateSelection = async () => { const validateSelection = async () => {
try { try {
const url = musicUrls[selectedIndex] const url = musicUrls[selectedIndex]
@@ -145,10 +156,12 @@ const SongReady = () => {
}) })
await pauseAllPlayers() await pauseAllPlayers()
reset({ const benaiUrl = typeof videos?.benai === 'string' ? videos.benai.trim() : ''
index: 1, if (benaiUrl) {
routes: [{ name: Routes.BottomTab }, { name: Routes.ChooseCoverType }], setOutroVideoUrl(benaiUrl)
}) } else {
navigateToCover()
}
} catch (e) { } catch (e) {
console.log('Validate error', e?.message) console.log('Validate error', e?.message)
} }
@@ -335,6 +348,11 @@ const SongReady = () => {
/> />
</> </>
)} )}
<FullscreenIntroVideo
visible={!!outroVideoUrl}
url={outroVideoUrl}
onClose={navigateToCover}
/>
</Page> </Page>
) )
} }
+1 -23
View File
@@ -1,4 +1,4 @@
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react' import React, { useCallback, useEffect, useMemo, useState } from 'react'
import { Image as ExpoImage } from 'expo-image' import { Image as ExpoImage } from 'expo-image'
import { Linking, Platform, ScrollView, StyleSheet, Text, View, Alert } from 'react-native' import { Linking, Platform, ScrollView, StyleSheet, Text, View, Alert } from 'react-native'
import useMinuit from 'react-native-minuit/src/hooks/useMinuit.js' import useMinuit from 'react-native-minuit/src/hooks/useMinuit.js'
@@ -22,7 +22,6 @@ import useGlobalLoading from '../../hooks/useGlobalLoading'
import { isWeb } from '../../hooks/useLayoutType' import { isWeb } from '../../hooks/useLayoutType'
import { getArtistDisplayName } from '../../utils/artistName' import { getArtistDisplayName } from '../../utils/artistName'
import { toDate } from '../../utils/dateFormatting' import { toDate } from '../../utils/dateFormatting'
import FullscreenIntroVideo from '../../components/FullscreenIntroVideo'
import { musiclandShareHeading } from '../../data' import { musiclandShareHeading } from '../../data'
const SongDownload = ({ route }) => { const SongDownload = ({ route }) => {
@@ -30,7 +29,6 @@ const SongDownload = ({ route }) => {
project: routeProject, project: routeProject,
selectedOption: routeSelectedOption, selectedOption: routeSelectedOption,
coverOptions: routeCoverOptions, coverOptions: routeCoverOptions,
skipAdventureGate = false,
promptPurchaseConfirm = false, promptPurchaseConfirm = false,
backRoute = null, backRoute = null,
} = route?.params || {} } = route?.params || {}
@@ -43,10 +41,6 @@ const SongDownload = ({ route }) => {
const [downloadPaymentPending, setDownloadPaymentPending] = useState(false) const [downloadPaymentPending, setDownloadPaymentPending] = useState(false)
const [pendingDownloadIntent, setPendingDownloadIntent] = useState(null) const [pendingDownloadIntent, setPendingDownloadIntent] = useState(null)
const [isPublishing, setIsPublishing] = useState(false) const [isPublishing, setIsPublishing] = useState(false)
const { videos } = useUser()
const part1Url = isWeb ? videos?.benaiPart1 : videos?.benaiPart1
const [showIntro, setShowIntro] = useState(null)
const introTriggeredRef = useRef(false)
const projectForStage = useMemo(() => { const projectForStage = useMemo(() => {
if (routeProject?.id && selectedProject?.id && routeProject.id === selectedProject.id) { if (routeProject?.id && selectedProject?.id && routeProject.id === selectedProject.id) {
@@ -106,17 +100,6 @@ const SongDownload = ({ route }) => {
return true return true
}, [backRoute]) }, [backRoute])
useEffect(() => {
if (skipAdventureGate || introTriggeredRef.current) return
if (typeof videos === 'undefined') {
return
}
introTriggeredRef.current = true
if (part1Url) {
setShowIntro(part1Url)
}
}, [part1Url, skipAdventureGate, videos])
const continueFlow = useCallback(async () => { const continueFlow = useCallback(async () => {
if (!selectedOption) { if (!selectedOption) {
return return
@@ -155,10 +138,6 @@ const SongDownload = ({ route }) => {
} }
}, [coverOptions, coverUrl, projectForStage, push, selectedOption, setLoading, updateProjectData]) }, [coverOptions, coverUrl, projectForStage, push, selectedOption, setLoading, updateProjectData])
const handleCloseIntro = useCallback(() => {
setShowIntro(null)
}, [])
const handleContinueAdventure = useCallback(() => { const handleContinueAdventure = useCallback(() => {
continueFlow() continueFlow()
}, [continueFlow]) }, [continueFlow])
@@ -610,7 +589,6 @@ const SongDownload = ({ route }) => {
/> />
</View> </View>
</ScrollView> </ScrollView>
<FullscreenIntroVideo url={showIntro} visible={!!showIntro} onClose={handleCloseIntro} />
</Page> </Page>
) )
} }