Add files via upload
This commit is contained in:
parent
0afea8ef67
commit
2e47865dcc
7 changed files with 35 additions and 18 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,8 @@ const styles = StyleSheet.create({
|
|||
},
|
||||
progress: {
|
||||
color: Colors.accent,
|
||||
fontFamily: Font.family.medium,
|
||||
fontFamily: 'System',
|
||||
fontWeight: '600',
|
||||
marginTop: 2,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
15
package.json
15
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",
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ export async function clearTokens() {
|
|||
|
||||
export async function apiFetch(path: string, opts: RequestInit = {}): Promise<Response> {
|
||||
const token = await getAccessToken();
|
||||
const headers: HeadersInit = {
|
||||
const headers: Record<string, string> = {
|
||||
'Content-Type': 'application/json',
|
||||
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
||||
...(opts.headers as Record<string, string> || {}),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue