Commit 49d4dff
Fastace
feat: 为S3云端恢复添加文件大小显示功能
修复了S3云端恢复场景中APK/USER/OBB等备份文件大小显示为0的问题。
主要改动:
- 在 AppsRepo.kt 中添加 calculateCloudAppArchiveSize() 函数,通过 S3 HeadObject 接口获取云端应用备份文件大小
- 在 FilesRepo.kt 中添加 calculateCloudFileArchiveSize() 函数,支持云端文件备份大小计算
- 修改 DetailsViewModel.kt 的 onResume() 函数,根据 cloud 字段判断调用云端或本地大小计算函数
- 利用 S3ClientImpl.size() 方法通过 HeadObject API 获取对象元数据中的 contentLength
- 云端大小计算支持所有6种数据类型(APK/USER/USER_DE/DATA/OBB/MEDIA)
- 使用 runCatching 进行错误处理,网络异常时返回0
- 所有云端操作在后台线程执行,不阻塞UI
- 本地和云端逻辑保持一致,便于维护1 parent 532e613 commit 49d4dff
3 files changed
Lines changed: 51 additions & 2 deletions
File tree
- source
- core/data/src/main/kotlin/com/xayah/core/data/repository
- feature/main/details/src/main/kotlin/com/xayah/feature/main/details
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
621 | 621 | | |
622 | 622 | | |
623 | 623 | | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
624 | 649 | | |
625 | 650 | | |
626 | 651 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
289 | 304 | | |
290 | 305 | | |
291 | 306 | | |
| |||
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
98 | 102 | | |
99 | 103 | | |
100 | 104 | | |
| |||
111 | 115 | | |
112 | 116 | | |
113 | 117 | | |
114 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
115 | 124 | | |
116 | 125 | | |
117 | 126 | | |
| |||
0 commit comments