feat: time offset playback
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { Image as ExpoImage } from 'expo-image'
|
||||
import {
|
||||
BackHandler,
|
||||
Linking,
|
||||
Platform,
|
||||
Pressable,
|
||||
@@ -10,6 +11,7 @@ import {
|
||||
View,
|
||||
Alert,
|
||||
} from 'react-native'
|
||||
import { useFocusEffect } from '@react-navigation/native'
|
||||
import useMinuit from 'react-native-minuit/src/hooks/useMinuit.js'
|
||||
import * as FileSystem from 'expo-file-system'
|
||||
import * as Sharing from 'expo-sharing'
|
||||
@@ -42,6 +44,7 @@ const SongDownload = ({ route }) => {
|
||||
coverOptions: routeCoverOptions,
|
||||
skipAdventureGate = false,
|
||||
promptPurchaseConfirm = false,
|
||||
backRoute = null,
|
||||
} = route?.params || {}
|
||||
const { selectedProject, updateProjectData, hasActiveSubscription, hasPurchased } = useUser()
|
||||
const { createSongDownloadCheckout } = useStripe()
|
||||
@@ -111,6 +114,25 @@ const SongDownload = ({ route }) => {
|
||||
const showSubscriptionCta = !hasActiveSubscription
|
||||
const shouldShowDownloadPage = adventureChoice === 'stop'
|
||||
|
||||
const handleBackPress = useCallback(() => {
|
||||
if (backRoute) {
|
||||
navigate(backRoute)
|
||||
return true
|
||||
}
|
||||
goBack()
|
||||
return true
|
||||
}, [backRoute])
|
||||
|
||||
useFocusEffect(
|
||||
useCallback(() => {
|
||||
if (Platform.OS !== 'android' || !backRoute) {
|
||||
return undefined
|
||||
}
|
||||
const subscription = BackHandler.addEventListener('hardwareBackPress', handleBackPress)
|
||||
return () => subscription.remove()
|
||||
}, [backRoute, handleBackPress])
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (adventureGateTriggeredRef.current) {
|
||||
return
|
||||
@@ -509,7 +531,7 @@ const SongDownload = ({ route }) => {
|
||||
|
||||
return (
|
||||
<Page backgroundImg={background.studioBG2} headerType="NONE">
|
||||
<MusicLandHeader onPressBack={goBack} progress={84} />
|
||||
<MusicLandHeader onPressBack={handleBackPress} progress={84} />
|
||||
{shouldShowDownloadPage ? (
|
||||
<ScrollView
|
||||
contentContainerStyle={[
|
||||
|
||||
Reference in New Issue
Block a user