feat: 自定义插件的更新
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
//
|
||||
// ACMConfig.h
|
||||
// ATAuthSDK
|
||||
//
|
||||
// Created by 刘超的MacBook on 2020/5/19.
|
||||
// Copyright © 2020. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ACMUploadInterface.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(NSInteger, ACMMonitorUploadType) {
|
||||
ACMMonitorUploadTypeRealTime, //实时上传,暂时不支持,如果采用这个方式将以默认的轮询上传实现
|
||||
ACMMonitorUploadTypeCirculate, //轮询上传
|
||||
ACMMonitorUploadTypeManual //手动上传
|
||||
};
|
||||
|
||||
@interface ACMConfig : NSObject
|
||||
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
/// 日志是否入库,默认NO
|
||||
@property (atomic, assign) BOOL loggerIsSaveInDB;
|
||||
/// 埋点是否入库,默认YES
|
||||
@property (atomic, assign) BOOL monitorIsSaveInDB;
|
||||
/// 日志是否上传,默认NO
|
||||
@property (atomic, assign) BOOL loggerIsUpload;
|
||||
/// 埋点是否上传,默认YES
|
||||
@property (atomic, assign) BOOL monitorIsUpload;
|
||||
|
||||
/// 日志埋点组件上传type,默认 ACMMonitorUploadTypeManual
|
||||
@property (nonatomic, assign) ACMMonitorUploadType uploadType;
|
||||
/// 日志埋点组件上传代理对象,注:这里是弱引用,组件外面需要保证该上传对象不要被释放,如果被释放掉将影响日志埋点的上传
|
||||
@property (nonatomic, weak) id<ACMProtocol> uploadDelegate;
|
||||
|
||||
/// 更新日志埋点组件限流信息
|
||||
- (void)setLimitConfig:(NSDictionary *)info;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -1,33 +1,47 @@
|
||||
//
|
||||
// ACMLogger.h
|
||||
// Monitor
|
||||
//
|
||||
// Created by Vienta on 2019/11/13.
|
||||
//
|
||||
|
||||
#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
|
||||
|
||||
+ (BOOL)verboseRecord:(id)obj;
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
+ (BOOL)debugRecord:(id)obj;
|
||||
/// 日志是否入库,默认不入库
|
||||
@property (nonatomic, assign) BOOL enterDatabase;;
|
||||
|
||||
+ (BOOL)infoRecord:(id)obj;
|
||||
|
||||
+ (BOOL)warnRecord:(id)obj;
|
||||
|
||||
+ (BOOL)errorRecord:(id)obj;
|
||||
/// 日志是否允许上传,默认不上传
|
||||
@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)uploadLoggerRecordsWithStartDate:(NSDate * _Nullable)startDate endDate:(NSDate * _Nullable)endDate levels:(NSArray <NSString *>* _Nullable)levels;
|
||||
- (void)uploadLoggersWithLevels:(NSArray <NSString *>* _Nullable)levels
|
||||
startDate:(NSDate * _Nullable)startDate
|
||||
endDate:(NSDate * _Nullable)endDate;
|
||||
|
||||
/**
|
||||
* 上传失败的日志,一般放在重启应用后
|
||||
*/
|
||||
- (void)uploadFailedRecords;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
73
Libs/YTXMonitor.framework/Headers/ACMManager.h
Normal file
73
Libs/YTXMonitor.framework/Headers/ACMManager.h
Normal file
@@ -0,0 +1,73 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ACMLogger.h"
|
||||
#import "ACMMonitor.h"
|
||||
#import "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
|
||||
@@ -1,34 +1,54 @@
|
||||
//
|
||||
// ACMMonitor.h
|
||||
// Monitor
|
||||
//
|
||||
// Created by Vienta on 2019/11/13.
|
||||
//
|
||||
|
||||
#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
|
||||
|
||||
/**
|
||||
* 上传非实时埋点
|
||||
* @param obj 埋点内容
|
||||
* @return 埋点存储结果
|
||||
*/
|
||||
+ (BOOL)monitorRecord:(id)obj;
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/// 埋点是否入库,默认入库
|
||||
@property (nonatomic, assign) BOOL enterDatabase;;
|
||||
|
||||
/// 埋点是否允许上传,默认上传
|
||||
@property (nonatomic, assign) BOOL isAllowUpload;
|
||||
|
||||
/**
|
||||
* 上传实时埋点
|
||||
* @param obj 埋点内容
|
||||
* @return 埋点上传准备结果
|
||||
* 非实时埋点入库
|
||||
* @param obj 埋点具体内容
|
||||
*/
|
||||
+ (BOOL)monitorRealtimeRecord:(id)obj;
|
||||
- (BOOL)monitor:(id)obj;
|
||||
|
||||
/**
|
||||
* 开始手动上传,在设置uploadType为ACMMonitorUploadManual时生效
|
||||
* 实时埋点入库
|
||||
* @param obj 埋点的具体内容
|
||||
*/
|
||||
+ (void)uploadMonitorByManual;
|
||||
- (BOOL)monitorRealtime:(id)obj;
|
||||
|
||||
/**
|
||||
* 手动触发埋点上传,只上传未上传过的埋点
|
||||
*/
|
||||
- (void)uploadMonitorByManual;
|
||||
|
||||
/**
|
||||
* 上传失败的埋点,一般放在重启应用后
|
||||
*/
|
||||
- (void)uploadFailedRecords;
|
||||
|
||||
/**
|
||||
* 删除埋点
|
||||
* @param type 删除类型
|
||||
* @param block 结果的异步回调
|
||||
*/
|
||||
- (void)deleteRecordsByType:(ACM_DELETE_TYPE)type block:(void (^)(BOOL))block;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
17
Libs/YTXMonitor.framework/Headers/ACMProtocol.h
Normal file
17
Libs/YTXMonitor.framework/Headers/ACMProtocol.h
Normal file
@@ -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
|
||||
@@ -1,25 +0,0 @@
|
||||
//
|
||||
// ACMUploadInterface.h
|
||||
// Monitor
|
||||
//
|
||||
// Created by 沈超 on 2019/12/17.
|
||||
//
|
||||
|
||||
@protocol ACMProtocol <NSObject>
|
||||
|
||||
@required
|
||||
/**
|
||||
* 埋点聚合上传(包括轮询和手动)
|
||||
* @param monitors 需要上传的埋点信息
|
||||
* @return 上传是否成功,建议上传采用同步策略
|
||||
*/
|
||||
- (BOOL)uploadMonitors:(NSArray<NSDictionary *> *)monitors;
|
||||
|
||||
/**
|
||||
* 日志上传
|
||||
* @param logContents 需要上传的日志
|
||||
* @return 上传是否成功,建议上传采用同步策略
|
||||
*/
|
||||
- (BOOL)uploadLogs:(NSArray<NSDictionary *> *)logContents;
|
||||
|
||||
@end
|
||||
@@ -1,26 +0,0 @@
|
||||
//
|
||||
// ACMUploadManager.h
|
||||
// Monitor
|
||||
//
|
||||
// Created by Vienta on 2019/11/13.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface ACMUploadManager : NSObject
|
||||
|
||||
/**
|
||||
* 上传失败的数据,同时会上传埋点和日志的数据,如果有降级限流的情况,最好是在设置完成相应的降级接口(setACMLoggerEnable:和 setACMMonitorEnable)之后调用
|
||||
*/
|
||||
+ (void)uploadFailedData;
|
||||
|
||||
/**
|
||||
* 业务层配置降级限流
|
||||
*/
|
||||
+ (void)setLimitConfig:(NSDictionary *)info;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -1,22 +1,3 @@
|
||||
//
|
||||
// YTXMonitor.h
|
||||
// YTXMonitor
|
||||
//
|
||||
// Created by li yang on 2020/11/23.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for YTXMonitor.
|
||||
FOUNDATION_EXPORT double YTXMonitorVersionNumber;
|
||||
|
||||
//! Project version string for YTXMonitor.
|
||||
FOUNDATION_EXPORT const unsigned char YTXMonitorVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <YTXMonitor/PublicHeader.h>
|
||||
|
||||
#import "ACMLogger.h"
|
||||
#import "ACMMonitor.h"
|
||||
#import "ACMConfig.h"
|
||||
#import "ACMUploadInterface.h"
|
||||
#import "ACMUploadManager.h"
|
||||
#import "ACMManager.h"
|
||||
#import "ACMProtocol.h"
|
||||
|
||||
Binary file not shown.
34
Libs/YTXMonitor.framework/PrivacyInfo.xcprivacy
Normal file
34
Libs/YTXMonitor.framework/PrivacyInfo.xcprivacy
Normal file
@@ -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>
|
||||
Binary file not shown.
Reference in New Issue
Block a user