feat: fix payment flow
This commit is contained in:
@@ -173,10 +173,13 @@ const PlaybackDownload = ({ route }) => {
|
||||
const hasShownAfterPlaybackRef = useRef(false)
|
||||
|
||||
const projectForDownload = useMemo(() => {
|
||||
if (routeProject?.id && selectedProject?.id && routeProject.id === selectedProject.id) {
|
||||
return selectedProject
|
||||
if (routeProject && typeof routeProject === 'object' && routeProject.id) {
|
||||
if (selectedProject?.id === routeProject.id) {
|
||||
return selectedProject
|
||||
}
|
||||
return routeProject
|
||||
}
|
||||
return routeProject || selectedProject || null
|
||||
return selectedProject?.id ? selectedProject : null
|
||||
}, [routeProject, selectedProject])
|
||||
|
||||
const playbackDownloadStatus = projectForDownload?.playbackDownloadPurchase?.status || null
|
||||
@@ -365,7 +368,7 @@ const PlaybackDownload = ({ route }) => {
|
||||
)
|
||||
|
||||
const startPlaybackDownloadCheckout = useCallback(
|
||||
async (intent, { force = false } = {}) => {
|
||||
async (intent) => {
|
||||
if (!projectForDownload?.id) {
|
||||
setTooltip({
|
||||
type: 'error',
|
||||
@@ -374,7 +377,7 @@ const PlaybackDownload = ({ route }) => {
|
||||
return
|
||||
}
|
||||
|
||||
if (!force && (isCheckoutLaunching || downloadPaymentPending)) {
|
||||
if (isCheckoutLaunching) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -396,7 +399,6 @@ const PlaybackDownload = ({ route }) => {
|
||||
},
|
||||
[
|
||||
createPlaybackDownloadCheckout,
|
||||
downloadPaymentPending,
|
||||
isCheckoutLaunching,
|
||||
projectForDownload,
|
||||
setTooltip,
|
||||
@@ -480,7 +482,7 @@ const PlaybackDownload = ({ route }) => {
|
||||
<Text style={styles.sectionTitle}>Téléchargement</Text>
|
||||
<Text style={styles.sectionDescription}>{downloadAccessLabel}</Text>
|
||||
<BorderGradientButton
|
||||
title="Option 1 · Téléchargement à des fins personnelles"
|
||||
title="Télécharger à des fins personnelles"
|
||||
onPress={() => handlePlaybackChoice('personal')}
|
||||
disabled={isPublishing || isDownloading || isCheckoutLaunching}
|
||||
loading={isDownloading && !isPublishing}
|
||||
@@ -492,7 +494,7 @@ const PlaybackDownload = ({ route }) => {
|
||||
title={
|
||||
isPublishing
|
||||
? 'Téléchargement et publication en cours...'
|
||||
: 'Option 2 · Télécharger et publier sur MusicLand'
|
||||
: 'Télécharger et publier sur MusicLand'
|
||||
}
|
||||
onPress={() => handlePlaybackChoice('publish')}
|
||||
disabled={isPublishing || isDownloading || isCheckoutLaunching}
|
||||
|
||||
Reference in New Issue
Block a user