diff --git a/uni_modules/uni-exit/utssdk/interface.uts b/uni_modules/uni-exit/utssdk/interface.uts index aae2adc5b3ded0e2c7b1dfb4af8214ffdf03abb2..e821a27e14f0c14064fbe4c1daa3abc1c44a3b9c 100644 --- a/uni_modules/uni-exit/utssdk/interface.uts +++ b/uni_modules/uni-exit/utssdk/interface.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": { diff --git a/uni_modules/uni-getDeviceInfo/utssdk/app-android/index.uts b/uni_modules/uni-getDeviceInfo/utssdk/app-android/index.uts index a91acc5dc565b623d8ced1e7b7f05b435bbbac19..8a854e0ec3b64841202f078354b923bab571e900 100644 --- a/uni_modules/uni-getDeviceInfo/utssdk/app-android/index.uts +++ b/uni_modules/uni-getDeviceInfo/utssdk/app-android/index.uts @@ -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; } @@ -72,6 +79,28 @@ function getBaseInfo(filterArray : Array) : 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 diff --git a/uni_modules/uni-getDeviceInfo/utssdk/app-ios/index.uts b/uni_modules/uni-getDeviceInfo/utssdk/app-ios/index.uts index 703e9ae31f518f0362d278dd2fd049e0b8034534..a1468ee05a2d942df4390587405b567de17addf0 100644 --- a/uni_modules/uni-getDeviceInfo/utssdk/app-ios/index.uts +++ b/uni_modules/uni-getDeviceInfo/utssdk/app-ios/index.uts @@ -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 = []; @@ -24,7 +25,13 @@ export const getDeviceInfo : GetDeviceInfo = (config : GetDeviceInfoOptions | nu "system", "platform", "isRoot", - "isSimulator" + "isSimulator", + "osName", + "osVersion", + "osLanguage", + "osTheme", + "romName", + "romVersion" ]; filter = defaultFilter; } @@ -70,6 +77,30 @@ function getBaseInfo(filterArray : Array) : GetDeviceInfoResult { } if (filterArray.indexOf("isSimulator") != -1) { 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; diff --git a/uni_modules/uni-getLocation-tencent/changelog.md b/uni_modules/uni-getLocation-tencent/changelog.md index e016b093be5a8e8848f780c89f2c6c99017078fd..8ae5bcdae0d1ed2fa17f8f9b852b24da1487a015 100644 --- a/uni_modules/uni-getLocation-tencent/changelog.md +++ b/uni_modules/uni-getLocation-tencent/changelog.md @@ -1,3 +1,5 @@ +## 1.1(2024-06-20) +支持iOS平台 ## 1.0.1(2023-10-23) 更新android自定义基座操作步骤 ## 1.0.0(2023-09-11) diff --git a/uni_modules/uni-getLocation-tencent/package.json b/uni_modules/uni-getLocation-tencent/package.json index 1a9c44bdc549338bebc17d7ee13a2259ecc0e6ed..c29537d751abd1f4cb5f09ba049288e22940dffd 100644 --- a/uni_modules/uni-getLocation-tencent/package.json +++ b/uni_modules/uni-getLocation-tencent/package.json @@ -1,14 +1,15 @@ { "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": { diff --git a/uni_modules/uni-getLocation-tencent/readme.md b/uni_modules/uni-getLocation-tencent/readme.md index 87169df0fed3ff45650ae2487e6cac8c75c972bc..bfcd8d393936fd2a4db225b98f224a39dea99250 100644 --- a/uni_modules/uni-getLocation-tencent/readme.md +++ b/uni_modules/uni-getLocation-tencent/readme.md @@ -1,44 +1,90 @@ # 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 + + + + + + -修改项目根目录下 AndroidManifest.xml -`` + + + +``` 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 + + + + + TencentLBSAPIKey + 您申请的Key + + +``` +3. 配置访问位置权限描述信息 +在项目根目录下 Info.plist 文件中添加以下权限描述信息: ```xml -TencentLBSAPIKey -您申请的Key + + + + + NSLocationAlwaysUsageDescription + 后台运行期访问位置信息的许可描述 + NSLocationWhenInUseUsageDescription + 运行期访问位置信息的许可描述 + NSLocationAlwaysAndWhenInUseUsageDescription + 访问位置信息的许可描述 + + ``` -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) diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-android/config.json b/uni_modules/uni-getLocation-tencent/utssdk/app-android/config.json index f7f9ab61cde5d32e0947692c782bf94458af5ea1..c4cc614767ed0821f8b4a52c1c62ee69556cd2a6 100644 --- a/uni_modules/uni-getLocation-tencent/utssdk/app-android/config.json +++ b/uni_modules/uni-getLocation-tencent/utssdk/app-android/config.json @@ -2,6 +2,6 @@ "dependencies": [ "com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.3.0" ], - "minSdkVersion": "19" + "minSdkVersion": "21" } 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..2cd4fcd4741fb1ee6b181b77ddf9862615161bc4 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" + ],"deploymentTarget": "12" } \ 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..4388d367917caf602e3f3f6b37cffc1c16476eec --- /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."); + 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() +} 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 + + + diff --git a/uni_modules/uni-media/package.json b/uni_modules/uni-media/package.json index 7544e1837c4470807be7283d046e1a9bc0860473..734a2134e05937a2125101aae0c733a6c65b5777 100644 --- a/uni_modules/uni-media/package.json +++ b/uni_modules/uni-media/package.json @@ -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": { diff --git a/uni_modules/uni-media/utssdk/ChooseImageUtils.uts b/uni_modules/uni-media/utssdk/app-android/utils/ChooseImageUtils.uts similarity index 100% rename from uni_modules/uni-media/utssdk/ChooseImageUtils.uts rename to uni_modules/uni-media/utssdk/app-android/utils/ChooseImageUtils.uts diff --git a/uni_modules/uni-media/utssdk/app-android/utils/MediaUtils.uts b/uni_modules/uni-media/utssdk/app-android/utils/MediaUtils.uts index 57bad6f4908a8c566e7ee5844b80b165abfae166..ae6ee26b4bb61c96022423f0a8c98afdbf4856ad 100644 --- a/uni_modules/uni-media/utssdk/app-android/utils/MediaUtils.uts +++ b/uni_modules/uni-media/utssdk/app-android/utils/MediaUtils.uts @@ -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) diff --git a/uni_modules/uni-media/utssdk/app-ios/ChooseImageUtils.uts b/uni_modules/uni-media/utssdk/app-ios/ChooseImageUtils.uts new file mode 100644 index 0000000000000000000000000000000000000000..cc98e47205b4b306bd1f041425db221a230b69b4 --- /dev/null +++ b/uni_modules/uni-media/utssdk/app-ios/ChooseImageUtils.uts @@ -0,0 +1,70 @@ +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 = (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 = (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 diff --git a/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64/DCloudMediaPicker.framework/PrivacyInfo.xcprivacy b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64/DCloudMediaPicker.framework/PrivacyInfo.xcprivacy new file mode 100644 index 0000000000000000000000000000000000000000..62f6a23c5ba873be2201e01684f97b2952df7bf7 --- /dev/null +++ b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64/DCloudMediaPicker.framework/PrivacyInfo.xcprivacy @@ -0,0 +1,32 @@ + + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPITypeReasons + + C617.1 + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + + + NSPrivacyCollectedDataTypes + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypePhotosorVideos + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + + diff --git a/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/PrivacyInfo.xcprivacy b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/PrivacyInfo.xcprivacy new file mode 100644 index 0000000000000000000000000000000000000000..62f6a23c5ba873be2201e01684f97b2952df7bf7 --- /dev/null +++ b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/PrivacyInfo.xcprivacy @@ -0,0 +1,32 @@ + + + + + NSPrivacyAccessedAPITypes + + + NSPrivacyAccessedAPITypeReasons + + C617.1 + + NSPrivacyAccessedAPIType + NSPrivacyAccessedAPICategoryFileTimestamp + + + NSPrivacyCollectedDataTypes + + + NSPrivacyCollectedDataType + NSPrivacyCollectedDataTypePhotosorVideos + NSPrivacyCollectedDataTypeLinked + + NSPrivacyCollectedDataTypeTracking + + NSPrivacyCollectedDataTypePurposes + + NSPrivacyCollectedDataTypePurposeAppFunctionality + + + + + diff --git a/uni_modules/uni-payment-wxpay/utssdk/app-ios/Libs/WeChatSDK/README.txt b/uni_modules/uni-payment-wxpay/utssdk/app-ios/Libs/WeChatSDK/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..862fe91bb0ea2d3f3ac0d251be8c9777aad15d8d --- /dev/null +++ b/uni_modules/uni-payment-wxpay/utssdk/app-ios/Libs/WeChatSDK/README.txt @@ -0,0 +1,163 @@ +重要! +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”里增加如下代码: +LSApplicationQueriesSchemes + +weixin + +NSAppTransportSecurity + +NSAllowsArbitraryLoads + + +2、开发者需要在工程中链接上 CoreTelephony.framework +3、解决bitcode编译不过问题 + +SDK1.5 +1、废弃safeSendReq:接口,使用sendReq:即可。 +2、新增+(BOOL) sendAuthReq:(SendAuthReq*) req viewController : (UIViewController*) viewController delegate:(id) delegate; +支持未安装微信情况下Auth,具体见WXApi.h接口描述 +3、微信开放平台新增了微信模块用户统计功能,便于开发者统计微信功能模块的用户使用和活跃情况。开发者需要在工程中链接上:SystemConfiguration.framework,libz.dylib,libsqlite3.0.dylib。 diff --git a/uni_modules/uni-payment-wxpay/utssdk/app-ios/Libs/WeChatSDK/WXApi.h b/uni_modules/uni-payment-wxpay/utssdk/app-ios/Libs/WeChatSDK/WXApi.h new file mode 100644 index 0000000000000000000000000000000000000000..879c505975ed7631ab68e46cc15db531e9d1fba3 --- /dev/null +++ b/uni_modules/uni-payment-wxpay/utssdk/app-ios/Libs/WeChatSDK/WXApi.h @@ -0,0 +1,231 @@ +// +// WXApi.h +// 所有Api接口 +// +// Created by Wechat on 12-2-28. +// Copyright (c) 2012年 Tencent. All rights reserved. +// + +#import +#import "WXApiObject.h" + +NS_ASSUME_NONNULL_BEGIN + + +typedef BOOL(^WXGrantReadPasteBoardPermissionCompletion)(void); + + +#pragma mark - WXApiDelegate +/*! @brief 接收并处理来自微信终端程序的事件消息 + * + * 接收并处理来自微信终端程序的事件消息,期间微信界面会切换到第三方应用程序。 + * WXApiDelegate 会在handleOpenURL:delegate:中使用并触发。 + */ +@protocol WXApiDelegate +@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 + +- (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)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)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)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)logDelegate; + +/*! @brief 停止打印log,会清理block或者delegate为空,释放block + * @param + */ ++ (void)stopLog; + +@end + +NS_ASSUME_NONNULL_END diff --git a/uni_modules/uni-payment-wxpay/utssdk/app-ios/Libs/WeChatSDK/WXApiObject.h b/uni_modules/uni-payment-wxpay/utssdk/app-ios/Libs/WeChatSDK/WXApiObject.h new file mode 100644 index 0000000000000000000000000000000000000000..85b645785dc7339a6ac477282b2e671266d2e00f --- /dev/null +++ b/uni_modules/uni-payment-wxpay/utssdk/app-ios/Libs/WeChatSDK/WXApiObject.h @@ -0,0 +1,1410 @@ +// +// MMApiObject.h +// Api对象,包含所有接口和对象数据定义 +// +// Created by Wechat on 12-2-28. +// Copyright (c) 2012年 Tencent. All rights reserved. +// + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +/*! @brief 错误码 + * + */ +enum WXErrCode { + WXSuccess = 0, /**< 成功 */ + WXErrCodeCommon = -1, /**< 普通错误类型 */ + WXErrCodeUserCancel = -2, /**< 用户点击取消并返回 */ + WXErrCodeSentFail = -3, /**< 发送失败 */ + WXErrCodeAuthDeny = -4, /**< 授权失败 */ + WXErrCodeUnsupport = -5, /**< 微信不支持 */ +}; + + + +/*! @brief 请求发送场景 + * + */ +enum WXScene { + WXSceneSession = 0, /**< 聊天界面 */ + WXSceneTimeline = 1, /**< 朋友圈 */ + WXSceneFavorite = 2, /**< 收藏 */ + WXSceneSpecifiedSession = 3, /**< 指定联系人 */ + WXSceneState = 4, /**< 状态 */ +}; + + +enum WXAPISupport { + WXAPISupportSession = 0, +}; + + + +/*! @brief 跳转profile类型 + * + */ +enum WXBizProfileType { + WXBizProfileType_Normal = 0, //**< 普通公众号 */ + WXBizProfileType_Device = 1, //**< 硬件公众号 */ +}; + +/*! @brief 分享小程序类型 + * + */ +typedef NS_ENUM(NSUInteger, WXMiniProgramType) { + WXMiniProgramTypeRelease = 0, //**< 正式版 */ + WXMiniProgramTypeTest = 1, //**< 开发版 */ + WXMiniProgramTypePreview = 2, //**< 体验版 */ +}; + +/*! @brief 跳转mp网页类型 + * + */ +enum WXMPWebviewType { + WXMPWebviewType_Ad = 0, /**< 广告网页 **/ +}; + +/*! @brief log的级别 + * + */ +typedef NS_ENUM(NSInteger,WXLogLevel) { + WXLogLevelNormal = 0, // 打印日常的日志 + WXLogLevelDetail = 1, // 打印详细的日志 +}; + + +/*! @brief 打印回调的block + * + */ +typedef void(^WXLogBolock)(NSString *log); + +/*! @brief 微信Universal Link检查函数 (WXApi#checkUniversalLinkReady:),检查步骤枚举值 + * + * WXULCheckStepParams 参数检测 + * WXULCheckStepSystemVersion 当前系统版本检测 + * WXULCheckStepWechatVersion 微信客户端版本检测 + * WXULCheckStepSDKInnerOperation 微信SDK内部操作检测 + * WXULCheckStepLaunchWechat App拉起微信检测 + * WXULCheckStepBackToCurrentApp 由微信返回当前App检测 + * WXULCheckStepFinal 最终结果 + */ +typedef NS_ENUM(NSInteger, WXULCheckStep) +{ + WXULCheckStepParams, + WXULCheckStepSystemVersion, + WXULCheckStepWechatVersion, + WXULCheckStepSDKInnerOperation, + WXULCheckStepLaunchWechat, + WXULCheckStepBackToCurrentApp, + WXULCheckStepFinal, +}; + + +#pragma mark - WXCheckULStepResult + +/*! @brief 该类为微信Universal Link检测函数结果类 +* +*/ +@interface WXCheckULStepResult : NSObject + +/** 是否成功 */ +@property(nonatomic, assign) BOOL success; +/** 当前错误信息 */ +@property(nonatomic, strong) NSString* errorInfo; +/** 修正建议 */ +@property(nonatomic, strong) NSString* suggestion; + +- (instancetype)initWithCheckResult:(BOOL)success errorInfo:(nullable NSString*)errorInfo suggestion:(nullable NSString*)suggestion; + +@end + + +/*! @brief 微信Universal Link检查函数 (WXApi#checkUniversalLinkReady:),回调Block + * + * @param step 当前检测步骤 + * @param result 检测结果 + */ +typedef void(^WXCheckULCompletion)(WXULCheckStep step, WXCheckULStepResult* result); + + +#pragma mark - BaseReq +/*! @brief 该类为微信终端SDK所有请求类的基类 + * + */ +@interface BaseReq : NSObject + +/** 请求类型 */ +@property (nonatomic, assign) int type; +/** 由用户微信号和AppID组成的唯一标识,需要校验微信用户是否换号登录时填写*/ +@property (nonatomic, copy) NSString *openID; + +@end + + + +#pragma mark - BaseResp +/*! @brief 该类为微信终端SDK所有响应类的基类 + * + */ +@interface BaseResp : NSObject +/** 错误码 */ +@property (nonatomic, assign) int errCode; +/** 错误提示字符串 */ +@property (nonatomic, copy) NSString *errStr; +/** 响应类型 */ +@property (nonatomic, assign) int type; + +@end + + + +#pragma mark - WXMediaMessage +@class WXMediaMessage; + +#ifndef BUILD_WITHOUT_PAY + +#pragma mark - PayReq +/*! @brief 第三方向微信终端发起支付的消息结构体 + * + * 第三方向微信终端发起支付的消息结构体,微信终端处理后会向第三方返回处理结果 + * @see PayResp + */ +@interface PayReq : BaseReq + +/** 商家向财付通申请的商家id */ +@property (nonatomic, copy) NSString *partnerId; +/** 预支付订单 */ +@property (nonatomic, copy) NSString *prepayId; +/** 随机串,防重发 */ +@property (nonatomic, copy) NSString *nonceStr; +/** 时间戳,防重发 */ +@property (nonatomic, assign) UInt32 timeStamp; +/** 商家根据财付通文档填写的数据和签名 */ +@property (nonatomic, copy) NSString *package; +/** 商家根据微信开放平台文档对数据做的签名 */ +@property (nonatomic, copy) NSString *sign; + +@end + + +#pragma mark - PayResp +/*! @brief 微信终端返回给第三方的关于支付结果的结构体 + * + * 微信终端返回给第三方的关于支付结果的结构体 + */ +@interface PayResp : BaseResp + +/** 财付通返回给商家的信息 */ +@property (nonatomic, copy) NSString *returnKey; + +@end + +#pragma mark - WXOfflinePay +/*! @brief 第三方向微信终端发起离线支付 + * + * 第三方向微信终端发起离线支付的消息结构体 + */ +@interface WXOfflinePayReq : BaseReq + +@end + +/*! @brief 第三方向微信终端发起离线支付返回 + * + * 第三方向微信终端发起离线支付返回的消息结构体 + */ +@interface WXOfflinePayResp : BaseResp + +@end + + +#pragma mark - WXNontaxPayReq +@interface WXNontaxPayReq:BaseReq + +@property (nonatomic, copy) NSString *urlString; + +@end + +#pragma mark - WXNontaxPayResp +@interface WXNontaxPayResp : BaseResp + +@property (nonatomic, copy) NSString *wxOrderId; + +@end + +#pragma mark - WXPayInsuranceReq +@interface WXPayInsuranceReq : BaseReq + +@property (nonatomic, copy) NSString *urlString; + +@end + +#pragma mark - WXPayInsuranceResp +@interface WXPayInsuranceResp : BaseResp + +@property (nonatomic, copy) NSString *wxOrderId; + +@end + + +#pragma mark - WXQRCodePayReq +@interface WXQRCodePayReq : BaseReq +/** 码内容 + * @note 必填,码长度必须大于0且小于10K + */ +@property (nonatomic, copy) NSString *codeContent; +/** 额外信息 + * @note 长度必须大于0且小于10K + */ +@property (nonatomic, copy) NSString *extraMsg; + +@end + +@interface WXQRCodePayResp : BaseResp +@end + +#endif + + +#pragma mark - SendAuthReq +/*! @brief 第三方程序向微信终端请求认证的消息结构 + * + * 第三方程序要向微信申请认证,并请求某些权限,需要调用WXApi的sendReq成员函数, + * 向微信终端发送一个SendAuthReq消息结构。微信终端处理完后会向第三方程序发送一个处理结果。 + * @see SendAuthResp + */ +@interface SendAuthReq : BaseReq +/** 第三方程序要向微信申请认证,并请求某些权限,需要调用WXApi的sendReq成员函数,向微信终端发送一个SendAuthReq消息结构。微信终端处理完后会向第三方程序发送一个处理结果。 + * @see SendAuthResp + * @note scope字符串长度不能超过1K + */ +@property (nonatomic, copy) NSString *scope; +/** 第三方程序本身用来标识其请求的唯一性,最后跳转回第三方程序时,由微信终端回传。 + * @note state字符串长度不能超过1K + */ +@property (nonatomic, copy) NSString *state; + +@property (nonatomic, assign) BOOL isOption1; + +/** 是否关闭自动授权 + * @note YES为关闭自动授权,每次登陆都需要用户手动授权;NO为允许自动授权 + */ +@property (nonatomic, assign) BOOL nonautomatic; + +@property (nonatomic, copy) NSString *extData; + +@end + +#pragma mark - SendAuthResp +/*! @brief 微信处理完第三方程序的认证和权限申请后向第三方程序回送的处理结果。 + * + * 第三方程序要向微信申请认证,并请求某些权限,需要调用WXApi的sendReq成员函数,向微信终端发送一个SendAuthReq消息结构。 + * 微信终端处理完后会向第三方程序发送一个SendAuthResp。 + * @see onResp + */ +@interface SendAuthResp : BaseResp +@property (nonatomic, copy, nullable) NSString *code; +/** 第三方程序发送时用来标识其请求的唯一性的标志,由第三方程序调用sendReq时传入,由微信终端回传 + * @note state字符串长度不能超过1K + * @note 在复杂度较高的应用程序中,可能会出现其他模块请求的响应对象被错误地回调到当前模块。 + * 为了避免影响其他模块,建议当前模块的开发者根据SendAuthResp的内容,采用白名单的方式进行处理。 + * 例如,SendAuthResp.state符合预期时,才对其进行处理。 + */ +@property (nonatomic, copy, nullable) NSString *state; +@property (nonatomic, copy, nullable) NSString *lang; +@property (nonatomic, copy, nullable) NSString *country; +@end + +#pragma mark - WXStateJumpInfo +/*! @brief 状态发表时的小尾巴跳转信息 + */ +@interface WXStateJumpInfo : NSObject + +@end + +#pragma mark - WXStateJumpUrlInfo +/*! @brief 状态小尾巴跳转指定url的信息 + */ +@interface WXStateJumpUrlInfo : WXStateJumpInfo +/** 跳转到指定的url + * @note 必填,url长度必须大于0且小于10K + */ +@property (nonatomic, copy) NSString *url; + +@end + +#pragma mark - WXStateJumpWXMiniProgramInfo +/*! @brief 状态小尾巴跳转指定小程序的信息 + */ +@interface WXStateJumpMiniProgramInfo : WXStateJumpInfo +/** 小程序username + * @note 必填 + */ +@property (nonatomic, copy) NSString *username; + +/** 小程序页面的路径 + * @attention 不填默认拉起小程序首页 + */ +@property (nonatomic, copy, nullable) NSString *path; + +/** 分享小程序的版本 + * @attention (正式,开发,体验) + */ +@property (nonatomic, assign) WXMiniProgramType miniProgramType; + +@end + + + +#pragma mark - WXStateJumpWXMiniProgramInfo +/*! @brief 状态小尾巴跳转指定视频号主页信息 + */ +@interface WXStateJumpChannelProfileInfo : WXStateJumpInfo +/** 视频号username + * @note 必填,username长度必须大于0且小于1K + */ +@property (nonatomic, copy) NSString *username; + + +@end + +#pragma mark - WXStateSceneDataObject +/*! @brief 场景类型额外参数基类 + */ +@interface WXSceneDataObject : NSObject + +@end + +#pragma mark - WXStateSceneDataObject +/*! @brief 状态场景类型 + * 用户填写WXStateSceneDataObject参数后,可以跳转到微信状态发表页 + */ +@interface WXStateSceneDataObject : WXSceneDataObject + +/** 状态标志的ID + * @note 选填,文本长度必须小于10K + */ +@property (nonatomic, copy) NSString *stateId; +/** 状态发表时附带的文本描述 + * @note 选填,文本长度必须小于10K + */ +@property (nonatomic, copy) NSString *stateTitle; +/** 后台校验token + * @note 选填,文本长度必须小于10K + */ +@property (nonatomic, copy) NSString *token; +/** 小尾巴跳转所需的信息 + * @note 必填,目前仅支持url跳转 + */ +@property (nonatomic, strong) WXStateJumpInfo *stateJumpDataInfo; + +@end + +#pragma mark - SendMessageToWXReq +/*! @brief 第三方程序发送消息至微信终端程序的消息结构体 + * + * 第三方程序向微信发送信息需要传入SendMessageToWXReq结构体,信息类型包括文本消息和多媒体消息, + * 分别对应于text和message成员。调用该方法后,微信处理完信息会向第三方程序发送一个处理结果。 + * @see SendMessageToWXResp + */ +@interface SendMessageToWXReq : BaseReq +/** 发送消息的文本内容 + * @note 文本长度必须大于0且小于10K + */ +@property (nonatomic, copy) NSString *text; +/** 发送消息的多媒体内容 + * @see WXMediaMessage + */ +@property (nonatomic, strong) WXMediaMessage *message; +/** 发送消息的类型,包括文本消息和多媒体消息两种,两者只能选择其一,不能同时发送文本和多媒体消息 */ +@property (nonatomic, assign) BOOL bText; +/** 发送的目标场景,可以选择发送到会话(WXSceneSession)或者朋友圈(WXSceneTimeline)。 默认发送到会话。 + * @see WXScene + */ +@property (nonatomic, assign) int scene; +/** 指定发送消息的人 + * @note WXSceneSpecifiedSession时有效 + */ +@property (nonatomic, copy, nullable) NSString *toUserOpenId; +/** 目标场景附带信息 + * @note 目前只针对状态场景 + */ +@property (nonatomic, strong) WXSceneDataObject *sceneDataObject; + +@end + +#pragma mark - SendMessageToWXResp +/*! @brief 微信终端向第三方程序返回的SendMessageToWXReq处理结果。 + * + * 第三方程序向微信终端发送SendMessageToWXReq后,微信发送回来的处理结果,该结果用SendMessageToWXResp表示。 + */ +@interface SendMessageToWXResp : BaseResp +@property(nonatomic, copy) NSString *lang; +@property(nonatomic, copy) NSString *country; +@end + +#pragma mark - GetMessageFromWXReq +/*! @brief 微信终端向第三方程序请求提供内容的消息结构体。 + * + * 微信终端向第三方程序请求提供内容,微信终端会向第三方程序发送GetMessageFromWXReq消息结构体, + * 需要第三方程序调用sendResp返回一个GetMessageFromWXResp消息结构体。 + */ +@interface GetMessageFromWXReq : BaseReq +@property (nonatomic, strong) NSString *lang; +@property (nonatomic, strong) NSString *country; +@end + + + +#pragma mark - GetMessageFromWXResp +/*! @brief 微信终端向第三方程序请求提供内容,第三方程序向微信终端返回的消息结构体。 + * + * 微信终端向第三方程序请求提供内容,第三方程序调用sendResp向微信终端返回一个GetMessageFromWXResp消息结构体。 + */ +@interface GetMessageFromWXResp : BaseResp +/** 向微信终端提供的文本内容 + @note 文本长度必须大于0且小于10K + */ +@property (nonatomic, strong) NSString *text; +/** 向微信终端提供的多媒体内容。 + * @see WXMediaMessage + */ +@property (nonatomic, strong) WXMediaMessage *message; +/** 向微信终端提供内容的消息类型,包括文本消息和多媒体消息两种,两者只能选择其一,不能同时发送文本和多媒体消息 */ +@property (nonatomic, assign) BOOL bText; +@end + + + +#pragma mark - ShowMessageFromWXReq +/*! @brief 微信通知第三方程序,要求第三方程序显示的消息结构体。 + * + * 微信需要通知第三方程序显示或处理某些内容时,会向第三方程序发送ShowMessageFromWXReq消息结构体。 + * 第三方程序处理完内容后调用sendResp向微信终端发送ShowMessageFromWXResp。 + */ +@interface ShowMessageFromWXReq : BaseReq +/** 微信终端向第三方程序发送的要求第三方程序处理的多媒体内容 + * @see WXMediaMessage + */ +@property (nonatomic, strong) WXMediaMessage *message; +@property (nonatomic, copy) NSString *lang; +@property (nonatomic, copy) NSString *country; +@end + + + +#pragma mark - ShowMessageFromWXResp +/*! @brief 微信通知第三方程序,要求第三方程序显示或处理某些消息,第三方程序处理完后向微信终端发送的处理结果。 + * + * 微信需要通知第三方程序显示或处理某些内容时,会向第三方程序发送ShowMessageFromWXReq消息结构体。 + * 第三方程序处理完内容后调用sendResp向微信终端发送ShowMessageFromWXResp。 + */ +@interface ShowMessageFromWXResp : BaseResp +@end + + +#pragma mark - LaunchFromWXReq +/*! @brief 微信终端打开第三方程序携带的消息结构体 + * + * 微信向第三方发送的结构体,第三方不需要返回 + */ +@interface LaunchFromWXReq : BaseReq +@property (nonatomic, strong) WXMediaMessage *message; +@property (nonatomic, copy) NSString *lang; +@property (nonatomic, copy) NSString *country; +@end + + +#pragma mark - OpenWebviewReq +/* ! @brief 第三方通知微信启动内部浏览器,打开指定网页 + * + * 第三方通知微信启动内部浏览器,打开指定Url对应的网页 + */ +@interface OpenWebviewReq : BaseReq +/** 需要打开的网页对应的Url + * @attention 长度不能超过1024 + */ +@property(nonatomic, copy) NSString *url; + +@end + +#pragma mark - OpenWebviewResp +/*! @brief 微信终端向第三方程序返回的OpenWebviewReq处理结果 + * + * 第三方程序向微信终端发送OpenWebviewReq后,微信发送回来的处理结果,该结果用OpenWebviewResp表示 + */ +@interface OpenWebviewResp : BaseResp + +@end + + + +#pragma mark - WXOpenBusinessWebViewReq +/*! @brief 第三方通知微信启动内部浏览器,打开指定业务的网页 + * + * + */ +@interface WXOpenBusinessWebViewReq : BaseReq + +/** 网页业务类型 + * @attention + */ +@property (nonatomic, assign) UInt32 businessType; + +/** 网页业务参数 + * @attention + */ +@property (nonatomic, strong, nullable) NSDictionary *queryInfoDic; + +@end + +#pragma mark - WXOpenBusinessWebViewResp +/*! @brief 微信终端向第三方程序返回的WXOpenBusinessWebViewResp处理结果。 + * + * 第三方程序向微信终端发送WXOpenBusinessWebViewReq后,微信发送回来的处理结果,该结果用WXOpenBusinessWebViewResp表示。 + */ +@interface WXOpenBusinessWebViewResp : BaseResp +/** 第三方程序自定义简单数据,微信终端会回传给第三方程序处理 + * @attention 长度不能超过2k + */ +@property (nonatomic, copy) NSString *result; + +/** 网页业务类型 + * @attention + */ +@property (nonatomic, assign) UInt32 businessType; + +@end + + +#pragma mark - OpenRankListReq +/* ! @brief 第三方通知微信,打开硬件排行榜 + * + * 第三方通知微信,打开硬件排行榜 + */ +@interface OpenRankListReq : BaseReq + +@end + +#pragma mark - OpenRanklistResp +/*! @brief 微信终端向第三方程序返回的OpenRankListReq处理结果。 + * + * 第三方程序向微信终端发送OpenRankListReq后,微信发送回来的处理结果,该结果用OpenRankListResp表示。 + */ +@interface OpenRankListResp : BaseResp + +@end + + +#pragma mark - WXCardItem + +@interface WXCardItem : NSObject +/** 卡id + * @attention 长度不能超过1024字节 + */ +@property (nonatomic, copy) NSString *cardId; +/** ext信息 + * @attention 长度不能超过2024字节 + */ +@property (nonatomic, copy, nullable) NSString *extMsg; +/** + * @attention 卡的状态,req不需要填。resp:0为未添加,1为已添加。 + */ +@property (nonatomic, assign) UInt32 cardState; +/** + * @attention req不需要填,chooseCard返回的。 + */ +@property (nonatomic, copy) NSString *encryptCode; +/** + * @attention req不需要填,chooseCard返回的。 + */ +@property (nonatomic, copy) NSString *appID; +@end; + +#pragma mark - WXInvoiceItem + +@interface WXInvoiceItem : NSObject +/** 卡id + * @attention 长度不能超过1024字节 + */ +@property (nonatomic, copy) NSString *cardId; +/** ext信息 + * @attention 长度不能超过2024字节 + */ +@property (nonatomic, copy, nullable) NSString *extMsg; +/** + * @attention 卡的状态,req不需要填。resp:0为未添加,1为已添加。 + */ +@property (nonatomic, assign) UInt32 cardState; +/** + * @attention req不需要填,chooseCard返回的。 + */ +@property (nonatomic, copy) NSString *encryptCode; +/** + * @attention req不需要填,chooseCard返回的。 + */ +@property (nonatomic, copy) NSString *appID; + +@end + +#pragma mark - AddCardToWXCardPackageReq +/* ! @brief 请求添加卡券至微信卡包 + * + */ + +@interface AddCardToWXCardPackageReq : BaseReq +/** 卡列表 + * @attention 个数不能超过40个 类型WXCardItem + */ +@property (nonatomic, strong) NSArray *cardAry; + +@end + + +#pragma mark - AddCardToWXCardPackageResp +/** ! @brief 微信返回第三方添加卡券结果 + * + */ + +@interface AddCardToWXCardPackageResp : BaseResp +/** 卡列表 + * @attention 个数不能超过40个 类型WXCardItem + */ +@property (nonatomic, strong) NSArray *cardAry; +@end + +#pragma mark - WXChooseCardReq +/* ! @brief 请求从微信选取卡券 + * + */ + +@interface WXChooseCardReq : BaseReq +@property (nonatomic, copy) NSString *appID; +@property (nonatomic, assign) UInt32 shopID; +@property (nonatomic, assign) UInt32 canMultiSelect; +@property (nonatomic, copy) NSString *cardType; +@property (nonatomic, copy) NSString *cardTpID; +@property (nonatomic, copy) NSString *signType; +@property (nonatomic, copy) NSString *cardSign; +@property (nonatomic, assign) UInt32 timeStamp; +@property (nonatomic, copy) NSString *nonceStr; +@end + + +#pragma mark - WXChooseCardResp +/** ! @brief 微信返回第三方请求选择卡券结果 + * + */ + +@interface WXChooseCardResp : BaseResp +@property (nonatomic, strong ) NSArray* cardAry; +@end + + +#pragma mark - WXChooseInvoiceReq +/* ! @brief 请求从微信选取发票 + * + */ +@interface WXChooseInvoiceReq : BaseReq +@property (nonatomic, copy) NSString *appID; +@property (nonatomic, assign) UInt32 shopID; +@property (nonatomic, copy) NSString *signType; +@property (nonatomic, copy) NSString *cardSign; +@property (nonatomic, assign) UInt32 timeStamp; +@property (nonatomic, copy) NSString *nonceStr; +@end + +#pragma mark - WXChooseInvoiceResp +/** ! @brief 微信返回第三方请求选择发票结果 + * + */ +@interface WXChooseInvoiceResp : BaseResp +@property (nonatomic, strong) NSArray* cardAry; +@end + +#pragma mark - WXSubscriptionReq +@interface WXSubscribeMsgReq : BaseReq +@property (nonatomic, assign) UInt32 scene; +@property (nonatomic, copy) NSString *templateId; +@property (nonatomic, copy, nullable) NSString *reserved; +@end + +#pragma mark - WXSubscriptionReq +@interface WXSubscribeMsgResp : BaseResp + +@property (nonatomic, copy) NSString *templateId; +@property (nonatomic, assign) UInt32 scene; +@property (nonatomic, copy) NSString *action; +@property (nonatomic, copy) NSString *reserved; +@property (nonatomic, copy, nullable) NSString *openId; + +@end + +#pragma mark - WXSubscribeMiniProgramMsg +/** ! @brief 第三方请求订阅小程序消息 + * + */ +@interface WXSubscribeMiniProgramMsgReq : BaseReq +@property (nonatomic, copy) NSString *miniProgramAppid; +@end + +#pragma mark - WXSubscriptionReq +@interface WXSubscribeMiniProgramMsgResp : BaseResp + +@property(nonatomic, copy) NSString *openId; // 小程序openid +@property(nonatomic, copy) NSString *unionId; // unionId +@property(nonatomic, copy) NSString *nickName; // 用户昵称 + +@end + +#pragma mark - WXinvoiceAuthInsertReq +@interface WXInvoiceAuthInsertReq : BaseReq + +@property (nonatomic, copy) NSString *urlString; + +@end + +#pragma mark - WXinvoiceAuthInsertResp + +@interface WXInvoiceAuthInsertResp : BaseResp + +@property (nonatomic, copy) NSString *wxOrderId; + +@end + +#pragma mark - WXMediaMessage + +/*! @brief 多媒体消息结构体 + * + * 用于微信终端和第三方程序之间传递消息的多媒体消息内容 + */ +@interface WXMediaMessage : NSObject + ++ (WXMediaMessage *)message; + +/** 标题 + * @note 长度不能超过512字节 + */ +@property (nonatomic, copy) NSString *title; +/** 描述内容 + * @note 长度不能超过1K + */ +@property (nonatomic, copy) NSString *description; +/** 缩略图数据 + * @note 大小不能超过64K + */ +@property (nonatomic, strong, nullable) NSData *thumbData; +/** + * @note 长度不能超过64字节 + */ +@property (nonatomic, copy, nullable) NSString *mediaTagName; +/** + * + */ +@property (nonatomic, copy, nullable) NSString *messageExt; +@property (nonatomic, copy, nullable) NSString *messageAction; +/** + * 多媒体数据对象,可以为WXImageObject,WXMusicObject,WXVideoObject,WXWebpageObject等。 + */ +@property (nonatomic, strong) id mediaObject; + +/** 缩略图的hash值 + * @note 使用sha256得到,用于计算签名 + */ +@property (nonatomic, copy, nullable) NSString *thumbDataHash; + +/** 消息签名 + * @note 用于校验消息体是否被篡改过 + */ +@property (nonatomic, copy, nullable) NSString *msgSignature; + + +/*! @brief 设置消息缩略图的方法 + * + * @param image 缩略图 + * @note 大小不能超过256K + */ +- (void)setThumbImage:(UIImage *)image; + +@end + + + +#pragma mark - WXImageObject +/*! @brief 多媒体消息中包含的图片数据对象 + * + * 微信终端和第三方程序之间传递消息中包含的图片数据对象。 + * @note imageData成员不能为空 + * @see WXMediaMessage + */ +@interface WXImageObject : NSObject +/*! @brief 返回一个WXImageObject对象 + * + * @note 返回的WXImageObject对象是自动释放的 + */ ++ (WXImageObject *)object; + +/** 图片真实数据内容 + * @note 大小不能超过25M + */ +@property (nonatomic, strong) NSData *imageData; + +/** 图片数据的hash值 + * @note 使用sha256得到,用于计算签名 + */ +@property (nonatomic, copy, nullable) NSString *imgDataHash; + +/** 分享的图片消息是否要带小程序入口,若 'entranceMiniProgramUsername' 非空则显示 + * 仅部分小程序类目可用 + * @note 本字段为空则发送普通app图片消息 + */ +@property (nonatomic, copy, nullable) NSString *entranceMiniProgramUsername; + +/** 分享的图片消息显示的小程序入口可以跳转的小程序路径 + * 仅当 'entranceMiniProgramUsername' 非空时生效 + */ +@property (nonatomic, copy, nullable) NSString *entranceMiniProgramPath; + +@end + + +#pragma mark - WXMusicObject +/*! @brief 多媒体消息中包含的音乐数据对象 + * + * 微信终端和第三方程序之间传递消息中包含的音乐数据对象。 + * @note musicUrl和musicLowBandUrl成员不能同时为空。 + * @see WXMediaMessage + */ +@interface WXMusicObject : NSObject +/*! @brief 返回一个WXMusicObject对象 + * + * @note 返回的WXMusicObject对象是自动释放的 + */ ++ (WXMusicObject *)object; + +/** 音乐网页的url地址 + * @note 长度不能超过10K + */ +@property (nonatomic, copy) NSString *musicUrl; +/** 音乐lowband网页的url地址 + * @note 长度不能超过10K + */ +@property (nonatomic, copy) NSString *musicLowBandUrl; +/** 音乐数据url地址 + * @note 长度不能超过10K + */ +@property (nonatomic, copy) NSString *musicDataUrl; + +/**音乐lowband数据url地址 + * @note 长度不能超过10K + */ +@property (nonatomic, copy) NSString *musicLowBandDataUrl; + +/**音乐封面图Url + * @note 长度不能超过10K + */ +@property (nonatomic, copy) NSString *songAlbumUrl; + +/**歌词信息 LRC格式 + * @note 长度不能超过32K + */ +@property (nonatomic, copy, nullable) NSString *songLyric; +@end + + + +#pragma mark - WXMusicVideoObject + +@interface WXMusicVipInfo : NSObject + +/**付费歌曲的id + * @note 长度不能超过32K + */ +@property (nonatomic, copy) NSString *musicId; + +@end + + +@interface WXMusicVideoObject : NSObject + +/*! @brief 返回一个WXMusicVideoObject对象 + * + * @note 返回的WXMusicVideoObject对象是自动释放的 + */ ++ (WXMusicVideoObject *)object; + +/** 音乐网页的url地址 + * @note 长度不能超过10K,不能为空 + */ +@property (nonatomic, copy) NSString *musicUrl; + +/** 音乐数据url地址 + * @note 长度不能超过10K,不能为空 + */ +@property (nonatomic, copy) NSString *musicDataUrl; + +/**歌手名 + * @note 长度不能超过1k,不能为空 + */ +@property (nonatomic, copy) NSString *singerName; + +/** + * @note 音乐时长, 单位毫秒 + */ +@property (nonatomic, assign) UInt32 duration; + +/**歌词信息 LRC格式 + * @note 长度不能超过32K + */ +@property (nonatomic, copy) NSString *songLyric; + +/**高清封面图 + * @note 大小不能超过1M + */ +@property (nonatomic, strong) NSData *hdAlbumThumbData; + +/** 高清封面图数据的hash值 + * @note 使用sha256得到,用于计算签名 + */ +@property (nonatomic, copy, nullable) NSString *hdAlbumThumbFileHash; + +/**音乐专辑名称 + * @note 长度不能超过1k + */ +@property (nonatomic, copy, nullable) NSString *albumName; + +/**音乐流派 + * @note 长度不能超过1k + */ +@property (nonatomic, copy, nullable) NSString *musicGenre; + +/**发行时间 + * @note Unix时间戳,单位为秒 + */ +@property (nonatomic, assign) UInt64 issueDate; + +/**音乐标识符 + * @note 长度不能超过1K,从微信跳回应用时会带上 + */ +@property (nonatomic, copy, nullable) NSString *identification; + +/**运营H5地址 + * @note 选填,建议填写,用户进入歌曲详情页将展示内嵌的运营H5,可展示该歌曲的相关评论、歌曲推荐等内容,不可诱导下载、分享等。 + */ +@property (nonatomic, copy, nullable) NSString *musicOperationUrl; + +/** 付费歌曲相关信息 + * @note 选填,如果歌曲是需要付费的,那么将付费歌曲id等信息封装在内。 + */ +@property (nonatomic, strong) WXMusicVipInfo *musicVipInfo; + +@end + + + +#pragma mark - WXVideoObject +/*! @brief 多媒体消息中包含的视频数据对象 + * + * 微信终端和第三方程序之间传递消息中包含的视频数据对象。 + * @note videoUrl和videoLowBandUrl不能同时为空。 + * @see WXMediaMessage + */ +@interface WXVideoObject : NSObject +/*! @brief 返回一个WXVideoObject对象 + * + * @note 返回的WXVideoObject对象是自动释放的 + */ ++ (WXVideoObject *)object; + +/** 视频网页的url地址 + * @note 长度不能超过10K + */ +@property (nonatomic, copy) NSString *videoUrl; +/** 视频lowband网页的url地址 + * @note 长度不能超过10K + */ +@property (nonatomic, copy) NSString *videoLowBandUrl; + +@end + + + +#pragma mark - WXWebpageObject +/*! @brief 多媒体消息中包含的网页数据对象 + * + * 微信终端和第三方程序之间传递消息中包含的网页数据对象。 + * @see WXMediaMessage + */ +@interface WXWebpageObject : NSObject +/*! @brief 返回一个WXWebpageObject对象 + * + * @note 返回的WXWebpageObject对象是自动释放的 + */ ++ (WXWebpageObject *)object; + +/** 网页的url地址 + * @note 不能为空且长度不能超过10K + */ +@property (nonatomic, copy) NSString *webpageUrl; + +/**是否是私密消息 + */ +@property (nonatomic, assign) BOOL isSecretMessage; + +/** 业务所需的额外信息 */ +@property (nonatomic, strong, nullable) NSDictionary *extraInfoDic; + +@end + + + +#pragma mark - WXAppExtendObject +/*! @brief 多媒体消息中包含的App扩展数据对象 + * + * 第三方程序向微信终端发送包含WXAppExtendObject的多媒体消息, + * 微信需要处理该消息时,会调用该第三方程序来处理多媒体消息内容。 + * @note url,extInfo和fileData不能同时为空 + * @see WXMediaMessage + */ +@interface WXAppExtendObject : NSObject +/*! @brief 返回一个WXAppExtendObject对象 + * + * @note 返回的WXAppExtendObject对象是自动释放的 + */ ++ (WXAppExtendObject *)object; + +/** 若第三方程序不存在,微信终端会打开该url所指的App下载地址 + * @note 长度不能超过10K + */ +@property (nonatomic, copy) NSString *url; +/** 第三方程序自定义简单数据,微信终端会回传给第三方程序处理 + * @note 长度不能超过2K + */ +@property (nonatomic, copy, nullable) NSString *extInfo; +/** App文件数据,该数据发送给微信好友,微信好友需要点击后下载数据,微信终端会回传给第三方程序处理 + * @note 大小不能超过10M + */ +@property (nonatomic, strong, nullable) NSData *fileData; + +@end + + + +#pragma mark - WXEmoticonObject +/*! @brief 多媒体消息中包含的表情数据对象 + * + * 微信终端和第三方程序之间传递消息中包含的表情数据对象。 + * @see WXMediaMessage + */ +@interface WXEmoticonObject : NSObject + +/*! @brief 返回一个WXEmoticonObject对象 + * + * @note 返回的WXEmoticonObject对象是自动释放的 + */ ++ (WXEmoticonObject *)object; + +/** 表情真实数据内容 + * @note 大小不能超过10M + */ +@property (nonatomic, strong) NSData *emoticonData; + +@end + + + +#pragma mark - WXFileObject +/*! @brief 多媒体消息中包含的文件数据对象 + * + * @see WXMediaMessage + */ +@interface WXFileObject : NSObject + +/*! @brief 返回一个WXFileObject对象 + * + * @note 返回的WXFileObject对象是自动释放的 + */ ++ (WXFileObject *)object; + +/** 文件后缀名 + * @note 长度不超过64字节 + */ +@property (nonatomic, copy) NSString *fileExtension; + +/** 文件真实数据内容 + * @note 大小不能超过10M + */ +@property (nonatomic, strong) NSData *fileData; + +@end + + +#pragma mark - WXLocationObject +/*! @brief 多媒体消息中包含的地理位置数据对象 + * + * 微信终端和第三方程序之间传递消息中包含的地理位置数据对象。 + * @see WXMediaMessage + */ +@interface WXLocationObject : NSObject + +/*! @brief 返回一个WXLocationObject对象 + * + * @note 返回的WXLocationObject对象是自动释放的 + */ ++ (WXLocationObject *)object; + +/** 地理位置信息 + * @note 经纬度 + */ +@property (nonatomic, assign) double lng; //经度 +@property (nonatomic, assign) double lat; //纬度 + +@end + +#pragma mark - WXTextObject +/*! @brief 多媒体消息中包含的文本数据对象 + * + * 微信终端和第三方程序之间传递消息中包含的文本数据对象。 + * @see WXMediaMessage + */ +@interface WXTextObject : NSObject + +/*! @brief 返回一个WXTextObject对象 + * + * @note 返回的WXTextObject对象是自动释放的 + */ ++ (WXTextObject *)object; + +/** 地理位置信息 + * @note 文本内容 + */ +@property (nonatomic, copy) NSString *contentText; + +@end + +#pragma mark - WXMiniProgramObject + +@interface WXMiniProgramObject : NSObject + +/*! @brief WXMiniProgramObject对象 + * + * @note 返回的WXMiniProgramObject对象是自动释放的 + */ ++ (WXMiniProgramObject *)object; + +/** 低版本网页链接 + * @attention 长度不能超过1024字节 + */ +@property (nonatomic, copy) NSString *webpageUrl; + +/** 小程序username */ +@property (nonatomic, copy) NSString *userName; + +/** 小程序页面的路径 + * @attention 不填默认拉起小程序首页 + */ +@property (nonatomic, copy, nullable) NSString *path; + +/** 小程序新版本的预览图 + * @attention 大小不能超过128k + */ +@property (nonatomic, strong, nullable) NSData *hdImageData; + +/** 是否使用带 shareTicket 的转发 */ +@property (nonatomic, assign) BOOL withShareTicket; + +/** 分享小程序的版本 + * @attention (正式,开发,体验) + */ +@property (nonatomic, assign) WXMiniProgramType miniProgramType; + +/** 是否禁用转发 */ +@property (nonatomic, assign) BOOL disableForward; + +@property (nonatomic, assign) BOOL isUpdatableMessage; + +@property (nonatomic, assign) BOOL isSecretMessage; + + +/** 业务所需的额外信息 */ +@property (nonatomic, strong, nullable) NSDictionary *extraInfoDic; + +@end + +#pragma mark - WXGameLiveObject + +/*! @brief WXGameLiveObject对象 + * + * @note 游戏直播消息类型 + */ + +@interface WXGameLiveObject : NSObject + ++ (WXGameLiveObject *)object; + +/** 业务所需的额外信息 */ +@property (nonatomic, strong, nullable) NSDictionary *extraInfoDic; + +@end + +@interface WXNativeGamePageObject : NSObject + +/** 是否为视频类型 + */ +@property (nonatomic, assign) BOOL isVideo; + +/** 视频时长 + @note 当为视频类型时,必填;单位为秒 + */ +@property (nonatomic, assign) UInt32 videoDuration; + +/** 透传字段 + @note 长度限制为100K + */ +@property (nonatomic, copy) NSString *shareData; + +/** 缩略图 + @note 大小限制为256K + */ +@property (nonatomic, strong) NSData *gameThumbData; + ++ (WXNativeGamePageObject *)object; + +@end + +#pragma mark - WXLaunchMiniProgramReq + +/*! @brief WXLaunchMiniProgramReq对象, 可实现通过sdk拉起微信小程序 + * + * @note 返回的WXLaunchMiniProgramReq对象是自动释放的 + */ +@interface WXLaunchMiniProgramReq : BaseReq + ++ (WXLaunchMiniProgramReq *)object; + +/** 小程序username */ +@property (nonatomic, copy) NSString *userName; + +/** 小程序页面的路径 + * @attention 不填默认拉起小程序首页 + */ +@property (nonatomic, copy, nullable) NSString *path; + +/** 分享小程序的版本 + * @attention (正式,开发,体验) + */ +@property (nonatomic, assign) WXMiniProgramType miniProgramType; + +/** ext信息 + * @attention json格式 + */ +@property (nonatomic, copy, nullable) NSString *extMsg; + +/** extDic + * @attention 字典,可存放图片等比较大的数据 + */ +@property (nonatomic, copy, nullable) NSDictionary *extDic; + +@end + +#pragma mark - WXLaunchMiniProgramResp +/*! @brief 微信终端向第三方程序返回的WXLaunchMiniProgramReq处理结果。 + * + * 第三方程序向微信终端发送WXLaunchMiniProgramReq后,微信发送回来的处理结果,该结果用WXLaunchMiniProgramResp表示。 + */ +@interface WXLaunchMiniProgramResp : BaseResp + +@property (nonatomic, copy, nullable) NSString *extMsg; + +@end + + +#pragma mark - WXOpenBusinessViewReq +/*! @brief WXOpenBusinessViewReq对象, 可实现第三方通知微信启动,打开业务页面 + * + * @note 返回的WXOpenBusinessViewReq对象是自动释放的 + */ + +@interface WXOpenBusinessViewReq : BaseReq + ++ (WXOpenBusinessViewReq *)object; + +/** 业务类型 + */ +@property (nonatomic, copy) NSString *businessType; + +/** 业务参数 + */ +@property (nonatomic, copy, nullable) NSString *query; + +/** ext信息 + * @note 选填,json格式 + */ +@property (nonatomic, copy, nullable) NSString *extInfo; + +/** extData数据 + * @note + */ +@property (nonatomic, strong, nullable) NSData *extData; +@end + + +@interface WXOpenBusinessViewResp : BaseResp + +/** 业务类型 + */ +@property (nonatomic, copy) NSString *businessType; + +/** 业务返回数据 + */ +@property (nonatomic, copy, nullable) NSString *extMsg; + +@end + +#pragma mark - WXOpenCustomerServiceReq +@interface WXOpenCustomerServiceReq : BaseReq + ++ (WXOpenCustomerServiceReq *)object; + +/**企微客服发起流程 url + */ +@property (nonatomic, copy, nullable) NSString *url; + +/**企业 id + */ +@property (nonatomic, copy, nullable) NSString *corpid; + +@end + +@interface WXOpenCustomerServiceResp : BaseResp + +/** 业务返回数据 + */ +@property (nonatomic, copy, nullable) NSString *extMsg; + +@end + + +#pragma mark - WXChannelStartLiveReq + +@interface WXChannelStartLiveReq : BaseReq + ++ (WXChannelStartLiveReq *)object; + +/** 必填,直播业务数据(json格式) + */ +@property (nonatomic, copy) NSString *liveJsonInfo; + +@end + +@interface WXChannelStartLiveResp : BaseResp + +/** 业务返回数据 + */ +@property (nonatomic, copy, nullable) NSString *extMsg; + +@end + +NS_ASSUME_NONNULL_END diff --git a/uni_modules/uni-payment-wxpay/utssdk/app-ios/Libs/WeChatSDK/WechatAuthSDK.h b/uni_modules/uni-payment-wxpay/utssdk/app-ios/Libs/WeChatSDK/WechatAuthSDK.h new file mode 100644 index 0000000000000000000000000000000000000000..308aaea1af9ac61ae73e63695ab23a2f890a89fe --- /dev/null +++ b/uni_modules/uni-payment-wxpay/utssdk/app-ios/Libs/WeChatSDK/WechatAuthSDK.h @@ -0,0 +1,68 @@ +// +// WechatAuthSDK.h +// WechatAuthSDK +// +// Created by 李凯 on 13-11-29. +// Copyright (c) 2013年 Tencent. All rights reserved. +// + +#import +#import + +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 +@optional + +- (void)onAuthGotQrcode:(UIImage *)image; //得到二维码 +- (void)onQrcodeScanned; //二维码被扫描 +- (void)onAuthFinish:(int)errCode AuthCode:(nullable NSString *)authCode; //成功登录 + +@end + +@interface WechatAuthSDK : NSObject{ + NSString *_sdkVersion; + __weak id _delegate; +} + +@property(nonatomic, weak, nullable) id 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 diff --git a/uni_modules/uni-payment-wxpay/utssdk/app-ios/Libs/WeChatSDK/libWeChatSDK.a b/uni_modules/uni-payment-wxpay/utssdk/app-ios/Libs/WeChatSDK/libWeChatSDK.a new file mode 100644 index 0000000000000000000000000000000000000000..845272b30a870c55806464a7de0d3167e57871cd Binary files /dev/null and b/uni_modules/uni-payment-wxpay/utssdk/app-ios/Libs/WeChatSDK/libWeChatSDK.a differ diff --git a/uni_modules/uni-payment-wxpay/utssdk/app-ios/UTS.entitlements b/uni_modules/uni-payment-wxpay/utssdk/app-ios/UTS.entitlements new file mode 100644 index 0000000000000000000000000000000000000000..314291360d66c665eca2d5f432d4e2fcc9db0da9 --- /dev/null +++ b/uni_modules/uni-payment-wxpay/utssdk/app-ios/UTS.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.developer.associated-domains + + + diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top.xml b/uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top.xml index 47e9e85ba465929fb401914fbfeffcd4443e3c58..8b04ee8a3e8ab66abb163abb033d57f5529d2e5e 100644 --- a/uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top.xml +++ b/uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top.xml @@ -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" /> >>>>>>> dev:uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top_night.xml android:textSize="16dp" /> diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top_night.xml index ddcb2253f5d38d89cd7464439e6b6cf7013223fe..c36172e61626dc6a12a9487724fef78cc79395a0 100644 --- a/uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top_night.xml +++ b/uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top_night.xml @@ -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" /> >>>>>>> dev:uni_modules/uni-prompt/utssdk/app-android/res/layout/uni_prompt_ac_recyclerview_layout_top.xml android:textSize="16dp" /> diff --git a/uni_modules/uts-progressNotification/changelog.md b/uni_modules/uts-progressNotification/changelog.md index 332470475bb5475b7d3b24b633c91917f4dce414..8f90d3db3a3a9fd5b32e117277c7a6c6cd056b86 100644 --- a/uni_modules/uts-progressNotification/changelog.md +++ b/uni_modules/uts-progressNotification/changelog.md @@ -1,3 +1,9 @@ +## 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) diff --git a/uni_modules/uts-progressNotification/package.json b/uni_modules/uts-progressNotification/package.json index 09e670999813e2e6271cbfd74dfbcbd43fe344a5..d3a6dcc4d6ffb91fea1be40fe92438d782d33e8d 100644 --- a/uni_modules/uts-progressNotification/package.json +++ b/uni_modules/uts-progressNotification/package.json @@ -1,7 +1,7 @@ { "id": "uts-progressNotification", "displayName": "uts-progressNotification", - "version": "1.0.7", + "version": "1.1.0", "description": "uts-progressNotification", "keywords": [ "uts-progressNotification" diff --git a/uni_modules/uts-progressNotification/utssdk/app-android/TransparentActivity.uts b/uni_modules/uts-progressNotification/utssdk/app-android/TransparentActivity.uts index 283e01db3035765dd294f3f40e0d9f52e037da08..19678999897061ac5dcba439fadd51d26e109551 100644 --- a/uni_modules/uts-progressNotification/utssdk/app-android/TransparentActivity.uts +++ b/uni_modules/uts-progressNotification/utssdk/app-android/TransparentActivity.uts @@ -4,15 +4,16 @@ 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" export class TransparentActivity extends Activity { constructor() { super() - } + } + @Suppress("DEPRECATION") override onCreate(savedInstanceState : Bundle | null) { super.onCreate(savedInstanceState) this.fullScreen(this) @@ -58,4 +59,4 @@ export class TransparentActivity extends Activity { } } } -} \ No newline at end of file +} diff --git a/uni_modules/uts-progressNotification/utssdk/app-android/callbacks.uts b/uni_modules/uts-progressNotification/utssdk/app-android/callbacks.uts new file mode 100644 index 0000000000000000000000000000000000000000..23781894a9c8c7d27b4cdba5a76578b6f027d105 --- /dev/null +++ b/uni_modules/uts-progressNotification/utssdk/app-android/callbacks.uts @@ -0,0 +1,4 @@ + + +export let globalNotificationProgressCallBack : (() => void) | null = () => { } +export let globalNotificationProgressFinishCallBack = () => { } diff --git a/uni_modules/uts-progressNotification/utssdk/app-android/index.uts b/uni_modules/uts-progressNotification/utssdk/app-android/index.uts index 39d14cd58fb17e0adf913bbd6995e5849345e313..0782f616b86ca2b45e0a2674bc02d909dfa88e2f 100644 --- a/uni_modules/uts-progressNotification/utssdk/app-android/index.uts +++ b/uni_modules/uts-progressNotification/utssdk/app-android/index.uts @@ -8,7 +8,8 @@ import ComponentName from 'android.content.ComponentName'; 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 @@ -156,4 +156,4 @@ function getAppName(context : Context) : string { e.printStackTrace() } return appName -} \ No newline at end of file +} diff --git a/uni_modules/uts-progressNotification/utssdk/app-ios/config.json b/uni_modules/uts-progressNotification/utssdk/app-ios/config.json deleted file mode 100644 index d6281248a698f70985f2fd54722b527135d860d6..0000000000000000000000000000000000000000 --- a/uni_modules/uts-progressNotification/utssdk/app-ios/config.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "deploymentTarget": "9" -} \ No newline at end of file diff --git a/uni_modules/uts-progressNotification/utssdk/app-ios/index.uts b/uni_modules/uts-progressNotification/utssdk/app-ios/index.uts deleted file mode 100644 index e45e1e4d3ea5281d36178987e4edaa428cd6ce15..0000000000000000000000000000000000000000 --- a/uni_modules/uts-progressNotification/utssdk/app-ios/index.uts +++ /dev/null @@ -1,85 +0,0 @@ -/** - * 引用 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 - */