diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBS.h b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBS.h new file mode 100644 index 0000000000000000000000000000000000000000..874d4f9eb7dc32530762ec83aecf8308902273a0 --- /dev/null +++ b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBS.h @@ -0,0 +1,21 @@ +// +// TencentLBS.h +// TencentLBS +// +// Created by mirantslu on 16/4/19. +// Copyright © 2016年 Tencent. All rights reserved. +// + +#import + +//! Project version number for TencentLBS. +FOUNDATION_EXPORT double TencentLBSVersionNumber; + +//! Project version string for TencentLBS. +FOUNDATION_EXPORT const unsigned char TencentLBSVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + +#import +#import +#import diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBSLocation.h b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBSLocation.h new file mode 100644 index 0000000000000000000000000000000000000000..b4263ecf7e0d89eabb1b680548b29fb3c0a49501 --- /dev/null +++ b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBSLocation.h @@ -0,0 +1,166 @@ +// +// TencentLBSLocation.h +// TencentLBS +// +// Created by mirantslu on 16/4/19. +// Copyright © 2016年 Tencent. All rights reserved. +// + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +#define TENCENTLBS_DEBUG 0 + +typedef NS_ENUM(NSInteger, TencentLBSDRProvider) { + TencentLBSDRProviderError = -2, //!< 错误,可能未开启dr + TencentLBSDRProviderUnkown = -1, //!< 定位结果来源未知 + TencentLBSDRProviderFusion = 0, //!< 定位结果来源融合的结果 + TencentLBSDRProviderGPS = 1, //!< 定位结果来源GPS + TencentLBSDRProviderNetWork = 2, //!< 定位结果来源网络 +}; + +@interface TencentLBSPoi : NSObject + +@property (nonatomic, copy) NSString *uid; //!< 当前POI的uid +@property (nonatomic, copy) NSString *name; //!< 当前POI的名称 +@property (nonatomic, copy) NSString *address; //!< 当前POI的地址 +@property (nonatomic, copy) NSString *catalog; //!< 当前POI的类别 +@property (nonatomic, assign) double longitude; //!< 当前POI的经度 +@property (nonatomic, assign) double latitude; //!< 当前POI的纬度 +@property (nonatomic, assign) double distance; //!< 当前POI与当前位置的距离 + +@end + +@interface TencentLBSLocation : NSObject + +/** + * 返回当前位置的CLLocation信息 + */ +@property (nonatomic, strong) CLLocation *location; + +/** + * 返回当前位置的行政区划, 0-表示中国大陆、港、澳, 1-表示其他 + */ +@property (nonatomic, assign) NSInteger areaStat; + +/** + * 返回室内定位楼宇Id + */ +@property (nonatomic, copy, nullable) NSString *buildingId; + +/** + * 返回室内定位楼层 + */ +@property (nonatomic, copy, nullable) NSString *buildingFloor; + +/** + * 返回室内定位类型,0表示普通定位结果,1表示蓝牙室内定位结果 + */ +@property (nonatomic, assign) NSInteger indoorLocationType; + +/** + * + */ +@property (nonatomic, assign) TencentLBSDRProvider drProvider; + +/** + * 返回当前位置的名称, + * 仅当TencentLBSRequestLevel为TencentLBSRequestLevelName或TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空 + */ +@property (nonatomic, copy, nullable) NSString *name; + +/** + * 返回当前位置的地址 + * 仅当TencentLBSRequestLevel为TencentLBSRequestLevelName或TencentLBSRequestLevelAdminName有返回值,否则为空 + */ +@property (nonatomic, copy, nullable) NSString *address; + +/** + * 返回国家编码,例如中国为156 + * 注意:该接口涉及到WebService API,请参考https://lbs.qq.com/service/webService/webServiceGuide/webServiceOverview中的配额限制说明, + * 并将申请的有效key通过TencentLBSLocationManager的- (void)setDataWithValue: forKey:方法设置,其中key为固定值@"ReGeoCodingnKey",例如[tencentLocationManager setDataWithValue:@"您申请的key(务必正确)" forKey:@"ReGeoCodingnKey"];,否则将返回默认值0 + */ +@property (nonatomic, assign) NSInteger nationCode; + +/** + * 返回当前位置的城市编码 + * 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空 + */ +@property (nonatomic, copy, nullable) NSString *code; + +/** + * 返回当前位置的国家 + * 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空 + */ +@property (nonatomic, copy, nullable) NSString *nation; + +/** + * 返回当前位置的省份 + * 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空 + */ +@property (nonatomic, copy, nullable) NSString *province; + +/** + * 返回当前位置的城市固话编码. + * 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空 + */ +@property (nonatomic, copy, nullable) NSString *cityPhoneCode; + +/** + * 返回当前位置的城市 + * 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空 + */ +@property (nonatomic, copy, nullable) NSString *city; + +/** + * 返回当前位置的区县 + * 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空 + */ +@property (nonatomic, copy, nullable) NSString *district; + +/** + * 返回当前位置的乡镇 + * 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空 + */ +@property (nonatomic, copy, nullable) NSString *town; + +/** + * 返回当前位置的村 + * 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空 + */ +@property (nonatomic, copy, nullable) NSString *village; + +/** + * 返回当前位置的街道 + * 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空 + */ +@property (nonatomic, copy, nullable) NSString *street; + +/** + * 返回当前位置的街道编码 + * 仅当TencentLBSRequestLevel为TencentLBSRequestLevelAdminName或TencentLBSRequestLevelPoi有返回值,否则为空 + */ +@property (nonatomic, copy, nullable) NSString *street_no; + +/** + * 返回当前位置周围的POI + * 仅当TencentLBSRequestLevel为TencentLBSRequestLevelPoi有返回值,否则为空 + */ +@property (nonatomic, strong, nullable) NSArray *poiList; + +/** + * 返回两个位置之间的横向距离 + * @param location + */ +- (double)distanceFromLocation:(const TencentLBSLocation *)location; + +// 测试使用 +#if TENCENTLBS_DEBUG +@property (nonatomic, copy, nullable) NSString *halleyTime; +#endif + +@end + +NS_ASSUME_NONNULL_END diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBSLocationManager.h b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBSLocationManager.h new file mode 100644 index 0000000000000000000000000000000000000000..e94a380dd70174a0f3d76613ac49cda22a0494ed --- /dev/null +++ b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBSLocationManager.h @@ -0,0 +1,374 @@ +// +// TencentLBSLocationManager.h +// TencentLBS +// +// Created by mirantslu on 16/4/19. +// Copyright © 2016年 Tencent. All rights reserved. +// + +#import +#import +#import "TencentLBSLocation.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(NSUInteger, TencentLBSRequestLevel) { + TencentLBSRequestLevelGeo = 0, + TencentLBSRequestLevelName = 1, + TencentLBSRequestLevelAdminName = 3, + TencentLBSRequestLevelPoi = 4, +}; + +typedef NS_ENUM(NSUInteger, TencentLBSLocationCoordinateType) { + TencentLBSLocationCoordinateTypeGCJ02 = 0, //!< 火星坐标,即国测局坐标 + TencentLBSLocationCoordinateTypeWGS84 = 1, //!< 地球坐标,注:如果是海外,无论设置的是火星坐标还是地球坐标,返回的都是地球坐标 +}; + +typedef NS_ENUM(NSUInteger, TencentLBSLocationError) { + TencentLBSLocationErrorUnknown = 0, //!< 错误码,表示目前位置未知,但是会一直尝试获取 + TencentLBSLocationErrorDenied = 1, //!< 错误码,表示定位权限被禁止 + TencentLBSLocationErrorNetwork = 2, //!< 错误码,表示网络错误 + TencentLBSLocationErrorHeadingFailure = 3, //!< 错误码,表示朝向无法确认 + TencentLBSLocationErrorOther = 4, //!< 错误码,表示未知错误 +}; + +typedef NS_ENUM(NSInteger, TencentLBSDRStartCode) { + TencentLBSDRStartCodeSuccess = 0, //!< 启动成功 + TencentLBSDRStartCodeNotSupport = -1, //!< 传感器有缺失或没有GPS芯片 + TencentLBSDRStartCodeHasStarted = -2, //!< 已经启动 + TencentLBSDRStartCodeSensorFailed = -3, //!< 传感器启动失败 + TencentLBSDRStartCodeGpsFailed = -4, //!< GPS启动失败 + TencentLBSDRStartCodePermissionFailed = -5, //!< 没有位置权限 + TencentLBSDRStartCodeUnkown = -6, //!< 未知 +}; +typedef NS_ENUM(NSInteger, TencentLBSDRStartMotionType) { + TencentLBSDRStartMotionTypeWalk = 2, //!< 步行 + TencentLBSDRStartMotionTypeBike = 3, //!< 骑行 +}; + +typedef NS_ENUM(NSInteger, TencentLBSAccuracyAuthorization) { + // This application has the user's permission to receive accurate location information. + TencentLBSAccuracyAuthorizationFullAccuracy, + + // The user has chosen to grant this application access to location information with reduced accuracy. + // Region monitoring and beacon ranging are not available to the application. Other CoreLocation APIs + // are available with reduced accuracy. + + // Location estimates will have a horizontalAccuracy on the order of about 5km. To achieve the + // reduction in accuracy, CoreLocation will snap location estimates to a nearby point which represents + // the region the device is in. Furthermore, CoreLocation will reduce the rate at which location + // estimates are produced. Applications should be prepared to receive locations that are up to 20 + // minutes old. + TencentLBSAccuracyAuthorizationReducedAccuracy, +}; + +/** + * TencentLBSLocatingCompletionBlock 单次定位返回Block + * + * @param location 位置信息 + * @param error 错误信息 参考 TencentLBSLocationError + */ +typedef void (^TencentLBSLocatingCompletionBlock)(TencentLBSLocation * _Nullable location, NSError * _Nullable error); + +@protocol TencentLBSLocationManagerDelegate; + +@interface TencentLBSLocationManager : NSObject +/** + * 当前位置管理器定位精度的授权状态 + */ +@property(nonatomic, readonly)TencentLBSAccuracyAuthorization accuracyAuthorization; +/** + * 当前位置管理器定位权限的授权状态 + */ +@property(nonatomic, readonly)CLAuthorizationStatus authorizationStatus; + +/** + * API Key, 在使用定位SDK服务之前需要先绑定key。 + */ +@property (nonatomic, copy) NSString* apiKey; + + +/** + * 实现了 TencentLBSLocationManagerDelegate 协议的类指针。 + */ +@property (nonatomic, weak) id delegate; + +/** + * 设定定位的最小更新距离。默认为 kCLDistanceFilterNone。 + */ +@property (nonatomic, assign) CLLocationDistance distanceFilter; + +/** + * 设定定位精度。默认为 kCLLocationAccuracyBest 。 + */ +@property (nonatomic, assign) CLLocationAccuracy desiredAccuracy; + +/** + * 指定定位是否会被系统自动暂停。默认为 YES 。 + */ +@property (nonatomic, assign) BOOL pausesLocationUpdatesAutomatically; + +/** + * 是否允许后台定位。默认为 NO。 + * iOS 9.0 以上用户需要设置该选项并且在info.list里面Background Modes 中的 Location updates 处于选中状态才可以使用后台定位权限。iOS 9.0之前可以直接申请总是使用的权限来获得后台定位。 + * + * 设置为 YES 的时候必须保证 Background Modes 中的 Location updates 处于选中状态,否则会抛出异常。 + */ +@property (nonatomic, assign) BOOL allowsBackgroundLocationUpdates; + +/** + * 用户的活动类型 + * + * 设置用户的活动类型。默认值为 CLActivityTypeOther + */ +@property (nonatomic, assign) CLActivityType activityType; + +/** + * 设置当朝向改变时,每隔多少度调用一次 + * 只有当设备方向的改变值超过该属性值时才激发delegate的方法。 + */ +@property(nonatomic, assign) CLLocationDegrees headingFilter; + +/** + * 设置设备当前的朝向 + */ +@property(nonatomic, assign) CLDeviceOrientation headingOrientation; + +/** + * 连续定位的逆地理信息请求的Level。默认为TencentLBSRequestLevelGeo + */ +@property (nonatomic, assign) TencentLBSRequestLevel requestLevel; + +/** + * 返回的TencentLBSLocation的location字段的坐标类型。默认为TencentLBSLocationCoordinateTypeGCJ02。 + * + * 在一次定位过程中,只允许设置一次,不允许重复设置 + */ +@property (nonatomic, assign) TencentLBSLocationCoordinateType coordinateType; + +/** + * 指定POI的更新间隔。 默认是10s + */ +@property(nonatomic, assign) NSInteger poiUpdateInterval; +#pragma mark - +/** + * accuracyAuthorization + * + * Discussion: + * Return the current TencentLBSAccuracyAuthorization of the calling application. + */ ++ (TencentLBSAccuracyAuthorization)accuracyAuthorization; + +/** + * 设置用户是否同意隐私协议政策 + *

调用其他接口前必须首先调用此接口进行用户是否同意隐私政策的设置,传入YES后才能正常使用定位功能,否则TencentLBSLocationManager初始化不成功,返回nil,定位功能均无法使用

+ * @param isAgree 是否同意隐私政策 + */ ++ (void)setUserAgreePrivacy:(BOOL) isAgree; + +/** + * 获取用户是否同意隐私政策协议 + *

设置用户隐私后,可通过该接口判断用户隐私状态

+ * @return isAgreePrivacy 是否同意隐私政策 + */ ++ (BOOL)getUserAgreePrivacy; + +#pragma mark - + +- (void)requestWhenInUseAuthorization; + +- (void)requestAlwaysAuthorization; + +/** + * 当前属于模糊定位状态时,通过该接口请求暂时的完全定位精度的权限 + * @param purposeKey 需要在info.plist中配置NSLocationTemporaryUsageDescriptionDictionary key值和对应的申请该权限的描述理由 + * @param completion 在弹框让用户选择后的用户的反馈,如果用户授予该权限,block中的参数为nil,如果未授予,block中的参数将为PurposeKey对于的key的描述(如PurposeKey=TemporaryPurposKey_1) + */ +- (void)requestTemporaryFullAccuracyAuthorizationWithPurposeKey:(NSString *)purposeKey + completion:(void (^)(NSError *))completion; +/** + * 当前属于模糊定位状态时,通过该接口请求暂时的完全定位精度的权限 + * @param purposeKey 需要在info.plist中配置NSLocationTemporaryUsageDescriptionDictionary key值和对应的申请该权限的描述理由 + */ +- (void)requestTemporaryFullAccuracyAuthorizationWithPurposeKey:(NSString *)purposeKey; + + +#pragma mark - +/** + * 获取定位SDK的版本 + */ ++(NSString *)getLBSSDKVersion; + +/** + * 获取定位SDK的构建日期 + */ ++(NSString *)getLBSSDKbuild; + + +#pragma mark - + +/** + * 向SDK内部设置数据,以满足定制的需求 + * @param value + * @param key + */ +- (void)setDataWithValue:(NSString *)value forKey:(NSString *)key; + +/** + * 单次定位 + * + * 该方法为下面方法的一层封装。 + * level默认是TencentLBSRequestLevelPoi + * timeout默认是10s + */ +- (BOOL)requestLocationWithCompletionBlock:(TencentLBSLocatingCompletionBlock)completionBlock; + +/** + * 单次定位 + * + * 注意:不能连续调用该接口,需在上一次返回之后才能再次发起调用。该接口兼容iOS 7.0及以上,因iOS 9.0系统提供单次定位能力,故在9.0以上会调用系统单次定位接口,9.0之前SDK完成封装。可以通过调用cancelRequestLocation来取消。 + * + * @param level 可以根据此参数来对应的获取POI信息 + * @param timeout 表示获取POI的超时时间。 + * @param completionBlock 单次定位完成后的Block + */ +- (BOOL)requestLocationWithRequestLevel:(TencentLBSRequestLevel)level + locationTimeout:(NSTimeInterval)timeout + completionBlock:(TencentLBSLocatingCompletionBlock)completionBlock; + +/** + * 取消单次定位 + **/ +- (void)cancelRequestLocation; + +/** + * 开始连续定位 + */ +- (void)startUpdatingLocation; + +/** + * 停止连续定位 + */ +- (void)stopUpdatingLocation; + +/** + * 开启更新定位朝向 + */ +- (void)startUpdatingHeading; + +/** + * 结束更新定位朝向 + */ +- (void)stopUpdatingHeading; + +/** + * 停止展示定位朝向校准提示 + */ +- (void)dismissHeadingCalibrationDisplay; + +#pragma mark - PDR 对外接口 +/** + * 主动获取DR实时融合位置,调用startDrEngine:成功后才可能有值,业务可根据自己的频率主动获取 + * @return DR融合后的定位结果 + */ +-(TencentLBSLocation *)getPosition; + +/** + * 启动DR引擎。引擎会自动获取传感器和GPS数据,并进行位置计算。 + * 启动后DR引擎会主动开启CLLocationManager startUpdatingLocation。 + * + * 注意:请确保调用之前已获取位置权限(使用期间或者始终允许) + * + * @param type 运动类型 目前支持,参考TencentLBSDRStartMotionType + * @return 返回码,参考TencentLBSDRStartCode + */ +-(TencentLBSDRStartCode)startDrEngine:(TencentLBSDRStartMotionType)type; + +/** + * 停止DR引擎。内部有极短时间延迟,若在此期间调用TencentLBSLocationManager startDrEngine:可能导致启动不成功。 + */ +-(void)terminateDrEngine; + +/** + * 是否支持DR引擎 + * @return + */ +-(BOOL)isSupport; + +#pragma mark - test used +// 测试使用 +#if TENCENTLBS_DEBUG ++ (void)upLoadData; ++ (NSData *)getLocationLog; ++ (void)newLocationLog; +#endif + +@end + + +#pragma mark - TencentLBSLocationManagerDelegate + +/** + * TencentLBSLocationManagerDelegate + * 定义了发生错误时的错误回调方法,连续定位的回调方法等。 + */ +@protocol TencentLBSLocationManagerDelegate +@optional + +/** + * 当定位发生错误时,会调用代理的此方法 + * + * @param manager 定位 TencentLBSLocationManager 类 + * @param error 返回的错误,参考 TencentLBSLocationError + */ +- (void)tencentLBSLocationManager:(TencentLBSLocationManager *)manager + didFailWithError:(NSError *)error; + +/** + * 连续定位回调函数 + * + * @param manager 定位 TencentLBSLocationManager 类 + * @param location 定位结果 + */ +- (void)tencentLBSLocationManager:(TencentLBSLocationManager *)manager + didUpdateLocation:(TencentLBSLocation *)location; + +/** + * 定位权限状态改变时回调函数 + * @deprecated 在iOS 14及以上废弃,由tencentLBSDidChangeAuthorization:代替 + * @param manager 定位 TencentLBSLocationManager 类 + * @param status 定位权限状态 + */ +- (void)tencentLBSLocationManager:(TencentLBSLocationManager *)manager + didChangeAuthorizationStatus:(CLAuthorizationStatus)status; + +/** + * 定位权限状态改变时回调函数 + * @param manager 定位 TencentLBSLocationManager 类,由此访问authorizationStatus,accuracyAuthorization + */ +- (void)tencentLBSDidChangeAuthorization:(TencentLBSLocationManager *)manager; + +/** + * 定位朝向改变时回调函数 + * + * @param manager 定位 TencentLBSLocationManager 类 + * @param newHeading 新的定位朝向 + */ +- (void)tencentLBSLocationManager:(TencentLBSLocationManager *)manager + didUpdateHeading:(CLHeading *)newHeading; + +/** + * 是否展示定位朝向校准提示的回调函数 + * + * @param manager 定位 TencentLBSLocationManager 类 + */ +- (BOOL)tencentLBSLocationManagerShouldDisplayHeadingCalibration:(TencentLBSLocationManager *)manager; + +/** + * 只是内部调试使用,外部不应实现该接口 + */ +- (void)tencentLBSLocationManager:(TencentLBSLocationManager *)manager didThrowLocation:(TencentLBSLocation *)location; + +@end + +NS_ASSUME_NONNULL_END diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBSLocationUtils.h b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBSLocationUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..61d838b23729cdd6a8bee35a5e1e0aaf56180455 --- /dev/null +++ b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Headers/TencentLBSLocationUtils.h @@ -0,0 +1,55 @@ +// +// TencentLBSLocationUtils.h +// TencentLBS +// +// Created by mirantslu on 16/8/11. +// Copyright © 2016年 Tencent. All rights reserved. +// + +#import +#import + +@class TencentLBSLocation; + +NS_ASSUME_NONNULL_BEGIN + +@interface TencentLBSLocationUtils : NSObject +/** + * 计算两个坐标点的距离 + */ ++ (double)distanceBetweenTwoCoordinate2D:(const CLLocationCoordinate2D *)coordinate coordinateTwo:(const CLLocationCoordinate2D *)coordinate2; +/** + * 计算两个location的距离 + */ ++ (double)distanceBetweenTwoCLLocations:(const CLLocation *)location locationTwo:(const CLLocation *)location2; + +/** + * 计算两个TencentLBSLocation的距离 + */ ++ (double)distanceBetweenTwoTencentLBSLocations:(const TencentLBSLocation *)location locationTwo:(const TencentLBSLocation *)location2; + +/** + * 判断经纬度是否在国内 + * + */ ++ (BOOL) isInRegionWithLatitude:(double)latitude longitude:(double)longitude; + +/** + * wgs84坐标转成gcj02坐标 + */ ++ (CLLocationCoordinate2D)WGS84TOGCJ02:(CLLocationCoordinate2D)coordinate; + +@end + +@interface TencentLBSServiceManager : NSObject + +/** + * 设置ID,如QQ号,微信号或是其他的登录账号,可用在发布前联调使用 + */ +@property (atomic, copy) NSString *deviceID; + ++ (instancetype)sharedInsance; + +@end + +NS_ASSUME_NONNULL_END diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Info.plist b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..3272071972e9722e88e33dcc59123acdd59853ce Binary files /dev/null and b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Info.plist differ diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Modules/module.modulemap b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Modules/module.modulemap new file mode 100644 index 0000000000000000000000000000000000000000..98a2c8be9e247ed644acf89ae102761c78b3dac7 --- /dev/null +++ b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module TencentLBS { + umbrella header "TencentLBS.h" + + export * + module * { export * } +} diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/TencentLBS b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/TencentLBS new file mode 100644 index 0000000000000000000000000000000000000000..41e00e17a701bccbf638b6890856b849dd9c30b4 Binary files /dev/null and b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/TencentLBS differ diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeDirectory b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeDirectory new file mode 100644 index 0000000000000000000000000000000000000000..faa399a40e895258432ed51106d9295f1daf7c4b Binary files /dev/null and b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeDirectory differ diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeRequirements b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeRequirements new file mode 100644 index 0000000000000000000000000000000000000000..dd335c9b978c1c584b9a66275524e4be358ec3f5 Binary files /dev/null and b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeRequirements differ diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeRequirements-1 b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeRequirements-1 new file mode 100644 index 0000000000000000000000000000000000000000..8ed917cbafd3184a4d9e1bdf7b1619a40a8e1c23 Binary files /dev/null and b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeRequirements-1 differ diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeResources b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000000000000000000000000000000000000..a9d7c4e4bc5d915b07943e3e9ca0de7906979e36 --- /dev/null +++ b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeResources @@ -0,0 +1,177 @@ + + + + + files + + Headers/TencentLBS.h + + hPC0/pGd4xrqNOXCT59Bc4EZx1o= + + Headers/TencentLBSLocation.h + + NTNAtRb6zd+vtrq8nFcrm/TvTno= + + Headers/TencentLBSLocationManager.h + + CqufUOM9qpXc8PkBQcTH7nFlxHU= + + Headers/TencentLBSLocationUtils.h + + ctiCEOKB25KPpldhCiCitDpWjsc= + + Info.plist + + dF6t7k2l2ACuPcw4w8e+8pX3Ds8= + + Modules/module.modulemap + + jS4bVEIZ8y6+mkDDypFhD0RkQVg= + + + files2 + + Headers/TencentLBS.h + + hash + + hPC0/pGd4xrqNOXCT59Bc4EZx1o= + + hash2 + + rXSLg9Gmqf/qi8hc0spd2V99ElDyGiIgDgvN30bahIQ= + + + Headers/TencentLBSLocation.h + + hash + + NTNAtRb6zd+vtrq8nFcrm/TvTno= + + hash2 + + LmWBqRV/iCuLqRmuUPDGqTOz3n2XBrAIRkPpulu9Dms= + + + Headers/TencentLBSLocationManager.h + + hash + + CqufUOM9qpXc8PkBQcTH7nFlxHU= + + hash2 + + ozYu6o4odbCMlj5n6GijSLmHlND06j8bgS/wHNmwwkI= + + + Headers/TencentLBSLocationUtils.h + + hash + + ctiCEOKB25KPpldhCiCitDpWjsc= + + hash2 + + clmnufMVF2VLg4uOOY70pixlfbrZK20rr/iOxOF4+E4= + + + Modules/module.modulemap + + hash + + jS4bVEIZ8y6+mkDDypFhD0RkQVg= + + hash2 + + j/3Yn2sASML4eiVUc877N1Qdw84cRUiapBx3Gc88OUI= + + + + rules + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeSignature b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeSignature new file mode 100644 index 0000000000000000000000000000000000000000..ff8a8f10cb05d203edd065618f8897ec7cf67ada Binary files /dev/null and b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/Frameworks/TencentLBS.framework/_CodeSignature/CodeSignature differ diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/config.json b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/config.json index 721b81e0240705a87ec0761aa9eb6f4e188769cb..21b97bc7034252ad8e2ddb5bf5b3ebb653d5a0b0 100644 --- a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/config.json +++ b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/config.json @@ -1,3 +1,5 @@ { - "deploymentTarget": "9" + "frameworks": [ + "libz.1.2.5.tbd" + ] } \ No newline at end of file diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/index.uts b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/index.uts new file mode 100644 index 0000000000000000000000000000000000000000..c4381974fafb61d85d646038fb4d36be7a51f9ba --- /dev/null +++ b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/index.uts @@ -0,0 +1,213 @@ +import { CLLocationManager, CLAuthorizationStatus } from "CoreLocation" +import { TencentLBSLocationManager, TencentLBSLocation, TencentLBSRequestLevel, TencentLBSLocationManagerDelegate } from "TencentLBS" +import { NSError, Bundle } from "Foundation" +import { GetLocationOptions, GetLocationSuccess } from "../interface.uts" + +/** + * 判断当前是否是自定义基座 + */ +export function checkHasIntegration() : boolean { + // todo + return true +} + +/** + * 定位 LBSLocation 类,封装定位相关方法 + */ +class LBSLocation implements TencentLBSLocationManagerDelegate { + + // 定义 locationManager 属性,类型为 TencentLBSLocationManager + locationManager! : TencentLBSLocationManager + + locationOptions ?: GetLocationOptions + + // 初始化 locationManager 方法 + configLocationManager() : boolean { + + if (this.locationManager == null) { + // 从 info.plist 中读取 apiKey + const apiKey = Bundle.main.infoDictionary?.["TencentLBSAPIKey"] + + // infoDictionary 获取的值类型为 any? + if (apiKey == null) { + // 如果 apiKey 为 null 返回 false + console.log("apiKey 未配置") + return false + } + // 调用API前需要设置同意用户隐私协议 + TencentLBSLocationManager.setUserAgreePrivacy(true) + // 初始化 locationManager 实例对象 + this.locationManager = new TencentLBSLocationManager() + // 设置 apiKey (因为 apiKey 是 any?类型,需要转成 string 类型赋值) + this.locationManager.apiKey = apiKey! as string; + this.locationManager.delegate = this + } + + return true + } + + // 请求定位权限 + requestPremission() { + if (this.configLocationManager()) { + const status = CLLocationManager.authorizationStatus() + // 如果未获取过定位权限,则发起权限请求 + if (status == CLAuthorizationStatus.notDetermined) { + this.locationManager.requestWhenInUseAuthorization() + } else if (status == CLAuthorizationStatus.denied || status == CLAuthorizationStatus.restricted) { + let ret = new UniError("uni-getLocation-tencent", -30, "permission missed."); + options.fail?.(ret) + options.complete?.(ret) + } + } + } + + // 获取单次位置信息 + getLocation(locationOptions : GetLocationOptions) : boolean { + + // 初始化 locationManager + if (!this.configLocationManager()) { + // 初始化失败返回 false + return false + } + + this.locationOptions = locationOptions + + const status = CLLocationManager.authorizationStatus() + if (status == CLAuthorizationStatus.authorizedAlways || status == CLAuthorizationStatus.authorizedWhenInUse) { + // 是否需要返回逆地理编码 + let requestLevel = TencentLBSRequestLevel.geo + if (locationOptions.geocode) { + requestLevel = TencentLBSRequestLevel.name + } + + // 请求单次定位信息 + this.locationManager.requestLocation(with = requestLevel, locationTimeout = 10, completionBlock = (location ?: TencentLBSLocation, err ?: NSError) : void => { + if (location != null) { + // 判断 address 是否有值 + var address = "" + if (location!.address != null) { + address = location!.address! + } + + let response : GetLocationSuccess = { + latitude: Number(location!.location.coordinate.latitude), + longitude: Number(location!.location.coordinate.longitude), + speed: Number(location!.location.speed), + altitude: Number(location!.location.altitude), + accuracy: Number(location!.location.horizontalAccuracy), + verticalAccuracy: Number(location!.location.verticalAccuracy), + horizontalAccuracy: Number(location!.location.horizontalAccuracy), + address: address + } + + locationOptions.success?.(response) + locationOptions.complete?.(response); + } else { + let ret = new UniError("uni-getLocation-tencent", -10, err!.localizedDescription); + locationOptions.fail?.(ret) + locationOptions.complete?.(ret) + } + }) + } else { + this.requestPremission() + } + return true + } + + // 监听位置变化 + watchPosition(locationOptions : GetLocationOptions) { + // 初始化 locationManager + if (!this.configLocationManager()) { + return + } + if (locationOptions.geocode) { + this.locationManager.requestLevel = TencentLBSRequestLevel.name + } else { + this.locationManager.requestLevel = TencentLBSRequestLevel.geo + } + this.locationOptions = locationOptions + this.locationManager.startUpdatingLocation() + } + + // 清除监听 + clearWatch() { + // 初始化 locationManager + if (!this.configLocationManager()) { + return + } + this.locationManager.stopUpdatingLocation() + } + + // 实现定位出错的 delegate 方法 + + tencentLBSDidChangeAuthorization(manager : TencentLBSLocationManager) { + const status = this.getAuthorizationStatus() + if (status == CLAuthorizationStatus.denied || status == CLAuthorizationStatus.restricted) { + let ret = new UniError("uni-getLocation-tencent", -30, "permission missed."); + options.fail?.(ret) + options.complete?.(ret) + } else if (status == CLAuthorizationStatus.authorizedAlways || status == CLAuthorizationStatus.authorizedWhenInUse) { + this.getLocation(this.locationOptions) + } + } + + tencentLBSLocationManager(manager : TencentLBSLocationManager, @argumentLabel("didFailWithError") error : NSError) { + let ret = new UniError("uni-getLocation-tencent", -10, error.localizedDescription); + this.locationOptions?.fail?.(ret) + this.locationOptions?.complete?.(ret) + } + + // 实现位置更新的 delegate 方法 + tencentLBSLocationManager(manager : TencentLBSLocationManager, @argumentLabel("didUpdate") location : TencentLBSLocation) { + + // 判断 address 是否有值 + var address = "" + if (location.address != null) { + address = location.address! + } + + let response : GetLocationSuccess = { + latitude: Number(location.location.coordinate.latitude), + longitude: Number(location.location.coordinate.longitude), + speed: Number(location.location.speed), + altitude: Number(location.location.altitude), + accuracy: Number(location.location.horizontalAccuracy), + verticalAccuracy: Number(location.location.verticalAccuracy), + horizontalAccuracy: Number(location.location.horizontalAccuracy), + address: address + } + this.locationOptions?.success?.(response) + this.locationOptions?.complete?.(response) + } + +} + +const LBSLocationTool : LBSLocation = new LBSLocation() + +/** + * 请求定位权限方法 + */ +export function requestPremission() { + LBSLocationTool.requestPremission() +} + +/* + * 获取位置信息方法(单次定位) + */ +export function getLocation(locationOptions : GetLocationOptions) : boolean { + return LBSLocationTool.getLocation(locationOptions) +} + +/** + * 持续监听位置变化 + */ +export function watchPosition(locationOptions : GetLocationOptions) { + LBSLocationTool.watchPosition(locationOptions) +} + +/** + * 关闭监听位置变化 + */ +export function clearWatch() { + LBSLocationTool.clearWatch() +} diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/info.plist b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/info.plist new file mode 100644 index 0000000000000000000000000000000000000000..3e3295273bbc8dc2e05565a6492871d6e103ee69 --- /dev/null +++ b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/info.plist @@ -0,0 +1,23 @@ + + + + + TencentLBSAPIKey + WZCBZ-OLPCU-TJJVJ-4LZTE-SSG5O-6JFEM + NSLocationAlwaysAndWhenInUseUsageDescription + 允许使用定位权限吗 + NSLocationAlwaysUsageDescription + 允许一直使用定位权限 + NSLocationWhenInUseUsageDescription + 允许仅在app运行期间使用定位权限 + NSLocationTemporaryUsageDescriptionDictionary + + key1111 + 获取准确的位置信息 + + UIBackgroundModes + + location + + +