feat(zen-box): 新增云端配置同步功能,完善应用构建与配置

本次提交实现了观空禅音应用的核心云端同步功能,包括:
1.  添加用户登录验证接口与本地存储管理
2.  新增云端配置存储与拉取接口,支持跨设备同步歌单、播放进度等设置
3.  新增登录页面与设置页账号管理模块
4.  更新依赖包版本与安卓、iOS打包配置
5.  优化缓存下载逻辑,修复OSS链接编码问题
6.  新增离线模式支持,自动过滤无缓存歌单
7.  新增歌曲排序偏好本地与云端同步功能
This commit is contained in:
yangxiangyuan
2026-07-11 10:57:02 +08:00
parent 33625e3438
commit 6a043687f5
18 changed files with 880 additions and 66 deletions
+8 -7
View File
@@ -1,4 +1,4 @@
import * as FileSystem from 'expo-file-system';
import * as FileSystem from 'expo-file-system/legacy';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { CacheInfo, Track } from '../types';
@@ -102,16 +102,17 @@ export const downloadAndCache = async (
const cacheKey = generateCacheKey(url);
const cachePath = `${CACHE_DIR}${cacheKey}`;
// 对 URL 进行编码,特别处理中文路径
const encodedUrl = encodeUrlPath(url);
// 直接使用原始 URL,不做额外编码
// OSS URL 通常已经正确编码,二次编码会破坏签名验证
const downloadUrl = url;
while (retryCount < maxRetries) {
try {
console.log(`[下载] 开始下载: ${encodedUrl}`);
console.log(`[下载] 开始下载: ${downloadUrl}`);
// 添加更多下载选项
const downloadResumable = FileSystem.createDownloadResumable(
encodedUrl,
downloadUrl,
cachePath,
{
// 设置一些常用的请求头,兼容 OSS
@@ -131,7 +132,7 @@ export const downloadAndCache = async (
const downloadResult = await downloadResumable.downloadAsync();
if (downloadResult && downloadResult.status === 200) {
console.log(`[下载] 成功: ${encodedUrl}`);
console.log(`[下载] 成功: ${downloadUrl}`);
const fileInfo = await FileSystem.getInfoAsync(cachePath);
const size = fileInfo.exists ? (fileInfo as any).size || 0 : 0;
@@ -153,7 +154,7 @@ export const downloadAndCache = async (
console.error(`[下载] 尝试 ${retryCount}/${maxRetries} 失败:`, error);
if (retryCount >= maxRetries) {
console.error(`[下载] 达到最大重试次数,放弃: ${encodedUrl}`);
console.error(`[下载] 达到最大重试次数,放弃: ${downloadUrl}`);
throw error;
}