Add ScenicPermission module and AMap CocoaPods with simulator support.

Integrate scenic selection and permission flows into home routing, add AMap SDK for device builds while keeping arm64 simulators compilable via Podfile post_install hooks.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-23 10:15:26 +08:00
parent e8bc9b7f44
commit c5374666de
416 changed files with 18641 additions and 38 deletions

View File

@ -0,0 +1,62 @@
//
// ScenicSelectionLocationProvider.swift
// suixinkan
//
// Created by Codex on 2026/6/23.
//
import CoreLocation
import Foundation
///
final class ScenicSelectionLocationProvider: NSObject, CLLocationManagerDelegate {
var onLocation: ((CLLocation) -> Void)?
var onFailure: ((String) -> Void)?
private let manager = CLLocationManager()
///
override init() {
super.init()
manager.delegate = self
manager.desiredAccuracy = kCLLocationAccuracyHundredMeters
}
///
func request() {
switch manager.authorizationStatus {
case .notDetermined:
manager.requestWhenInUseAuthorization()
case .authorizedAlways, .authorizedWhenInUse:
manager.requestLocation()
case .denied, .restricted:
onFailure?("定位权限未开启,请在系统设置中允许访问位置")
@unknown default:
onFailure?("定位状态不可用")
}
}
///
func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
switch manager.authorizationStatus {
case .authorizedAlways, .authorizedWhenInUse:
manager.requestLocation()
case .denied, .restricted:
onFailure?("定位权限未开启,请在系统设置中允许访问位置")
default:
break
}
}
///
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if let location = locations.last {
onLocation?(location)
}
}
///
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
onFailure?("定位失败:\(error.localizedDescription)")
}
}