feat: close v1 feature gaps — freemium gating, video/audio infrastructure, EAS build config
- Add access control service with 3 free workouts (IDs 1, 11, 43), paywall gating on workout detail and lock indicators on explore grid - Wire VideoPlayer into player background and workout detail preview - Add placeholder HLS video URLs to 5 sample workouts (Apple test streams) - Add test audio URLs to music service MOCK_TRACKS for all vibes - Switch RevenueCat API key to env-based with sandbox fallback - Create eas.json with development/preview/production build profiles - Update app.json with iOS privacy descriptions (HealthKit, Camera) and non-exempt encryption flag - Create collection detail screen (route crash fix) - Replace hardcoded profile stats with real activity store data - Add unlockWithPremium i18n key in EN/FR/DE/ES
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
# TabataFit Environment Variables
|
||||
# Copy this file to .env and fill in your Supabase credentials
|
||||
# Copy this file to .env and fill in your credentials
|
||||
|
||||
# Supabase Configuration
|
||||
EXPO_PUBLIC_SUPABASE_URL=your_supabase_project_url
|
||||
EXPO_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
|
||||
|
||||
# RevenueCat (Apple subscriptions)
|
||||
# Defaults to test_ sandbox key if not set
|
||||
EXPO_PUBLIC_REVENUECAT_API_KEY=your_revenuecat_api_key
|
||||
|
||||
# Admin Dashboard (optional - for admin authentication)
|
||||
EXPO_PUBLIC_ADMIN_EMAIL=admin@tabatafit.app
|
||||
|
||||
12
app.json
12
app.json
@@ -11,7 +11,17 @@
|
||||
"ios": {
|
||||
"supportsTablet": true,
|
||||
"bundleIdentifier": "com.millianlmx.tabatafit",
|
||||
"buildNumber": "1"
|
||||
"buildNumber": "1",
|
||||
"infoPlist": {
|
||||
"NSHealthShareUsageDescription": "TabataFit uses HealthKit to read and write workout data including heart rate, calories burned, and exercise minutes.",
|
||||
"NSHealthUpdateUsageDescription": "TabataFit saves your workout sessions to Apple Health so you can track your fitness progress.",
|
||||
"NSCameraUsageDescription": "TabataFit uses the camera for profile photos and workout form checks.",
|
||||
"NSUserTrackingUsageDescription": "TabataFit uses this to provide personalized workout recommendations.",
|
||||
"ITSAppUsesNonExemptEncryption": false
|
||||
},
|
||||
"config": {
|
||||
"usesNonExemptEncryption": false
|
||||
}
|
||||
},
|
||||
"android": {
|
||||
"adaptiveIcon": {
|
||||
|
||||
@@ -8,7 +8,9 @@ import Ionicons from '@expo/vector-icons/Ionicons'
|
||||
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useHaptics } from '@/src/shared/hooks'
|
||||
import { usePurchases } from '@/src/shared/hooks/usePurchases'
|
||||
import { useWorkouts, useCollections, useFeaturedWorkouts, useTrainers } from '@/src/shared/hooks/useSupabaseData'
|
||||
import { isFreeWorkout } from '@/src/shared/services/access'
|
||||
import { StyledText } from '@/src/shared/components/StyledText'
|
||||
|
||||
import { useThemeColors, BRAND } from '@/src/shared/theme'
|
||||
@@ -108,9 +110,11 @@ function CollectionCard({
|
||||
function WorkoutCard({
|
||||
workout,
|
||||
onPress,
|
||||
isLocked,
|
||||
}: {
|
||||
workout: Workout
|
||||
onPress: () => void
|
||||
isLocked?: boolean
|
||||
}) {
|
||||
const colors = useThemeColors()
|
||||
const categoryColor = CATEGORY_COLORS[workout.category]
|
||||
@@ -133,9 +137,15 @@ function WorkoutCard({
|
||||
</StyledText>
|
||||
</View>
|
||||
|
||||
{isLocked && (
|
||||
<View style={styles.lockBadge}>
|
||||
<Ionicons name="lock-closed" size={10} color="#FFFFFF" />
|
||||
</View>
|
||||
)}
|
||||
|
||||
<View style={styles.playArea}>
|
||||
<View style={[styles.playCircle, { backgroundColor: categoryColor + '20' }]}>
|
||||
<Ionicons name="play" size={18} color={categoryColor} />
|
||||
<Ionicons name={isLocked ? 'lock-closed' : 'play'} size={18} color={categoryColor} />
|
||||
</View>
|
||||
</View>
|
||||
|
||||
@@ -209,6 +219,7 @@ export default function ExploreScreen() {
|
||||
const router = useRouter()
|
||||
const haptics = useHaptics()
|
||||
const colors = useThemeColors()
|
||||
const { isPremium } = usePurchases()
|
||||
|
||||
const [filters, setFilters] = useState<FilterState>({
|
||||
category: 'all',
|
||||
@@ -319,6 +330,7 @@ export default function ExploreScreen() {
|
||||
key={workout.id}
|
||||
workout={workout}
|
||||
onPress={() => handleWorkoutPress(workout.id)}
|
||||
isLocked={!isPremium && !isFreeWorkout(workout.id)}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
@@ -398,6 +410,7 @@ export default function ExploreScreen() {
|
||||
key={workout.id}
|
||||
workout={workout}
|
||||
onPress={() => handleWorkoutPress(workout.id)}
|
||||
isLocked={!isPremium && !isFreeWorkout(workout.id)}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
@@ -516,6 +529,17 @@ const styles = StyleSheet.create({
|
||||
paddingVertical: 3,
|
||||
borderRadius: RADIUS.SM,
|
||||
},
|
||||
lockBadge: {
|
||||
position: 'absolute',
|
||||
top: SPACING[3],
|
||||
left: SPACING[3],
|
||||
width: 22,
|
||||
height: 22,
|
||||
borderRadius: 11,
|
||||
backgroundColor: 'rgba(0,0,0,0.6)',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
playArea: {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
|
||||
@@ -18,7 +18,7 @@ import * as Linking from 'expo-linking'
|
||||
import Constants from 'expo-constants'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useMemo, useState } from 'react'
|
||||
import { useUserStore } from '@/src/shared/stores'
|
||||
import { useUserStore, useActivityStore } from '@/src/shared/stores'
|
||||
import { requestNotificationPermissions, usePurchases } from '@/src/shared/hooks'
|
||||
import { useThemeColors, BRAND } from '@/src/shared/theme'
|
||||
import type { ThemeColors } from '@/src/shared/theme/types'
|
||||
@@ -78,12 +78,14 @@ export default function ProfileScreen() {
|
||||
const planLabel = isPremium ? 'TabataFit+' : t('profile.freePlan')
|
||||
const avatarInitial = profile.name?.[0]?.toUpperCase() || 'U'
|
||||
|
||||
// Mock stats (replace with real data from activityStore when available)
|
||||
const stats = {
|
||||
workouts: 47,
|
||||
streak: 12,
|
||||
calories: 12500,
|
||||
}
|
||||
// Real stats from activity store
|
||||
const history = useActivityStore((s) => s.history)
|
||||
const streak = useActivityStore((s) => s.streak)
|
||||
const stats = useMemo(() => ({
|
||||
workouts: history.length,
|
||||
streak: streak.current,
|
||||
calories: history.reduce((sum, r) => sum + (r.calories ?? 0), 0),
|
||||
}), [history, streak])
|
||||
|
||||
const handleSignOut = () => {
|
||||
updateProfile({
|
||||
|
||||
249
app/collection/[id].tsx
Normal file
249
app/collection/[id].tsx
Normal file
@@ -0,0 +1,249 @@
|
||||
/**
|
||||
* TabataFit Collection Detail Screen
|
||||
* Shows collection info + list of workouts in that collection
|
||||
*/
|
||||
|
||||
import { useMemo } from 'react'
|
||||
import { View, StyleSheet, ScrollView, Pressable } from 'react-native'
|
||||
import { useRouter, useLocalSearchParams } from 'expo-router'
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
||||
import { LinearGradient } from 'expo-linear-gradient'
|
||||
import Ionicons from '@expo/vector-icons/Ionicons'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
import { useHaptics } from '@/src/shared/hooks'
|
||||
import { useCollection } from '@/src/shared/hooks/useSupabaseData'
|
||||
import { getWorkoutById } from '@/src/shared/data'
|
||||
import { useTranslatedWorkouts } from '@/src/shared/data/useTranslatedData'
|
||||
import { StyledText } from '@/src/shared/components/StyledText'
|
||||
import { track } from '@/src/shared/services/analytics'
|
||||
|
||||
import { useThemeColors, BRAND, GRADIENTS } from '@/src/shared/theme'
|
||||
import type { ThemeColors } from '@/src/shared/theme/types'
|
||||
import { SPACING, LAYOUT } from '@/src/shared/constants/spacing'
|
||||
import { RADIUS } from '@/src/shared/constants/borderRadius'
|
||||
|
||||
export default function CollectionDetailScreen() {
|
||||
const insets = useSafeAreaInsets()
|
||||
const router = useRouter()
|
||||
const haptics = useHaptics()
|
||||
const { t } = useTranslation()
|
||||
const { id } = useLocalSearchParams<{ id: string }>()
|
||||
|
||||
const colors = useThemeColors()
|
||||
const styles = useMemo(() => createStyles(colors), [colors])
|
||||
|
||||
const { data: collection, isLoading } = useCollection(id)
|
||||
|
||||
// Resolve workouts from collection's workoutIds
|
||||
const rawWorkouts = useMemo(() => {
|
||||
if (!collection) return []
|
||||
return collection.workoutIds
|
||||
.map((wId) => getWorkoutById(wId))
|
||||
.filter(Boolean) as NonNullable<ReturnType<typeof getWorkoutById>>[]
|
||||
}, [collection])
|
||||
|
||||
const workouts = useTranslatedWorkouts(rawWorkouts)
|
||||
|
||||
const handleBack = () => {
|
||||
haptics.selection()
|
||||
router.back()
|
||||
}
|
||||
|
||||
const handleWorkoutPress = (workoutId: string) => {
|
||||
haptics.buttonTap()
|
||||
track('collection_workout_tapped', {
|
||||
collection_id: id,
|
||||
workout_id: workoutId,
|
||||
})
|
||||
router.push(`/workout/${workoutId}`)
|
||||
}
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<View style={[styles.container, styles.centered, { paddingTop: insets.top }]}>
|
||||
<StyledText size={17} color={colors.text.tertiary}>Loading...</StyledText>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
if (!collection) {
|
||||
return (
|
||||
<View style={[styles.container, styles.centered, { paddingTop: insets.top }]}>
|
||||
<Ionicons name="folder-open-outline" size={48} color={colors.text.tertiary} />
|
||||
<StyledText size={17} color={colors.text.tertiary} style={{ marginTop: SPACING[3] }}>
|
||||
Collection not found
|
||||
</StyledText>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={[styles.container, { paddingTop: insets.top }]}>
|
||||
{/* Header */}
|
||||
<View style={styles.header}>
|
||||
<Pressable onPress={handleBack} style={styles.backButton}>
|
||||
<Ionicons name="chevron-back" size={24} color={colors.text.primary} />
|
||||
</Pressable>
|
||||
<StyledText size={22} weight="bold" color={colors.text.primary} numberOfLines={1} style={{ flex: 1, textAlign: 'center' }}>
|
||||
{collection.title}
|
||||
</StyledText>
|
||||
<View style={styles.backButton} />
|
||||
</View>
|
||||
|
||||
<ScrollView
|
||||
style={styles.scrollView}
|
||||
contentContainerStyle={[styles.scrollContent, { paddingBottom: insets.bottom + 100 }]}
|
||||
showsVerticalScrollIndicator={false}
|
||||
>
|
||||
{/* Hero Card */}
|
||||
<View style={styles.heroCard}>
|
||||
<LinearGradient
|
||||
colors={collection.gradient ?? [BRAND.PRIMARY, '#FF3B30']}
|
||||
start={{ x: 0, y: 0 }}
|
||||
end={{ x: 1, y: 1 }}
|
||||
style={StyleSheet.absoluteFill}
|
||||
/>
|
||||
<View style={styles.heroContent}>
|
||||
<StyledText size={48} color="#FFFFFF" style={styles.heroIcon}>
|
||||
{collection.icon}
|
||||
</StyledText>
|
||||
<StyledText size={28} weight="bold" color="#FFFFFF">
|
||||
{collection.title}
|
||||
</StyledText>
|
||||
<StyledText size={15} color="rgba(255,255,255,0.8)" style={{ marginTop: SPACING[1] }}>
|
||||
{collection.description}
|
||||
</StyledText>
|
||||
<StyledText size={13} weight="semibold" color="rgba(255,255,255,0.6)" style={{ marginTop: SPACING[2] }}>
|
||||
{t('plurals.workout', { count: workouts.length })}
|
||||
</StyledText>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* Workout List */}
|
||||
<StyledText
|
||||
size={20}
|
||||
weight="bold"
|
||||
color={colors.text.primary}
|
||||
style={{ marginTop: SPACING[6], marginBottom: SPACING[3] }}
|
||||
>
|
||||
{t('screens:explore.workouts')}
|
||||
</StyledText>
|
||||
|
||||
{workouts.map((workout) => (
|
||||
<Pressable
|
||||
key={workout.id}
|
||||
style={styles.workoutCard}
|
||||
onPress={() => handleWorkoutPress(workout.id)}
|
||||
>
|
||||
<View style={[styles.workoutAvatar, { backgroundColor: BRAND.PRIMARY }]}>
|
||||
<Ionicons name="flame" size={20} color="#FFFFFF" />
|
||||
</View>
|
||||
<View style={styles.workoutInfo}>
|
||||
<StyledText size={17} weight="semibold" color={colors.text.primary}>
|
||||
{workout.title}
|
||||
</StyledText>
|
||||
<StyledText size={13} color={colors.text.tertiary}>
|
||||
{t('durationLevel', {
|
||||
duration: workout.duration,
|
||||
level: t(`levels.${workout.level.toLowerCase()}`),
|
||||
})}
|
||||
</StyledText>
|
||||
</View>
|
||||
<View style={styles.workoutMeta}>
|
||||
<StyledText size={13} color={BRAND.PRIMARY}>
|
||||
{t('units.calUnit', { count: workout.calories })}
|
||||
</StyledText>
|
||||
<Ionicons name="chevron-forward" size={16} color={colors.text.tertiary} />
|
||||
</View>
|
||||
</Pressable>
|
||||
))}
|
||||
|
||||
{workouts.length === 0 && (
|
||||
<View style={styles.emptyState}>
|
||||
<Ionicons name="barbell-outline" size={48} color={colors.text.tertiary} />
|
||||
<StyledText size={17} color={colors.text.tertiary} style={{ marginTop: SPACING[3] }}>
|
||||
No workouts in this collection
|
||||
</StyledText>
|
||||
</View>
|
||||
)}
|
||||
</ScrollView>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
function createStyles(colors: ThemeColors) {
|
||||
return StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: colors.bg.base,
|
||||
},
|
||||
centered: {
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
header: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'space-between',
|
||||
paddingHorizontal: LAYOUT.SCREEN_PADDING,
|
||||
paddingVertical: SPACING[3],
|
||||
},
|
||||
backButton: {
|
||||
width: 44,
|
||||
height: 44,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
heroCard: {
|
||||
height: 200,
|
||||
borderRadius: RADIUS.XL,
|
||||
overflow: 'hidden',
|
||||
...colors.shadow.lg,
|
||||
},
|
||||
heroContent: {
|
||||
flex: 1,
|
||||
padding: SPACING[5],
|
||||
justifyContent: 'flex-end',
|
||||
},
|
||||
heroIcon: {
|
||||
marginBottom: SPACING[2],
|
||||
},
|
||||
scrollView: {
|
||||
flex: 1,
|
||||
},
|
||||
scrollContent: {
|
||||
paddingHorizontal: LAYOUT.SCREEN_PADDING,
|
||||
},
|
||||
workoutCard: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
paddingVertical: SPACING[3],
|
||||
paddingHorizontal: SPACING[4],
|
||||
backgroundColor: colors.bg.surface,
|
||||
borderRadius: RADIUS.LG,
|
||||
marginBottom: SPACING[2],
|
||||
gap: SPACING[3],
|
||||
},
|
||||
workoutAvatar: {
|
||||
width: 44,
|
||||
height: 44,
|
||||
borderRadius: 22,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
workoutInfo: {
|
||||
flex: 1,
|
||||
gap: 2,
|
||||
},
|
||||
workoutMeta: {
|
||||
alignItems: 'flex-end',
|
||||
gap: 4,
|
||||
},
|
||||
emptyState: {
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
paddingVertical: SPACING[12],
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -36,6 +36,7 @@ import { useTranslatedWorkout } from '@/src/shared/data/useTranslatedData'
|
||||
import { useWatchSync } from '@/src/features/watch'
|
||||
|
||||
import { track } from '@/src/shared/services/analytics'
|
||||
import { VideoPlayer } from '@/src/shared/components/VideoPlayer'
|
||||
import { BRAND, PHASE_COLORS, GRADIENTS, darkColors } from '@/src/shared/theme'
|
||||
import type { ThemeColors } from '@/src/shared/theme/types'
|
||||
import { TYPOGRAPHY } from '@/src/shared/constants/typography'
|
||||
@@ -461,9 +462,12 @@ export default function PlayerScreen() {
|
||||
<View style={styles.container}>
|
||||
<StatusBar hidden />
|
||||
|
||||
{/* Background gradient */}
|
||||
<LinearGradient
|
||||
colors={[colors.bg.base, colors.bg.surface]}
|
||||
{/* Background video or gradient fallback */}
|
||||
<VideoPlayer
|
||||
videoUrl={workout?.videoUrl}
|
||||
gradientColors={[colors.bg.base, colors.bg.surface]}
|
||||
mode="background"
|
||||
isPlaying={timer.isRunning && !timer.isPaused}
|
||||
style={StyleSheet.absoluteFill}
|
||||
/>
|
||||
|
||||
|
||||
@@ -14,9 +14,12 @@ import { Host, Button, HStack } from '@expo/ui/swift-ui'
|
||||
import { glassEffect, padding } from '@expo/ui/swift-ui/modifiers'
|
||||
|
||||
import { useHaptics } from '@/src/shared/hooks'
|
||||
import { usePurchases } from '@/src/shared/hooks/usePurchases'
|
||||
import { track } from '@/src/shared/services/analytics'
|
||||
import { canAccessWorkout } from '@/src/shared/services/access'
|
||||
import { getWorkoutById } from '@/src/shared/data'
|
||||
import { useTranslatedWorkout, useMusicVibeLabel } from '@/src/shared/data/useTranslatedData'
|
||||
import { VideoPlayer } from '@/src/shared/components/VideoPlayer'
|
||||
|
||||
import { useThemeColors, BRAND } from '@/src/shared/theme'
|
||||
import type { ThemeColors } from '@/src/shared/theme/types'
|
||||
@@ -35,6 +38,7 @@ export default function WorkoutDetailScreen() {
|
||||
const { t } = useTranslation()
|
||||
const { id } = useLocalSearchParams<{ id: string }>()
|
||||
const [isSaved, setIsSaved] = useState(false)
|
||||
const { isPremium } = usePurchases()
|
||||
|
||||
const colors = useThemeColors()
|
||||
const styles = useMemo(() => createStyles(colors), [colors])
|
||||
@@ -62,7 +66,18 @@ export default function WorkoutDetailScreen() {
|
||||
)
|
||||
}
|
||||
|
||||
const isLocked = !canAccessWorkout(workout.id, isPremium)
|
||||
|
||||
const handleStartWorkout = () => {
|
||||
if (isLocked) {
|
||||
haptics.buttonTap()
|
||||
track('paywall_triggered', {
|
||||
source: 'workout_detail',
|
||||
workout_id: workout.id,
|
||||
})
|
||||
router.push('/paywall')
|
||||
return
|
||||
}
|
||||
haptics.phaseChange()
|
||||
router.push(`/player/${workout.id}`)
|
||||
}
|
||||
@@ -110,6 +125,13 @@ export default function WorkoutDetailScreen() {
|
||||
contentContainerStyle={[styles.scrollContent, { paddingBottom: insets.bottom + 100 }]}
|
||||
showsVerticalScrollIndicator={false}
|
||||
>
|
||||
{/* Video Preview Hero */}
|
||||
<VideoPlayer
|
||||
videoUrl={workout.videoUrl}
|
||||
mode="preview"
|
||||
isPlaying={true}
|
||||
style={styles.videoPreview}
|
||||
/>
|
||||
{/* Quick stats */}
|
||||
<View style={styles.quickStats}>
|
||||
<View style={[styles.statBadge, { backgroundColor: 'rgba(255, 107, 53, 0.15)' }]}>
|
||||
@@ -184,11 +206,17 @@ export default function WorkoutDetailScreen() {
|
||||
<Pressable
|
||||
style={({ pressed }) => [
|
||||
styles.startButton,
|
||||
isLocked && styles.lockedButton,
|
||||
pressed && styles.startButtonPressed,
|
||||
]}
|
||||
onPress={handleStartWorkout}
|
||||
>
|
||||
<RNText style={styles.startButtonText}>{t('screens:workout.startWorkout')}</RNText>
|
||||
{isLocked && (
|
||||
<Ionicons name="lock-closed" size={18} color="#FFFFFF" style={{ marginRight: 8 }} />
|
||||
)}
|
||||
<RNText style={styles.startButtonText}>
|
||||
{isLocked ? t('screens:workout.unlockWithPremium') : t('screens:workout.startWorkout')}
|
||||
</RNText>
|
||||
</Pressable>
|
||||
</View>
|
||||
</View>
|
||||
@@ -235,6 +263,14 @@ function createStyles(colors: ThemeColors) {
|
||||
height: 44,
|
||||
},
|
||||
|
||||
// Video Preview
|
||||
videoPreview: {
|
||||
height: 220,
|
||||
borderRadius: RADIUS.XL,
|
||||
overflow: 'hidden' as const,
|
||||
marginBottom: SPACING[4],
|
||||
},
|
||||
|
||||
// Quick Stats
|
||||
quickStats: {
|
||||
flexDirection: 'row',
|
||||
@@ -380,6 +416,12 @@ function createStyles(colors: ThemeColors) {
|
||||
backgroundColor: BRAND.PRIMARY,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
flexDirection: 'row',
|
||||
},
|
||||
lockedButton: {
|
||||
backgroundColor: colors.bg.surface,
|
||||
borderWidth: 1,
|
||||
borderColor: BRAND.PRIMARY,
|
||||
},
|
||||
startButtonPressed: {
|
||||
backgroundColor: BRAND.PRIMARY_DARK,
|
||||
|
||||
36
eas.json
Normal file
36
eas.json
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"cli": {
|
||||
"version": ">= 16.0.1",
|
||||
"appVersionSource": "remote"
|
||||
},
|
||||
"build": {
|
||||
"development": {
|
||||
"developmentClient": true,
|
||||
"distribution": "internal",
|
||||
"ios": {
|
||||
"simulator": true
|
||||
}
|
||||
},
|
||||
"preview": {
|
||||
"distribution": "internal",
|
||||
"ios": {
|
||||
"resourceClass": "m-medium"
|
||||
}
|
||||
},
|
||||
"production": {
|
||||
"autoIncrement": true,
|
||||
"ios": {
|
||||
"resourceClass": "m-medium"
|
||||
}
|
||||
}
|
||||
},
|
||||
"submit": {
|
||||
"production": {
|
||||
"ios": {
|
||||
"appleId": "millianlmx@icloud.com",
|
||||
"ascAppId": "REPLACE_WITH_APP_STORE_CONNECT_APP_ID",
|
||||
"appleTeamId": "REPLACE_WITH_APPLE_TEAM_ID"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ export const WORKOUTS: Workout[] = [
|
||||
restTime: 10,
|
||||
equipment: ['No equipment required', 'Yoga mat optional'],
|
||||
musicVibe: 'electronic',
|
||||
videoUrl: 'https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8',
|
||||
exercises: [
|
||||
{ name: 'Jumping Jacks', duration: 20 },
|
||||
{ name: 'Squats', duration: 20 },
|
||||
@@ -45,6 +46,7 @@ export const WORKOUTS: Workout[] = [
|
||||
restTime: 10,
|
||||
equipment: ['Dumbbells optional'],
|
||||
musicVibe: 'hip-hop',
|
||||
videoUrl: 'https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8',
|
||||
exercises: [
|
||||
{ name: 'Burpees', duration: 20 },
|
||||
{ name: 'Lunges', duration: 20 },
|
||||
@@ -238,6 +240,7 @@ export const WORKOUTS: Workout[] = [
|
||||
restTime: 10,
|
||||
equipment: ['Yoga mat'],
|
||||
musicVibe: 'electronic',
|
||||
videoUrl: 'https://devstreaming-cdn.apple.com/videos/streaming/examples/adv_dv_atmos/main.m3u8',
|
||||
exercises: [
|
||||
{ name: 'Crunches', duration: 20 },
|
||||
{ name: 'Russian Twists', duration: 20 },
|
||||
@@ -880,6 +883,7 @@ export const WORKOUTS: Workout[] = [
|
||||
restTime: 10,
|
||||
equipment: ['No equipment required'],
|
||||
musicVibe: 'electronic',
|
||||
videoUrl: 'https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8',
|
||||
exercises: [
|
||||
{ name: 'Burpees', duration: 20 },
|
||||
{ name: 'Mountain Climbers', duration: 20 },
|
||||
@@ -922,6 +926,7 @@ export const WORKOUTS: Workout[] = [
|
||||
restTime: 10,
|
||||
equipment: ['No equipment required'],
|
||||
musicVibe: 'pop',
|
||||
videoUrl: 'https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8',
|
||||
exercises: [
|
||||
{ name: 'Grapevine', duration: 20 },
|
||||
{ name: 'Step Touch', duration: 20 },
|
||||
|
||||
@@ -189,7 +189,8 @@
|
||||
"music": "Musik",
|
||||
"musicMix": "{{vibe}} Mix",
|
||||
"curatedForWorkout": "Zusammengestellt für dein Workout",
|
||||
"startWorkout": "WORKOUT STARTEN"
|
||||
"startWorkout": "WORKOUT STARTEN",
|
||||
"unlockWithPremium": "MIT TABATAFIT+ FREISCHALTEN"
|
||||
},
|
||||
|
||||
"onboarding": {
|
||||
|
||||
@@ -189,7 +189,8 @@
|
||||
"music": "Music",
|
||||
"musicMix": "{{vibe}} Mix",
|
||||
"curatedForWorkout": "Curated for your workout",
|
||||
"startWorkout": "START WORKOUT"
|
||||
"startWorkout": "START WORKOUT",
|
||||
"unlockWithPremium": "UNLOCK WITH TABATAFIT+"
|
||||
},
|
||||
|
||||
"paywall": {
|
||||
|
||||
@@ -189,7 +189,8 @@
|
||||
"music": "M\u00fasica",
|
||||
"musicMix": "Mix {{vibe}}",
|
||||
"curatedForWorkout": "Seleccionado para tu entreno",
|
||||
"startWorkout": "EMPEZAR ENTRENO"
|
||||
"startWorkout": "EMPEZAR ENTRENO",
|
||||
"unlockWithPremium": "DESBLOQUEAR CON TABATAFIT+"
|
||||
},
|
||||
|
||||
"onboarding": {
|
||||
|
||||
@@ -189,7 +189,8 @@
|
||||
"music": "Musique",
|
||||
"musicMix": "Mix {{vibe}}",
|
||||
"curatedForWorkout": "Sélectionné pour votre entraînement",
|
||||
"startWorkout": "COMMENCER L'ENTRAÎNEMENT"
|
||||
"startWorkout": "COMMENCER L'ENTRAÎNEMENT",
|
||||
"unlockWithPremium": "DÉBLOQUER AVEC TABATAFIT+"
|
||||
},
|
||||
|
||||
"paywall": {
|
||||
|
||||
32
src/shared/services/access.ts
Normal file
32
src/shared/services/access.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* TabataFit Access Control Service
|
||||
* Manages free tier vs premium workout access
|
||||
*
|
||||
* Freemium model: 3 free workouts, rest behind paywall
|
||||
*/
|
||||
|
||||
/** Workout IDs available without a subscription */
|
||||
export const FREE_WORKOUT_IDS: readonly string[] = [
|
||||
'1', // Full Body Ignite — Beginner, 4 min (full-body)
|
||||
'11', // Core Crusher — Intermediate, 4 min (core)
|
||||
'43', // Dance Cardio — Beginner, 4 min (cardio)
|
||||
] as const
|
||||
|
||||
/** Number of free workouts (for display in paywall copy) */
|
||||
export const FREE_WORKOUT_COUNT = FREE_WORKOUT_IDS.length
|
||||
|
||||
/**
|
||||
* Check if a specific workout is part of the free tier
|
||||
*/
|
||||
export function isFreeWorkout(workoutId: string): boolean {
|
||||
return FREE_WORKOUT_IDS.includes(workoutId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user can access a workout
|
||||
* Premium users can access everything; free users only get FREE_WORKOUT_IDS
|
||||
*/
|
||||
export function canAccessWorkout(workoutId: string, isPremium: boolean): boolean {
|
||||
if (isPremium) return true
|
||||
return isFreeWorkout(workoutId)
|
||||
}
|
||||
@@ -10,31 +10,35 @@ export interface MusicTrack {
|
||||
vibe: MusicVibe
|
||||
}
|
||||
|
||||
// Public-domain / royalty-free test audio from Apple HLS examples & samples
|
||||
// Replace with Supabase-hosted tracks in production
|
||||
const TEST_AUDIO_BASE = 'https://www2.cs.uic.edu/~i101/SoundFiles'
|
||||
|
||||
const MOCK_TRACKS: Record<MusicVibe, MusicTrack[]> = {
|
||||
electronic: [
|
||||
{ id: '1', title: 'Energy Pulse', artist: 'Neon Dreams', duration: 240, url: '', vibe: 'electronic' },
|
||||
{ id: '2', title: 'Cyber Sprint', artist: 'Digital Flux', duration: 180, url: '', vibe: 'electronic' },
|
||||
{ id: '3', title: 'High Voltage', artist: 'Circuit Breakers', duration: 200, url: '', vibe: 'electronic' },
|
||||
{ id: '1', title: 'Energy Pulse', artist: 'Neon Dreams', duration: 240, url: `${TEST_AUDIO_BASE}/StarWars60.wav`, vibe: 'electronic' },
|
||||
{ id: '2', title: 'Cyber Sprint', artist: 'Digital Flux', duration: 180, url: `${TEST_AUDIO_BASE}/tapioca.wav`, vibe: 'electronic' },
|
||||
{ id: '3', title: 'High Voltage', artist: 'Circuit Breakers', duration: 200, url: `${TEST_AUDIO_BASE}/preamble10.wav`, vibe: 'electronic' },
|
||||
],
|
||||
'hip-hop': [
|
||||
{ id: '4', title: 'Street Heat', artist: 'Urban Flow', duration: 210, url: '', vibe: 'hip-hop' },
|
||||
{ id: '5', title: 'Rhythm Power', artist: 'Beat Masters', duration: 195, url: '', vibe: 'hip-hop' },
|
||||
{ id: '6', title: 'Flow State', artist: 'MC Dynamic', duration: 220, url: '', vibe: 'hip-hop' },
|
||||
{ id: '4', title: 'Street Heat', artist: 'Urban Flow', duration: 210, url: `${TEST_AUDIO_BASE}/StarWars60.wav`, vibe: 'hip-hop' },
|
||||
{ id: '5', title: 'Rhythm Power', artist: 'Beat Masters', duration: 195, url: `${TEST_AUDIO_BASE}/tapioca.wav`, vibe: 'hip-hop' },
|
||||
{ id: '6', title: 'Flow State', artist: 'MC Dynamic', duration: 220, url: `${TEST_AUDIO_BASE}/preamble10.wav`, vibe: 'hip-hop' },
|
||||
],
|
||||
pop: [
|
||||
{ id: '7', title: 'Summer Energy', artist: 'The Popstars', duration: 185, url: '', vibe: 'pop' },
|
||||
{ id: '8', title: 'Upbeat Vibes', artist: 'Chart Toppers', duration: 200, url: '', vibe: 'pop' },
|
||||
{ id: '9', title: 'Feel Good', artist: 'Radio Hits', duration: 175, url: '', vibe: 'pop' },
|
||||
{ id: '7', title: 'Summer Energy', artist: 'The Popstars', duration: 185, url: `${TEST_AUDIO_BASE}/StarWars60.wav`, vibe: 'pop' },
|
||||
{ id: '8', title: 'Upbeat Vibes', artist: 'Chart Toppers', duration: 200, url: `${TEST_AUDIO_BASE}/tapioca.wav`, vibe: 'pop' },
|
||||
{ id: '9', title: 'Feel Good', artist: 'Radio Hits', duration: 175, url: `${TEST_AUDIO_BASE}/preamble10.wav`, vibe: 'pop' },
|
||||
],
|
||||
rock: [
|
||||
{ id: '10', title: 'Power Chord', artist: 'The Amplifiers', duration: 230, url: '', vibe: 'rock' },
|
||||
{ id: '11', title: 'High Gain', artist: ' distortion', duration: 205, url: '', vibe: 'rock' },
|
||||
{ id: '12', title: ' adrenaline', artist: 'Thunderstruck', duration: 215, url: '', vibe: 'rock' },
|
||||
{ id: '10', title: 'Power Chord', artist: 'The Amplifiers', duration: 230, url: `${TEST_AUDIO_BASE}/StarWars60.wav`, vibe: 'rock' },
|
||||
{ id: '11', title: 'High Gain', artist: 'Distortion', duration: 205, url: `${TEST_AUDIO_BASE}/tapioca.wav`, vibe: 'rock' },
|
||||
{ id: '12', title: 'Adrenaline', artist: 'Thunderstruck', duration: 215, url: `${TEST_AUDIO_BASE}/preamble10.wav`, vibe: 'rock' },
|
||||
],
|
||||
chill: [
|
||||
{ id: '13', title: 'Smooth Flow', artist: 'Lo-Fi Beats', duration: 250, url: '', vibe: 'chill' },
|
||||
{ id: '14', title: 'Zen Mode', artist: 'Calm Collective', duration: 240, url: '', vibe: 'chill' },
|
||||
{ id: '15', title: 'Deep Breath', artist: 'Mindful Tones', duration: 260, url: '', vibe: 'chill' },
|
||||
{ id: '13', title: 'Smooth Flow', artist: 'Lo-Fi Beats', duration: 250, url: `${TEST_AUDIO_BASE}/StarWars60.wav`, vibe: 'chill' },
|
||||
{ id: '14', title: 'Zen Mode', artist: 'Calm Collective', duration: 240, url: `${TEST_AUDIO_BASE}/tapioca.wav`, vibe: 'chill' },
|
||||
{ id: '15', title: 'Deep Breath', artist: 'Mindful Tones', duration: 260, url: `${TEST_AUDIO_BASE}/preamble10.wav`, vibe: 'chill' },
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,9 @@ import Purchases, { LOG_LEVEL } from 'react-native-purchases'
|
||||
|
||||
// RevenueCat configuration
|
||||
// test_ prefix = sandbox mode (free transactions on simulator + device sandbox accounts)
|
||||
export const REVENUECAT_API_KEY = 'test_oIJbIHWISJaUZdgxRMHlwizBHvM'
|
||||
// Set EXPO_PUBLIC_REVENUECAT_API_KEY in .env for production
|
||||
export const REVENUECAT_API_KEY =
|
||||
process.env.EXPO_PUBLIC_REVENUECAT_API_KEY || 'test_oIJbIHWISJaUZdgxRMHlwizBHvM'
|
||||
|
||||
// Entitlement ID configured in RevenueCat dashboard
|
||||
export const ENTITLEMENT_ID = '1000 Corp Pro'
|
||||
|
||||
Reference in New Issue
Block a user