feat: 新增资源收藏功能#1541
Open
leemwood wants to merge 1 commit into
Open
Conversation
- Room 持久化 FavoriteAsset 实体(platform+projectId 唯一),AppDatabase v2→3 迁移 - FavoriteManager 管理器 + StateFlow,三处入口(搜索结果卡/下载详情版本行/收藏列表) - 收藏列表页支持按类别筛选(带侧边栏同款图标)与搜索 - 链接语义:存平台原始直链,下载时再走 MCIM 镜像
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
功能概述
新增「资源收藏」功能,用户可收藏资源(整合包/模组/资源包/地图/光影)的项目 + 特定版本下载链接到本地,不收藏本地模组文件本身。
实现要点
持久化(Room)
FavoriteAsset实体,复合唯一索引(platform, projectId),DB v2 → v3 +MIGRATION_2_3FavoriteAssetDao全suspend,FavoriteManagerobject管理器暴露StateFlow<List<FavoriteAsset>>(参照GamePathManager模式)Converters补Platform/PlatformClasses/PlatformReleaseType的@TypeConverter收藏入口(三处统一调
FavoriteManager)_Search.Result.kt):仅有项目元信息,首次收藏downloadUrl留空 +versionName=null,UI 灰色徽标「未指定版本」DownloadAssetsScreen/DownloadAssetsElements):收藏「项目 + 特定版本链接」,语义最完整,每个版本行独立显示收藏态FavoritesListScreen):卡片右侧图标显示已收藏态,点击取消链接语义
downloadUrl存平台原始直链(未经 MCIM 映射),下载时再mapMCIMMirrorUrlsdownloadUrl=""+versionName=null路由
NormalNavKey.DownloadAssets(platform, projectId, classes, iconUrl)NestedNavKey.DownloadFavorites,由ScreenBackStackViewModel持有downloadFavoritesScreenDownloadScreen.ktdownloadsList追加收藏分类(ic_favorite_outlined)收藏列表页
ic_*(整合包/模组/资源包/地图/光影)字符串
favorites_前缀,5 语言(en/zh-rCN/tr/vi/pt-rBR)CurrentGameInfo.favoritesMap)命名冲突关键修复
FavoriteMapper的projectId取自PlatformProject.platformId()(非PlatformVersion.platformId(),后者是 version id 会导致 404)downloadUrl比对判断收藏态,切换版本时保留原savedAt测试
./gradlew :ZalithLauncher:assembleDebug编译打包通过不包含
AGENTS.md开发规范文档兼容性
accounts/servers/gamePaths表CurrentGameInfo.favoritesMap(旧「版本收藏」语义保留)