优化首页位置上报体验
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
// suixinkan
|
||||
//
|
||||
|
||||
import CoreLocation
|
||||
import Foundation
|
||||
|
||||
/// 位置上报成功结果。
|
||||
@ -16,6 +17,7 @@ struct LocationReportSuccessResult: Equatable {
|
||||
final class LocationReportService {
|
||||
|
||||
static let operationIntervalMillis: Int64 = 30_000
|
||||
static let manualReportDesiredAccuracy: CLLocationAccuracy = kCLLocationAccuracyHundredMeters
|
||||
|
||||
private(set) var lastOnlineStatusSwitchTime: Int64 = 0
|
||||
private(set) var lastLocationReportTime: Int64 = 0
|
||||
@ -87,7 +89,8 @@ final class LocationReportService {
|
||||
longitude: nil,
|
||||
address: nil,
|
||||
type: 1,
|
||||
showSuccessToast: true
|
||||
showSuccessToast: true,
|
||||
desiredAccuracy: Self.manualReportDesiredAccuracy
|
||||
)
|
||||
}
|
||||
|
||||
@ -98,7 +101,8 @@ final class LocationReportService {
|
||||
longitude: Double?,
|
||||
address: String?,
|
||||
type: Int,
|
||||
showSuccessToast: Bool = true
|
||||
showSuccessToast: Bool = true,
|
||||
desiredAccuracy: CLLocationAccuracy = kCLLocationAccuracyBest
|
||||
) async throws -> LocationReportSuccessResult {
|
||||
if type != 3 {
|
||||
let now = currentTimestampMillis()
|
||||
@ -136,7 +140,7 @@ final class LocationReportService {
|
||||
address: resolvedAddress
|
||||
)
|
||||
} else {
|
||||
snapshot = try await locationProvider.requestSnapshot()
|
||||
snapshot = try await locationProvider.requestSnapshot(desiredAccuracy: desiredAccuracy)
|
||||
}
|
||||
|
||||
let locationText = snapshot.address.isEmpty
|
||||
|
||||
Reference in New Issue
Block a user