Zzx/bugfix/map ios#570
Merged
Merged
Conversation
985892345
previously approved these changes
May 27, 2026
There was a problem hiding this comment.
Pull request overview
该 PR 主要面向 KMP iOS 端的可运行性与地图资源更新问题:通过调整 iOS 工程对 KMP Framework 的构建/引用方式,并重构地图底图的下载、缓存与加载流程,避免 iOS 端持续使用旧包/旧图,同时让地图加载与交互更顺畅。
Changes:
- 修复 iOS 工程侧的 KMP Framework 构建/资源同步与模块引用(Xcode build phase、Swift import、Framework 搜索路径等)
- 重构地图底图下载与缓存逻辑:支持 http→https 兼容(ATS),下载结果返回 bytes 并标记是否成功落盘缓存
- 优化地图相关 UI/VM:地图图像加载 key 化、聚焦/底部弹层行为调整、MapInfo/ButtonInfo/PlaceDetails 本地优先加载与差异化落库
Reviewed changes
Copilot reviewed 13 out of 31 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| cyxbs-pages/schoolcar/src/iosMain/kotlin/com/cyxbs/pages/schoolcar/viewmodel/SchoolCarViewModel.ios.kt | 为 schoolcar 模块补齐 iOS actual ViewModel 实现(位置能力在 iOS 侧关闭) |
| cyxbs-pages/schoolcar/src/iosMain/kotlin/com/cyxbs/pages/schoolcar/utils/ImageFileUtils.ios.kt | iOS 端 schoolcar 地图图片缓存文件读写实现(FileKit/Okio) |
| cyxbs-pages/map/src/noWebMain/kotlin/com/cyxbs/pages/map/widget/MapImageLoad.noWeb.kt | 地图图像加载组件重构:使用 key(inputStream),分离容器与变换层 |
| cyxbs-pages/map/src/iosMain/kotlin/com/cyxbs/pages/map/util/MapImageHelper.ios.kt | iOS 端 map 底图缓存文件读写实现(支持 append sink) |
| cyxbs-pages/map/src/commonMain/kotlin/com/cyxbs/pages/map/widget/MapUiController.kt | FocusOnPlace 时额外触发 bottom sheet collapse |
| cyxbs-pages/map/src/commonMain/kotlin/com/cyxbs/pages/map/viewmodel/MapComposeViewModel.kt | placeSearch 超时/本地兜底;MapInfo/ButtonInfo/PlaceDetails 本地优先与差异化保存 |
| cyxbs-pages/map/src/commonMain/kotlin/com/cyxbs/pages/map/util/MapImageHelper.kt | 底图下载逻辑改为直接取 ByteArray,并进行 http→https 处理,返回是否成功写入缓存 |
| cyxbs-pages/map/src/commonMain/kotlin/com/cyxbs/pages/map/ui/MapNavEntry.kt | 地图页底图加载/更新流程重写:本地优先、版本比对、失败兜底与弹窗状态处理 |
| cyxbs-components/utils/src/commonMain/kotlin/com/cyxbs/components/utils/extensions/Coil.kt | Coil 图片加载对 http URL 做 https 转换以兼容 iOS ATS |
| cyxbs-applications/multiplatform/iosApp/iosApp/iOSApp.swift | Swift 入口模块 import 修正 |
| cyxbs-applications/multiplatform/iosApp/iosApp/ContentView.swift | Swift View 模块 import 修正并清理尾部空行 |
| cyxbs-applications/multiplatform/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json | 新增/更新 iOS AppIcon 配置 |
| cyxbs-applications/multiplatform/iosApp/iosApp.xcodeproj/project.pbxproj | Xcode 构建脚本改为 multiplatform 任务 + compose 资源同步,并补充 Framework 搜索路径 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+45
to
56
| val bytes = HttpClientNoToken.get(url.toHttpsCdnUrl()) { | ||
| onDownload { bytesSentTotal, contentLength -> | ||
| listener(bytesSentTotal, contentLength ?: 1L) | ||
| } | ||
| } | ||
| val channel = response.bodyAsChannel() | ||
| getSink().buffer().use { sink -> | ||
| val buffer = ByteArray(8 * 1024) | ||
| while (!channel.isClosedForRead) { | ||
| val bytesRead = channel.readAvailable(buffer) | ||
| if (bytesRead < 0) break | ||
| sink.write(buffer, 0, bytesRead) | ||
| }.body<ByteArray>() | ||
| if (bytes.isEmpty()) error("Map image is empty") | ||
| // 是否写入缓存,同样使用runCatching包住 | ||
| val isCached = runCatching { | ||
| getSink().buffer().use { sink -> | ||
| sink.write(bytes) | ||
| sink.flush() | ||
| } |
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.
1.修复了跨平台下ios无法运行以及运行后一直跑旧包的bug
2.简单重构了下地图加载的逻辑,现在加载更顺了