feat: benai chagne location
This commit is contained in:
@@ -17,7 +17,6 @@ import { background, icons } from '../../assets'
|
||||
import alert from '../../components/Alert'
|
||||
import BorderGradientButton from '../../components/BorderGradientButton'
|
||||
import CreditAmount from '../../components/CreditAmount'
|
||||
import FullscreenIntroVideo from '../../components/FullscreenIntroVideo'
|
||||
import GradientButton from '../../components/GradientButton'
|
||||
import ValidateModal from '../../components/modal/ValidateModal'
|
||||
import MusicLandHeader from '../../components/MusicLandHeader'
|
||||
@@ -43,11 +42,9 @@ const SongReady = () => {
|
||||
selectedProject,
|
||||
updateProjectData,
|
||||
updateUserData,
|
||||
videos,
|
||||
} = useUser()
|
||||
const [showValidateModal, setShowValidateModal] = useState(false)
|
||||
const [showRegenerateModal, setShowRegenerateModal] = useState(false)
|
||||
const [outroVideoUrl, setOutroVideoUrl] = useState(null)
|
||||
const [musicUrls, setMusicUrls] = useState([])
|
||||
const [selectedIndex, setSelectedIndex] = useState(0)
|
||||
const playerRefs = useRef({})
|
||||
@@ -114,7 +111,6 @@ const SongReady = () => {
|
||||
}, [selectedProject?.musicUrls])
|
||||
|
||||
const navigateToCover = useCallback(() => {
|
||||
setOutroVideoUrl(null)
|
||||
reset({
|
||||
index: 1,
|
||||
routes: [{ name: Routes.BottomTab }, { name: Routes.ChooseCoverType }],
|
||||
@@ -156,12 +152,7 @@ const SongReady = () => {
|
||||
})
|
||||
|
||||
await pauseAllPlayers()
|
||||
const benaiUrl = typeof videos?.benai === 'string' ? videos.benai.trim() : ''
|
||||
if (benaiUrl) {
|
||||
setOutroVideoUrl(benaiUrl)
|
||||
} else {
|
||||
navigateToCover()
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Validate error', e?.message)
|
||||
}
|
||||
@@ -348,11 +339,6 @@ const SongReady = () => {
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<FullscreenIntroVideo
|
||||
visible={!!outroVideoUrl}
|
||||
url={outroVideoUrl}
|
||||
onClose={navigateToCover}
|
||||
/>
|
||||
</Page>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { Image as ExpoImage } from 'expo-image'
|
||||
import { Linking, Platform, ScrollView, StyleSheet, Text, View, Alert } from 'react-native'
|
||||
import useMinuit from 'react-native-minuit/src/hooks/useMinuit.js'
|
||||
import * as FileSystem from 'expo-file-system'
|
||||
import * as Sharing from 'expo-sharing'
|
||||
import BorderGradientButton from '../../components/BorderGradientButton'
|
||||
import FullscreenIntroVideo from '../../components/FullscreenIntroVideo'
|
||||
import GradientButton from '../../components/GradientButton'
|
||||
import MusicLandHeader from '../../components/MusicLandHeader'
|
||||
import { projectsRef, serverTimestamp } from '../../config/firebase'
|
||||
@@ -29,10 +30,18 @@ const SongDownload = ({ route }) => {
|
||||
project: routeProject,
|
||||
selectedOption: routeSelectedOption,
|
||||
coverOptions: routeCoverOptions,
|
||||
skipAdventureGate = false,
|
||||
promptPurchaseConfirm = false,
|
||||
backRoute = null,
|
||||
} = route?.params || {}
|
||||
const { selectedProject, updateProjectData, hasActiveSubscription, hasPurchased } = useUser()
|
||||
const {
|
||||
selectedProject,
|
||||
updateProjectData,
|
||||
hasActiveSubscription,
|
||||
hasPurchased,
|
||||
currentUserData,
|
||||
videos,
|
||||
} = useUser()
|
||||
const { createSongDownloadCheckout } = useStripe()
|
||||
const { setTooltip } = useMinuit()
|
||||
const { setLoading } = useGlobalLoading()
|
||||
@@ -41,6 +50,21 @@ const SongDownload = ({ route }) => {
|
||||
const [downloadPaymentPending, setDownloadPaymentPending] = useState(false)
|
||||
const [pendingDownloadIntent, setPendingDownloadIntent] = useState(null)
|
||||
const [isPublishing, setIsPublishing] = useState(false)
|
||||
const [benaiVideoUrl, setBenaiVideoUrl] = useState(null)
|
||||
const benaiVideoHandledRef = useRef(false)
|
||||
|
||||
useEffect(() => {
|
||||
if (skipAdventureGate || benaiVideoHandledRef.current) return
|
||||
|
||||
const preferredLanguage = currentUserData?.preferredLanguage === 'en' ? 'en' : 'fr'
|
||||
if (videos?.id !== preferredLanguage) return
|
||||
|
||||
benaiVideoHandledRef.current = true
|
||||
const url = typeof videos?.benai === 'string' ? videos.benai.trim() : ''
|
||||
if (url) {
|
||||
setBenaiVideoUrl(url)
|
||||
}
|
||||
}, [currentUserData?.preferredLanguage, skipAdventureGate, videos])
|
||||
|
||||
const projectForStage = useMemo(() => {
|
||||
if (routeProject?.id && selectedProject?.id && routeProject.id === selectedProject.id) {
|
||||
@@ -589,6 +613,11 @@ const SongDownload = ({ route }) => {
|
||||
/>
|
||||
</View>
|
||||
</ScrollView>
|
||||
<FullscreenIntroVideo
|
||||
url={benaiVideoUrl}
|
||||
visible={!!benaiVideoUrl}
|
||||
onClose={() => setBenaiVideoUrl(null)}
|
||||
/>
|
||||
</Page>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user