feat: 更新素材管理和举报风险地图
This commit is contained in:
@ -24,7 +24,10 @@ final class LocationProvider: NSObject, LocationProviding {
|
||||
try AMapBootstrap.requireConfigured()
|
||||
try await ensureLocationPermission()
|
||||
|
||||
let manager = makeLocationManager()
|
||||
let manager = makeLocationManager(
|
||||
desiredAccuracy: kCLLocationAccuracyBest,
|
||||
locatingWithReGeocode: true
|
||||
)
|
||||
return try await withCheckedThrowingContinuation { continuation in
|
||||
let started = manager.requestLocation(withReGeocode: true) { location, regeocode, error in
|
||||
if let error {
|
||||
@ -48,11 +51,14 @@ final class LocationProvider: NSObject, LocationProviding {
|
||||
}
|
||||
}
|
||||
|
||||
func requestCoordinate() async throws -> CLLocationCoordinate2D {
|
||||
func requestCoordinate(desiredAccuracy: CLLocationAccuracy) async throws -> CLLocationCoordinate2D {
|
||||
try AMapBootstrap.requireConfigured()
|
||||
try await ensureLocationPermission()
|
||||
|
||||
let manager = makeLocationManager()
|
||||
let manager = makeLocationManager(
|
||||
desiredAccuracy: desiredAccuracy,
|
||||
locatingWithReGeocode: false
|
||||
)
|
||||
return try await withCheckedThrowingContinuation { continuation in
|
||||
let started = manager.requestLocation(withReGeocode: false) { location, _, error in
|
||||
if let error {
|
||||
@ -89,12 +95,15 @@ final class LocationProvider: NSObject, LocationProviding {
|
||||
}
|
||||
}
|
||||
|
||||
private func makeLocationManager() -> AMapLocationManager {
|
||||
private func makeLocationManager(
|
||||
desiredAccuracy: CLLocationAccuracy,
|
||||
locatingWithReGeocode: Bool
|
||||
) -> AMapLocationManager {
|
||||
let manager = AMapLocationManager()
|
||||
manager.desiredAccuracy = kCLLocationAccuracyBest
|
||||
manager.desiredAccuracy = desiredAccuracy
|
||||
manager.locationTimeout = 30
|
||||
manager.reGeocodeTimeout = 10
|
||||
manager.locatingWithReGeocode = true
|
||||
manager.locatingWithReGeocode = locatingWithReGeocode
|
||||
return manager
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user