提交 9a59eecd 编写于 作者: lizhongyi_'s avatar lizhongyi_

fix: uts-tencentgeolocation 插件uts语法调整

上级 fc1a78cb
...@@ -18,7 +18,7 @@ export function checkHasIntegration():boolean{ ...@@ -18,7 +18,7 @@ export function checkHasIntegration():boolean{
class LBSLocation implements TencentLBSLocationManagerDelegate { class LBSLocation implements TencentLBSLocationManagerDelegate {
// 定义 locationManager 属性,类型为 TencentLBSLocationManager // 定义 locationManager 属性,类型为 TencentLBSLocationManager
locationManager: TencentLBSLocationManager locationManager!: TencentLBSLocationManager
locationOptions?: LocationOptions locationOptions?: LocationOptions
...@@ -75,11 +75,12 @@ class LBSLocation implements TencentLBSLocationManagerDelegate { ...@@ -75,11 +75,12 @@ class LBSLocation implements TencentLBSLocationManagerDelegate {
// 请求单次定位信息 // 请求单次定位信息
this.locationManager.requestLocation(with = requestLevel, locationTimeout = 10, completionBlock = (location?: TencentLBSLocation, err?: NSError): void => { this.locationManager.requestLocation(with = requestLevel, locationTimeout = 10, completionBlock = (location?: TencentLBSLocation, err?: NSError): void => {
if (location != null) { if (location != null) {
let response = new LocationResponse(); let response: LocationResponse = {
response.name = location!.name; name: location!.name,
response.address = location!.address; address: location!.address,
response.latitude = Number(location!.location.coordinate.latitude); latitude: Number(location!.location.coordinate.latitude),
response.longitude = Number(location!.location.coordinate.longitude); longitude: Number(location!.location.coordinate.longitude)
}
locationOptions.success(response); locationOptions.success(response);
} else { } else {
locationOptions.fail(err!.localizedDescription) locationOptions.fail(err!.localizedDescription)
...@@ -120,11 +121,12 @@ class LBSLocation implements TencentLBSLocationManagerDelegate { ...@@ -120,11 +121,12 @@ class LBSLocation implements TencentLBSLocationManagerDelegate {
// 实现位置更新的 delegate 方法 // 实现位置更新的 delegate 方法
tencentLBSLocationManager(manager: TencentLBSLocationManager, @argumentLabel("didUpdate") location: TencentLBSLocation) { tencentLBSLocationManager(manager: TencentLBSLocationManager, @argumentLabel("didUpdate") location: TencentLBSLocation) {
let response = new LocationResponse(); let response: LocationResponse = {
response.name = location.name; name: location.name,
response.address = location.address; address: location.address,
response.latitude = Number(location.location.coordinate.latitude); latitude: Number(location.location.coordinate.latitude),
response.longitude = Number(location.location.coordinate.longitude); longitude: Number(location.location.coordinate.longitude)
}
this.locationOptions?.success(response) this.locationOptions?.success(response)
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册