完成登录功能
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="gym.manage.uniapp">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||
|
||||
<application>
|
||||
<activity
|
||||
android:name="com.mobile.auth.gatewayauth.LoginAuthActivity"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:exported="false"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/authsdk_activity_dialog" />
|
||||
|
||||
<activity
|
||||
android:name="com.mobile.auth.gatewayauth.activity.AuthWebVeiwActivity"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:exported="false"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="behind" />
|
||||
|
||||
<activity
|
||||
android:name="com.mobile.auth.gatewayauth.PrivacyDialogActivity"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
android:exported="false"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/authsdk_activity_dialog" />
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -17,9 +17,7 @@
|
||||
"delay" : 0
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules" : {
|
||||
"OAuth" : {}
|
||||
},
|
||||
"modules" : {},
|
||||
/* 应用发布信息 */
|
||||
"distribute" : {
|
||||
/* android打包配置 */
|
||||
@@ -49,10 +47,7 @@
|
||||
/* SDK配置 */
|
||||
"sdkConfigs" : {
|
||||
"oauth" : {
|
||||
"weixin" : {
|
||||
"appid" : "wx8f0d644d1d8985f6",
|
||||
"UniversalLinks" : ""
|
||||
}
|
||||
"univerify" : {}
|
||||
}
|
||||
},
|
||||
"icons" : {
|
||||
@@ -87,6 +82,22 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"nativePlugins" : {
|
||||
"AliCloud-NirvanaPns" : {
|
||||
"__plugin_info__" : {
|
||||
"name" : "阿里云号码认证SDK",
|
||||
"description" : "阿里云号码认证SDK,包含一键登录和本机号码校验两个功能。",
|
||||
"platforms" : "Android,iOS",
|
||||
"url" : "https://ext.dcloud.net.cn/plugin?id=4297",
|
||||
"android_package_name" : "gym.manage.uniapp",
|
||||
"ios_bundle_id" : "",
|
||||
"isCloud" : true,
|
||||
"bought" : 1,
|
||||
"pid" : "4297",
|
||||
"parameters" : {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 240 B |
|
After Width: | Height: | Size: 309 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 573 B |
|
After Width: | Height: | Size: 950 B |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 240 B |
|
After Width: | Height: | Size: 309 B |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 573 B |
|
After Width: | Height: | Size: 950 B |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// ATAuthSDK.h
|
||||
// ATAuthSDK
|
||||
//
|
||||
// Created by yangli on 2020/11/11.
|
||||
// Copyright © 2020. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for ATAuthSDK.
|
||||
FOUNDATION_EXPORT double ATAuthSDKVersionNumber;
|
||||
|
||||
//! Project version string for ATAuthSDK.
|
||||
FOUNDATION_EXPORT const unsigned char ATAuthSDKVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <ATAuthSDK/PublicHeader.h>
|
||||
|
||||
#import "TXCommonHandler.h"
|
||||
#import "TXCommonUtils.h"
|
||||
#import "PNSReturnCode.h"
|
||||
#import "TXCustomModel.h"
|
||||
#import "PNSReporter.h"
|
||||
#import "PNSFeatureManager.h"
|
||||
@@ -0,0 +1,27 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface PNSFeatureManager : NSObject
|
||||
|
||||
/// 是否开启供应商级别缓存(默认为私网IP级缓存,开启之后缓存为供应商级别)
|
||||
@property (class, nonatomic, assign) BOOL enableCacheVendorLevel;
|
||||
|
||||
/// 是否开启运营商类型缓存(默认不开启,开启后会缓存上一次sim卡运营商归属信息)
|
||||
@property (class, nonatomic, assign) BOOL enableCacheLastVendorInfo;
|
||||
|
||||
/// 是否开启降低网络请求频次模式(默认NO),开启后将跳过配置、埋点等dypns域名访问,不影响登录核心功能
|
||||
@property (class, nonatomic, assign) BOOL enableReduceNetworkAccess;
|
||||
|
||||
+ (void)enableCacheVendorLevel:(BOOL)enable;
|
||||
|
||||
|
||||
+ (void)enableCacheLastVendorInfo:(BOOL)enable;
|
||||
|
||||
|
||||
+ (void)enableReduceNetworkAccess:(BOOL)enable;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// PNSReporter.h
|
||||
// ATAuthSDK
|
||||
//
|
||||
// Created by 刘超的MacBook on 2020/5/21.
|
||||
// Copyright © 2020. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, PNSLoggerLevel) {
|
||||
PNSLoggerLevelVerbose = 1,
|
||||
PNSLoggerLevelDebug,
|
||||
PNSLoggerLevelInfo,
|
||||
PNSLoggerLevelWarn,
|
||||
PNSLoggerLevelError
|
||||
};
|
||||
|
||||
@interface PNSReporter : NSObject
|
||||
|
||||
/**
|
||||
* 控制台日志输出开关,若开启会以PNS_LOGGER为开始标记对日志进行输出,Release模式记得关闭!
|
||||
* @param enable 开关参数,默认为NO
|
||||
*/
|
||||
- (void)setConsolePrintLoggerEnable:(BOOL)enable;
|
||||
|
||||
/**
|
||||
* 设置埋点上传开关,但不会对通过 setupUploader: 接口实现的自定义上传方法起作用
|
||||
* @param enable 开关设置BOOL值,默认为YES
|
||||
*/
|
||||
- (void)setUploadEnable:(BOOL)enable DEPRECATED_MSG_ATTRIBUTE("日志不再上传");;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,88 @@
|
||||
//
|
||||
// PNSReturnCode.h
|
||||
// ATAuthSDK
|
||||
//
|
||||
// Created by 刘超的MacBook on 2019/9/4.
|
||||
// Copyright © 2019. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef PNSReturnCode_h
|
||||
#define PNSReturnCode_h
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#pragma mark - 该返回码为阿里云号码认证SDK⾃身的返回码,请注意600011及600012错误内均含有运营商返回码,具体错误在碰到之后查阅 https://help.aliyun.com/document_detail/85351.html?spm=a2c4g.11186623.6.561.32a7360cxvWk6H
|
||||
|
||||
|
||||
/// 接口成功
|
||||
static NSString * const PNSCodeSuccess = @"600000";
|
||||
/// 获取运营商配置信息失败
|
||||
static NSString * const PNSCodeGetOperatorInfoFailed = @"600004";
|
||||
/// 未检测到sim卡
|
||||
static NSString * const PNSCodeNoSIMCard = @"600007";
|
||||
/// 蜂窝网络未开启或不稳定
|
||||
static NSString * const PNSCodeNoCellularNetwork = @"600008";
|
||||
/// 无法判运营商
|
||||
static NSString * const PNSCodeUnknownOperator = @"600009";
|
||||
/// 未知异常
|
||||
static NSString * const PNSCodeUnknownError = @"600010";
|
||||
/// 获取token失败
|
||||
static NSString * const PNSCodeGetTokenFailed = @"600011";
|
||||
/// 预取号失败
|
||||
static NSString * const PNSCodeGetMaskPhoneFailed = @"600012";
|
||||
/// 运营商维护升级,该功能不可用
|
||||
static NSString * const PNSCodeInterfaceDemoted = @"600013";
|
||||
/// 运营商维护升级,该功能已达最大调用次数
|
||||
static NSString * const PNSCodeInterfaceLimited = @"600014";
|
||||
/// 接口超时
|
||||
static NSString * const PNSCodeInterfaceTimeout = @"600015";
|
||||
/// AppID、Appkey解析失败
|
||||
static NSString * const PNSCodeDecodeAppInfoFailed = @"600017";
|
||||
/// 该号码已被运营商管控,目前只有联通号码有该功能
|
||||
static NSString * const PNSCodePhoneBlack = @"600018";
|
||||
/// 运营商已切换
|
||||
static NSString * const PNSCodeCarrierChanged = @"600021";
|
||||
/// 终端环境检测失败(终端不支持认证 / 终端检测参数错误)
|
||||
static NSString * const PNSCodeEnvCheckFail = @"600025";
|
||||
|
||||
/*************** 号码认证授权页相关返回码 START ***************/
|
||||
|
||||
/// 唤起授权页成功
|
||||
static NSString * const PNSCodeLoginControllerPresentSuccess = @"600001";
|
||||
/// 唤起授权页失败
|
||||
static NSString * const PNSCodeLoginControllerPresentFailed = @"600002";
|
||||
/// 授权页已加载时不允许调用加速或预取号接口
|
||||
static NSString * const PNSCodeCallPreLoginInAuthPage = @"600026";
|
||||
/// 点击返回,⽤户取消一键登录
|
||||
static NSString * const PNSCodeLoginControllerClickCancel = @"700000";
|
||||
/// 点击切换按钮,⽤户取消免密登录
|
||||
static NSString * const PNSCodeLoginControllerClickChangeBtn = @"700001";
|
||||
/// 点击登录按钮事件
|
||||
static NSString * const PNSCodeLoginControllerClickLoginBtn = @"700002";
|
||||
/// 点击CheckBox事件
|
||||
static NSString * const PNSCodeLoginControllerClickCheckBoxBtn = @"700003";
|
||||
/// 点击协议富文本文字
|
||||
static NSString * const PNSCodeLoginControllerClickProtocol = @"700004";
|
||||
/// 中断页面消失的时候,也就是suspendDisMissVC设置为YES的时候,点击左上角返回按钮时透出的状态码
|
||||
static NSString * const PNSCodeLoginControllerSuspendDisMissVC = @"700010";
|
||||
/// 授权页已销毁
|
||||
static NSString * const PNSCodeLoginControllerDeallocVC = @"700020";
|
||||
|
||||
|
||||
/*************** 号码认证授权页相关返回码 FINISH ***************/
|
||||
|
||||
|
||||
/*************** 二次授权页返回code码 START ***************/
|
||||
|
||||
/// 点击一键登录拉起授权页二次弹窗
|
||||
static NSString * const PNSCodeLoginClickPrivacyAlertView = @"700006";
|
||||
/// 隐私协议二次弹窗关闭
|
||||
static NSString * const PNSCodeLoginPrivacyAlertViewClose = @"700007";
|
||||
/// 隐私协议二次弹窗点击确认并继续
|
||||
static NSString * const PNSCodeLoginPrivacyAlertViewClickContinue = @"700008";
|
||||
/// 点击隐私协议二次弹窗上的协议富文本文字
|
||||
static NSString * const PNSCodeLoginPrivacyAlertViewPrivacyContentClick = @"700009";
|
||||
|
||||
/*************** 二次授权页返回code码 FINISH ***************/
|
||||
|
||||
#endif /* PNSReturnCode_h */
|
||||
@@ -0,0 +1,138 @@
|
||||
//
|
||||
// TXCommonHandler.h
|
||||
// ATAuthSDK
|
||||
//
|
||||
// Created by yangli on 15/03/2018.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "TXCustomModel.h"
|
||||
#import "PNSReporter.h"
|
||||
|
||||
|
||||
typedef NS_ENUM(NSInteger, PNSAuthType) {
|
||||
PNSAuthTypeVerifyToken = 1, //本机号码校验
|
||||
PNSAuthTypeLoginToken = 2 //一键登录
|
||||
};
|
||||
|
||||
@interface TXCommonHandler : NSObject
|
||||
|
||||
/**
|
||||
* 获取该类的单例实例对象
|
||||
* @return 单例实例对象
|
||||
*/
|
||||
+ (instancetype _Nonnull )sharedInstance;
|
||||
|
||||
/**
|
||||
* 获取当前SDK版本号
|
||||
* @return 字符串,sdk版本号
|
||||
*/
|
||||
- (NSString *_Nonnull)getVersion;
|
||||
|
||||
/**
|
||||
* SDK鉴权,app生命周期内调用一次
|
||||
* @param info app对应的秘钥
|
||||
* @param complete 结果异步回调到主线程,成功时resultDic=@{resultCode:600000, msg:...},其他情况时"resultCode"值请参考PNSReturnCode
|
||||
* @note 重复调用时以最新info信息为准
|
||||
*/
|
||||
- (void)setAuthSDKInfo:(NSString * _Nonnull)info complete:(void(^_Nullable)(NSDictionary * _Nonnull resultDic))complete;
|
||||
|
||||
/**
|
||||
* 检查当前环境是否支持一键登录或号码认证,resultDic 返回 PNSCodeSuccess 说明当前环境支持
|
||||
* @param authType 服务类型 PNSAuthTypeVerifyToken 本机号码校验流程,PNSAuthTypeLoginToken 一键登录流程
|
||||
* @param complete 结果异步回调到主线程,成功时resultDic=@{resultCode:600000, msg:...},其他情况时"resultCode"值请参考PNSReturnCode,只有成功回调才能保障后续接口调用
|
||||
*/
|
||||
- (void)checkEnvAvailableWithAuthType:(PNSAuthType)authType complete:(void (^_Nullable)(NSDictionary * _Nullable resultDic))complete;
|
||||
|
||||
/**
|
||||
* 加速获取本机号码校验token,防止调用 getVerifyTokenWithTimeout:complete: 获取token时间过长
|
||||
* @param timeout 接口超时时间,单位s,默认为3.0s
|
||||
* @param complete 结果异步回调到主线程,成功时resultDic=@{resultCode:600000, token:..., msg:...},其他情况时"resultCode"值请参考PNSReturnCode
|
||||
*/
|
||||
- (void)accelerateVerifyWithTimeout:(NSTimeInterval)timeout complete:(void (^_Nullable)(NSDictionary * _Nonnull resultDic))complete;
|
||||
|
||||
/**
|
||||
* 获取本机号码校验Token
|
||||
* @param timeout 接口超时时间,单位s,默认为3.0s
|
||||
* @param complete 结果异步回调到主线程,成功时resultDic=@{resultCode:600000, token:..., msg:...},其他情况时"resultCode"值请参考PNSReturnCode
|
||||
*/
|
||||
- (void)getVerifyTokenWithTimeout:(NSTimeInterval)timeout complete:(void (^_Nullable)(NSDictionary * _Nonnull resultDic))complete;
|
||||
|
||||
/**
|
||||
* 加速一键登录授权页弹起,防止调用 getLoginTokenWithTimeout:controller:model:complete: 等待弹起授权页时间过长
|
||||
* @param timeout 接口超时时间,单位s,默认为3.0s
|
||||
* @param complete 结果异步回调到主线程,成功时resultDic=@{resultCode:600000, msg:...},其他情况时"resultCode"值请参考PNSReturnCode
|
||||
*/
|
||||
- (void)accelerateLoginPageWithTimeout:(NSTimeInterval)timeout complete:(void (^_Nullable)(NSDictionary * _Nonnull resultDic))complete;
|
||||
|
||||
/**
|
||||
* 获取一键登录Token,调用该接口首先会弹起授权页,点击授权页的登录按钮获取Token
|
||||
* @warning 注意的是,如果前面没有调用 accelerateLoginPageWithTimeout:complete: 接口,该接口内部会自动先帮我们调用,成功后才会弹起授权页,所以有一个明显的等待过程
|
||||
* @param timeout 接口超时时间,单位s,默认为3.0s
|
||||
* @param controller 唤起自定义授权页的容器,内部会对其进行验证,检查是否符合条件
|
||||
* @param model 自定义授权页面选项,可为nil,采用默认的授权页面,具体请参考TXCustomModel.h文件
|
||||
* @param complete 结果异步回调到主线程,"resultDic"里面的"resultCode"值请参考PNSReturnCode,如下:
|
||||
*
|
||||
* 授权页控件点击事件:700000(点击授权页返回按钮)、700001(点击切换其他登录方式)、
|
||||
* 700002(点击登录按钮事件,根据返回字典里面的 "isChecked"字段来区分check box是否被选中,只有被选中的时候内部才会去获取Token)、700003(点击check box事件)、700004(点击协议富文本文字)
|
||||
接口回调其他事件:600001(授权页唤起成功)、600002(授权页唤起失败)、600000(成功获取Token)、600011(获取Token失败)、
|
||||
* 600015(获取Token超时)、600013(运营商维护升级,该功能不可用)、600014(运营商维护升级,该功能已达最大调用次数).....
|
||||
*/
|
||||
- (void)getLoginTokenWithTimeout:(NSTimeInterval)timeout controller:(UIViewController *_Nonnull)controller model:(TXCustomModel *_Nullable)model complete:(void (^_Nullable)(NSDictionary * _Nonnull resultDic))complete;
|
||||
|
||||
/**
|
||||
* 此接口仅用于开发期间用于一键登录页面不同机型尺寸适配调试(可支持模拟器),非正式页面,手机掩码为0,不能正常登录,请开发者注意下
|
||||
* @param controller 唤起自定义授权页的容器,内部会对其进行验证,检查是否符合条件
|
||||
* @param model 自定义授权页面选项,可为nil,采用默认的授权页面,具体请参考TXCustomModel.h文件
|
||||
* @param complete 结果异步回调到主线程,"resultDic"里面的"resultCode"值请参考PNSReturnCode
|
||||
*/
|
||||
- (void)debugLoginUIWithController:(UIViewController *_Nonnull)controller model:(TXCustomModel *_Nullable)model complete:(void (^_Nullable)(NSDictionary * _Nonnull resultDic))complete;
|
||||
|
||||
/**
|
||||
* 授权页弹起后,修改checkbox按钮选中状态,当checkout按钮隐藏时,设置不生效
|
||||
*/
|
||||
- (void)setCheckboxIsChecked:(BOOL)isChecked;
|
||||
|
||||
/**
|
||||
* 查询授权页checkbox是否勾选,YES:勾选,NO:未勾选
|
||||
*/
|
||||
- (BOOL)queryCheckBoxIsChecked;
|
||||
|
||||
/**
|
||||
* 授权页协议内容动画执行,注意:必须设置privacyAnimation属性,才会执行动画
|
||||
*/
|
||||
- (void)privacyAnimationStart;
|
||||
|
||||
/**
|
||||
* 授权页checkbox动画执行,注意:必须设置checkboxAnimation属性,才会执行动画
|
||||
*/
|
||||
- (void)checkboxAnimationStart;
|
||||
|
||||
/**
|
||||
* 手动隐藏一键登录获取登录Token之后的等待动画,默认为自动隐藏,当设置 TXCustomModel 实例 autoHideLoginLoading = NO 时, 可调用该方法手动隐藏
|
||||
*/
|
||||
- (void)hideLoginLoading;
|
||||
|
||||
/**
|
||||
* 注销授权页,建议用此方法,对于移动卡授权页的消失会清空一些数据
|
||||
* @param flag 是否添加动画
|
||||
* @param complete 成功返回
|
||||
*/
|
||||
- (void)cancelLoginVCAnimated:(BOOL)flag complete:(void (^_Nullable)(void))complete;
|
||||
|
||||
/**
|
||||
* 获取日志埋点相关控制对象
|
||||
*/
|
||||
- (PNSReporter * _Nonnull)getReporter;
|
||||
|
||||
/**
|
||||
* 关闭二次授权弹窗页
|
||||
*/
|
||||
- (void)closePrivactAlertView;
|
||||
|
||||
/**
|
||||
* 检查及准备调用环境,resultDic返回PNSCodeSuccess才能调用下面的功能接口
|
||||
* @param complete 结果异步回调到主线程,成功时resultDic=@{resultCode:600000, msg:...},其他情况时"resultCode"值请参考PNSReturnCode,只有成功回调才能保障后续接口调用
|
||||
*/
|
||||
- (void)checkEnvAvailableWithComplete:(void (^_Nullable)(NSDictionary * _Nullable resultDic))complete DEPRECATED_MSG_ATTRIBUTE("Please use checkEnvAvailableWithAuthType:complete: instead");
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// TXCommonUtils.h
|
||||
// authsdk
|
||||
//
|
||||
// Created by yangli on 12/03/2018.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface TXCommonUtils : NSObject
|
||||
|
||||
/**
|
||||
判断当前设备蜂窝数据网络是否开启,即3G/4G
|
||||
@return 结果
|
||||
*/
|
||||
+ (BOOL)checkDeviceCellularDataEnable;
|
||||
|
||||
/**
|
||||
判断当前上网卡运营商是否是中国联通
|
||||
@return 结果
|
||||
*/
|
||||
+ (BOOL)isChinaUnicom;
|
||||
|
||||
/**
|
||||
判断当前上网卡运营商是否是中国移动
|
||||
@return 结果
|
||||
*/
|
||||
+ (BOOL)isChinaMobile;
|
||||
|
||||
/**
|
||||
判断当前上网卡运营商是否是中国电信
|
||||
@return 结果
|
||||
*/
|
||||
+ (BOOL)isChinaTelecom;
|
||||
|
||||
/**
|
||||
获取当前上网卡运营商名称,比如中国移动、中国电信、中国联通
|
||||
@return 结果
|
||||
*/
|
||||
+ (NSString *)getCurrentCarrierName;
|
||||
|
||||
/**
|
||||
获取当前上网卡网络类型,比如WiFi,4G
|
||||
@return 结果
|
||||
*/
|
||||
+ (NSString *)getNetworktype;
|
||||
|
||||
/**
|
||||
判断当前设备是否有SIM卡
|
||||
@return 结果
|
||||
*/
|
||||
+ (BOOL)simSupportedIsOK;
|
||||
|
||||
/**
|
||||
判断wwan是否开着(通过p0网卡判断,无wifi或有wifi情况下都能检测到)
|
||||
@return 结果
|
||||
*/
|
||||
+ (BOOL)isWWANOpen;
|
||||
|
||||
/**
|
||||
判断wwan是否开着(仅无wifi情况下)
|
||||
@return 结果
|
||||
*/
|
||||
+ (BOOL)reachableViaWWAN;
|
||||
|
||||
/**
|
||||
获取设备当前网络私网IP地址
|
||||
@return 结果
|
||||
*/
|
||||
+ (NSString *)getMobilePrivateIPAddress:(BOOL)preferIPv4;
|
||||
|
||||
/**
|
||||
获取当前设备的唯一标识ID
|
||||
*/
|
||||
+ (NSString *)getUniqueID;
|
||||
|
||||
/**
|
||||
通过颜色设置生成图片,支持弧度设置,比如一键登录按钮背景图片
|
||||
*/
|
||||
+ (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size isRoundedCorner:(BOOL )isRounded radius:(CGFloat)radius;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,453 @@
|
||||
//
|
||||
// TXCustomModel.h
|
||||
// ATAuthSDK
|
||||
//
|
||||
// Created by yangli on 2019/4/4.
|
||||
// Copyright © 2019. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSUInteger, PNSPresentationDirection){
|
||||
PNSPresentationDirectionBottom = 0,
|
||||
PNSPresentationDirectionRight,
|
||||
PNSPresentationDirectionTop,
|
||||
PNSPresentationDirectionLeft,
|
||||
};
|
||||
|
||||
/**
|
||||
* 构建控件的frame,view布局时会调用该block得到控件的frame
|
||||
* @param screenSize 屏幕的size,可以通过该size来判断是横屏还是竖屏
|
||||
* @param superViewSize 该控件的super view的size,可以通过该size,辅助该控件重新布局
|
||||
* @param frame 控件默认的位置
|
||||
* @return 控件新设置的位置
|
||||
*/
|
||||
typedef CGRect(^PNSBuildFrameBlock)(CGSize screenSize, CGSize superViewSize, CGRect frame);
|
||||
|
||||
@interface TXCustomModel : NSObject
|
||||
|
||||
/**
|
||||
* 说明,可设置的Y轴距离,waring: 以下所有关于Y轴的设置<=0都将不生效,请注意
|
||||
* 全屏模式:默认是以375x667pt为基准,其他屏幕尺寸可以根据(ratio = 屏幕高度/667)比率来适配,比如 Y*ratio
|
||||
*/
|
||||
|
||||
#pragma mark- 全屏、弹窗模式设置
|
||||
/**
|
||||
* 授权页面中,渲染并显示所有控件的view,称content view,不实现该block默认为全屏模式
|
||||
* 实现弹窗的方案 x >= 0 || y >= 0 width <= 屏幕宽度 || height <= 屏幕高度
|
||||
*/
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock contentViewFrameBlock;
|
||||
|
||||
#pragma mark- 竖屏、横屏模式设置
|
||||
/** 屏幕是否支持旋转方向,默认UIInterfaceOrientationMaskPortrait,注意:在刘海屏,UIInterfaceOrientationMaskPortraitUpsideDown属性慎用! */
|
||||
@property (nonatomic, assign) UIInterfaceOrientationMask supportedInterfaceOrientations;
|
||||
|
||||
#pragma mark- 仅弹窗模式属性
|
||||
/** 底部蒙层背景颜色,默认黑色 */
|
||||
@property (nonatomic, strong) UIColor *alertBlurViewColor;
|
||||
/** 底部蒙层背景透明度,默认0.5 */
|
||||
@property (nonatomic, assign) CGFloat alertBlurViewAlpha;
|
||||
/** contentView背景颜色,默认白色 */
|
||||
@property (nonatomic, strong) UIColor *alertContentViewColor;
|
||||
/** contentView背景透明度,默认1.0 ,即不透明*/
|
||||
@property (nonatomic, assign) CGFloat alertContentViewAlpha;
|
||||
/** contentView的四个圆角值,顺序为左上,左下,右下,右上,需要填充4个值,不足4个值则无效,如果值<=0则为直角 */
|
||||
@property (nonatomic, copy) NSArray<NSNumber *> *alertCornerRadiusArray;
|
||||
/** 标题栏背景颜色 */
|
||||
@property (nonatomic, strong) UIColor *alertTitleBarColor;
|
||||
/** 标题栏是否隐藏,默认NO */
|
||||
@property (nonatomic, assign) BOOL alertBarIsHidden;
|
||||
/** 标题栏标题,内容、字体、大小、颜色 */
|
||||
@property (nonatomic, copy) NSAttributedString *alertTitle;
|
||||
/** 标题栏右侧关闭按钮图片设置*/
|
||||
@property (nonatomic, strong) UIImage *alertCloseImage;
|
||||
/** 标题栏右侧关闭按钮是否显示,默认NO*/
|
||||
@property (nonatomic, assign) BOOL alertCloseItemIsHidden;
|
||||
|
||||
/** 构建标题栏的frame,view布局或布局发生变化时调用,不实现则按默认处理,实现时仅有height生效 */
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock alertTitleBarFrameBlock;
|
||||
/** 构建标题栏标题的frame,view布局或布局发生变化时调用,不实现则按默认处理 */
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock alertTitleFrameBlock;
|
||||
/** 构建标题栏右侧关闭按钮的frame,view布局或布局发生变化时调用,不实现则按默认处理 */
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock alertCloseItemFrameBlock;
|
||||
|
||||
/** 弹窗位置是否根据键盘弹起关闭动态调整,仅在键盘弹起后遮挡弹窗的情况生效,调整后弹窗将居于键盘上方,默认NO*/
|
||||
@property (nonatomic, assign) BOOL alertFrameChangeWithKeyboard;
|
||||
|
||||
#pragma mark- 导航栏(只对全屏模式有效)
|
||||
/**授权页显示中,导航栏是否隐藏,默认NO*/
|
||||
@property (nonatomic, assign) BOOL navIsHidden;
|
||||
/**授权页push到其他页面后,导航栏是否隐藏,默认NO*/
|
||||
@property (nonatomic, assign) BOOL navIsHiddenAfterLoginVCDisappear;
|
||||
/**是否需要中断返回,如果设置为YES,则点击左上角返回按钮的时候默认页面不消失,同时透出状态码700010,需要自己调用TXCommonHandler cancelLoginVCAnimated方法隐藏页面,默认为NO*/
|
||||
@property (nonatomic, assign) BOOL suspendDisMissVC;
|
||||
/** 导航栏主题色 */
|
||||
@property (nonatomic, strong) UIColor *navColor;
|
||||
/** 导航栏标题,内容、字体、大小、颜色 */
|
||||
@property (nonatomic, copy) NSAttributedString *navTitle;
|
||||
/** 导航栏返回图片 */
|
||||
@property (nonatomic, strong) UIImage *navBackImage;
|
||||
/** 是否隐藏授权页导航栏返回按钮,默认不隐藏 */
|
||||
@property (nonatomic, assign) BOOL hideNavBackItem;
|
||||
/** 导航栏右侧自定义控件,可以在创建该VIEW的时候添加手势操作,或者创建按钮或其他赋值给VIEW */
|
||||
@property (nonatomic, strong) UIView *navMoreView;
|
||||
|
||||
/** 构建导航栏返回按钮的frame,view布局或布局发生变化时调用,不实现则按默认处理 */
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock navBackButtonFrameBlock;
|
||||
/** 构建导航栏标题的frame,view布局或布局发生变化时调用,不实现则按默认处理 */
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock navTitleFrameBlock;
|
||||
/** 构建导航栏右侧more view的frame,view布局或布局发生变化时调用,不实现则按默认处理,边界 CGRectGetMinX(frame) >= (superViewSizeViewSize / 0.3) && CGRectGetWidth(frame) <= (superViewSize.width / 3.0) */
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock navMoreViewFrameBlock;
|
||||
|
||||
#pragma mark- 全屏、弹窗模式共同属性
|
||||
|
||||
#pragma mark- 授权页动画相关
|
||||
/** 授权页弹出方向,默认PNSPresentationDirectionBottom,该属性只对自带动画起效,不影响自定义动画 */
|
||||
@property (nonatomic, assign) PNSPresentationDirection presentDirection;
|
||||
/** 授权页显示和消失动画时间,默认为0.25s,<= 0 时关闭动画,该属性只对自带动画起效,不影响自定义动画 **/
|
||||
@property (nonatomic, assign) CGFloat animationDuration;
|
||||
|
||||
/** 授权页显示动画(弹窗 & 全屏),不设置或设置为nil默认使用自带动画,SDK内部会主动更改动画的一些属性(包括:removedOnCompletion = NO、fillMode = kCAFillModeForwards 及 delegate) **/
|
||||
@property (nonatomic, strong, nullable) CAAnimation *entryAnimation;
|
||||
/** 授权页消失动画(弹窗 & 全屏),不设置或设置为nil默认使用自带动画,SDK内部会主动更改动画的一些属性(包括:removedOnCompletion = NO、fillMode = kCAFillModeForwards 及 delegate) **/
|
||||
@property (nonatomic, strong, nullable) CAAnimation *exitAnimation;
|
||||
|
||||
/** 授权页显示时的背景动画(仅弹窗),不设置或设置为nil默认使用自带动画,SDK内部会主动更改动画的一些属性(包括:removedOnCompletion = NO、fillMode = kCAFillModeForwards 及 delegate) **/
|
||||
@property (nonatomic, strong, nullable) CAAnimation *bgEntryAnimation;
|
||||
/** 授权页消失时的背景动画(仅弹窗),不设置或设置为nil默认使用自带动画,SDK内部会主动更改动画的一些属性(包括:removedOnCompletion = NO、fillMode = kCAFillModeForwards 及 delegate) **/
|
||||
@property (nonatomic, strong, nullable) CAAnimation *bgExitAnimation;
|
||||
|
||||
#pragma mark- 状态栏
|
||||
/** 状态栏是否隐藏,默认NO */
|
||||
@property (nonatomic, assign) BOOL prefersStatusBarHidden;
|
||||
/** 状态栏主题风格,默认UIStatusBarStyleDefault */
|
||||
@property (nonatomic, assign) UIStatusBarStyle preferredStatusBarStyle;
|
||||
|
||||
#pragma mark- 背景
|
||||
/** 授权页背景色 */
|
||||
@property (nonatomic, strong) UIColor *backgroundColor;
|
||||
/** 授权页背景图片 */
|
||||
@property (nonatomic, strong) UIImage *backgroundImage;
|
||||
/** 授权页背景图片view的 content mode,默认为 UIViewContentModeScaleAspectFill */
|
||||
@property (nonatomic, assign) UIViewContentMode backgroundImageContentMode;
|
||||
/** 点击授权页背景是否关闭授权页,只有在弹窗模式下生效,默认NO*/
|
||||
@property (nonatomic, assign) BOOL tapAuthPageMaskClosePage;
|
||||
|
||||
#pragma mark- logo图片
|
||||
/** logo图片设置 */
|
||||
@property (nonatomic, strong) UIImage *logoImage;
|
||||
/** logo是否隐藏,默认NO */
|
||||
@property (nonatomic, assign) BOOL logoIsHidden;
|
||||
|
||||
/** 构建logo的frame,view布局或布局发生变化时调用,不实现则按默认处理 */
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock logoFrameBlock;
|
||||
/** logo的宽设置 */
|
||||
@property (nonatomic, assign) CGFloat logoWidth DEPRECATED_MSG_ATTRIBUTE("Please use logoFrameBlock instead");
|
||||
/** logo的高设置 */
|
||||
@property (nonatomic, assign) CGFloat logoHeight DEPRECATED_MSG_ATTRIBUTE("Please use logoFrameBlock instead");
|
||||
/** logo相对导航栏底部或标题栏底部的Y轴距离 */
|
||||
@property (nonatomic, assign) CGFloat logoTopOffetY DEPRECATED_MSG_ATTRIBUTE("Please use logoFrameBlock instead");
|
||||
|
||||
#pragma mark- slogan
|
||||
/** slogan文案,内容、字体、大小、颜色 */
|
||||
@property (nonatomic, copy) NSAttributedString *sloganText;
|
||||
/** slogan是否隐藏,默认NO */
|
||||
@property (nonatomic, assign) BOOL sloganIsHidden;
|
||||
|
||||
/** 构建slogan的frame,view布局或布局发生变化时调用,不实现则按默认处理 */
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock sloganFrameBlock;
|
||||
/** slogan相对导航栏底部或标题栏底部的Y轴距离 */
|
||||
@property (nonatomic, assign) CGFloat sloganTopOffetY DEPRECATED_MSG_ATTRIBUTE("Please use sloganFrameBlock instead");
|
||||
|
||||
#pragma mark- 号码
|
||||
/** 号码颜色设置 */
|
||||
@property (nonatomic, strong) UIColor *numberColor;
|
||||
/** 号码字体设置,大小小于16则不生效 */
|
||||
@property (nonatomic, strong) UIFont *numberFont;
|
||||
|
||||
/**
|
||||
* 构建号码的frame,view布局或布局发生变化时调用,只有x、y生效,不实现则按默认处理,
|
||||
* 注:设置不能超出父视图 content view
|
||||
*/
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock numberFrameBlock;
|
||||
/**
|
||||
* 号码相对导航栏底部或标题栏底部的Y轴距离,不设置则按默认处理
|
||||
* 注:设置超出父视图 content view 时不生效
|
||||
*/
|
||||
@property (nonatomic, assign) CGFloat numberTopOffetY DEPRECATED_MSG_ATTRIBUTE("Please use numberFrameBlock instead");
|
||||
/**
|
||||
* 号码相对屏幕中线的X轴偏移距离,不设置则按默认处理,默认为0水平居中
|
||||
* 注:设置不能超出父视图 content view
|
||||
*/
|
||||
@property (nonatomic, assign) CGFloat numberOffetX DEPRECATED_MSG_ATTRIBUTE("Please use numberFrameBlock instead");
|
||||
|
||||
#pragma mark- 登录
|
||||
/** 登陆按钮文案,内容、字体、大小、颜色*/
|
||||
@property (nonatomic, strong) NSAttributedString *loginBtnText;
|
||||
/** 登录按钮背景图片组,默认高度50.0pt,@[激活状态的图片,失效状态的图片,高亮状态的图片] */
|
||||
@property (nonatomic, strong) NSArray<UIImage *> *loginBtnBgImgs;
|
||||
/**
|
||||
* 是否显示获取登录Token等待过程的loading组件,默认为YES;
|
||||
* 设置为NO时,SDK内部不会自动展示loading,适用于完全不需要loading的场景
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL showLoginLoading;
|
||||
/**
|
||||
* 是否自动隐藏点击登录按钮之后授权页上转圈的 loading, 默认为YES,在获取登录Token成功后自动隐藏
|
||||
* 如果设置为 NO,需要自己手动调用 [[TXCommonHandler sharedInstance] hideLoginLoading] 隐藏
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL autoHideLoginLoading;
|
||||
/**
|
||||
* loading组件背景图片,默认为nil不设置;
|
||||
* 如果设置,显示loading时会在转圈指示器下方显示该背景图
|
||||
*/
|
||||
@property (nonatomic, strong, nullable) UIImage *loadingBackgroundImage;
|
||||
/**
|
||||
* 构建登录按钮的frame,view布局或布局发生变化时调用,不实现则按默认处理
|
||||
* 注:不能超出父视图 content view,height不能小于20,width不能小于父视图宽度的一半
|
||||
*/
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock loginBtnFrameBlock;
|
||||
/**
|
||||
* 登录按钮相对导航栏底部或标题栏底部的Y轴距离,不设置则按默认处理
|
||||
* 注:设置超出父视图 content view 时不生效
|
||||
*/
|
||||
@property (nonatomic, assign) CGFloat loginBtnTopOffetY DEPRECATED_MSG_ATTRIBUTE("Please use loginBtnFrameBlock instead");
|
||||
/** 登录按钮高度,小于20.0pt不生效,不设置则按默认处理 */
|
||||
@property (nonatomic, assign) CGFloat loginBtnHeight DEPRECATED_MSG_ATTRIBUTE("Please use loginBtnFrameBlock instead");
|
||||
/** 登录按钮相对content view的左右边距,按钮宽度必须大于等于屏幕的一半,不设置则按默认处理 */
|
||||
@property (nonatomic, assign) CGFloat loginBtnLRPadding DEPRECATED_MSG_ATTRIBUTE("Please use loginBtnFrameBlock instead");
|
||||
|
||||
#pragma mark- 协议
|
||||
/** checkBox图片组,[uncheckedImg,checkedImg]*/
|
||||
@property (nonatomic, copy) NSArray<UIImage *> *checkBoxImages;
|
||||
/** checkBox图片距离控件边框的填充,默认为 UIEdgeInsetsZero,确保控件大小减去内填充大小为资源图片大小情况下,图片才不会变形 **/
|
||||
@property (nonatomic, assign) UIEdgeInsets checkBoxImageEdgeInsets;
|
||||
/** checkBox是否勾选,默认NO */
|
||||
@property (nonatomic, assign) BOOL checkBoxIsChecked;
|
||||
/** checkBox是否隐藏,默认NO */
|
||||
@property (nonatomic, assign) BOOL checkBoxIsHidden;
|
||||
/** checkBox大小,高宽一样,必须大于0 */
|
||||
@property (nonatomic, assign) CGFloat checkBoxWH;
|
||||
/** checkBox是否和协议内容垂直居中,默认NO,即顶部对齐 */
|
||||
@property (nonatomic, assign) BOOL checkBoxVerticalCenter;
|
||||
|
||||
/** 协议1,[协议名称,协议Url],注:三个协议名称不能相同 */
|
||||
@property (nonatomic, copy) NSArray<NSString *> *privacyOne;
|
||||
/** 协议2,[协议名称,协议Url],注:三个协议名称不能相同 */
|
||||
@property (nonatomic, copy) NSArray<NSString *> *privacyTwo;
|
||||
/** 协议3,[协议名称,协议Url],注:三个协议名称不能相同 */
|
||||
@property (nonatomic, copy) NSArray<NSString *> *privacyThree;
|
||||
/** 协议名称之间连接字符串数组,默认 ["和","、","、"] ,即第一个为"和",其他为"、",按顺序读取,为空则取默认 */
|
||||
@property (nonatomic, copy) NSArray<NSString *> *privacyConectTexts;
|
||||
/** 协议内容颜色数组,[非点击文案颜色,点击文案颜色] */
|
||||
@property (nonatomic, copy) NSArray<UIColor *> *privacyColors;
|
||||
/** 运营商协议内容颜色 ,优先级最高,如果privacyOperatorColors不设置,则取privacyColors中的点击文案颜色,privacyColors不设置,则是默认色*/
|
||||
@property (nonatomic, strong) UIColor *privacyOperatorColor;
|
||||
/** 协议1内容颜色,优先级最高,如果privacyOneColors不设置,则取privacyColors中的点击文案颜色,privacyColors不设置,则是默认色*/
|
||||
@property (nonatomic, strong) UIColor *privacyOneColor;
|
||||
/** 协议2内容颜色,优先级最高,如果privacyTwoColors不设置,则取privacyColors中的点击文案颜色,privacyColors不设置,则是默认色*/
|
||||
@property (nonatomic, strong) UIColor *privacyTwoColor;
|
||||
/** 协议3内容颜色,优先级最高,如果privacyThreeColors不设置,则取privacyColors中的点击文案颜色,privacyColors不设置,则是默认色*/
|
||||
@property (nonatomic, strong) UIColor *privacyThreeColor;
|
||||
/** 协议文案支持居中、居左、居右设置,默认居左 */
|
||||
@property (nonatomic, assign) NSTextAlignment privacyAlignment;
|
||||
/** 协议整体文案,前缀部分文案 */
|
||||
@property (nonatomic, copy) NSString *privacyPreText;
|
||||
/** 协议整体文案,后缀部分文案 */
|
||||
@property (nonatomic, copy) NSString *privacySufText;
|
||||
/** 运营商协议名称前缀文案,仅支持 <([《(【『 */
|
||||
@property (nonatomic, copy) NSString *privacyOperatorPreText;
|
||||
/** 运营商协议名称后缀文案,仅支持 >)]》)】』*/
|
||||
@property (nonatomic, copy) NSString *privacyOperatorSufText;
|
||||
/** 运营商协议指定显示顺序,默认0,即第1个协议显示,最大值可为3,即第4个协议显示*/
|
||||
@property (nonatomic, assign) NSInteger privacyOperatorIndex;
|
||||
/** 协议整体文案字体,小于10.0不生效 */
|
||||
@property (nonatomic, strong) UIFont *privacyFont;
|
||||
/** 协议整体文案行间距,默认0 */
|
||||
@property (nonatomic, assign) CGFloat privacyLineSpaceDp;
|
||||
/** 运营商协议文案字体,仅对运营商协议本体文案和前后缀生效,小于10.0不生效 */
|
||||
@property (nonatomic, strong) UIFont *privacyOperatorFont;
|
||||
/** 运营商协议文案下划线,仅对运营商协议本体文案和前后缀生效,YES:展示下划线;NO:不展示下划线,默认不展示 */
|
||||
@property (nonatomic, assign) BOOL privacyOperatorUnderline;
|
||||
/** checkBox是否扩大按钮可交互范围至"协议前缀部分文案(默认:我已阅读并同意)"区域,默认NO */
|
||||
@property (nonatomic, assign) BOOL expandAuthPageCheckedScope;
|
||||
|
||||
/**
|
||||
* 构建协议整体(包括checkBox)的frame,view布局或布局发生变化时调用,不实现则按默认处理
|
||||
* 如果设置的width小于checkBox的宽则不生效,最小x、y为0,最大width、height为父试图宽高
|
||||
* 最终会根据设置进来的width对协议文本进行自适应,得到的size是协议控件的最终大小
|
||||
*/
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock privacyFrameBlock;
|
||||
/**
|
||||
* 未同意协议时点击登录按钮,协议整体文案的动画效果,不设置或设置为nil默认没有动画,SDK内部会主动更改动画的一些属性(包括:removedOnCompletion = NO、fillMode = kCAFillModeRemoved 及 delegate)
|
||||
*/
|
||||
@property (nonatomic, strong, nullable) CAAnimation *privacyAnimation;
|
||||
/**
|
||||
* 未同意协议时点击登录按钮,checkbox的动画效果,不设置或设置为nil默认没有动画,SDK内部会主动更改动画的一些属性(包括:removedOnCompletion = NO、fillMode = kCAFillModeRemoved 及 delegate)
|
||||
*/
|
||||
@property (nonatomic, strong, nullable) CAAnimation *checkboxAnimation;
|
||||
/** 协议整体相对屏幕底部的Y轴距离,与其他有区别!!不能小于0 */
|
||||
@property (nonatomic, assign) CGFloat privacyBottomOffetY DEPRECATED_MSG_ATTRIBUTE("Please use privacyFrameBlock instead");
|
||||
/** 协议整体(包括checkBox)相对content view的左右边距,当协议整体宽度小于(content view宽度-2*左右边距)且居中模式,则左右边距设置无效,不能小于0 */
|
||||
@property (nonatomic, assign) CGFloat privacyLRPadding DEPRECATED_MSG_ATTRIBUTE("Please use privacyFrameBlock instead");
|
||||
|
||||
#pragma mark- 切换到其他方式
|
||||
/** changeBtn标题,内容、字体、大小、颜色 */
|
||||
@property (nonatomic, copy) NSAttributedString *changeBtnTitle;
|
||||
/** changeBtn是否隐藏,默认NO*/
|
||||
@property (nonatomic, assign) BOOL changeBtnIsHidden;
|
||||
|
||||
/** 构建changeBtn的frame,view布局或布局发生变化时调用,不实现则按默认处理 */
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock changeBtnFrameBlock;
|
||||
/** changeBtn相对导航栏底部或标题栏底部的Y轴距离 */
|
||||
@property (nonatomic, assign) CGFloat changeBtnTopOffetY DEPRECATED_MSG_ATTRIBUTE("Please use changeBtnFrameBlock instead");
|
||||
|
||||
#pragma mark- 协议详情页
|
||||
/** 协议详情页容器是否自定义,默认NO,若为YES,则根据 PNSCodeLoginControllerClickProtocol 返回码获取协议点击详情信息 */
|
||||
@property (nonatomic, assign) BOOL privacyVCIsCustomized;
|
||||
/** 导航栏背景颜色设置 */
|
||||
@property (nonatomic, strong) UIColor *privacyNavColor;
|
||||
/** 导航栏标题字体、大小 */
|
||||
@property (nonatomic, strong) UIFont *privacyNavTitleFont;
|
||||
/** 导航栏标题颜色 */
|
||||
@property (nonatomic, strong) UIColor *privacyNavTitleColor;
|
||||
/** 导航栏返回图片 */
|
||||
@property (nonatomic, strong) UIImage *privacyNavBackImage;
|
||||
|
||||
#pragma mark- 其他自定义控件添加及布局
|
||||
|
||||
/**
|
||||
* 自定义控件添加,注意:自定义视图的创建初始化和添加到父视图,都需要在主线程!!
|
||||
* @param superCustomView 父视图
|
||||
*/
|
||||
@property (nonatomic, copy) void(^customViewBlock)(UIView *superCustomView);
|
||||
|
||||
/**
|
||||
* 每次授权页布局完成时会调用该block,可以在该block实现里面可设置自定义添加控件的frame
|
||||
* @param screenSize 屏幕的size
|
||||
* @param contentViewFrame content view的frame,
|
||||
* @param navFrame 导航栏的frame,仅全屏时有效
|
||||
* @param titleBarFrame 标题栏的frame,仅弹窗时有效
|
||||
* @param logoFrame logo图片的frame
|
||||
* @param sloganFrame slogan的frame
|
||||
* @param numberFrame 号码栏的frame
|
||||
* @param loginFrame 登录按钮的frame
|
||||
* @param changeBtnFrame 切换到其他方式按钮的frame
|
||||
* @param privacyFrame 协议整体(包括checkBox)的frame
|
||||
*/
|
||||
@property (nonatomic, copy) void(^customViewLayoutBlock)(CGSize screenSize, CGRect contentViewFrame, CGRect navFrame, CGRect titleBarFrame, CGRect logoFrame, CGRect sloganFrame, CGRect numberFrame, CGRect loginFrame, CGRect changeBtnFrame, CGRect privacyFrame);
|
||||
|
||||
#pragma mark - 二次隐私协议弹窗设置
|
||||
/** 二次隐私协议弹窗是否需要显示, 默认NO */
|
||||
@property (nonatomic, assign) BOOL privacyAlertIsNeedShow;
|
||||
/** 二次隐私协议弹窗点击按钮是否需要执行登陆,默认YES */
|
||||
@property (nonatomic, assign) BOOL privacyAlertIsNeedAutoLogin;
|
||||
/** 二次隐私协议弹窗显示/隐藏动画时长,单位秒,默认0.3s,<=0时使用默认值 */
|
||||
@property (nonatomic, assign) CGFloat privacyAlertAnimationDuration;
|
||||
/** 二次隐私协议弹窗显示自定义动画,默认从下往上位移动画 */
|
||||
@property (nonatomic, strong, nullable) CAAnimation *privacyAlertEntryAnimation;
|
||||
/** 二次隐私协议弹窗隐藏自定义动画,默认从上往下位移动画 */
|
||||
@property (nonatomic, strong, nullable) CAAnimation *privacyAlertExitAnimation;
|
||||
/** 二次隐私协议弹窗的四个圆角值,顺序为左上,左下,右下,右上,需要填充4个值,不足4个值则无效,如果值<=0则为直角 ,默认0*/
|
||||
@property (nonatomic, copy) NSArray<NSNumber *> *privacyAlertCornerRadiusArray;
|
||||
/** 二次隐私协议弹窗背景颜色,默认为白色 */
|
||||
@property (nonatomic, strong) UIColor *privacyAlertBackgroundColor;
|
||||
/** 二次隐私协议弹窗透明度,默认不透明1.0 ,设置范围0.3~1.0之间 */
|
||||
@property (nonatomic, assign) CGFloat privacyAlertAlpha;
|
||||
/** 二次隐私协议弹窗标题文字内容,默认"请阅读并同意以下条款" */
|
||||
@property (nonatomic, copy) NSString *privacyAlertTitleContent;
|
||||
/** 二次隐私协议弹窗标题文字字体,最小10,默认10 */
|
||||
@property (nonatomic, strong) UIFont *privacyAlertTitleFont;
|
||||
/** 二次隐私协议弹窗标题文字颜色,默认黑色 */
|
||||
@property (nonatomic, strong) UIColor *privacyAlertTitleColor;
|
||||
/** 二次隐私协议弹窗标题背景颜色,默认白色*/
|
||||
@property (nonatomic, strong) UIColor *privacyAlertTitleBackgroundColor;
|
||||
/** 二次隐私协议弹窗标题位置,默认居中*/
|
||||
@property (nonatomic, assign) NSTextAlignment privacyAlertTitleAlignment;
|
||||
/** 二次隐私协议弹窗协议内容文字字体,最小10,默认10 */
|
||||
@property (nonatomic, strong) UIFont *privacyAlertContentFont;
|
||||
/** 二次隐私协议弹窗协议内容行间距,默认0 */
|
||||
@property (nonatomic, assign) CGFloat privacyAlertLineSpaceDp;
|
||||
/** 二次隐私协议弹窗协议内容背景颜色,默认白色 */
|
||||
@property (nonatomic, strong) UIColor *privacyAlertContentBackgroundColor;
|
||||
/** 二次隐私协议弹窗协议内容颜色数组,[非点击文案颜色,点击文案颜色],默认[0x999999,0x1890FF] */
|
||||
@property (nonatomic, copy) NSArray<UIColor *> *privacyAlertContentColors;
|
||||
/** 二次隐私协议弹窗运营商协议内容文字字体,仅对运营商协议部分的文本生效,最小10,默认10 */
|
||||
@property (nonatomic, strong) UIFont *privacyAlertContentOperatorFont;
|
||||
/** 二次隐私协议弹窗运营商协议内容文字下划线,仅对运营商协议部分的文本生效,YES:展示下划线,NO:不展示下划线,默认不展示 */
|
||||
@property (nonatomic, assign) BOOL privacyAlertContentUnderline;
|
||||
/** 二次隐私协议弹窗协议运营商协议内容颜色,优先级最高,如果privacyAlertOperatorColors不设置,则取privacyAlertContentColors中的点击文案颜色,privacyAlertContentColors不设置,则是默认色*/
|
||||
@property (nonatomic, strong) UIColor *privacyAlertOperatorColor;
|
||||
/** 二次隐私协议弹窗协议协议1内容颜色 ,优先级最高,如果privacyAlertOneColors不设置,则取privacyAlertContentColors中的点击文案颜色,privacyAlertContentColors不设置,则是默认色*/
|
||||
@property (nonatomic, strong) UIColor *privacyAlertOneColor;
|
||||
/** 二次隐私协议弹窗协议协议2内容颜色 ,优先级最高,如果privacyAlertTwoColors不设置,则取privacyAlertContentColors中的点击文案颜色,privacyAlertContentColors不设置,则是默认色*/
|
||||
@property (nonatomic, strong) UIColor *privacyAlertTwoColor;
|
||||
/** 二次隐私协议弹窗协议协议3内容颜色 ,优先级最高,如果privacyAlertThreeColors不设置,则取privacyAlertContentColors中的点击文案颜色,privacyAlertContentColors不设置,则是默认色*/
|
||||
@property (nonatomic, strong) UIColor *privacyAlertThreeColor;
|
||||
/** 二次隐私协议弹窗协议文案支持居中、居左、居右设置,默认居左 */
|
||||
@property (nonatomic, assign) NSTextAlignment privacyAlertContentAlignment;
|
||||
|
||||
/** 二次隐私协议弹窗协议整体文案,前缀部分文案 ,如果不赋值,默认使用privacyPreText*/
|
||||
@property (nonatomic, copy) NSString *privacyAlertPreText;
|
||||
/** 二次隐私协议弹窗协议整体文案,后缀部分文案 如果不赋值,默认使用privacySufText*/
|
||||
@property (nonatomic, copy) NSString *privacyAlertSufText;
|
||||
|
||||
/** 二次隐私协议弹窗按钮文字内容 默认“同意”*/
|
||||
@property (nonatomic, copy) NSString *privacyAlertBtnContent;
|
||||
/** 二次隐私协议弹窗登录按钮的圆角值,如果值<=0则为直角 ,默认0*/
|
||||
@property (nonatomic, assign) CGFloat privacyAlertBtnCornerRadius;
|
||||
/** 二次隐私协议弹窗按钮按钮背景图片 ,默认高度50.0pt,@[激活状态的图片,高亮状态的图片] */
|
||||
@property (nonatomic, copy) NSArray<UIImage *> *privacyAlertBtnBackgroundImages;
|
||||
/** 二次隐私协议弹窗按钮文字颜色,默认黑色, @[激活状态的颜色,高亮状态的颜色] */
|
||||
@property (nonatomic, copy) NSArray<UIColor *> *privacyAlertButtonTextColors;
|
||||
/** 二次隐私协议弹窗按钮文字字体,最小10,默认18*/
|
||||
@property (nonatomic, strong) UIFont *privacyAlertButtonFont;
|
||||
/** 二次隐私协议弹窗关闭按钮是否显示,默认显示 */
|
||||
@property (nonatomic, assign) BOOL privacyAlertCloseButtonIsNeedShow;
|
||||
/** 二次隐私协议弹窗右侧关闭按钮图片设置,默认内置的X图片*/
|
||||
@property (nonatomic, strong) UIImage *privacyAlertCloseButtonImage;
|
||||
/** 二次隐私协议弹窗背景蒙层是否显示 ,默认YES*/
|
||||
@property (nonatomic, assign) BOOL privacyAlertMaskIsNeedShow;
|
||||
/** 二次隐私协议弹窗点击背景蒙层是否关闭弹窗 ,默认YES*/
|
||||
@property (nonatomic, assign) BOOL tapPrivacyAlertMaskCloseAlert;
|
||||
/** 二次隐私协议弹窗蒙版背景颜色,默认黑色 */
|
||||
@property (nonatomic, strong) UIColor *privacyAlertMaskColor;
|
||||
/** 二次隐私协议弹窗蒙版透明度 设置范围0.3~1.0之间 ,默认0.5*/
|
||||
@property (nonatomic, assign) CGFloat privacyAlertMaskAlpha;
|
||||
/** 二次隐私协议弹窗蒙版显示动画,默认渐显动画 */
|
||||
@property (nonatomic, strong) CAAnimation *privacyAlertMaskEntryAnimation;
|
||||
/** 二次隐私协议弹窗蒙版消失动画,默认渐隐动画 */
|
||||
@property (nonatomic, strong) CAAnimation *privacyAlertMaskExitAnimation;
|
||||
/** 二次隐私协议弹窗尺寸设置,不能超出父视图 content view,height不能小于50,width不能小于0,默认屏幕居中,宽为屏幕的宽度减掉80,高为200 */
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock privacyAlertFrameBlock;
|
||||
/** 二次隐私协议弹窗标题尺寸,默认x=0,y=0,width=弹窗宽度,最小宽度为100,height=根据文本计算的高度,最小高度为15,不能超出父视图 */
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock privacyAlertTitleFrameBlock;
|
||||
/** 二次隐私协议弹窗内容尺寸,默认为从标题顶部位置开始,最终会根据设置进来的width对协议文本进行自适应,得到的size是协议控件的最终大小。不能超出父视图 */
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock privacyAlertPrivacyContentFrameBlock;
|
||||
/** 二次隐私协议弹窗确认按钮尺寸,默认为父视图的宽度一半,居中显示。高度默认50, */
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock privacyAlertButtonFrameBlock;
|
||||
/** 二次隐私协议弹窗右侧关闭按钮尺寸,默认宽高44,居弹窗右侧15,居弹窗顶部0*/
|
||||
@property (nonatomic, copy) PNSBuildFrameBlock privacyAlertCloseFrameBlock;
|
||||
|
||||
/**
|
||||
* 二次授权页弹窗自定义控件添加,注意:自定义视图的创建初始化和添加到父视图,都需要在主线程!!
|
||||
* @param superPrivacyAlertCustomView 父视图
|
||||
*/
|
||||
@property (nonatomic, copy) void(^privacyAlertCustomViewBlock)(UIView *superPrivacyAlertCustomView);
|
||||
|
||||
/**
|
||||
* 二次授权页弹窗布局完成时会调用该block,可以在该block实现里面可设置自定义添加控件的frame
|
||||
* @param privacyAlertFrame 二次授权页弹窗frame
|
||||
* @param privacyAlertTitleFrame 二次授权页弹窗标题frame
|
||||
* @param privacyAlertPrivacyContentFrame 二次授权页弹窗协议内容frame
|
||||
* @param privacyAlertButtonFrame 二次授权页弹窗确认按钮frame
|
||||
* @param privacyAlertCloseFrame 二次授权页弹窗右上角关闭按钮frame
|
||||
*/
|
||||
@property (nonatomic, copy) void(^privacyAlertCustomViewLayoutBlock)(CGRect privacyAlertFrame, CGRect privacyAlertTitleFrame, CGRect privacyAlertPrivacyContentFrame, CGRect privacyAlertButtonFrame, CGRect privacyAlertCloseFrame);
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
framework module ATAuthSDK {
|
||||
umbrella header "ATAuthSDK.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeOtherDataTypes</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>NSPrivacyTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>35F9.1</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>CA92.1</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 日志级别
|
||||
extern NSString * const ACM_LOGGER_LEVEL_VERBOSE;
|
||||
extern NSString * const ACM_LOGGER_LEVEL_DEBUG;
|
||||
extern NSString * const ACM_LOGGER_LEVEL_INFO;
|
||||
extern NSString * const ACM_LOGGER_LEVEL_WARN;
|
||||
extern NSString * const ACM_LOGGER_LEVEL_ERROR;
|
||||
extern NSString * const ACM_LOGGER_LEVEL_REALTIME;
|
||||
|
||||
@interface ACMLogger : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/// 日志是否入库,默认不入库
|
||||
@property (nonatomic, assign) BOOL enterDatabase;;
|
||||
|
||||
/// 日志是否允许上传,默认不上传
|
||||
@property (nonatomic, assign) BOOL isAllowUpload;
|
||||
|
||||
/**
|
||||
* 日志入库
|
||||
* @param obj 日志的具体内容
|
||||
* @param level 日志等级
|
||||
*/
|
||||
- (BOOL)logger:(id)obj level:(NSString *)level ;
|
||||
|
||||
/**
|
||||
* 上传日志
|
||||
* @param startDate 日志开始时间,如果传nil则查询不加该条件
|
||||
* @param endDate 日志结束时间,如果传nil则查询不加该条件
|
||||
* @param levels 日志等级数组,里面包含对应的日志等级字符串,如果传nil则查询不加该条件
|
||||
*/
|
||||
- (void)uploadLoggersWithLevels:(NSArray <NSString *>* _Nullable)levels
|
||||
startDate:(NSDate * _Nullable)startDate
|
||||
endDate:(NSDate * _Nullable)endDate;
|
||||
|
||||
/**
|
||||
* 上传失败的日志,一般放在重启应用后
|
||||
*/
|
||||
- (void)uploadFailedRecords;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <YTXMonitor/ACMLogger.h>
|
||||
#import <YTXMonitor/ACMMonitor.h>
|
||||
#import <YTXMonitor/ACMProtocol.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface ACMManager : NSObject
|
||||
|
||||
/// 日志操作对象
|
||||
@property (nonatomic, strong, readonly) ACMLogger *logger;
|
||||
|
||||
/// 埋点操作对象
|
||||
@property (nonatomic, strong, readonly) ACMMonitor *monitor;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
* @param databaseName 数据库名,不指定则默认为 “ACMDatabase”
|
||||
* @param monitorTableName 埋点表名,必须要指定,用来区分不同产品数据
|
||||
* @param loggerTablename 日志表名,必须要指定,用来区分不同产品数据
|
||||
* @param limitKeyPrefix 限流信息存储到本地key的前缀,用来区分不同产品的限流缓存
|
||||
*/
|
||||
- (instancetype)initWithDatabaseName:(NSString * _Nullable)databaseName
|
||||
monitorTableName:(NSString *)monitorTableName
|
||||
loggerTableName:(NSString *)loggerTablename
|
||||
limitKeyPrefix:(NSString *)limitKeyPrefix;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
* @param databaseName 数据库名,不指定则默认为 “ACMDatabase”
|
||||
* @param monitorTableName 埋点表名,必须要指定,用来区分不同产品数据
|
||||
* @param loggerTablename 日志表名,必须要指定,用来区分不同产品数据
|
||||
* @param limitKeyPrefix 限流信息存储到本地key的前缀,用来区分不同产品的限流缓存
|
||||
* @param uploadCount 每次上传条数
|
||||
* @param retryRightNow 上传失败是否立马重试,默认立马重试
|
||||
* @param uploadOnce 是否只执行一轮上传,默认NO
|
||||
*/
|
||||
- (instancetype)initWithDatabaseName:(NSString * _Nullable)databaseName
|
||||
monitorTableName:(NSString *)monitorTableName
|
||||
loggerTableName:(NSString *)loggerTablename
|
||||
limitKeyPrefix:(NSString *)limitKeyPrefix
|
||||
uploadCount:(NSInteger)uploadCount
|
||||
retryRightNow:(BOOL)retryRightNow
|
||||
uploadOnce:(BOOL)uploadOnce;
|
||||
|
||||
/**
|
||||
* 获取组件当前版本号
|
||||
*/
|
||||
- (NSString *)getVersion;
|
||||
|
||||
/**
|
||||
* 设置日志埋点上传代理对象
|
||||
* 注:这里是强引用
|
||||
* @param uploadDelegate 代理对象,需要实现 ACMProtocol 协议
|
||||
*/
|
||||
- (void)setUploadDelegate:(id<ACMProtocol> _Nullable)uploadDelegate;
|
||||
|
||||
/**
|
||||
* 更新限流相关
|
||||
* @param isLimit 是否限流
|
||||
* @param limitTimeHour 限流区间大小
|
||||
* @param limitCount 区间内限流次数
|
||||
*/
|
||||
- (void)updateLimitConfig:(BOOL)isLimit
|
||||
limitTimeHour:(NSInteger)limitTimeHour
|
||||
limitCount:(NSInteger)limitCount;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,55 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, ACM_DELETE_TYPE) {
|
||||
ACM_DELETE_TYPE_ALL,
|
||||
ACM_DELETE_TYPE_FAILED,
|
||||
ACM_DELETE_TYPE_UNUPLOAD
|
||||
};
|
||||
|
||||
|
||||
|
||||
@interface ACMMonitor : NSObject
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/// 埋点是否入库,默认入库
|
||||
@property (nonatomic, assign) BOOL enterDatabase;;
|
||||
|
||||
/// 埋点是否允许上传,默认上传
|
||||
@property (nonatomic, assign) BOOL isAllowUpload;
|
||||
|
||||
/**
|
||||
* 非实时埋点入库
|
||||
* @param obj 埋点具体内容
|
||||
*/
|
||||
- (BOOL)monitor:(id)obj;
|
||||
|
||||
/**
|
||||
* 实时埋点入库
|
||||
* @param obj 埋点的具体内容
|
||||
*/
|
||||
- (BOOL)monitorRealtime:(id)obj;
|
||||
|
||||
/**
|
||||
* 手动触发埋点上传,只上传未上传过的埋点
|
||||
*/
|
||||
- (void)uploadMonitorByManual;
|
||||
|
||||
/**
|
||||
* 上传失败的埋点,一般放在重启应用后
|
||||
*/
|
||||
- (void)uploadFailedRecords;
|
||||
|
||||
/**
|
||||
* 删除埋点
|
||||
* @param type 删除类型
|
||||
* @param block 结果的异步回调
|
||||
*/
|
||||
- (void)deleteRecordsByType:(ACM_DELETE_TYPE)type block:(void (^)(BOOL))block;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol ACMProtocol <NSObject>
|
||||
|
||||
@required
|
||||
|
||||
/// 埋点抛出,可在抛出里面进行上传
|
||||
- (BOOL)uploadMonitors:(NSArray<NSDictionary *> *)monitors;
|
||||
/// 日志抛出,可在抛出里面进行上传
|
||||
- (BOOL)uploadLoggers:(NSArray<NSDictionary *> *)loggers;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
#import <YTXMonitor/ACMManager.h>
|
||||
#import <YTXMonitor/ACMProtocol.h>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
framework module YTXMonitor {
|
||||
umbrella header "YTXMonitor.h"
|
||||
export *
|
||||
|
||||
module * { export * }
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeOtherDataTypes</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>NSPrivacyTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>CA92.1</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,100 @@
|
||||
//
|
||||
// YTXNetUtils.h
|
||||
// YTXOperators
|
||||
//
|
||||
// Created by yangli on 2020/11/9.
|
||||
// Copyright © 2020 com.alicom. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface YTXNetUtils : NSObject
|
||||
|
||||
/**
|
||||
判断当前设备蜂窝数据网络是否开启,即3G/4G
|
||||
@return 结果
|
||||
*/
|
||||
- (BOOL)checkDeviceCellularDataEnable;
|
||||
|
||||
/**
|
||||
判断当前上网卡运营商是否是中国联通
|
||||
@return 结果
|
||||
*/
|
||||
- (BOOL)isChinaUnicom;
|
||||
|
||||
/**
|
||||
判断当前上网卡运营商是否是中国移动
|
||||
@return 结果
|
||||
*/
|
||||
- (BOOL)isChinaMobile;
|
||||
|
||||
/**
|
||||
判断当前上网卡运营商是否是中国电信
|
||||
@return 结果
|
||||
*/
|
||||
- (BOOL)isChinaTelecom;
|
||||
|
||||
/**
|
||||
获取当前上网卡运营商名称,比如中国移动、中国电信、中国联通
|
||||
@return 结果
|
||||
*/
|
||||
- (NSString *)getCurrentCarrierName;
|
||||
|
||||
/**
|
||||
获取当前上网卡运营商编码,比如46000、46001、46003
|
||||
@return 结果
|
||||
*/
|
||||
- (NSString *)getCurrentCarrierCode API_DEPRECATED("废弃,完成不可用,返回空字符串", ios(4.0, 16.0));
|
||||
|
||||
/**
|
||||
获取当前上网卡网络类型,比如WiFi,4G
|
||||
@return 结果
|
||||
*/
|
||||
- (NSString *)getNetworktype;
|
||||
|
||||
/**
|
||||
判断当前设备是否有SIM卡
|
||||
@return 结果
|
||||
*/
|
||||
- (BOOL)simSupportedIsOK;
|
||||
|
||||
/**
|
||||
判断wwan是否开着(通过p0网卡判断,无wifi或有wifi情况下都能检测到)
|
||||
@return 结果
|
||||
*/
|
||||
- (BOOL)isWWANOpen;
|
||||
|
||||
/**
|
||||
判断WiFi是否开着
|
||||
@return 结果
|
||||
*/
|
||||
- (BOOL)isWiFiOpen;
|
||||
|
||||
/**
|
||||
判断wwan是否开着(仅无wifi情况下)
|
||||
@return 结果
|
||||
*/
|
||||
- (BOOL)reachableViaWWAN;
|
||||
|
||||
/**
|
||||
获取设备当前网络私网IP地址
|
||||
@return 结果
|
||||
*/
|
||||
- (NSString *)getMobilePrivateIPAddress:(BOOL)preferIPv4;
|
||||
|
||||
/**
|
||||
获取双卡设备下,非上网卡信息
|
||||
@return 结果
|
||||
*/
|
||||
- (NSString *)getOptionalCarrierInfo API_DEPRECATED("废弃,完成不可用,返回空字符串", ios(4.0, 16.0));;
|
||||
|
||||
/**
|
||||
获取当前蜂网络Ip地址
|
||||
*/
|
||||
- (NSString *)getCellularIp;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// YTXOperators.h
|
||||
// YTXOperators
|
||||
//
|
||||
// Created by yangli on 2020/11/9.
|
||||
// Copyright © 2020 com.alicom. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for YTXOperators.
|
||||
FOUNDATION_EXPORT double YTXOperatorsVersionNumber;
|
||||
|
||||
//! Project version string for YTXOperators.
|
||||
FOUNDATION_EXPORT const unsigned char YTXOperatorsVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <YTXOperators/PublicHeader.h>
|
||||
|
||||
#import <YTXOperators/YTXVendorService.h>
|
||||
#import <YTXOperators/YTXNetUtils.h>
|
||||
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// YTXVendorService.h
|
||||
// ATAuthSDK
|
||||
//
|
||||
// Created by 刘超的MacBook on 2020/1/15.
|
||||
// Copyright © 2020. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface YTXRequest : NSObject
|
||||
/// 接口调用超时时间,注:目前内部限制最小超时时间为5s,小于5s则按5s设置
|
||||
@property (nonatomic, assign) NSTimeInterval timeout;
|
||||
/// 是否是蜂窝网络
|
||||
@property (nonatomic, assign) BOOL isReachableViaWWAN;
|
||||
@end
|
||||
|
||||
@interface YTXVendorConfig : NSObject
|
||||
/// 当前供应商标识:中移互联(cm_zyhl),联通小沃(cu_xw),联通在线(cu_zx),电信世纪龙(ct_sjl)
|
||||
@property (nonatomic, copy) NSString *vendorKey;
|
||||
/// 供应商二级标识
|
||||
@property (nonatomic, copy) NSString *vendorSubKey;
|
||||
/// 供应商 access id
|
||||
@property (nonatomic, copy) NSString *vendorAccessId;
|
||||
/// 供应商 access secret
|
||||
@property (nonatomic, copy) NSString *vendorAccessSecret;
|
||||
@end
|
||||
|
||||
@interface YTXVendorService : NSObject
|
||||
|
||||
/**
|
||||
* 获取SDK版本号
|
||||
*/
|
||||
+ (NSString *)getVersion;
|
||||
|
||||
/**
|
||||
* 获取供应商SDK版本号
|
||||
*/
|
||||
+ (NSDictionary *)getVendorsVersion;
|
||||
|
||||
/**
|
||||
* 初始化或更新各个供应商的接口调用对象,根据各个供应商的配置信息
|
||||
* @param vendorConfigs 各个供应商配置信息
|
||||
*/
|
||||
- (void)updateVendorHandlers:(NSArray<YTXVendorConfig *> *)vendorConfigs;
|
||||
|
||||
/**
|
||||
* 获取本机号码校验Token
|
||||
* @param request 请求参数结构体
|
||||
* @param vendorConfig 当前供应商配置信息
|
||||
* @param complete 结果回调
|
||||
*/
|
||||
- (void)getVerifyTokenWithRequest:(YTXRequest *)request
|
||||
vendorConfig:(YTXVendorConfig *)vendorConfig
|
||||
complete:(void(^)(NSDictionary *response))complete;
|
||||
|
||||
/**
|
||||
* 获取手机掩码
|
||||
* @param request 请求参数结构体
|
||||
* @param vendorConfig 当前供应商配置信息
|
||||
* @param complete 结果回调
|
||||
*/
|
||||
- (void)getMaskNumberWithRequest:(YTXRequest *)request
|
||||
vendorConfig:(YTXVendorConfig *)vendorConfig
|
||||
complete:(void(^)(NSDictionary *response))complete;
|
||||
|
||||
|
||||
/**
|
||||
* 电信/联通获取一键登录Token
|
||||
* @param request 请求参数结构体
|
||||
* @param vendorConfig 当前供应商配置信息
|
||||
* @param complete 结果回调
|
||||
* @abstract 移动的获取登录Token不走这个回调,走弹起授权页的回调
|
||||
*/
|
||||
- (void)getLoginTokenWithRequest:(YTXRequest *)request
|
||||
vendorConfig:(YTXVendorConfig *)vendorConfig
|
||||
complete:(void(^)(NSDictionary *response))complete;
|
||||
|
||||
- (void)deleteCacheWithVendorConfigs:(NSArray<YTXVendorConfig *> *)vendorConfigs;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,6 @@
|
||||
framework module YTXOperators {
|
||||
umbrella header "YTXOperators.h"
|
||||
export *
|
||||
|
||||
module * { export * }
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeOtherDataTypes</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false/>
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>35F9.1</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>CA92.1</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [ Alibaba ] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"name": "阿里云号码认证SDK",
|
||||
"id": "AliCloud-NirvanaPns",
|
||||
"version": "2.1.9",
|
||||
"description": "阿里云号码认证SDK",
|
||||
"_dp_type":"nativeplugin",
|
||||
"_dp_nativeplugin":{
|
||||
"android": {
|
||||
"plugins": [
|
||||
{
|
||||
"type": "module",
|
||||
"name": "AliCloud-NirvanaPns",
|
||||
"class": "com.nirvana.prd.auth.ALiLoginManager"
|
||||
}
|
||||
],
|
||||
"hooksClass": "",
|
||||
"integrateType": "aar",
|
||||
"dependencies": [],
|
||||
"compileOptions": {
|
||||
"sourceCompatibility": "1.8",
|
||||
"targetCompatibility": "1.8"
|
||||
},
|
||||
"abis": [
|
||||
"armeabi-v7a","arm64-v8a","x86"
|
||||
],
|
||||
"minSdkVersion": "21",
|
||||
"useAndroidX": true,
|
||||
"permissions": [
|
||||
"android.permission.INTERNET",
|
||||
"android.permission.ACCESS_WIFI_STATE",
|
||||
"android.permission.CHANGE_NETWORK_STATE",
|
||||
"android.permission.READ_PHONE_STATE",
|
||||
"android.permission.WRITE_EXTERNAL_STORAGE",
|
||||
"android.permission.READ_EXTERNAL_STORAGE",
|
||||
"android.permission.ACCESS_NETWORK_STATE"
|
||||
],
|
||||
"parameters": {
|
||||
}
|
||||
},
|
||||
"ios": {
|
||||
"plugins": [
|
||||
{
|
||||
"type": "module",
|
||||
"name": "AliCloud-NirvanaPns",
|
||||
"class": "ATAuthSDKModule"
|
||||
}
|
||||
],
|
||||
"integrateType": "framework",
|
||||
"hooksClass": "",
|
||||
"frameworks": [
|
||||
"ATAuthSDK.framework", "YTXMonitor.framework", "YTXOperators.framework","Network.framework"
|
||||
],
|
||||
"embedFrameworks": [
|
||||
],
|
||||
"capabilities": {
|
||||
"entitlements": {
|
||||
},
|
||||
"plists": {
|
||||
}
|
||||
},
|
||||
"plists": {
|
||||
},
|
||||
"assets": [
|
||||
],
|
||||
"privacies": [
|
||||
""
|
||||
],
|
||||
"embedSwift": false,
|
||||
"deploymentTarget": "9.0",
|
||||
"validArchitectures": [
|
||||
"armv7","arm64","x86_64"
|
||||
],
|
||||
"parameters": {
|
||||
},
|
||||
"resources": [
|
||||
"ATAuthSDK.bundle"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,28 @@
|
||||
{
|
||||
"pages": [
|
||||
{
|
||||
"path": "pages/memberInfo/login",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "登录"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"path": "pages/test/test",
|
||||
"style": {
|
||||
"navigationBarTitleText": "测试页面"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"style": {
|
||||
"navigationStyle":"custom",
|
||||
"navigationBarTitleText": "健身房",
|
||||
"app-plus": {
|
||||
"animationType": "fade-in",
|
||||
"animationDuration": 200
|
||||
}
|
||||
"app-plus": {
|
||||
"animationType": "fade-in",
|
||||
"animationDuration": 200
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -34,13 +48,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/memberInfo/login",
|
||||
"style": {
|
||||
"navigationStyle": "custom",
|
||||
"navigationBarTitleText": "登录"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/memberInfo/memberCard",
|
||||
"style": {
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
<template>
|
||||
<view class="webview-container">
|
||||
<web-view :src="url" @message="handleMessage"></web-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
const url = ref('')
|
||||
|
||||
onLoad((options) => {
|
||||
if (options.url) {
|
||||
url.value = decodeURIComponent(options.url)
|
||||
}
|
||||
})
|
||||
|
||||
function handleMessage(e) {
|
||||
console.log('[webview] 收到消息:', e.detail)
|
||||
// 处理支付回调消息
|
||||
const data = e.detail.data
|
||||
if (data && data.payResult) {
|
||||
if (data.payResult === 'success') {
|
||||
// 支付成功
|
||||
uni.showToast({ title: '支付成功', icon: 'success' })
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
} else {
|
||||
uni.showToast({ title: '支付失败', icon: 'none' })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.webview-container {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
}
|
||||
</style>
|
||||
@@ -1,7 +1,7 @@
|
||||
const BASE_URL = '/api'
|
||||
// const BASE_URL = 'http://localhost:8084'
|
||||
|
||||
// 缓存相关常量
|
||||
// 缓存相关常`量
|
||||
const CACHE_PREFIX = 'API_CACHE_'
|
||||
const CACHE_EXPIRE_TIME = 5 * 60 * 1000 // 默认缓存时间5分钟
|
||||
|
||||
@@ -107,6 +107,42 @@ export const clearToken = () => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取refreshToken
|
||||
* @returns {string|null} refreshToken
|
||||
*/
|
||||
export const getRefreshToken = () => {
|
||||
try {
|
||||
return uni.getStorageSync('refreshToken') || null
|
||||
} catch (e) {
|
||||
console.error('获取refreshToken失败:', e)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置refreshToken
|
||||
* @param {string} refreshToken - refreshToken值
|
||||
*/
|
||||
export const setRefreshToken = (refreshToken) => {
|
||||
try {
|
||||
uni.setStorageSync('refreshToken', refreshToken)
|
||||
} catch (e) {
|
||||
console.error('设置refreshToken失败:', e)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除refreshToken
|
||||
*/
|
||||
export const clearRefreshToken = () => {
|
||||
try {
|
||||
uni.removeStorageSync('refreshToken')
|
||||
} catch (e) {
|
||||
console.error('清除refreshToken失败:', e)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成请求缓存键名
|
||||
* @param {string} url - 请求URL
|
||||
|
||||