提交 d38d3d80 编写于 作者: DCloud-yyl's avatar DCloud-yyl

Merge branch 'dev' into alpha

# Conflicts:
#	uni_modules/uni-fileSystemManager/package.json
#	uni_modules/uni-fileSystemManager/utssdk/app-android/FileDescriptorUtil.uts
#	uni_modules/uni-fileSystemManager/utssdk/app-android/index.uts
#	uni_modules/uni-fileSystemManager/utssdk/app-js/index.uts
#	uni_modules/uni-fileSystemManager/utssdk/interface.uts
#	uni_modules/uni-fileSystemManager/utssdk/unierror.uts
#	uni_modules/uni-getAppBaseInfo/utssdk/app-android/index.uts
#	uni_modules/uni-getAppBaseInfo/utssdk/app-ios/index.uts
#	uni_modules/uni-getAppBaseInfo/utssdk/interface.uts
#	uni_modules/uni-getDeviceInfo/utssdk/app-android/device/DeviceUtil.uts
#	uni_modules/uni-getDeviceInfo/utssdk/interface.uts
#	uni_modules/uni-getPerformance/utssdk/interface.uts
#	uni_modules/uni-getProvider/utssdk/app-android/index.uts
#	uni_modules/uni-getProvider/utssdk/interface.uts
#	uni_modules/uni-getSystemInfo/utssdk/app-android/index.uts
#	uni_modules/uni-getSystemInfo/utssdk/app-ios/index.uts
#	uni_modules/uni-getSystemInfo/utssdk/interface.uts
#	uni_modules/uni-getbatteryinfo/utssdk/interface.uts
#	uni_modules/uni-media/utssdk/app-android/index.uts
#	uni_modules/uni-media/utssdk/app-android/utils/ChooseImageUtils.uts
#	uni_modules/uni-media/utssdk/app-android/utils/ChooseMediaUtils.uts
#	uni_modules/uni-media/utssdk/app-android/utils/CompressUtils.uts
#	uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/Info.plist
#	uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64/DCloudMediaPicker.framework/DCloudMediaPicker
#	uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/DCloudMediaPicker
#	uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/_CodeSignature/CodeDirectory
#	uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/_CodeSignature/CodeRequirements-1
#	uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/_CodeSignature/CodeResources
#	uni_modules/uni-media/utssdk/app-ios/index.uts
#	uni_modules/uni-media/utssdk/app-ios/info.plist
#	uni_modules/uni-media/utssdk/interface.uts
#	uni_modules/uni-navigationBar/utssdk/app-android/index.uts
#	uni_modules/uni-network/utssdk/app-ios/index.uts
#	uni_modules/uni-network/utssdk/app-ios/interface.uts
#	uni_modules/uni-network/utssdk/app-ios/network/NetworkManager.uts
#	uni_modules/uni-payment-alipay/utssdk/app-android/Alipay.uts
#	uni_modules/uni-payment-alipay/utssdk/app-android/index.uts
#	uni_modules/uni-payment-alipay/utssdk/app-ios/config.json
#	uni_modules/uni-payment-alipay/utssdk/app-ios/index.uts
#	uni_modules/uni-payment-wxpay/utssdk/app-android/index.uts
#	uni_modules/uni-payment-wxpay/utssdk/app-android/src/WXPayEntryActivity.uts
#	uni_modules/uni-payment-wxpay/utssdk/app-android/src/Wxpay.uts
#	uni_modules/uni-payment-wxpay/utssdk/app-ios/config.json
#	uni_modules/uni-payment-wxpay/utssdk/app-ios/index.uts
#	uni_modules/uni-payment/utssdk/app-android/index.uts
#	uni_modules/uni-payment/utssdk/app-ios/index.uts
#	uni_modules/uni-payment/utssdk/interface.uts
#	uni_modules/uni-payment/utssdk/unierror.uts
#	uni_modules/uni-prompt/utssdk/app-android/res/layout/ac_recyclerview_layout_top.xml
#	uni_modules/uni-prompt/utssdk/app-android/res/layout/ac_recyclerview_layout_top_night.xml
#	uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top.xml
#	uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top_night.xml
#	uni_modules/uni-prompt/utssdk/app-android/showToast.uts
#	uni_modules/uni-route/utssdk/app-android/navigateBack.uts
#	uni_modules/uni-route/utssdk/constants.uts
#	uni_modules/uni-route/utssdk/interface.uts
#	uni_modules/uni-tabBar/utssdk/interface.uts
#	uni_modules/uni-websocket/utssdk/app-ios/websocket/WebsockerClient.uts
......@@ -61,12 +61,14 @@ export interface Uni {
* "android": {
* "osVer": "5.0",
* "uniVer": "3.8.15",
* "unixVer": "3.9.0"
* "unixVer": "3.9.0",
* "utsPlugin": "3.9.0"
* },
* "ios": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* "unixVer": "x",
* "utsPlugin": "x"
* }
* },
* "web": {
......
......@@ -24,7 +24,14 @@ export const getDeviceInfo : GetDeviceInfo = (config : GetDeviceInfoOptions | nu
"platform",
"isRoot",
"isSimulator",
"isUSBDebugging"
"isUSBDebugging",
"osName",
"osVersion",
"osLanguage",
"osTheme",
"osAndroidAPILevel",
"romName",
"romVersion"
];
filter = defaultFilter;
}
......@@ -73,5 +80,27 @@ function getBaseInfo(filterArray : Array<string>) : GetDeviceInfoResult {
if (filterArray.indexOf("isUSBDebugging") != -1) {
result.isUSBDebugging = DeviceUtil.listeningForADB();
}
if (filterArray.indexOf("osName") != -1) {
result.osName = "android";
}
if (filterArray.indexOf("osVersion") != -1) {
result.osVersion = Build.VERSION.RELEASE;
}
if (filterArray.indexOf("osLanguage") != -1) {
result.osLanguage = UTSAndroid.getLanguageInfo(activity)["osLanguage"].toString();
}
if (filterArray.indexOf("osTheme") != -1) {
result.osTheme = UTSAndroid.getOsTheme();
}
if (filterArray.indexOf("osAndroidAPILevel") != -1) {
result.osAndroidAPILevel = Build.VERSION.SDK_INT;
}
if (filterArray.indexOf("romName") != -1) {
result.romName = DeviceUtil.getRomName();
}
if (filterArray.indexOf("romVersion") != -1) {
result.romVersion = DeviceUtil.getRomVersion();
}
return result;
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ import { UTSiOS } from "DCloudUTSFoundation";
import { DeviceUtil } from './device/DeviceUtil.uts';
import { GetDeviceInfo, GetDeviceInfoOptions, GetDeviceInfoResult } from '../interface.uts'
import { UIScreen , UIDevice ,UIApplication } from 'UIKit';
export const getDeviceInfo : GetDeviceInfo = (config : GetDeviceInfoOptions | null) : GetDeviceInfoResult => {
let filter : Array<string> = [];
......@@ -24,7 +25,13 @@ export const getDeviceInfo : GetDeviceInfo = (config : GetDeviceInfoOptions | nu
"system",
"platform",
"isRoot",
"isSimulator"
"isSimulator",
"osName",
"osVersion",
"osLanguage",
"osTheme",
"romName",
"romVersion"
];
filter = defaultFilter;
}
......@@ -72,5 +79,29 @@ function getBaseInfo(filterArray : Array<string>) : GetDeviceInfoResult {
result.isSimulator = UTSiOS.isSimulator();
}
if (filterArray.indexOf("osName") != -1) {
result.osName = "ios";
}
if (filterArray.indexOf("osVersion") != -1) {
result.osVersion = UIDevice.current.systemVersion;
}
if (filterArray.indexOf("osLanguage") != -1) {
result.osLanguage = UTSiOS.getOsLanguage();
}
if (filterArray.indexOf("osTheme") != -1) {
let osTheme = 'light'
if(UTSiOS.available("iOS 13, *")){
let currentTraitCollection = UIApplication.shared.keyWindow?.traitCollection
osTheme = currentTraitCollection?.userInterfaceStyle == UIUserInterfaceStyle.dark ? "dark" : "light"
}
result.osTheme = osTheme;
}
if (filterArray.indexOf("romName") != -1) {
result.romName = "ios"
}
if (filterArray.indexOf("romVersion") != -1) {
result.romVersion = UIDevice.current.systemVersion;
}
return result;
}
\ No newline at end of file
## 1.1(2024-06-20)
支持iOS平台
## 1.0.1(2023-10-23)
更新android自定义基座操作步骤
## 1.0.0(2023-09-11)
......
{
"id": "uni-getLocation-tencent",
"displayName": "uni-getLocation-tencent",
"version": "1.0.1",
"version": "1.1",
"description": "基于腾讯定位服务,实现uni.getLocation 获取定位功能",
"keywords": [
"uni-getLocation-tencent"
"uni.getLocation",
"tencent"
],
"repository": "",
"engines": {
"HBuilderX": "^3.8.12"
"HBuilderX": "^4.0"
},
"dcloudext": {
"type": "uts",
......@@ -41,7 +42,8 @@
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
"aliyun": "y",
"alipay": "n"
},
"client": {
"Vue": {
......@@ -50,10 +52,10 @@
},
"App": {
"app-android": {
"minVersion": "19"
"minVersion": "21"
},
"app-ios": {
"minVersion": "9"
"minVersion": "12"
}
},
"H5-mobile": {
......
# uts-tencentgeolocation腾讯定位插件使用文档
## API使用
参考[uni.getLocation](https://doc.dcloud.net.cn/uni-app-x/api/get-location.html)
## Android 平台
1. 申请腾讯地图key
[申请网址](https://lbs.qq.com/mobile/androidMapSDK/developerGuide/getKey)
2. 配置key到插件中
2. 配置key到项目
在项目根目录下添加 AndroidManifest.xml 文件,详情参考:[Android原生应用清单文件](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#%E5%BA%94%E7%94%A8%E6%B8%85%E5%8D%95%E6%96%87%E4%BB%B6-androidmanifest-xml)。将申请的 key 配置到项目 AndroidManifest.xml 的 application 节点中,如下:
```xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
>
<application>
<!-- 将申请到的 key 配置在 android:value 属性中 -->
<meta-data android:name="TencentMapSDK" android:value="您申请的Key" />
修改项目根目录下 AndroidManifest.xml
`<meta-data android:name="TencentMapSDK" android:value="您申请的Key" />`
</application>
</manifest>
```
3. 制作自定义基座运行后生效
提交云端打包制作自定义基座后,再在HBuilderX中真机运行。
## iOS 平台
1.申请腾讯地图key
1. 申请腾讯地图key
[申请网址](https://lbs.qq.com/mobile/androidMapSDK/developerGuide/getKey)
2.配置key到插件中
2. 配置key到插件中
将申请的key配置到插件目录下 app-ios -> info.plist 中 TencentLBSAPIKey 对应的值
在项目根目录下添加 Info.plist 文件,详情参考:[iOS原生应用配置文件](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-ios.html#infoplist)。将申请的 key 配置到项目 Info.plist 的 TencentLBSAPIKey 键值中,如下:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>TencentLBSAPIKey</key>
<string>您申请的Key</string>
</dict>
</plist>
```
3. 配置访问位置权限描述信息
在项目根目录下 Info.plist 文件中添加以下权限描述信息:
```xml
<key>TencentLBSAPIKey</key>
<string>您申请的Key</string>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSLocationAlwaysUsageDescription</key>
<string>后台运行期访问位置信息的许可描述</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>运行期访问位置信息的许可描述</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>访问位置信息的许可描述</string>
</dict>
</plist>
```
3.配置访问位置权限描述信息
> 许可描述信息需根据应用实际业务情况准确描述,否则可能无法通过 AppStore 上架审核
> uni-app 项目也可以在 manifest.json 的 "App权限配置" 可视化界面的 "iOS隐私信息访问的许可描述" 下配置
3. 制作自定义基座运行后生效
提交云端打包制作自定义基座后,再在HBuilderX中真机运行。
## 注意事项
### 隐私合规问题
此插件使用了腾讯位置服务SDK,调用定位API会采集个人隐私信息,在业务中请确保最终用户已经同意了App的隐私协议后再调用定位API,否则会因为隐私合规问题无法上架应用市场。
选中工程中的 manifest.json -> App权限配置 -> iOS隐私信息访问的许可描述,分别配置下列权限描述信息
App的隐私政策中需披露使用的三方SDK相关情况:
- NSLocationAlwaysUsageDescription
- NSLocationWhenInUseUsageDescription
- NSLocationAlwaysAndWhenInUseUsageDescription
- Android平台腾讯位置服务SDK [合规说明](https://lbs.qq.com/mobile/androidLocationSDK/androidLBSInfo)
- iOS平台腾讯位置服务SDK [合规说明](https://lbs.qq.com/mobile/iosLocationSDK/iosLBSInfo)
4.制作自定义基座运行后生效
## 相关开发文档
- [UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html)
- [UTS 原生插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html)
- [UTS 插件开发文档](https://doc.dcloud.net.cn/uni-app-x/plugin/uts-plugin.html)
......@@ -2,6 +2,6 @@
"dependencies": [
"com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.3.0"
],
"minSdkVersion": "19"
"minSdkVersion": "21"
}
//
// TencentLBS.h
// TencentLBS
//
// Created by mirantslu on 16/4/19.
// Copyright © 2016年 Tencent. All rights reserved.
//
#import <UIKit/UIKit.h>
//! 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 <TencentLBS/PublicHeader.h>
#import <TencentLBS/TencentLBSLocation.h>
#import <TencentLBS/TencentLBSLocationManager.h>
#import <TencentLBS/TencentLBSLocationUtils.h>
//
// TencentLBSLocation.h
// TencentLBS
//
// Created by mirantslu on 16/4/19.
// Copyright © 2016年 Tencent. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
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<NSSecureCoding, NSCopying>
@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<NSSecureCoding, NSCopying>
/**
* 返回当前位置的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
* <b>注意:该接口涉及到WebService API,请参考https://lbs.qq.com/service/webService/webServiceGuide/webServiceOverview中的配额限制说明,
* 并将申请的有效key通过TencentLBSLocationManager的- (void)setDataWithValue: forKey:方法设置,其中key为固定值@"ReGeoCodingnKey",例如[tencentLocationManager setDataWithValue:@"您申请的key(务必正确)" forKey:@"ReGeoCodingnKey"];,否则将返回默认值0</b>
*/
@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<TencentLBSPoi*> *poiList;
/**
* 返回两个位置之间的横向距离
* @param location
*/
- (double)distanceFromLocation:(const TencentLBSLocation *)location;
// 测试使用
#if TENCENTLBS_DEBUG
@property (nonatomic, copy, nullable) NSString *halleyTime;
#endif
@end
NS_ASSUME_NONNULL_END
//
// TencentLBSLocationManager.h
// TencentLBS
//
// Created by mirantslu on 16/4/19.
// Copyright © 2016年 Tencent. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#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<TencentLBSLocationManagerDelegate> 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;
/**
* 设置用户是否同意隐私协议政策
* <p>调用其他接口前必须首先调用此接口进行用户是否同意隐私政策的设置,传入YES后才能正常使用定位功能,否则TencentLBSLocationManager初始化不成功,返回nil,定位功能均无法使用</p>
* @param isAgree 是否同意隐私政策
*/
+ (void)setUserAgreePrivacy:(BOOL) isAgree;
/**
* 获取用户是否同意隐私政策协议
* <p>设置用户隐私后,可通过该接口判断用户隐私状态</p>
* @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 <NSObject>
@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
//
// TencentLBSLocationUtils.h
// TencentLBS
//
// Created by mirantslu on 16/8/11.
// Copyright © 2016年 Tencent. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
@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
framework module TencentLBS {
umbrella header "TencentLBS.h"
export *
module * { export * }
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict>
<key>Headers/TencentLBS.h</key>
<data>
hPC0/pGd4xrqNOXCT59Bc4EZx1o=
</data>
<key>Headers/TencentLBSLocation.h</key>
<data>
NTNAtRb6zd+vtrq8nFcrm/TvTno=
</data>
<key>Headers/TencentLBSLocationManager.h</key>
<data>
CqufUOM9qpXc8PkBQcTH7nFlxHU=
</data>
<key>Headers/TencentLBSLocationUtils.h</key>
<data>
ctiCEOKB25KPpldhCiCitDpWjsc=
</data>
<key>Info.plist</key>
<data>
dF6t7k2l2ACuPcw4w8e+8pX3Ds8=
</data>
<key>Modules/module.modulemap</key>
<data>
jS4bVEIZ8y6+mkDDypFhD0RkQVg=
</data>
</dict>
<key>files2</key>
<dict>
<key>Headers/TencentLBS.h</key>
<dict>
<key>hash</key>
<data>
hPC0/pGd4xrqNOXCT59Bc4EZx1o=
</data>
<key>hash2</key>
<data>
rXSLg9Gmqf/qi8hc0spd2V99ElDyGiIgDgvN30bahIQ=
</data>
</dict>
<key>Headers/TencentLBSLocation.h</key>
<dict>
<key>hash</key>
<data>
NTNAtRb6zd+vtrq8nFcrm/TvTno=
</data>
<key>hash2</key>
<data>
LmWBqRV/iCuLqRmuUPDGqTOz3n2XBrAIRkPpulu9Dms=
</data>
</dict>
<key>Headers/TencentLBSLocationManager.h</key>
<dict>
<key>hash</key>
<data>
CqufUOM9qpXc8PkBQcTH7nFlxHU=
</data>
<key>hash2</key>
<data>
ozYu6o4odbCMlj5n6GijSLmHlND06j8bgS/wHNmwwkI=
</data>
</dict>
<key>Headers/TencentLBSLocationUtils.h</key>
<dict>
<key>hash</key>
<data>
ctiCEOKB25KPpldhCiCitDpWjsc=
</data>
<key>hash2</key>
<data>
clmnufMVF2VLg4uOOY70pixlfbrZK20rr/iOxOF4+E4=
</data>
</dict>
<key>Modules/module.modulemap</key>
<dict>
<key>hash</key>
<data>
jS4bVEIZ8y6+mkDDypFhD0RkQVg=
</data>
<key>hash2</key>
<data>
j/3Yn2sASML4eiVUc877N1Qdw84cRUiapBx3Gc88OUI=
</data>
</dict>
</dict>
<key>rules</key>
<dict>
<key>^.*</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^.*</key>
<true/>
<key>^.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
{
"deploymentTarget": "9"
"frameworks": [
"libz.1.2.5.tbd"
],"deploymentTarget": "12"
}
\ No newline at end of file
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.");
this.locationOptions?.fail?.(ret)
this.locationOptions?.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 = CLLocationManager.authorizationStatus()
if (status == CLAuthorizationStatus.denied || status == CLAuthorizationStatus.restricted) {
let ret = new UniError("uni-getLocation-tencent", -30, "permission missed.");
this.locationOptions?.fail?.(ret)
this.locationOptions?.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()
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>TencentLBSAPIKey</key>
<string>WZCBZ-OLPCU-TJJVJ-4LZTE-SSG5O-6JFEM</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>允许使用定位权限吗</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>允许一直使用定位权限</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>允许仅在app运行期间使用定位权限</string>
<key>NSLocationTemporaryUsageDescriptionDictionary</key>
<dict>
<key>key1111</key>
<string>获取准确的位置信息</string>
</dict>
<key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>
</dict>
</plist>
......@@ -86,7 +86,7 @@
"app": {
"js": false,
"kotlin": true,
"swift": false
"swift": true
}
},
"saveVideoToPhotosAlbum": {
......@@ -94,7 +94,7 @@
"app": {
"js": false,
"kotlin": true,
"swift": false
"swift": true
}
},
"getVideoInfo": {
......
......@@ -25,7 +25,7 @@ export function getVideoMetadata(src : string) : any {
let error = new MediaErrorImpl(1101003, UniError_GetVideoInfo);
return error
}
videoInfo.size = videoFile.length()
videoInfo.size = videoFile.length() / 1024;
try {
let retriever = new MediaMetadataRetriever()
retriever.setDataSource(path)
......
import { ChooseImageOptions, ChooseVideoOptions } from "../interface.uts"
import {
UniError_ChooseImage, UniError_ChooseVideo, MediaErrorImpl
} from "../unierror.uts"
export const CODE_CAMERA_ERROR = 11;
export const CODE_GALLERY_ERROR = 12;
export const CODE_GET_IMAGE_INFO_CODE = 13
export function uniChooseImage(options : ChooseImageOptions, onSourceTypeSelect : (count : number, compressed : boolean, index : number) => void) {
let count = options.count != null ? (options.count! <= 0 ? 9 : options.count) : 9
// 默认为 false
let compressed = false;
if ((options.sizeType) != null) {
compressed = options.sizeType!.indexOf("original") < 0
}
/* source type 乱传如何处理 */
let sourceType : Array<string> = (options.sourceType != null && options.sourceType!.length > 0) ? options.sourceType! : ["album", "camera"];
let itemList = ["拍摄", "从相册选择"]
if (sourceType.length == 1) {
if (sourceType.indexOf("album") >= 0) {
onSourceTypeSelect(count!, compressed, 1)
} else if (sourceType.indexOf("camera") >= 0) {
onSourceTypeSelect(count!, compressed, 0)
}
return
}
if (sourceType.length == 2) {
uni.showActionSheet({
itemList: itemList,
success: (e) => {
onSourceTypeSelect(count!, compressed, e.tapIndex!)
},
fail: (e) => {
let error = new MediaErrorImpl(1101001, UniError_ChooseImage);
options.fail?.(error)
options.complete?.(error)
}
})
}
}
export function uniChooseVideo(options : ChooseVideoOptions, onSourceTypeSelect : (count : number, compressed : boolean, index : number) => void) {
let count = 1
/* source type 乱传如何处理 */
let sourceType : Array<string> = (options.sourceType != null && options.sourceType!.length > 0) ? options.sourceType! : ["album", "camera"];
let itemList = ["拍摄", "从相册选择"]
if (sourceType.length == 1) {
if (sourceType.indexOf("album") >= 0) {
onSourceTypeSelect(count, options.compressed, 1)
} else if (sourceType.indexOf("camera") >= 0) {
onSourceTypeSelect(count, options.compressed, 0)
}
return
}
if (sourceType.length == 2) {
uni.showActionSheet({
itemList: itemList,
success: (e) => {
onSourceTypeSelect(count, options.compressed, e.tapIndex!)
},
fail: (e) => {
let error = new MediaErrorImpl(1101001, UniError_ChooseVideo);
options.fail?.(error)
options.complete?.(error)
}
})
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
</dict>
</array>
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypePhotosorVideos</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>
</array>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
</dict>
</array>
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypePhotosorVideos</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
</array>
</dict>
</array>
</dict>
</plist>
重要!
SDK2.0.4
1.增加privacy manifest文件
2.修复跳微信时可能卡顿的问题
SDK2.0.2
1. 优化XCFramework打包方式
SDK2.0.1
1. SDK支持XCFramework
SDK2.0.0
1. 分享能力支持内容防篡改校验
SDK1.9.9
1. 授权登录支持关闭自动授权
2. 分享支持添加签名,防止篡改
SDK1.9.7
1. 适配CocoaPods
SDK1.9.6
1. 适配iOS 16,减少读写剪切板
SDK1.9.4
1. 修复授权登录取消/拒绝时state字段没有带回
SDK1.9.3
1. 新增发起二维码支付能力
SDK1.9.2
1. 新增发起企微客服会话能力
SDK1.9.1
1. 音乐视频分享类型增加运营H5字段
SDK1.8.9
1. 增加音乐视频分享类型
SDK1.8.8
1. 增加游戏直播消息类型
SDK1.8.7.1
1. 修复Xcode11以下编译不通过
SDK1.8.7
1. 修复iPadOS,未安装微信的情况下,因为UA问题无法授权登录
2. 修复未安装微信的情况下, 适配了UIScene的App因为UIAlertView Crash
3. 增加Universal Link检测函数
SDK1.8.6.2
1. 修改包含"UIWebView"字符的类名
SDK1.8.6.1
1.短信授权登录使用的UIWebview切换成WKWebview
SDK1.8.6
1. 支持Universal Link拉起微信以及返回App
2. SDK移除MTA库
SDK1.8.5
1. 更换MTA库:取消对剪切板的访问, 防止和其他SDK竞争导致crash
2. NSMutableArray的MTA分类方法改名,减少命名冲突
3. 不含支付功能版本移除非税支付和医保支付接口
4. 分享音乐支持填写歌词和高清封面图
SDK1.8.4
1. 调整分享图片大小限制
2. 新增openBusinessView接口
SDK1.8.3
1. SDK增加调起微信刷卡支付接口
2. SDK增加小程序订阅消息接口
3. 修复小程序订阅消息接口没有resp的问题
SDK1.8.2
1. SDK增加开发票授权 WXInvoiceAuthInsert
2. SDK增加非税接口 WXNontaxPay
3. SDK增加医保接口 WXPayInsurance
4. 更换MTA库
SDK1.8.1
1. SDK打开小程序支持指定版本(体验,开发,正式版)
2. SDK分享小程序支持指定版本(体验,开发,正式版)
3. SDK支持输出log日志
SDK1.8.0
1. SDK支持打开小程序
2. SDK分享小程序支持shareTicket
SDK1.7.9
1. SDK订阅一次性消息
SDK1.7.8
1 SDK分享小程序支持大图
SDK1.7.7
1 增加SDK分享小程序
2 增加选择发票接口
SDK1.7.6
1. 提高稳定性
1 修复mta崩溃
2 新增接口支持开发者关闭mta数据统计上报
SDK1.7.5
1. 提高稳定性
2. 加快registerApp接口启动速度
SDK1.7.4
1. 更新支持iOS启用 ATS(App Transport Security)
2. 需要在工程中链接CFNetwork.framework
3. 在工程配置中的”Other Linker Flags”中加入”-Objc -all_load”
SDK1.7.3
1. 增强稳定性,适配iOS10
2. 修复小于32K的jpg格式缩略图设置失败的问题
SDK1.7.2
1. 修复因CTTeleponyNetworkInfo引起的崩溃问题
SDK1.7.1
1. 支持兼容ipv6(提升稳定性)
2. xCode Version 7.3.1 (7D1014) 编译
SDK1.7
1. 支持兼容ipv6
2. 修复若干问题增强稳定性
SDK1.6.3
1. xCode7.2 构建的sdk包。
2. 请使用xCode7.2进行编译。
3. 需要在Build Phases中Link Security.framework
4. 修复若干小问题。
SDK1.6.2
1、xCode7.1 构建的sdk包
2、请使用xCode7.1进行编译
SDK1.6.1
1、修复armv7s下,bitcode可能编译不过
2、解决warning
SDK1.6
1、iOS 9系统策略更新,限制了http协议的访问,此外应用需要在“Info.plist”中将要使用的URL Schemes列为白名单,才可正常检查其他应用是否安装。
受此影响,当你的应用在iOS 9中需要使用微信SDK的相关能力(分享、收藏、支付、登录等)时,需要在“Info.plist”里增加如下代码:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>weixin</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
2、开发者需要在工程中链接上 CoreTelephony.framework
3、解决bitcode编译不过问题
SDK1.5
1、废弃safeSendReq:接口,使用sendReq:即可。
2、新增+(BOOL) sendAuthReq:(SendAuthReq*) req viewController : (UIViewController*) viewController delegate:(id<WXApiDelegate>) delegate;
支持未安装微信情况下Auth,具体见WXApi.h接口描述
3、微信开放平台新增了微信模块用户统计功能,便于开发者统计微信功能模块的用户使用和活跃情况。开发者需要在工程中链接上:SystemConfiguration.framework,libz.dylib,libsqlite3.0.dylib。
//
// WXApi.h
// 所有Api接口
//
// Created by Wechat on 12-2-28.
// Copyright (c) 2012年 Tencent. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "WXApiObject.h"
NS_ASSUME_NONNULL_BEGIN
typedef BOOL(^WXGrantReadPasteBoardPermissionCompletion)(void);
#pragma mark - WXApiDelegate
/*! @brief 接收并处理来自微信终端程序的事件消息
*
* 接收并处理来自微信终端程序的事件消息,期间微信界面会切换到第三方应用程序。
* WXApiDelegate 会在handleOpenURL:delegate:中使用并触发。
*/
@protocol WXApiDelegate <NSObject>
@optional
/*! @brief 收到一个来自微信的请求,第三方应用程序处理完后调用sendResp向微信发送结果
*
* 收到一个来自微信的请求,异步处理完成后必须调用sendResp发送处理结果给微信。
* 可能收到的请求有GetMessageFromWXReq、ShowMessageFromWXReq等。
* @param req 具体请求内容,是自动释放的
*/
- (void)onReq:(BaseReq*)req;
/*! @brief 发送一个sendReq后,收到微信的回应
*
* 收到一个来自微信的处理结果。调用一次sendReq后会收到onResp。
* 可能收到的处理结果有SendMessageToWXResp、SendAuthResp等。
* @param resp具体的回应内容,是自动释放的
*/
- (void)onResp:(BaseResp*)resp;
/* ! @brief 用于在iOS16以及以上系统上,控制OpenSDK是否读取剪切板中微信传递的数据以及读取的时机
* 在iOS16以及以上系统,在SDK需要读取剪切板中微信写入的数据时,会回调该方法。没有实现默认会直接读取微信通过剪切板传递过来的数据
* 注意:
* 1. 只在iOS16以及以上的系统版本上回调;
* 2. 不实现时,OpenSDK会直接调用读取剪切板接口,读取微信传递过来的数据;
* 3. 若实现该方法:开发者需要通过调用completion(), 支持异步,通知SDK允许读取剪切板中微信传递的数据,
* 不调用completion()则代表不授权OpenSDK读取剪切板,会导致收不到onReq:, onResp:回调,无法后续业务流程。请谨慎使用
* 4. 不要长时间持有completion不释放,可能会导致内存泄漏。
*/
- (void)onNeedGrantReadPasteBoardPermissionWithURL:(nonnull NSURL *)openURL completion:(nonnull WXGrantReadPasteBoardPermissionCompletion)completion;
@end
#pragma mark - WXApiLogDelegate
@protocol WXApiLogDelegate <NSObject>
- (void)onLog:(NSString*)log logLevel:(WXLogLevel)level;
@end
#pragma mark - WXApi
/*! @brief 微信Api接口函数类
*
* 该类封装了微信终端SDK的所有接口
*/
@interface WXApi : NSObject
/*! @brief WXApi的成员函数,向微信终端程序注册第三方应用。
*
* 需要在每次启动第三方应用程序时调用。
* @attention 请保证在主线程中调用此函数
* @param appid 微信开发者ID
* @param universalLink 微信开发者Universal Link
* @return 成功返回YES,失败返回NO。
*/
+ (BOOL)registerApp:(NSString *)appid universalLink:(NSString *)universalLink;
/*! @brief 处理旧版微信通过URL启动App时传递的数据
*
* 需要在 application:openURL:sourceApplication:annotation:或者application:handleOpenURL中调用。
* @param url 微信启动第三方应用时传递过来的URL
* @param delegate WXApiDelegate对象,用来接收微信触发的消息。
* @return 成功返回YES,失败返回NO。
*/
+ (BOOL)handleOpenURL:(NSURL *)url delegate:(nullable id<WXApiDelegate>)delegate;
/*! @brief 处理微信通过Universal Link启动App时传递的数据
*
* 需要在 application:continueUserActivity:restorationHandler:中调用。
* @param userActivity 微信启动第三方应用时系统API传递过来的userActivity
* @param delegate WXApiDelegate对象,用来接收微信触发的消息。
* @return 成功返回YES,失败返回NO。
*/
+ (BOOL)handleOpenUniversalLink:(NSUserActivity *)userActivity delegate:(nullable id<WXApiDelegate>)delegate;
/*! @brief 检查微信是否已被用户安装
*
* @return 微信已安装返回YES,未安装返回NO。
*/
+ (BOOL)isWXAppInstalled;
/*! @brief 判断当前微信的版本是否支持OpenApi
*
* @return 支持返回YES,不支持返回NO。
*/
+ (BOOL)isWXAppSupportApi;
/*! @brief 判断当前微信的版本是否支持分享微信状态功能
*
* @attention 需在工程LSApplicationQueriesSchemes配置中添加weixinStateAPI
* @return 支持返回YES,不支持返回NO。
*/
+ (BOOL)isWXAppSupportStateAPI;
#ifndef BUILD_WITHOUT_PAY
/*! @brief 判断当前微信的版本是否支持二维码拉起微信支付
*
* @attention 需在工程LSApplicationQueriesSchemes配置中添加weixinQRCodePayAPI
* @return 支持返回YES,不支持返回NO。
*/
+ (BOOL)isWXAppSupportQRCodePayAPI;
#endif
/*! @brief 获取微信的itunes安装地址
*
* @return 微信的安装地址字符串。
*/
+ (NSString *)getWXAppInstallUrl;
/*! @brief 获取当前微信SDK的版本号
*
* @return 返回当前微信SDK的版本号
*/
+ (NSString *)getApiVersion;
/*! @brief 打开微信
*
* @return 成功返回YES,失败返回NO。
*/
+ (BOOL)openWXApp;
/*! @brief 发送请求到微信,等待微信返回onResp
*
* 函数调用后,会切换到微信的界面。第三方应用程序等待微信返回onResp。微信在异步处理完成后一定会调用onResp。支持以下类型
* SendAuthReq、SendMessageToWXReq、PayReq等。
* @param req 具体的发送请求。
* @param completion 调用结果回调block
*/
+ (void)sendReq:(BaseReq *)req completion:(void (^ __nullable)(BOOL success))completion;
/*! @brief 收到微信onReq的请求,发送对应的应答给微信,并切换到微信界面
*
* 函数调用后,会切换到微信的界面。第三方应用程序收到微信onReq的请求,异步处理该请求,完成后必须调用该函数。可能发送的相应有
* GetMessageFromWXResp、ShowMessageFromWXResp等。
* @param resp 具体的应答内容
* @param completion 调用结果回调block
*/
+ (void)sendResp:(BaseResp*)resp completion:(void (^ __nullable)(BOOL success))completion;
/*! @brief 发送Auth请求到微信,支持用户没安装微信,等待微信返回onResp
*
* 函数调用后,会切换到微信的界面。第三方应用程序等待微信返回onResp。微信在异步处理完成后一定会调用onResp。支持SendAuthReq类型。
* @param req 具体的发送请求。
* @param viewController 当前界面对象。
* @param delegate WXApiDelegate对象,用来接收微信触发的消息。
* @param completion 调用结果回调block
*/
+ (void)sendAuthReq:(SendAuthReq *)req viewController:(UIViewController*)viewController delegate:(nullable id<WXApiDelegate>)delegate completion:(void (^ __nullable)(BOOL success))completion;
/*! @brief 测试函数,用于排查当前App通过Universal Link方式分享到微信的流程
注意1: 调用自检函数之前必须要先调用registerApp:universalLink接口, 并确认调用成功
注意2: 自检过程中会有Log产生,可以先调用startLogByLevel函数,根据Log排查问题
注意3: 会多次回调block
注意4: 仅用于新接入SDK时调试使用,请勿在正式环境的调用
*
* 当completion回调的step为WXULCheckStepFinal时,表示检测通过,Universal Link接入成功
* @param completion 回调Block
*/
+ (void)checkUniversalLinkReady:(nonnull WXCheckULCompletion)completion;
/*! @brief WXApi的成员函数,接受微信的log信息。byBlock
注意1:SDK会强引用这个block,注意不要导致内存泄漏,注意不要导致内存泄漏
注意2:调用过一次startLog by block之后,如果再调用一次任意方式的startLoad,会释放上一次logBlock,不再回调上一个logBlock
*
* @param level 打印log的级别
* @param logBlock 打印log的回调block
*/
+ (void)startLogByLevel:(WXLogLevel)level logBlock:(WXLogBolock)logBlock;
/*! @brief WXApi的成员函数,接受微信的log信息。byDelegate
注意1:sdk会弱引用这个delegate,这里可加任意对象为代理,不需要与WXApiDelegate同一个对象
注意2:调用过一次startLog by delegate之后,再调用一次任意方式的startLoad,不会再回调上一个logDelegate对象
* @param level 打印log的级别
* @param logDelegate 打印log的回调代理,
*/
+ (void)startLogByLevel:(WXLogLevel)level logDelegate:(id<WXApiLogDelegate>)logDelegate;
/*! @brief 停止打印log,会清理block或者delegate为空,释放block
* @param
*/
+ (void)stopLog;
@end
NS_ASSUME_NONNULL_END
//
// WechatAuthSDK.h
// WechatAuthSDK
//
// Created by 李凯 on 13-11-29.
// Copyright (c) 2013年 Tencent. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
enum AuthErrCode {
WechatAuth_Err_Ok = 0, //Auth成功
WechatAuth_Err_NormalErr = -1, //普通错误
WechatAuth_Err_NetworkErr = -2, //网络错误
WechatAuth_Err_GetQrcodeFailed = -3, //获取二维码失败
WechatAuth_Err_Cancel = -4, //用户取消授权
WechatAuth_Err_Timeout = -5, //超时
};
@protocol WechatAuthAPIDelegate<NSObject>
@optional
- (void)onAuthGotQrcode:(UIImage *)image; //得到二维码
- (void)onQrcodeScanned; //二维码被扫描
- (void)onAuthFinish:(int)errCode AuthCode:(nullable NSString *)authCode; //成功登录
@end
@interface WechatAuthSDK : NSObject{
NSString *_sdkVersion;
__weak id<WechatAuthAPIDelegate> _delegate;
}
@property(nonatomic, weak, nullable) id<WechatAuthAPIDelegate> delegate;
@property(nonatomic, readonly) NSString *sdkVersion; //authSDK版本号
/*! @brief 发送登录请求,等待WechatAuthAPIDelegate回调
*
* @param appId 微信开发者ID
* @param nonceStr 一个随机的尽量不重复的字符串,用来使得每次的signature不同
* @param timeStamp 时间戳
* @param scope 应用授权作用域,拥有多个作用域用逗号(,)分隔
* @param signature 签名
* @param schemeData 会在扫码后拼在scheme后
* @return 成功返回YES,失败返回NO
注:该实现只保证同时只有一个Auth在运行,Auth未完成或未Stop再次调用Auth接口时会返回NO。
*/
- (BOOL)Auth:(NSString *)appId
nonceStr:(NSString *)nonceStr
timeStamp:(NSString *)timeStamp
scope:(NSString *)scope
signature:(NSString *)signature
schemeData:(nullable NSString *)schemeData;
/*! @brief 暂停登录请求
*
* @return 成功返回YES,失败返回NO。
*/
- (BOOL)StopAuth;
@end
NS_ASSUME_NONNULL_END
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<array/>
</dict>
</plist>
......@@ -9,17 +9,26 @@
android:id="@+id/line_bottom"
android:layout_width="match_parent"
android:layout_height="0dp"
<<<<<<<< HEAD:uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top.xml
android:background="@color/uni_prompt_night_bg_hair_line"
========
android:background="@color/uni_prompt_night_bg_hair_line_night"
>>>>>>>> dev:uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top_night.xml
android:orientation="vertical" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/uni_prompt_actionsheet_button_select_total_night_top"
android:gravity="center"
android:padding="17dp"
<<<<<<<< HEAD:uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top.xml
android:textColor="@color/uni_prompt_dialog_title_text"
android:background="@drawable/uni_prompt_actionsheet_button_select_total_top"
========
android:textColor="@color/uni_prompt_dialog_title_text_night"
>>>>>>>> dev:uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top_night.xml
android:textSize="16dp" />
......
......@@ -9,17 +9,28 @@
android:id="@+id/line_bottom"
android:layout_width="match_parent"
android:layout_height="0dp"
<<<<<<<< HEAD:uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top_night.xml
android:background="@color/uni_prompt_night_bg_hair_line_night"
========
android:background="@color/uni_prompt_night_bg_hair_line"
>>>>>>>> dev:uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top.xml
android:orientation="vertical" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tvName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
<<<<<<<< HEAD:uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top_night.xml
android:background="@drawable/uni_prompt_actionsheet_button_select_total_night_top"
android:gravity="center"
android:padding="17dp"
android:textColor="@color/uni_prompt_dialog_title_text_night"
========
android:gravity="center"
android:padding="17dp"
android:textColor="@color/uni_prompt_dialog_title_text"
android:background="@drawable/uni_prompt_actionsheet_button_select_total_top"
>>>>>>>> dev:uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top.xml
android:textSize="16dp" />
......
## 1.1.0(2024-03-08)
修复uniapp打包报错问题
## 1.0.9(2024-02-29)
去除代码过时警告
## 1.0.8(2023-12-21)
去除app-ios目录
## 1.0.7(2023-12-11)
去除无用代码
## 1.0.6(2023-12-11)
......
{
"id": "uts-progressNotification",
"displayName": "uts-progressNotification",
"version": "1.0.7",
"version": "1.1.0",
"description": "uts-progressNotification",
"keywords": [
"uts-progressNotification"
......
......@@ -4,7 +4,7 @@ import Build from 'android.os.Build';
import View from 'android.view.View';
import Color from 'android.graphics.Color';
import WindowManager from 'android.view.WindowManager';
import { globalNotificationProgressFinishCallBack, globalNotificationProgressCallBack } from './index.uts';
import { globalNotificationProgressFinishCallBack, globalNotificationProgressCallBack } from './callbacks.uts';
import { ACTION_DOWNLOAD_FINISH, ACTION_DOWNLOAD_PROGRESS } from "./constant.uts"
......@@ -13,6 +13,7 @@ export class TransparentActivity extends Activity {
super()
}
@Suppress("DEPRECATION")
override onCreate(savedInstanceState : Bundle | null) {
super.onCreate(savedInstanceState)
this.fullScreen(this)
......
export let globalNotificationProgressCallBack : (() => void) | null = () => { }
export let globalNotificationProgressFinishCallBack = () => { }
......@@ -9,6 +9,7 @@ import PendingIntent from 'android.app.PendingIntent';
import { CreateNotificationProgressOptions, FinishNotificationProgressOptions } from '../interface.uts';
import { ACTION_DOWNLOAD_FINISH, ACTION_DOWNLOAD_PROGRESS } from "./constant.uts"
import { globalNotificationProgressFinishCallBack, globalNotificationProgressCallBack } from './callbacks.uts';
export { TransparentActivity } from './TransparentActivity.uts';
......@@ -26,8 +27,7 @@ let histroyProgress = 0
let isProgress = false
export let globalNotificationProgressCallBack : (() => void) | null = () => { }
export let globalNotificationProgressFinishCallBack = () => { }
export function createNotificationProgress(options : CreateNotificationProgressOptions) : void {
const { content, progress, onClick } = options
......
{
"deploymentTarget": "9"
}
\ No newline at end of file
/**
* 引用 iOS 系统库,示例如下:
* import { UIDevice } from "UIKit";
* [可选实现,按需引入]
*/
/* 引入 interface.uts 文件中定义的变量 */
import { MyApiOptions, MyApiResult, MyApi, MyApiSync } from '../interface.uts';
/* 引入 unierror.uts 文件中定义的变量 */
import { MyApiFailImpl } from '../unierror';
/**
* 引入三方库
* [可选实现,按需引入]
*
* 在 iOS 平台引入三方库有以下两种方式:
* 1、通过引入三方库framework 或者.a 等方式,需要将 .framework 放到 ./Frameworks 目录下,将.a 放到 ./Libs 目录下。更多信息[详见](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#ios-平台原生配置)
* 2、通过 cocoaPods 方式引入,将要引入的 pod 信息配置到 config.json 文件下的 dependencies-pods 字段下。详细配置方式[详见](https://uniapp.dcloud.net.cn/plugin/uts-ios-cocoapods.html)
*
* 在通过上述任意方式依赖三方库后,使用时需要在文件中 import:
* 示例:import { LottieLoopMode } from 'Lottie'
*/
/**
* UTSiOS 为平台内置对象,不需要 import 可直接调用其API,[详见](https://uniapp.dcloud.net.cn/uts/utsios.html)
*/
/**
* 异步方法
*
* uni-app项目中(vue/nvue)调用示例:
* 1、引入方法声明 import { myApi } from "@/uni_modules/uts-api"
* 2、方法调用
* myApi({
* paramA: false,
* complete: (res) => {
* console.log(res)
* }
* });
*
*/
export const myApi : MyApi = function (options : MyApiOptions) {
if (options.paramA == true) {
// 返回数据
const res : MyApiResult = {
fieldA: 85,
fieldB: true,
fieldC: 'some message'
};
options.success?.(res);
options.complete?.(res);
} else {
// 返回错误
let failResult = new MyApiFailImpl(9010001);
options.fail?.(failResult)
options.complete?.(failResult)
}
}
/**
* 同步方法
*
* uni-app项目中(vue/nvue)调用示例:
* 1、引入方法声明 import { myApiSync } from "@/uni_modules/uts-api"
* 2、方法调用
* myApiSync(true);
*
*/
export const myApiSync : MyApiSync = function (paramA : boolean) : MyApiResult {
// 返回数据,根据插件功能获取实际的返回值
const res : MyApiResult = {
fieldA: 85,
fieldB: paramA,
fieldC: 'some message'
};
return res;
}
/**
* 更多插件开发的信息详见:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
*/
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册