模块化 AppStore 并完善素材管理与个人空间设置。

将会话、权限、位置、收款与排队存储拆分为独立模块,同步更新各 ViewModel 与单元测试,并补充素材管理 UI 与个人空间设置交互。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-13 11:01:08 +08:00
parent ceca780ab3
commit 005349f8e6
128 changed files with 2953 additions and 1123 deletions

View File

@ -24,7 +24,7 @@ final class ScenicSelectionViewModelTests: XCTestCase {
}
func testSearchFiltersByNameAndAddress() {
appStore.saveRoleScenicList([
appStore.permissions.saveRoleScenicList([
ScenicInfo(id: 1, name: "西湖景区", status: 1, location: ScenicLocationInfo(lng: 120.1, lat: 30.2, address: "杭州西湖"), coverImg: nil),
ScenicInfo(id: 2, name: "灵隐寺", status: 1, location: ScenicLocationInfo(lng: 120.2, lat: 30.3, address: "杭州灵隐"), coverImg: nil),
])
@ -43,12 +43,12 @@ final class ScenicSelectionViewModelTests: XCTestCase {
}
func testNearestTagWhenLocationProvided() {
appStore.saveRoleScenicList([
appStore.permissions.saveRoleScenicList([
ScenicInfo(id: 1, name: "", status: 1, location: ScenicLocationInfo(lng: 116.40, lat: 39.91, address: "A"), coverImg: nil),
ScenicInfo(id: 2, name: "", status: 1, location: ScenicLocationInfo(lng: 116.50, lat: 39.95, address: "B"), coverImg: nil),
])
let items = ScenicSpotDisplayMapper.buildItems(
scenicList: appStore.roleScenicList(),
scenicList: appStore.permissions.roleScenicList(),
searchQuery: "",
currentLat: 39.9087,
currentLng: 116.3975,
@ -58,7 +58,7 @@ final class ScenicSelectionViewModelTests: XCTestCase {
}
func testClosedStatusTag() {
appStore.saveRoleScenicList([
appStore.permissions.saveRoleScenicList([
ScenicInfo(id: 1, name: "停业", status: 2, location: nil, coverImg: nil),
])
let viewModel = ScenicSelectionViewModel(appStore: appStore)
@ -68,7 +68,7 @@ final class ScenicSelectionViewModelTests: XCTestCase {
}
func testSelectSpotWritesAppStore() {
appStore.saveRoleScenicList([
appStore.permissions.saveRoleScenicList([
ScenicInfo(id: 5, name: "测试景区", status: 1),
])
let viewModel = ScenicSelectionViewModel(appStore: appStore)
@ -78,8 +78,8 @@ final class ScenicSelectionViewModelTests: XCTestCase {
viewModel.loadFromLocal()
viewModel.selectSpot(viewModel.spots[0])
XCTAssertEqual(appStore.currentScenicId, 5)
XCTAssertEqual(appStore.currentScenicName, "测试景区")
XCTAssertEqual(appStore.session.currentScenicId, 5)
XCTAssertEqual(appStore.session.currentScenicName, "测试景区")
XCTAssertTrue(completed)
XCTAssertTrue(viewModel.spots.first?.isSelected == true)
}