diff --git a/app/(tabs)/index.tsx b/app/(tabs)/index.tsx index d425b73..b368063 100644 --- a/app/(tabs)/index.tsx +++ b/app/(tabs)/index.tsx @@ -29,7 +29,7 @@ export default function HomeScreen() { const load = useCallback(async () => { // Check network const isOnline = await Network.getNetworkStateAsync(); - setOnline(isOnline.isConnected); + setOnline(isOnline.isConnected ?? false); if (isOnline.isConnected) { try { diff --git a/components/CoverImage.tsx b/components/CoverImage.tsx index 5f5171a..c268897 100644 --- a/components/CoverImage.tsx +++ b/components/CoverImage.tsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import { Text, ViewStyle } from 'react-native'; +import { Text, ImageStyle } from 'react-native'; import { Image } from 'expo-image'; import { LinearGradient } from 'expo-linear-gradient'; import { Radius } from '../constants/theme'; @@ -31,7 +31,7 @@ interface Props { title: string; size: number; radius?: number; - style?: ViewStyle; + style?: ImageStyle; blurRadius?: number; } diff --git a/components/DownloadButton.tsx b/components/DownloadButton.tsx index 114f343..43186ba 100644 --- a/components/DownloadButton.tsx +++ b/components/DownloadButton.tsx @@ -95,7 +95,8 @@ const styles = StyleSheet.create({ }, progress: { color: Colors.accent, - fontFamily: Font.family.medium, + fontFamily: 'System', + fontWeight: '600', marginTop: 2, }, }); diff --git a/package.json b/package.json index 30ca345..93c9508 100644 --- a/package.json +++ b/package.json @@ -10,30 +10,31 @@ "update": "eas update --branch production" }, "dependencies": { + "@react-native-async-storage/async-storage": "1.23.1", + "@react-native-community/slider": "4.5.2", "expo": "~51.0.28", - "expo-router": "~3.5.23", "expo-blur": "~13.0.2", "expo-constants": "~16.0.2", + "expo-file-system": "~16.0.9", "expo-haptics": "~13.0.1", "expo-image": "~1.12.15", "expo-linear-gradient": "~13.0.2", "expo-linking": "~6.3.1", + "expo-network": "^55.0.13", + "expo-router": "~3.5.23", "expo-secure-store": "~13.0.2", "expo-status-bar": "~1.12.1", "expo-updates": "~0.25.27", "expo-web-browser": "~13.0.3", - "expo-file-system": "~16.0.9", - "expo-network": "~6.0.0", "react": "18.2.0", "react-native": "0.74.5", "react-native-gesture-handler": "~2.16.2", "react-native-reanimated": "~3.10.1", "react-native-safe-area-context": "4.10.5", "react-native-screens": "3.31.1", - "zustand": "^4.5.4", - "@react-native-async-storage/async-storage": "1.23.1", - "@react-native-community/slider": "4.5.2", - "react-native-track-player": "^4.1.1" + "react-native-svg": "^15.15.4", + "react-native-track-player": "^4.1.1", + "zustand": "^4.5.4" }, "devDependencies": { "@babel/core": "^7.24.0", diff --git a/services/api.ts b/services/api.ts index 49a6207..2df1476 100644 --- a/services/api.ts +++ b/services/api.ts @@ -23,7 +23,7 @@ export async function clearTokens() { export async function apiFetch(path: string, opts: RequestInit = {}): Promise { const token = await getAccessToken(); - const headers: HeadersInit = { + const headers: Record = { 'Content-Type': 'application/json', ...(token ? { Authorization: `Bearer ${token}` } : {}), ...(opts.headers as Record || {}), diff --git a/services/offline.ts b/services/offline.ts index c34874e..de29d28 100644 --- a/services/offline.ts +++ b/services/offline.ts @@ -134,12 +134,13 @@ export async function downloadTrack( filePath, {}, (progress) => { - const { totalBytesWritten, totalBytesExpectedToDownload } = progress; + const { totalBytesWritten, totalBytesExpectedToDownload } = progress as any; + const total = totalBytesExpectedToDownload || 1; onProgress?.({ trackId: track.id, - progress: totalBytesWritten / totalBytesExpectedToDownload, + progress: totalBytesWritten / total, loaded: totalBytesWritten, - total: totalBytesExpectedToDownload, + total: total, }); } ); @@ -183,7 +184,9 @@ export async function getStorageInfo(): Promise<{ used: number; total: number } for (const file of files) { const fileInfo = await FileSystem.getInfoAsync(`${DOCUMENTS_DIR}${file}`); - if (fileInfo.size) used += fileInfo.size; + if (fileInfo.exists && 'size' in fileInfo && fileInfo.size) { + used += (fileInfo as any).size; + } } return { used, total: 5 * 1024 * 1024 * 1024 }; // 5GB limit diff --git a/tsconfig.json b/tsconfig.json index b1806d2..8213f5e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,10 +1,22 @@ { - "extends": "expo/tsconfig.base", "compilerOptions": { + "target": "ES2020", + "module": "ESNext", + "lib": ["ES2020"], + "jsx": "react-jsx", "strict": true, "baseUrl": ".", + "skipLibCheck": true, + "esModuleInterop": true, + "moduleResolution": "bundler", + "resolveJsonModule": true, + "declaration": true, + "declarationMap": true, + "sourceMap": true, "paths": { "@/*": ["./*"] } - } + }, + "include": ["app", "components", "constants", "hooks", "services", "store"], + "exclude": ["node_modules", "dist"] }