开发版本-developer——01 first commit
This commit is contained in:
Binary file not shown.
+24
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* AliBCUserTrack.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "AlibcJSBridgeDynamicHandler.h"
|
||||
|
||||
#ifndef AliBCUserTrack_h
|
||||
#define AliBCUserTrack_h
|
||||
|
||||
@interface AliBCUserTrack : AlibcJSBridgeDynamicHandler
|
||||
+ (void)toUT:(AlibcHybridContext *)context param:(NSDictionary *)param;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* AlibcConfig.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcConfig_h
|
||||
#define AlibcConfig_h
|
||||
|
||||
/** 环境,测试和预发,只有内网有效,外部使用只能用线上环境 */
|
||||
typedef NS_ENUM (NSInteger, AlibcEnvironment) {
|
||||
/** 未定义环境 */
|
||||
AlibcEnvironmentNone = -1,
|
||||
/** 测试环境 */
|
||||
AlibcEnvironmentDaily = 0,
|
||||
/** 预发环境 */
|
||||
AlibcEnvironmentPreRelease,
|
||||
/** 线上环境 */
|
||||
AlibcEnvironmentRelease
|
||||
};
|
||||
|
||||
/** 日志级别 */
|
||||
typedef NS_ENUM (NSUInteger, AlibcLogLevel) {
|
||||
/** 调试 */
|
||||
AlibcLogLevelDebug = 0,
|
||||
/** 信息 */
|
||||
AlibcLogLevelInfo = 1,
|
||||
/** */
|
||||
AlibcLogLevelPerf = 2,
|
||||
/** 警告 */
|
||||
AlibcLogLevelWarn = 3,
|
||||
/** 错误 */
|
||||
AlibcLogLevelError = 4,
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/** 配置 */
|
||||
@interface AlibcConfig : NSObject
|
||||
/** 系统环境 */
|
||||
@property(atomic, assign) AlibcEnvironment environment;
|
||||
/** 日志级别 */
|
||||
@property(atomic, assign) AlibcLogLevel logLevel;
|
||||
/** UTDID */
|
||||
@property(atomic, strong) NSString *utdId;
|
||||
/** appKey */
|
||||
@property(atomic, strong) NSString *appKey;
|
||||
|
||||
/** 共享实例 */
|
||||
+ (instancetype)sharedConfig;
|
||||
|
||||
/** 写入插件上下文 */
|
||||
- (void)setValue:(nullable id)value forKey:(NSString *)key forModule:(NSString *)module;
|
||||
|
||||
/** 读取插件上下文 */
|
||||
- (id)valueForKey:(NSString *)key forModule:(NSString *)module;
|
||||
|
||||
- (void)setDictionary:(NSDictionary *)dic forModule:(NSString *)module;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
#endif
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* AlibcHybridContext.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#ifndef AlibcHybridContext_h
|
||||
#define AlibcHybridContext_h
|
||||
|
||||
// 成功返回
|
||||
#define MSG_RET_SUCCESS @"BC_SUCCESS"
|
||||
// JSBridge 功能关闭
|
||||
#define MSG_RET_CLOSE @"BC_CLOSED"
|
||||
// 无此服务
|
||||
#define MSG_RET_NO_HANDLER @"BC_NO_HANDLER"
|
||||
// 权限禁止
|
||||
#define MSG_RET_NO_PERMIT @"BC_NO_PERMISSION"
|
||||
// 失败返回
|
||||
#define MSG_RET_FAILED @"BC_FAILED"
|
||||
// 参数错误
|
||||
#define MSG_RET_PARAM_ERR @"BC_PARAM_ERR"
|
||||
// 发生异常
|
||||
#define MSG_RET_EXP @"BC_EXCEPTION"
|
||||
|
||||
|
||||
@interface AlibcHybridContext : NSObject
|
||||
/** 控制器 */
|
||||
@property(nonatomic, weak) UIViewController *vc;
|
||||
/** 网页 */
|
||||
@property(nonatomic, weak) UIWebView *webView;
|
||||
|
||||
- (instancetype)initWithVC:(UIViewController *)vc webView:(UIWebView *)webView requestId:(NSString *)requestId;
|
||||
|
||||
//函数执行成功,只能触发一次
|
||||
- (void)fireSuccess:(NSDictionary *)returnData;
|
||||
|
||||
//函数执行失败,只能触发一次
|
||||
- (void)fireFail:(NSString *)code;
|
||||
|
||||
//函数执行失败,只能触发一次
|
||||
- (void)fireFail:(NSString *)code msg:(NSString *)msg;
|
||||
|
||||
//函数执行失败,只能触发一次
|
||||
- (void)fireFail:(NSString *)code msg:(NSString *)msg data:(NSDictionary *)returnData;
|
||||
|
||||
//上报自定义事件,可以多次触发
|
||||
- (void)fireEvent:(NSString *)eventId data:(NSDictionary *)returnData;
|
||||
|
||||
//执行js脚本,同步
|
||||
- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* AlibcJSBridgeDynamicHandler.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "AlibcHybridContext.h"
|
||||
|
||||
#ifndef AlibcJSBridgeDynamicHandler_h
|
||||
#define AlibcJSBridgeDynamicHandler_h
|
||||
|
||||
//继承该类,并且实现一个如下格式的函数即可
|
||||
@interface AlibcJSBridgeDynamicHandler : NSObject
|
||||
//+ (void)yourFun:(AlibcHybridContext*)context param:(NSDictionary*)param;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* AlibcJSBridgeParam.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcJSBridgeParam_h
|
||||
#define AlibcJSBridgeParam_h
|
||||
|
||||
@interface AlibcJSBridgeParam : NSObject
|
||||
@property(nonatomic, copy) NSString *className;
|
||||
@property(nonatomic, copy) NSString *requestId;
|
||||
@property(nonatomic, copy) NSString *methodName;
|
||||
@property(nonatomic, copy) NSDictionary *param;
|
||||
|
||||
- (instancetype)initWithURL:(NSURL *)url;
|
||||
|
||||
- (BOOL)isDataRight;
|
||||
@end
|
||||
|
||||
@interface AlibcJSBridgeResult : NSObject
|
||||
@property(nonatomic, strong) NSString *code;
|
||||
@property(nonatomic, strong) NSString *msg;
|
||||
@property(nonatomic, strong) NSDictionary *data;
|
||||
|
||||
+ (instancetype)build:(NSDictionary *)data;
|
||||
|
||||
+ (instancetype)build:(NSString *)code message:(NSString *)message data:(NSDictionary *)data;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* AlibcJSBridgeService.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcJSBridgeService_h
|
||||
#define AlibcJSBridgeService_h
|
||||
|
||||
@class AlibcURLBusContext;
|
||||
|
||||
@interface AlibcJSBridgeService : NSObject
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
+ (BOOL)handle:(NSURLRequest *)request context:(AlibcURLBusContext *)context;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* AlibcJSON.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcJSON_h
|
||||
#define AlibcJSON_h
|
||||
|
||||
@interface AlibcJSON : NSObject
|
||||
|
||||
+ (id)jsonDataToObject:(NSData *)jsonData class:(Class)clazz;
|
||||
|
||||
+ (NSDictionary *)jsonDataToDictionary:(NSData *)jsonData;
|
||||
|
||||
+ (NSArray *)jsonDataToArray:(NSData *)jsonData;
|
||||
|
||||
+ (NSData *)objectToJsonData:(id)object;
|
||||
|
||||
|
||||
+ (id)jsonStringToObject:(NSString *)jsonString class:(Class)clazz;
|
||||
|
||||
+ (NSDictionary *)jsonStringToDictionary:(NSString *)jsonString;
|
||||
|
||||
+ (NSArray *)jsonStringToArray:(NSString *)jsonString;
|
||||
|
||||
+ (NSString *)objectToJsonString:(id)object;
|
||||
|
||||
+ (id)dictionaryToClass:(NSDictionary *)dictionary class:(Class)clazz;
|
||||
|
||||
+ (id)asJsonableObject:(id)object;
|
||||
|
||||
/**
|
||||
* 修复直接将 JSON 字符串作为 js 使用时,\u2028 和 \u2029 导致 JS 报错的问题。
|
||||
*
|
||||
* 一份额外的列表,尚未决定是否全部替换 [\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]
|
||||
*/
|
||||
+ (NSString *)fixJSON2JSBug:(NSString *)json;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* AlibcLog.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcLog_h
|
||||
#define AlibcLog_h
|
||||
|
||||
#ifdef DEBUG
|
||||
#define BCAssert(condition, info) \
|
||||
do { \
|
||||
@try { \
|
||||
if (!(condition)) { \
|
||||
if(tbim_check_debugger() == 0){ \
|
||||
TLOG_ERROR(info)\
|
||||
[NSException raise:@"Assert" format:@"%@",info];} \
|
||||
else {TLOG_ALERT(info)} \
|
||||
} \
|
||||
}\
|
||||
@catch (NSException *exception) {} \
|
||||
} while (0);
|
||||
#else
|
||||
#define BCAssert(condition, info) \
|
||||
do { \
|
||||
if (!(condition)) {TLOG_ERROR(info)}\
|
||||
} while (0);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
#define BCAssert_F(condition, frmt, ...) \
|
||||
do { \
|
||||
@try { \
|
||||
if (!(condition)) { \
|
||||
if(tbim_check_debugger() == 0){ \
|
||||
TLOG_ERROR_F(frmt,##__VA_ARGS__) \
|
||||
[NSException raise:@"Assert" format:@"Assert"];} \
|
||||
else {TLOG_ALERT_F(frmt,##__VA_ARGS__)} \
|
||||
} \
|
||||
}\
|
||||
@catch (NSException *exception) {} \
|
||||
} while (0);
|
||||
#else
|
||||
#define BCAssert_F(condition, frmt, ...) \
|
||||
do { \
|
||||
if (!(condition)) { \
|
||||
TLOG_ERROR_F(frmt,##__VA_ARGS__) \
|
||||
} \
|
||||
} while (0);
|
||||
#endif
|
||||
|
||||
#define TLOG_ALERT(info) [[AlibcLog GetInstance] showAssertAlert:__FILE__ funcName:__func__ line: __LINE__ msg:info];
|
||||
#define TLOG_ALERT_F(fmt, ...) [[AlibcLog GetInstance] showAssertAlert:__FILE__ funcName:__func__ line: __LINE__ msg:[NSString stringWithFormat:fmt, ##__VA_ARGS__]];
|
||||
|
||||
|
||||
#define TLOG_DEBUG_EMPTY [[AlibcLog GetInstance] logDebugMsg:__FILE__ funcName:__func__ line: __LINE__ msg:@""];
|
||||
#define TLOG_INFO_EMPTY [[AlibcLog GetInstance] logInfoMsg:__FILE__ funcName:__func__ line: __LINE__ msg:@""];
|
||||
#define TLOG_WARN_EMPTY [[AlibcLog GetInstance] logWarnMsg:__FILE__ funcName:__func__ line: __LINE__ msg:@""];
|
||||
#define TLOG_ERROR_EMPTY [[AlibcLog GetInstance] logErrorMsg:__FILE__ funcName:__func__ line: __LINE__ msg:@""];
|
||||
|
||||
#define TLOG_DEBUG(info) [[AlibcLog GetInstance] logDebugMsg:__FILE__ funcName:__func__ line:__LINE__ msg:info];
|
||||
#define TLOG_INFO(info) [[AlibcLog GetInstance] logInfoMsg:__FILE__ funcName:__func__ line:__LINE__ msg:info];
|
||||
#define TLOG_WARN(info) [[AlibcLog GetInstance] logWarnMsg:__FILE__ funcName:__func__ line: __LINE__ msg:info];
|
||||
#define TLOG_ERROR(info) [[AlibcLog GetInstance] logErrorMsg:__FILE__ funcName:__func__ line: __LINE__ msg:info];
|
||||
|
||||
#define TLOG_DEBUG_F(fmt, ...) [[AlibcLog GetInstance] logDebugMsg:__FILE__ funcName:__func__ line: __LINE__ msg:[NSString stringWithFormat:fmt, ##__VA_ARGS__]];
|
||||
#define TLOG_INFO_F(fmt, ...) [[AlibcLog GetInstance] logInfoMsg:__FILE__ funcName:__func__ line: __LINE__ msg:[NSString stringWithFormat:fmt, ##__VA_ARGS__]];
|
||||
#define TLOG_WARN_F(fmt, ...) [[AlibcLog GetInstance] logWarnMsg:__FILE__ funcName:__func__ line: __LINE__ msg:[NSString stringWithFormat:fmt, ##__VA_ARGS__]];
|
||||
#define TLOG_ERROR_F(fmt, ...) [[AlibcLog GetInstance] logErrorMsg:__FILE__ funcName:__func__ line: __LINE__ msg:[NSString stringWithFormat:fmt, ##__VA_ARGS__]];
|
||||
|
||||
|
||||
int tbim_check_debugger();
|
||||
|
||||
|
||||
@interface AlibcLog : NSObject
|
||||
|
||||
+ (instancetype)GetInstance;
|
||||
|
||||
- (NSString *)getLogFilePath;
|
||||
|
||||
- (void)showAssertAlert:(const char *)file funcName:(const char *)func line:(int)line msg:(NSString *)msg;
|
||||
|
||||
- (void)logDebugMsg:(const char *)file funcName:(const char *)func line:(int)line msg:(NSString *)msg;
|
||||
|
||||
- (void)logInfoMsg:(const char *)file funcName:(const char *)func line:(int)line msg:(NSString *)msg;
|
||||
|
||||
- (void)logWarnMsg:(const char *)file funcName:(const char *)func line:(int)line msg:(NSString *)msg;
|
||||
|
||||
- (void)logErrorMsg:(const char *)file funcName:(const char *)func line:(int)line msg:(NSString *)msg;
|
||||
|
||||
- (void)setDebugLogOpen:(BOOL)isDebugLogOpen;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* AlibcMonitorUtil.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef ALiMonitorUtil_h
|
||||
#define ALiMonitorUtil_h
|
||||
|
||||
#define MONITOR_MODULE @"BCTradeSDK"
|
||||
|
||||
@interface AlibcMonitorUtil : NSObject
|
||||
|
||||
+ (instancetype)shareInstance;
|
||||
|
||||
/**
|
||||
* 注册性能监控点
|
||||
@param monitor 监控点,例:@"init"
|
||||
*/
|
||||
//-(void)registMonitorPoint:(ALiMonitor*)monitor;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 记录业务操作成功接口
|
||||
*
|
||||
* @param module 模块名称,安卓iOS要相同. 命名规范:若之前埋点有页面名,则用原来的; 否则用"业务名_页面名"(无页面则"业务名"); 采用首字母大写驼峰方式. 如Shop_Detail, Shop_List
|
||||
* @param monitorPoint 监控点名称,安卓iOS要相同,从@雷曼 获取
|
||||
* @arg 附加参数,用于做横向扩展
|
||||
*/
|
||||
- (void)commitSuccessWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint arg:(NSString *)arg;
|
||||
|
||||
/**
|
||||
* 记录业务操作失败接口
|
||||
*
|
||||
* @param module 模块名称,安卓iOS要相同. 命名规范:若之前埋点有页面名,则用原来的; 否则用"业务名_页面名"(无页面则"业务名"); 采用首字母大写驼峰方式. 如Shop_Detail, Shop_List
|
||||
* @param monitorPoint 监控点名称,安卓iOS要相同,从@雷曼 获取
|
||||
* @param errorCode 错误码,若为MTOP请求则传MTOP的错误码,否则请业务方对错误进行分类编码,方便统计错误类型占比
|
||||
* @param errorMsg 错误信息,若位MTOP请求则传MTOP的错误信息, 否则请业务方自己描述错误, 方便自己查找原因
|
||||
* @arg 附加参数,用于做横向扩展
|
||||
*/
|
||||
- (void)commitFailWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint errorCode:(NSString *)errorCode errorMsg:(NSString *)errorMsg arg:(NSString *)arg;
|
||||
|
||||
|
||||
/**
|
||||
* 提交多维度,多指标
|
||||
* @param monitor 监控模块
|
||||
*/
|
||||
//-(void)commitWithMonitor:(ALiMonitor*)monitor;
|
||||
|
||||
/**
|
||||
* 开始监控
|
||||
* @param key 计算时间的标示符,不能重复
|
||||
* @return 是否加入监控,key重复,会覆盖
|
||||
*/
|
||||
//-(BOOL)beginTimeMonitor:(NSString*)key;
|
||||
|
||||
/**
|
||||
* 结束监控,清楚监控key
|
||||
* @param key ,计算时间的标示符,必须有begin,否则返回0
|
||||
* @return 返回耗时,毫秒数
|
||||
*/
|
||||
//-(NSString*)endTimeMonitor:(NSString*)key;
|
||||
|
||||
/**
|
||||
* 清除所有监控key
|
||||
*/
|
||||
//-(void)clearAllTimeMonitor;
|
||||
|
||||
/**
|
||||
* 清除指定监控key
|
||||
*/
|
||||
//-(void)clearTimeMonitor:(NSString*)key;
|
||||
|
||||
@end
|
||||
|
||||
@class AlibcTradeMonitor;
|
||||
|
||||
@protocol AlibcTradeAppMonitorAdapter <NSObject>
|
||||
|
||||
- (void)commit:(AlibcTradeMonitor *)monitor;
|
||||
|
||||
- (void)commitSuccessWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint arg:(NSString *)arg;
|
||||
|
||||
- (void)commitFailWithModule:(NSString *)module monitorPoint:(NSString *)monitorPoint errorCode:(NSString *)errorCode errorMsg:(NSString *)errorMsg arg:(NSString *)arg;
|
||||
|
||||
- (void)registerMonitor:(AlibcTradeMonitor *)monitor;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#endif /* ALiMonitorUtil_h */
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* AlibcMsgBus.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcMsgBus_h
|
||||
#define AlibcMsgBus_h
|
||||
|
||||
typedef NS_ENUM(NSInteger, MsgBusItemType) {
|
||||
MsgBusItemTypeFilter, //过滤器
|
||||
MsgBusItemTypeTop, //top监听,首先被串行通知,通知完后才通知normal
|
||||
MsgBusItemTypeNormal //普通监听,并发通知
|
||||
};
|
||||
|
||||
|
||||
@interface AlibcMsgBus : NSObject
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
- (void)registerNotify:(NSString *)eventID target:(NSObject *)target action:(SEL)action dataType:(Class)dataType mainThread:(BOOL)bMain type:(MsgBusItemType)type;
|
||||
|
||||
- (void)registerNotify:(NSString *)eventID target:(NSObject *)target action:(SEL)action dataType:(Class)dataType1 dataType:(Class)dataType2 mainThread:(BOOL)bMain type:(MsgBusItemType)type;
|
||||
|
||||
- (void)registerNotify:(NSString *)eventID target:(NSObject *)target action:(SEL)action dataType:(Class)dataType1 dataType:(Class)dataType2 dataType:(Class)dataType3 mainThread:(BOOL)bMain type:(MsgBusItemType)type;
|
||||
|
||||
|
||||
- (void)unregisterEventNotifyByTarget:(NSString *)eventID target:(NSObject *)target;
|
||||
|
||||
- (BOOL)fireEventNotify:(NSString *)eventID data:(id)data;
|
||||
|
||||
- (BOOL)fireEventNotify:(NSString *)eventID data1:(id)data1 data2:(id)data2;
|
||||
|
||||
- (BOOL)fireEventNotify:(NSString *)eventID data1:(id)data1 data2:(id)data2 data3:(id)data3;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* AlibcMsgBusHelp.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#ifndef AlibcMsgBusHelp_h
|
||||
#define AlibcMsgBusHelp_h
|
||||
|
||||
/**
|
||||
Filter和top,是串行通知,通知结束后并发通知普通notify
|
||||
**/
|
||||
|
||||
/**
|
||||
//所有notify/topNotify的action都是sel:(id)data
|
||||
//所有notify/topNotify2的action都是sel:(id)data1 data2:(id)data2
|
||||
//所有notify/topNotify3的action都是sel:(id)data1 data2:(id)data2 data3:(id)data3
|
||||
|
||||
//所有Filter的action都是sel:(id)data stop:(BOOL*)bStop
|
||||
//所有Filter2的action都是sel:(id)data1 data2:(id)data2 stop:(BOOL*)bStop
|
||||
//所有Filter3的action都是sel:(id)data1 data2:(id)data2 data3:(id)data3 stop:(BOOL*)bStop
|
||||
*/
|
||||
|
||||
#define MSGBUS_RECEIVER(eventId, function, dataclass) [self registerEventNotify:eventId action:@selector(function) dataClass:[dataclass class]];
|
||||
#define MSGBUS_RECEIVER2(eventId, function, dataclass1, dataclass2) [self registerEventNotify:eventId action:@selector(function) dataClass1:[dataclass1 class] dataClass2:[dataclass2 class]];
|
||||
#define MSGBUS_RECEIVER3(eventId, function, dataclass1, dataclass2, dataclass3) [self registerEventNotify:eventId action:@selector(function) dataClass1:[dataclass1 class] dataClass2:[dataclass2 class] dataClass3:[dataclass3 class]];
|
||||
|
||||
|
||||
#define MSGBUS_TOP_RECEIVER(eventId, function, dataclass) [self registerEventTopNotify:eventId action:@selector(function) dataClass:[dataclass class]];
|
||||
#define MSGBUS_TOP_RECEIVER2(eventId, function, dataclass1, dataclass2) [self registerEventTopNotify:eventId action:@selector(function) dataClass1:[dataclass1 class] dataClass2:[dataclass2 class]];
|
||||
#define MSGBUS__TOP_RECEIVER3(eventId, function, dataclass1, dataclass2, dataclass3) [self registerEventTopNotify:eventId action:@selector(function) dataClass1:[dataclass1 class] dataClass2:[dataclass2 class] dataClass3:[dataclass3 class]];
|
||||
|
||||
|
||||
#define MSGBUS_RECEIVER_FILTER(eventId, function, dataclass) [self registerEventFilter:eventId action:@selector(function) dataClass:[dataclass class]];
|
||||
#define MSGBUS_RECEIVER_FILTER2(eventId, function, dataclass1, dataclass2) [self registerEventFilter:eventId action:@selector(function) dataClass1:[dataclass1 class] dataClass2:[dataclass2 class]];
|
||||
#define MSGBUS_RECEIVER_FILTER3(eventId, function, dataclass1, dataclass2, dataclass3) [self registerEventFilter:eventId action:@selector(function) dataClass1:[dataclass1 class] dataClass2:[dataclass2 class] dataClass3:[dataclass3 class]];
|
||||
|
||||
|
||||
@protocol AMPMsgBusHelpProtocol <NSObject>
|
||||
|
||||
- (void)registerEventFilter:(nonnull NSString *)eventID action:(nonnull SEL)action dataClass:(nonnull Class)dataClass;
|
||||
|
||||
- (void)registerEventFilter:(nonnull NSString *)eventID action:(nonnull SEL)action dataClass1:(nonnull Class)dataClass1 dataClass2:(nonnull Class)dataClass2;
|
||||
|
||||
- (void)registerEventFilter:(nonnull NSString *)eventID action:(nonnull SEL)action dataClass1:(nonnull Class)dataClass1 dataClass2:(nonnull Class)dataClass2 dataClass3:(nonnull Class)dataClass3;
|
||||
|
||||
- (void)registerEventTopNotify:(nonnull NSString *)eventID action:(nonnull SEL)action dataClass:(nonnull Class)dataClass;
|
||||
|
||||
- (void)registerEventTopNotify:(nonnull NSString *)eventID action:(nonnull SEL)action dataClass1:(nonnull Class)dataClass1 dataClass2:(nonnull Class)dataClass2;
|
||||
|
||||
- (void)registerEventTopNotify:(nonnull NSString *)eventID action:(nonnull SEL)action dataClass1:(nonnull Class)dataClass1 dataClass2:(nonnull Class)dataClass2 dataClass3:(nonnull Class)dataClass3;
|
||||
|
||||
- (void)registerEventNotify:(nonnull NSString *)eventID action:(nonnull SEL)action dataClass:(nonnull Class)dataClass;
|
||||
|
||||
- (void)registerEventNotify:(nonnull NSString *)eventID action:(nonnull SEL)action dataClass1:(nonnull Class)dataClass1 dataClass2:(nonnull Class)dataClass2;
|
||||
|
||||
- (void)registerEventNotify:(nonnull NSString *)eventID action:(nonnull SEL)action dataClass1:(nonnull Class)dataClass1 dataClass2:(nonnull Class)dataClass2 dataClass3:(nonnull Class)dataClass3;
|
||||
|
||||
@end
|
||||
|
||||
//MSGBUG_FILTER,都是注册在专用线程上.
|
||||
//MSGBUS_RECEIVER,继承自AMPMsgBusHelp的,都是注册在专用线程上(非并发执行),
|
||||
@interface AlibcMsgBusHelp : NSObject <AMPMsgBusHelpProtocol>
|
||||
|
||||
@end
|
||||
|
||||
//继承自AMPMsgBusUIHelp的,都是注册在ui主线程上..
|
||||
@interface AlibcMsgBusUIHelp : UIViewController <AMPMsgBusHelpProtocol>
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* AlibcMtopBridge.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "AlibcConfig.h"
|
||||
|
||||
#ifndef AlibcMtopBridge_h
|
||||
#define AlibcMtopBridge_h
|
||||
|
||||
@class AlibcNetPacket;
|
||||
@class MtopError;
|
||||
@class AlibcNetError;
|
||||
|
||||
@interface AlibcMtopBridge : NSObject
|
||||
|
||||
+ (BOOL)isAvailable;
|
||||
|
||||
+ (void)openSDKSwitchLog:(BOOL)logCtr;
|
||||
|
||||
+ (void)initMtop;
|
||||
|
||||
+ (void)setEnvironment:(AlibcEnvironment)env;
|
||||
|
||||
+ (void)setTTID:(NSString *)ttid;
|
||||
|
||||
@end
|
||||
|
||||
@protocol AlibcMtopAdapter <NSObject>
|
||||
|
||||
- (void)openSDKSwitchLog:(BOOL)logCtr;
|
||||
|
||||
- (void)initMtop;
|
||||
|
||||
- (BOOL)performSend:(AlibcNetPacket *)packet;
|
||||
|
||||
- (AlibcNetError *)proccessMtopError:(MtopError *)sdkError;
|
||||
|
||||
- (BOOL)shouldRetry:(NSError *)error;
|
||||
|
||||
- (void)setTTID:(NSString *)ttid;
|
||||
|
||||
- (void)setEnvironment:(AlibcEnvironment)env;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* AlibcMtopCmd.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcMtopCmd_h
|
||||
#define AlibcMtopCmd_h
|
||||
|
||||
@interface AlibcMtopCmd : NSObject
|
||||
|
||||
@property(nonatomic, strong) NSString *_Nonnull name; // mtop命令
|
||||
@property(nonatomic, strong) NSString *_Nonnull version; //版本,默认是@"1.0"
|
||||
@property(nonatomic, assign) BOOL needLogin; //是否需要登录,默认值:NO
|
||||
@property(nonatomic, assign) BOOL needAuth; //是否需要授权,默认值:NO
|
||||
@property(nonatomic, assign) BOOL needWUA; //是否需要人机识别,默认是NO
|
||||
@property(nonatomic, assign) BOOL needPost;
|
||||
|
||||
+ (nonnull instancetype)cmd;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* AlibcMtopRequestHelp.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "AlibcMtopCmd.h"
|
||||
#import "AlibcNetError.h"
|
||||
#import "AlibcConfig.h"
|
||||
|
||||
#ifndef AlibcMtopRequestHelp_h
|
||||
#define AlibcMtopRequestHelp_h
|
||||
|
||||
//dataObj是mtop返回数据的data节点
|
||||
typedef void(^MtopRequestCallback)(AlibcNetError *_Nullable error, _Nullable id dataObj);
|
||||
|
||||
|
||||
@interface AlibcMtopRequestHelp : NSObject
|
||||
//uniqueKey长度大于0,会以cmd+uniqueKey作为值请求去重.
|
||||
//NSDictionary里面可以包含基本的array,NSDictionary,内部会自己转换成string的
|
||||
//needLogin,needAuth不填,则默认都欧式NO
|
||||
//version可以填nil,默认版本是1.0
|
||||
|
||||
+ (void)ProcessMtopRequest:(nonnull AlibcMtopCmd *)cmd
|
||||
data:(nullable NSDictionary *)dict
|
||||
complete:(nullable MtopRequestCallback)callback;
|
||||
|
||||
+ (void)ProcessMtopRequest:(nonnull AlibcMtopCmd *)cmd
|
||||
data:(nullable NSDictionary *)dict
|
||||
uniqueKey:(nullable NSString *)uniqueKey
|
||||
complete:(nullable MtopRequestCallback)callback;
|
||||
|
||||
//这个接口专给组件用的
|
||||
+ (void)ProcessMtopRequest:(nonnull NSString *)cmdName
|
||||
version:(nullable NSString *)version
|
||||
data:(nullable NSDictionary *)dict
|
||||
bizId:(nullable NSString *)bizId
|
||||
uniqueKey:(nullable NSString *)uniqueKey
|
||||
needLogin:(BOOL)needLogin
|
||||
needAuth:(BOOL)needAuth
|
||||
needWua:(BOOL)needWua
|
||||
complete:(nullable MtopRequestCallback)callback;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* AlibcMultiDelegates.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class AlibcMultiDelegateEnumerator;
|
||||
|
||||
@interface AlibcMultiDelegates<ObjectType> : NSObject
|
||||
|
||||
- (void)addDelegate:(nullable ObjectType)aDelegate;
|
||||
|
||||
- (void)removeDelegate:(nullable ObjectType)aDelegate;
|
||||
|
||||
- (void)addDelegate:(nullable ObjectType)delegate delegateQueue:(nullable dispatch_queue_t)delegateQueue;
|
||||
- (void)removeDelegate:(nullable ObjectType)delegate delegateQueue:(nullable dispatch_queue_t)delegateQueue;
|
||||
|
||||
- (void)removeAllDelegates;
|
||||
|
||||
- (NSUInteger)count;
|
||||
- (NSUInteger)countOfClass:(Class)aClass;
|
||||
- (NSUInteger)countForSelector:(SEL)aSelector;
|
||||
|
||||
- (BOOL)hasDelegateThatRespondsToSelector:(SEL)aSelector;
|
||||
|
||||
- (AlibcMultiDelegateEnumerator *)delegateEnumerator;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface AlibcMultiDelegateEnumerator : NSObject
|
||||
|
||||
- (NSUInteger)count;
|
||||
- (NSUInteger)countOfClass:(Class)aClass;
|
||||
- (NSUInteger)countForSelector:(SEL)aSelector;
|
||||
|
||||
- (BOOL)getNextDelegate:(id _Nullable * _Nullable)delegatePointer delegateQueue:(dispatch_queue_t _Nullable * _Nullable)queuePointer;
|
||||
- (BOOL)getNextDelegate:(id _Nullable * _Nullable)delegatePointer delegateQueue:(dispatch_queue_t _Nullable * _Nullable)queuePointer ofClass:(Class)aClass;
|
||||
- (BOOL)getNextDelegate:(id _Nullable * _Nullable)delegatePointer delegateQueue:(dispatch_queue_t _Nullable * _Nullable)queuePointer forSelector:(SEL)aSelector;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* AlibcNet.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcNet_h
|
||||
#define AlibcNet_h
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface AlibcNet : NSObject
|
||||
|
||||
+ (void)dataTaskWithURL:(NSURL *)url completionHandler:(void (^)(NSData *_Nullable data, NSURLResponse *_Nullable response, NSError *_Nullable error))completionHandler;
|
||||
|
||||
+ (void)dataTaskWithRequest:(NSURLRequest *)request completionHandler:(void (^)(NSData *_Nullable data, NSURLResponse *_Nullable response, NSError *_Nullable error))completionHandler;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
#endif
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* AlibcNetError.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcNetError_h
|
||||
#define AlibcNetError_h
|
||||
|
||||
@interface AlibcError : NSError
|
||||
|
||||
+ (instancetype)errorWithDomain:(NSString *)domain code:(NSInteger)code msg:(NSString *)msg;
|
||||
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT NSString *const AlibcNetErrorCodeMtopNotAvailable;
|
||||
|
||||
@interface AlibcNetError : NSObject
|
||||
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
@property(nonatomic, copy) NSString *code;
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*/
|
||||
@property(nonatomic, copy) NSString *msg;
|
||||
|
||||
/**
|
||||
* 原始错误对象
|
||||
*/
|
||||
@property(nonatomic, strong) NSError *rawError;
|
||||
|
||||
/**
|
||||
* 是否取消了登录
|
||||
*/
|
||||
@property(assign, nonatomic) BOOL isLoginCancel;
|
||||
|
||||
/**
|
||||
* 是否取消了授权
|
||||
*/
|
||||
@property(assign, nonatomic) BOOL isAuthCancel;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* AlibcNetMock.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcNetMock_h
|
||||
#define AlibcNetMock_h
|
||||
|
||||
@interface AlibcNetMock : NSObject
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
- (NSString *)getMtopMockData:(NSString *)cmd;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* AlibcNetPacket.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "AlibcNetError.h"
|
||||
|
||||
#ifndef AlibcNetPacket_h
|
||||
#define AlibcNetPacket_h
|
||||
|
||||
//*******使用须知
|
||||
//函数是给子类重载用的; block是给外部调用者设置的,子类自己不要用
|
||||
|
||||
|
||||
typedef NS_ENUM(long, ALiNetPriority) {
|
||||
ALiNetPriorityHigh = 1, //高,马上发送
|
||||
ALiNetPriorityNormal, //普通,发送任务多时,可能等待200ms(等待时可以合并请求)
|
||||
ALiNetPriorityLow, //低,等待200ms后发送,供合并请求
|
||||
};
|
||||
|
||||
typedef NS_ENUM(long, AlibcNetPacketStatus) {
|
||||
AlibcNetPacketStatusNormal = 1,//请求未处理
|
||||
AlibcNetPacketStatusSendng, //发送中
|
||||
AlibcNetPacketStatusSuccess, //请求成功
|
||||
AlibcNetPacketStatusFail, //请求失败
|
||||
};
|
||||
|
||||
typedef void (^SuccessAction)(id netData); //发送成功
|
||||
typedef void (^ErrorAction)(AlibcNetError *error); //发送失败
|
||||
|
||||
//mtop请求包头定义
|
||||
@interface AlibcNetPacketHttpHeader : NSObject
|
||||
@property(nonatomic, copy) NSString *cmd; //mtop命令
|
||||
@property(nonatomic, copy) NSString *version; //版本,默认值"1.0"
|
||||
@property(nonatomic, assign) BOOL needPost; //是否用post,默认是YES
|
||||
@property(nonatomic, assign) BOOL needLogin; //是否需要login,默认是NO
|
||||
@property(nonatomic, assign) BOOL needAuth; //是否需要授权,默认是NO
|
||||
@property(nonatomic, assign) BOOL needWua; //是否需要人机,默认是NO
|
||||
|
||||
@property(nonatomic, copy) NSString *bizId; //组件id,默认不需要填,组件发起的才需要填
|
||||
|
||||
|
||||
- (instancetype)initWithCmd:(NSString *)cmd;
|
||||
@end
|
||||
|
||||
//......
|
||||
@interface AlibcNetPacket<ObjectType> : NSObject
|
||||
@property(nonatomic, assign) NSUInteger retryTime; //发送重试次数,默认(0),不重试 最大重试5次
|
||||
@property(nonatomic, assign) ALiNetPriority priority; //默认值(AMPNetPriorityNormal)
|
||||
|
||||
//****** 下面变量,是netservice维护的, ******//
|
||||
@property(nonatomic, assign) NSUInteger retryCount; //当前是第几次重试,网络层用..子类不要动,切忌
|
||||
@property(nonatomic, assign) AlibcNetPacketStatus status;
|
||||
|
||||
//block,只供外部使用者设置,子类不要用;
|
||||
@property(nonatomic, copy) SuccessAction successAction;
|
||||
@property(nonatomic, copy) ErrorAction failAction;
|
||||
|
||||
|
||||
//**************供子类重载用的
|
||||
//Mtop发送相关
|
||||
- (AlibcNetPacketHttpHeader *)generateMtopHeader;
|
||||
|
||||
- (NSDictionary *)generateMtopBody;
|
||||
|
||||
//重试通知, 如果有需要在这里修改内部数据 ,否则不用管,retryCount是第几次(1开始)
|
||||
//retryAction时,可以改变netType,这样重试的时候,可以改变通道方式.比如第一次用accs的,重发的时候用mtop
|
||||
- (void)retryAction:(NSUInteger)retryCount;
|
||||
|
||||
//剔除sendPacke中自己已经在请求中部分.如果全部剔除完,返回YES,sendPacke会被丢弃(参考AMPBatchGetUserPacket)
|
||||
- (BOOL)filterNewPacket:(__kindof AlibcNetPacket *)sendPack;
|
||||
|
||||
//等待队列,请求合并..合并待发送的包,返回YES,sendPacke会被丢弃
|
||||
- (BOOL)conbineWaitingPacket:(__kindof AlibcNetPacket *)sendPack;
|
||||
|
||||
//打点逻辑,如果retry时每次都要打点,重载这个..一般的成功失败打点直接successAction,failAction里挂载打点即可..
|
||||
- (void)trackActionSuccess:(BOOL)isSuccess error:(AlibcNetError *)error duration:(double)durationMillisecond;
|
||||
|
||||
|
||||
//**********给子类用的辅助函数
|
||||
//是否有效,用户切换后则无效 .没事不要重载修改
|
||||
- (BOOL)isValued;
|
||||
|
||||
- (BOOL)sendPacket;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* AlibcNetServiceBase.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "AlibcNetPacket.h"
|
||||
|
||||
#ifndef AlibcNetServiceBase_h
|
||||
#define AlibcNetServiceBase_h
|
||||
|
||||
#define AMP_NET_ERROR_TIME_OUT 118
|
||||
|
||||
@interface AlibcNetServiceBase : NSObject
|
||||
@property(nonatomic, assign) NSTimeInterval timeoutSeconds;
|
||||
|
||||
- (BOOL)processPacket:(AlibcNetPacket *)packet;
|
||||
|
||||
- (void)netPacketSuccess:(AlibcNetPacket *)packet data:(id)data;
|
||||
|
||||
- (void)netPacketFail:(AlibcNetPacket *)packet error:(AlibcNetError *)error;
|
||||
|
||||
//子类重载该函数,执行真实发送 ,其他的不要乱重载
|
||||
- (BOOL)performSend:(AlibcNetPacket *)packet;
|
||||
|
||||
- (BOOL)shouldRetry:(NSError *)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* AlibcNetServiceMtop.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "AlibcNetServiceBase.h"
|
||||
|
||||
#ifndef AlibcNetServiceMtop_h
|
||||
#define AlibcNetServiceMtop_h
|
||||
|
||||
@interface AlibcNetServiceMtop : AlibcNetServiceBase
|
||||
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
|
||||
//设置是否免授权
|
||||
- (void)setIsAuthVip:(BOOL)isVip;
|
||||
|
||||
- (BOOL)isAuthVip;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* AlibcNumber.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcNumber_h
|
||||
#define AlibcNumber_h
|
||||
|
||||
@interface AlibcNumber : NSObject
|
||||
|
||||
+ (NSNumber *)stringToNumber:(NSString *)value;
|
||||
|
||||
+ (BOOL)isANumber:(NSString *)string;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* AlibcReflectionUtil.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcReflectionUtil_h
|
||||
#define AlibcReflectionUtil_h
|
||||
|
||||
@interface AlibcReflectionUtil : NSObject
|
||||
+ (id)getSharedInstance:(NSString *)className;
|
||||
|
||||
+ (id)getInstance:(NSString *)className instanceMethodName:(NSString *)instanceMethodName;
|
||||
|
||||
+ (id)executeInstanceMethod:(NSString *)methodName instance:(id)instance params:(NSArray *)params;
|
||||
|
||||
+ (id)executeClassMethod:(NSString *)methodName clazz:(Class)clazz;
|
||||
|
||||
+ (id)executeInstanceMethod:(NSString *)methodName instanceAndargs:(id)instance, ...;
|
||||
@end
|
||||
|
||||
|
||||
#define BC_MAKE_SELECTOR(var_name, sel_name) _Pragma("clang diagnostic push")\
|
||||
_Pragma("clang diagnostic ignored \"-Wundeclared-selector\"")\
|
||||
SEL var_name = @selector(sel_name);\
|
||||
_Pragma("clang diagnostic pop")
|
||||
|
||||
#define BC_FETCH_CLASS(className) [NSClassFromString(@#className) class]
|
||||
|
||||
#endif
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* AlibcSecurityGuardBridge.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcSecurityGuardBridge_h
|
||||
#define AlibcSecurityGuardBridge_h
|
||||
|
||||
@interface AlibcSecurityGuardBridge : NSObject
|
||||
|
||||
#pragma mark - Life Cycle
|
||||
|
||||
|
||||
/**
|
||||
安全模块初始化
|
||||
|
||||
@param handler callback
|
||||
*/
|
||||
+ (void)asyncInit:(void (^)(NSError *))handler;
|
||||
|
||||
#pragma mark - Info
|
||||
|
||||
|
||||
/**
|
||||
安全是否可用
|
||||
|
||||
@return 安全是否可用
|
||||
*/
|
||||
+ (BOOL)isSecurityGuardAvaleable;
|
||||
|
||||
|
||||
/**
|
||||
authCode
|
||||
|
||||
@return auth code
|
||||
*/
|
||||
+ (NSString *)authCode;
|
||||
|
||||
|
||||
/**
|
||||
获取AppKey
|
||||
|
||||
@return AppKey
|
||||
*/
|
||||
+ (NSString *)getAppKey;
|
||||
|
||||
#pragma mark - Encryption & Decryption
|
||||
|
||||
|
||||
/**
|
||||
解析混淆ID
|
||||
|
||||
@param itemId 混淆ID
|
||||
@return 明文ID
|
||||
*/
|
||||
+ (NSNumber *)analyzeItemId:(NSString *)itemId;
|
||||
|
||||
|
||||
#pragma mark - Storage
|
||||
|
||||
+ (NSString *)getString:(NSString *)key;
|
||||
|
||||
+ (int)putString:(NSString *)value forKey:(NSString *)key;
|
||||
|
||||
+ (NSData *)getData:(NSString *)key;
|
||||
|
||||
+ (int)putData:(NSData *)value forKey:(NSString *)key;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/**
|
||||
Security Adapter 协议
|
||||
*/
|
||||
@protocol AlibcSecurityAdapter <NSObject>
|
||||
|
||||
- (void)asyncInit:(void (^)(NSError *))handler;
|
||||
|
||||
#pragma mark - Info
|
||||
|
||||
- (NSString *)getAppKey;
|
||||
|
||||
#pragma mark - Encryption & Decryption
|
||||
|
||||
- (NSNumber *)analyzeItemId:(NSString *)itemId;
|
||||
|
||||
#pragma mark - Storage
|
||||
|
||||
- (NSString *)getString:(NSString *)key;
|
||||
|
||||
- (int)putString:(NSString *)value forKey:(NSString *)key;
|
||||
|
||||
- (NSData *)getData:(NSString *)key;
|
||||
|
||||
- (int)putData:(NSData *)value forKey:(NSString *)key;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* AlibcString.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcString_h
|
||||
#define AlibcString_h
|
||||
|
||||
@interface AlibcString : NSObject
|
||||
|
||||
+ (BOOL)isChinaMobileNumber:(NSString *)number;
|
||||
|
||||
+ (NSString *)fromCString:(char *)cString;
|
||||
|
||||
+ (NSString *)fromNSData:(NSData *)data;
|
||||
|
||||
+ (NSString *)fromNSData:(NSData *)data encoding:(NSStringEncoding)encoding;
|
||||
|
||||
+ (NSString *)fromProtocol:(Protocol *)protocol;
|
||||
|
||||
+ (NSString *)fromObject:(id)obj;
|
||||
|
||||
+ (NSString *)fromClass:(Class)clazz;
|
||||
|
||||
+ (NSString *)fromSelector:(SEL)selector;
|
||||
|
||||
+ (const char *)toCString:(NSString *)string;
|
||||
|
||||
+ (NSData *)toNSData:(NSString *)string;
|
||||
|
||||
+ (Protocol *)toProtocol:(NSString *)string;
|
||||
|
||||
+ (Class)toClass:(NSString *)string;
|
||||
|
||||
+ (SEL)toSEL:(NSString *)string;
|
||||
|
||||
+ (NSString *)trim:(NSString *)string;
|
||||
|
||||
+ (BOOL)hasSubString:(NSString *)string substring:(NSString *)substring;
|
||||
|
||||
+ (BOOL)isBlank:(NSString *)string;
|
||||
|
||||
+ (BOOL)isNotBlank:(NSString *)string;
|
||||
|
||||
+ (NSArray *)split:(NSString *)string sep:(NSString *)sep;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* AlibcThread.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcThread_h
|
||||
#define AlibcThread_h
|
||||
|
||||
@interface AlibcThread : NSObject
|
||||
|
||||
/**
|
||||
* 提交到主线程运行
|
||||
*/
|
||||
+ (void)foreground:(dispatch_block_t)block;
|
||||
|
||||
/**
|
||||
* 提交到后台主线程
|
||||
*/
|
||||
+ (void)backgroundMain:(dispatch_block_t)block;
|
||||
|
||||
+ (void)backgroundConcurrentTask:(dispatch_block_t)block;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* AlibcTradeBenchmarkable.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcTradeBenchmarkable_h
|
||||
#define AlibcTradeBenchmarkable_h
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
可基准化协议
|
||||
*/
|
||||
@protocol AlibcTradeBenchmarkable <NSObject>
|
||||
|
||||
/**
|
||||
基准字段值
|
||||
*/
|
||||
@property(strong, nonatomic, readonly) NSString *name;
|
||||
|
||||
/**
|
||||
基准值
|
||||
*/
|
||||
@property(strong, nonatomic, readonly) id value;
|
||||
|
||||
- (NSDictionary *)toDictionary;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - 指标
|
||||
|
||||
/**
|
||||
指标基本类
|
||||
*/
|
||||
@interface AlibcTradeMeasure : NSObject <AlibcTradeBenchmarkable>
|
||||
|
||||
/**
|
||||
指标的字段名
|
||||
*/
|
||||
@property(strong, nonatomic, readonly) NSString *name;
|
||||
|
||||
/**
|
||||
指标的对应值
|
||||
*/
|
||||
@property(strong, nonatomic, readwrite, nullable) NSNumber *value;
|
||||
|
||||
|
||||
/**
|
||||
构造方法
|
||||
|
||||
@param name 指标字段名
|
||||
@return 指标对象
|
||||
*/
|
||||
- (instancetype)initWithName:(nonnull NSString *)name;
|
||||
|
||||
/**
|
||||
@return @{ name : value }
|
||||
*/
|
||||
- (NSDictionary *)toDictionary;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - 维度
|
||||
|
||||
/**
|
||||
维度基本类
|
||||
*/
|
||||
@interface AlibcTradeDimension : NSObject <AlibcTradeBenchmarkable>
|
||||
|
||||
/**
|
||||
维度的字段名
|
||||
*/
|
||||
@property(strong, nonatomic, readonly) NSString *name;
|
||||
|
||||
/**
|
||||
维度的对应值
|
||||
*/
|
||||
@property(strong, nonatomic, readwrite, nullable) NSString *value;
|
||||
|
||||
/**
|
||||
构造方法
|
||||
|
||||
@param name 维度字段名
|
||||
@return 维度对象
|
||||
*/
|
||||
- (instancetype)initWithName:(nonnull NSString *)name;
|
||||
|
||||
/**
|
||||
@return @{ name : value }
|
||||
*/
|
||||
- (NSDictionary *)toDictionary;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
|
||||
#pragma mark - 时间指标
|
||||
|
||||
/**
|
||||
时间指标
|
||||
*/
|
||||
@interface AlibcTradeTimeMeasure : AlibcTradeMeasure
|
||||
|
||||
/**
|
||||
如果还没开始, 那么开始..
|
||||
*/
|
||||
- (void)start;
|
||||
|
||||
|
||||
/**
|
||||
没开始就开始, 开始了就重新开始..
|
||||
*/
|
||||
- (void)restart;
|
||||
|
||||
|
||||
/**
|
||||
结束并记录时长.
|
||||
*/
|
||||
- (void)stopThenRecord;
|
||||
|
||||
- (BOOL)isRecording;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* AlibcTradeCommon.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import "AlibcConfig.h"
|
||||
#import "AlibcMtopRequestHelp.h"
|
||||
#import "AlibcNetError.h"
|
||||
#import "AlibcMsgBus.h"
|
||||
#import "AlibcMsgBusHelp.h"
|
||||
#import "AlibcReflectionUtil.h"
|
||||
#import "AlibcSecurityGuardBridge.h"
|
||||
#import "AlibcMonitorUtil.h"
|
||||
#import "AlibcMtopCmd.h"
|
||||
#import "AlibcLog.h"
|
||||
#import "AlibcUT.h"
|
||||
#import "AlibcJSON.h"
|
||||
#import "AlibcURLBus.h"
|
||||
#import "AlibcWebViewEventListener.h"
|
||||
#import "AlibcTradeBenchmarkable.h"
|
||||
#import "AlibcTradeMonitor.h"
|
||||
#import "AlibcTradeInitMonitor.h"
|
||||
#import "NSString+AlibcURL.h"
|
||||
#import "AlibcUTDefine.h"
|
||||
#import "AlibcTradeCommonSDK.h"
|
||||
#import "NSDictionary+TrimNSNull.h"
|
||||
#import "AlibcMtopBridge.h"
|
||||
#import "AliBCUserTrack.h"
|
||||
#import "AlibcHybridContext.h"
|
||||
#import "AlibcJSBridgeDynamicHandler.h"
|
||||
#import "AlibcJSBridgeParam.h"
|
||||
#import "AlibcJSBridgeService.h"
|
||||
#import "AlibcNetMock.h"
|
||||
#import "AlibcNetPacket.h"
|
||||
#import "AlibcNetServiceBase.h"
|
||||
#import "AlibcNetServiceMtop.h"
|
||||
#import "AlibcNumber.h"
|
||||
#import "AlibcString.h"
|
||||
#import "AlibcThread.h"
|
||||
#import "AlibcURL.h"
|
||||
#import "AlibcWebViewDelegate.h"
|
||||
#import "AlibcWebviewHookHelp.h"
|
||||
#import "AlibcWebViewService.h"
|
||||
#import "AlibcWebViewServiceImpl.h"
|
||||
#import "NSURL+ALIURL.h"
|
||||
#import "AlibcNet.h"
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* AlibcTradeCommonSDK.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "AlibcConfig.h"
|
||||
|
||||
#ifndef AlibcTradeCommonSDK_h
|
||||
#define AlibcTradeCommonSDK_h
|
||||
|
||||
@interface AlibcTradeCommonSDK : NSObject
|
||||
/**
|
||||
* 初始化函数,初始化成功后方可正常使用SDK中的功能
|
||||
*
|
||||
* @param onSuccess 初始化成功的回调
|
||||
* @param onFailure 初始化失败的回调
|
||||
*/
|
||||
+ (void)asyncInitWithSuccess:(void (^)())onSuccess
|
||||
failure:(void (^)(NSError *error))onFailure;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface AlibcTradeCommonSDK (Settings)
|
||||
|
||||
/**
|
||||
* 设置环境
|
||||
*/
|
||||
+ (void)setEnv:(AlibcEnvironment)env;
|
||||
|
||||
/**
|
||||
* 获取当前环境对象
|
||||
*/
|
||||
+ (AlibcEnvironment)getEnv;
|
||||
|
||||
|
||||
/**
|
||||
开启 Debug 模式日志
|
||||
*/
|
||||
+ (void)setDebugLogOpen:(BOOL)isDebugLogOpen;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* AlibcTradeInitMonitor.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import "AlibcTradeCommonSDK.h"
|
||||
#import "AlibcTradeMonitor.h"
|
||||
#import "AlibcTradeBenchmarkable.h"
|
||||
|
||||
#ifndef AlibcTradeInitMonitor_h
|
||||
#define AlibcTradeInitMonitor_h
|
||||
|
||||
@interface AlibcTradeInitMonitor : AlibcTradeMonitor
|
||||
|
||||
@property(strong, nonatomic, readonly) AlibcTradeTimeMeasure *allTimeMeasure;
|
||||
|
||||
@property(strong, nonatomic, readonly) AlibcTradeTimeMeasure *utTimeMeasure;
|
||||
|
||||
@property(strong, nonatomic, readonly) AlibcTradeTimeMeasure *securityTimeMeasure;
|
||||
|
||||
@property(strong, nonatomic, readonly) AlibcTradeTimeMeasure *authTimeMeasure;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface AlibcTradeCommonSDK (AlibcTradeInitMonitor)
|
||||
|
||||
+ (void)alibc_setInitMonitor:(AlibcTradeInitMonitor *)monitor;
|
||||
|
||||
+ (AlibcTradeInitMonitor *)alibc_initMonitor;
|
||||
|
||||
+ (dispatch_group_t)alibc_initMonitorGroup;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* AlibcTradeMonitor.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcTradeMonitor_h
|
||||
#define AlibcTradeMonitor_h
|
||||
|
||||
@class AlibcTradeMeasure;
|
||||
@class AlibcTradeDimension;
|
||||
@protocol AlibcTradeBenchmarkable;
|
||||
|
||||
|
||||
/**
|
||||
性能监控器基本类
|
||||
*/
|
||||
@interface AlibcTradeMonitor : NSObject
|
||||
|
||||
/**
|
||||
监控点所在模块名
|
||||
*/
|
||||
@property(strong, nonatomic, readonly) NSString *moduleName;
|
||||
|
||||
/**
|
||||
监控点名称
|
||||
*/
|
||||
@property(strong, nonatomic, readonly) NSString *name;
|
||||
|
||||
/**
|
||||
AppKey 维度
|
||||
*/
|
||||
@property(strong, nonatomic, readonly) AlibcTradeDimension *appkeyDimension;
|
||||
|
||||
|
||||
/**
|
||||
App Version 维度
|
||||
*/
|
||||
@property(strong, nonatomic, readonly) AlibcTradeDimension *appVersionDimension;
|
||||
|
||||
/**
|
||||
SDK Version 维度
|
||||
*/
|
||||
@property(strong, nonatomic, readonly) AlibcTradeDimension *sdkVersionDimension;
|
||||
|
||||
/**
|
||||
平台指标
|
||||
*/
|
||||
@property(strong, nonatomic, readonly) AlibcTradeDimension *platformDimension;
|
||||
|
||||
- (instancetype)initWithName:(NSString *)name;
|
||||
|
||||
- (NSDictionary *)benchmarkableDataDictionary;
|
||||
|
||||
- (NSArray<id <AlibcTradeBenchmarkable>> *)allBenchmarkableData;
|
||||
|
||||
- (void)commit;
|
||||
|
||||
+ (void)registerMonitor;
|
||||
|
||||
@end
|
||||
|
||||
@interface AlibcTradeDispatchGroup : NSObject
|
||||
|
||||
@property(nonatomic, readonly) dispatch_group_t group;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* AlibcURL.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef ALiURL_h
|
||||
#define ALiURL_h
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface AlibcURL : NSObject
|
||||
|
||||
+ (NSString *)urlEncoded:(NSString *)string;
|
||||
|
||||
+ (NSString *)urlDecoded:(NSString *)string;
|
||||
|
||||
/**
|
||||
* 移除 URL 中的查询参数和 Fragment。
|
||||
*/
|
||||
+ (NSString *)urlWithoutQueryAndFragment:(NSString *)url;
|
||||
@end
|
||||
|
||||
#endif /* ALiURL_h */
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* AlibcURLBus.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "AlibcURLBusContext.h"
|
||||
|
||||
#ifndef AlibcURLBus_h
|
||||
#define AlibcURLBus_h
|
||||
|
||||
@class UIWebView;
|
||||
@class UIViewController;
|
||||
|
||||
/** 处理结果 */
|
||||
@interface AlibcURLProcessResult : NSObject
|
||||
/** 是否过滤 */
|
||||
@property(assign, nonatomic) BOOL filtered;
|
||||
/** 是否处理 */
|
||||
@property(assign, nonatomic) BOOL handled;
|
||||
/** 结果URL */
|
||||
@property(strong, nonatomic) NSURL *URL;
|
||||
@end
|
||||
|
||||
//url匹配,getUrlRule和matchUrl只需实现一个,
|
||||
@protocol AlibcURLBusMatch <NSObject>
|
||||
@optional
|
||||
//返回正则匹配表达式,会自动用正则做判断
|
||||
- (NSArray<NSString *> *)getUrlRule;
|
||||
|
||||
//返回是否匹配,匹配返回YES
|
||||
- (BOOL)matchUrl:(NSString *)url;
|
||||
@end
|
||||
|
||||
@protocol AlibcURLBusHandle <AlibcURLBusMatch>
|
||||
//返回YES,则url加载会被中断...返回NO,正常加载
|
||||
- (BOOL)handleURL:(NSURL *)url context:(AlibcURLBusContext *)context;
|
||||
|
||||
@end
|
||||
|
||||
@protocol AlibcURLBusFilter <AlibcURLBusMatch>
|
||||
//返回修改过的url,或者把参数url返回...会加载返回的url值
|
||||
- (NSURL *)filterURL:(NSURL *)url context:(AlibcURLBusContext *)context;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface AlibcURLBus : NSObject
|
||||
+ (instancetype)defaultBus;
|
||||
|
||||
|
||||
/**
|
||||
添加一个 Handle 实现
|
||||
|
||||
@param handle Handle 实例
|
||||
*/
|
||||
- (void)addHandle:(id <AlibcURLBusHandle>)handle;
|
||||
|
||||
|
||||
/**
|
||||
移除一个 Handle 实现
|
||||
|
||||
@param handle Handle 实例
|
||||
*/
|
||||
- (void)removeHandle:(id <AlibcURLBusHandle>)handle;
|
||||
|
||||
|
||||
- (void)addFilter:(id <AlibcURLBusFilter>)handle;
|
||||
|
||||
- (void)removeFilter:(id <AlibcURLBusFilter>)handle;
|
||||
|
||||
|
||||
/**
|
||||
处理URL
|
||||
@param url 原始URL
|
||||
@param context 总线上下文
|
||||
@return 是否处理
|
||||
*/
|
||||
- (BOOL)handleURL:(NSURL *)url context:(AlibcURLBusContext *)context;
|
||||
|
||||
/**
|
||||
过滤并处理URL
|
||||
@param url 原始URL
|
||||
@param context 总线上下文
|
||||
@return 处理结果
|
||||
*/
|
||||
- (AlibcURLProcessResult *)processURL:(NSURL *)url context:(AlibcURLBusContext *)context;
|
||||
|
||||
|
||||
- (BOOL)handleOpenURL:(NSURL *)url;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* AlibcURLBusContext.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface AlibcURLBusContext : NSObject
|
||||
@property(nonatomic, weak) UIWebView *webview;
|
||||
@property(nonatomic, assign) BOOL bFiltered; //标记本次加载是通过filter触发的
|
||||
@property(nonatomic, weak) UIViewController *sourceViewController;
|
||||
|
||||
@property(nonatomic, strong) NSMutableDictionary *extraData; //附加数据,各个业务可以自己塞,注意key冲突
|
||||
@property(nonatomic, strong) id tradeData; //电商业务专用附加数据
|
||||
|
||||
|
||||
- (void)setWebviewAndViewController:(UIWebView *)webview controller:(UIViewController *)vc;
|
||||
|
||||
//webview触发load事件
|
||||
- (void)setLoadWithRequest:(NSURLRequest *)request;
|
||||
|
||||
//绑定webview点击事件
|
||||
- (void)bindGesture;
|
||||
|
||||
|
||||
|
||||
|
||||
/**** 辅助函数,方便后续修改UIWebView到UIWebViewProxy的情况. ***/
|
||||
//放在这里是因为bus上的拦截到处都可以用..其实都是工具函数,为了复用
|
||||
- (void)loadRequest:(NSURLRequest *)request;
|
||||
|
||||
- (void)reload; //刷新webview
|
||||
- (void)goBack; //浏览器回退或者无堆栈时pop vc,
|
||||
- (void)popView;
|
||||
|
||||
- (void)smartGoBack;// 根据跳转类型决定是否goback,主要用在取消登陆的场景
|
||||
@end
|
||||
@@ -0,0 +1,222 @@
|
||||
/*
|
||||
* AlibcUT.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcUT_h
|
||||
#define AlibcUT_h
|
||||
|
||||
#define ALiTRADE_TRACE_TRACKER_ID @"aliTradesdk"
|
||||
|
||||
typedef NSString AlibcUTEventID;
|
||||
@class UIWebView;
|
||||
@class UIViewController;
|
||||
|
||||
FOUNDATION_EXTERN NSString *AlibcUTGlobalPropertySdkVersion;
|
||||
FOUNDATION_EXTERN NSString *AlibcUTGlobalPropertyTTID;
|
||||
|
||||
|
||||
/*
|
||||
* @brief 用于透出事件埋点
|
||||
*/
|
||||
FOUNDATION_EXTERN AlibcUTEventID *const AlibcUTEventID$2201;
|
||||
|
||||
/*
|
||||
* @brief 用于点击事件埋点
|
||||
*/
|
||||
FOUNDATION_EXTERN AlibcUTEventID *const AlibcUTEventID$2101;
|
||||
|
||||
FOUNDATION_EXTERN NSString *const AlibcUTArgsKeyYBHPSS;
|
||||
|
||||
FOUNDATION_EXTERN NSString *const AlibcUTArgsKeyYBHPSS_LABEL;
|
||||
|
||||
@interface AlibcUT : NSObject
|
||||
|
||||
|
||||
/**
|
||||
初始化 ALiUT
|
||||
*/
|
||||
+ (void)initUT;
|
||||
|
||||
|
||||
/**
|
||||
功能是否可用, 是否有 adapter 支撑功能
|
||||
|
||||
@return 是否可用
|
||||
*/
|
||||
+ (BOOL)isAvailable;
|
||||
|
||||
|
||||
/**
|
||||
是否三方ut
|
||||
|
||||
@return 是否三方ut
|
||||
*/
|
||||
+ (BOOL)isThird;
|
||||
|
||||
|
||||
/**
|
||||
添加打点记录的便捷方法
|
||||
|
||||
@param page pageName
|
||||
@param label arg1
|
||||
@param interval 无效兼容字段
|
||||
@param propertyDict args
|
||||
*/
|
||||
+ (void)addTraceLog:(NSString *)page
|
||||
label:(NSString *)label
|
||||
interval:(NSInteger)interval
|
||||
propertys:(NSDictionary *)propertyDict;
|
||||
|
||||
|
||||
/**
|
||||
添加打点记录的便捷方法
|
||||
|
||||
@param label arg1
|
||||
@param propertyDict args
|
||||
*/
|
||||
+ (void)addTraceLog:(NSString *)label propertys:(NSDictionary *)propertyDict;
|
||||
|
||||
|
||||
/**
|
||||
添加打点记录的便捷方法
|
||||
|
||||
@param label arg1
|
||||
*/
|
||||
+ (void)addTraceLog:(NSString *)label;
|
||||
|
||||
|
||||
/**
|
||||
添加打点记录的便捷方法
|
||||
|
||||
@param eventID eventID
|
||||
@param arg1 arg1
|
||||
@param args args
|
||||
*/
|
||||
+ (void)addTradeLogWithEventID:(AlibcUTEventID *)eventID arg1:(NSString *)arg1 args:(NSDictionary *)args;
|
||||
|
||||
|
||||
/**
|
||||
添加打点记录的便捷方法
|
||||
|
||||
@param trackerID trackerID
|
||||
@param eventLabel arg1
|
||||
@param properties args
|
||||
*/
|
||||
+ (void)addTrackToTracker:(NSString *)trackerID eventLabel:(NSString *)eventLabel properties:(NSDictionary *)properties;
|
||||
|
||||
|
||||
/**
|
||||
打点的标准实现
|
||||
|
||||
@param trackerID track id
|
||||
@param eventID 事件 id
|
||||
@param pageName pageName
|
||||
@param arg1 arg1 == label
|
||||
@param arg2 arg2 description
|
||||
@param arg3 arg3 description
|
||||
@param args args == propertirs
|
||||
*/
|
||||
+ (void)addTradeLog:(NSString *)trackerID
|
||||
eventID:(NSString *)eventID
|
||||
page:(NSString *)pageName
|
||||
arg1:(NSString *)arg1
|
||||
arg2:(NSString *)arg2
|
||||
arg3:(NSString *)arg3
|
||||
args:(NSDictionary *)args;
|
||||
|
||||
|
||||
/**
|
||||
供jsbridge打点
|
||||
|
||||
@param dataDict dataDict
|
||||
@param pView webView
|
||||
@param pViewController vc
|
||||
@return return value
|
||||
*/
|
||||
+ (BOOL)h5UT:(NSDictionary *)dataDict view:(UIWebView *)pView viewController:(UIViewController *)pViewController;
|
||||
|
||||
|
||||
/**
|
||||
设置 channel
|
||||
|
||||
@param channel channel
|
||||
*/
|
||||
+ (void)setChannel:(NSString *)channel;
|
||||
|
||||
|
||||
/**
|
||||
读取全局字段
|
||||
|
||||
@param key 字段名
|
||||
@return 值
|
||||
*/
|
||||
+ (NSString *)globalPropertyForKey:(NSString *)key;
|
||||
|
||||
|
||||
/**
|
||||
设置全局字段
|
||||
|
||||
@param property 值
|
||||
@param key 字段名
|
||||
*/
|
||||
+ (void)setGlobalProperty:(NSString *)property forKey:(NSString *)key;
|
||||
|
||||
@end
|
||||
|
||||
@protocol AlibcUTAdapter <NSObject>
|
||||
|
||||
#pragma mark - Initialize
|
||||
|
||||
@required
|
||||
|
||||
- (void)initWithAppkey:(NSString *)appkey;
|
||||
|
||||
|
||||
#pragma mark - Configure
|
||||
|
||||
@required
|
||||
- (void)setChannel:(NSString *)channel;
|
||||
|
||||
@required
|
||||
- (NSString *)globalPropertyForKey:(NSString *)key asTracker:(NSString *)trackerID;
|
||||
|
||||
@required
|
||||
- (void)setGlobalProperty:(NSString *)property forKey:(NSString *)key asTracker:(NSString *)trackerID;
|
||||
|
||||
|
||||
#pragma mark - Commit
|
||||
|
||||
@required
|
||||
- (void)addTradeLog:(NSString *)trackerID
|
||||
eventID:(NSString *)eventID
|
||||
page:(NSString *)pageName
|
||||
arg1:(NSString *)arg1
|
||||
arg2:(NSString *)arg2
|
||||
arg3:(NSString *)arg3
|
||||
args:(NSDictionary *)args;
|
||||
|
||||
@optional
|
||||
- (void)h5UT:(NSDictionary *)dataDict view:(UIWebView *)pView viewController:(UIViewController *)pViewController;
|
||||
|
||||
#pragma mark - Other
|
||||
|
||||
@optional
|
||||
- (BOOL)isThird;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#define AlibcNSStringify(a) @#a
|
||||
#define AlibcAppendUTSuffixUtil AlibcNSStringify(_aliTradesdk_)AlibcTradeBizSDKVersion
|
||||
|
||||
#endif
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* AlibcUTDefine.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef AlibcUTDefine_h
|
||||
#define AlibcUTDefine_h
|
||||
|
||||
#pragma mark - Common Layer
|
||||
|
||||
#define ponit_usability_pageNative @"Page_Native"//native打开链路
|
||||
#define ponit_usability_pageH5 @"Page_H5"//h5打开链路
|
||||
#define ponit_usability_mtop @"InvokeMtop"//mtop请求
|
||||
|
||||
////监控点,可用性埋点使用
|
||||
|
||||
#endif
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* AlibcWebViewDelegate.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "AlibcURLBus.h"
|
||||
|
||||
#ifndef AlibcWebViewDelegate_h
|
||||
#define AlibcWebViewDelegate_h
|
||||
|
||||
@interface AlibcWebViewDelegate : NSObject <UIWebViewDelegate>
|
||||
@property(nonatomic, weak) id <UIWebViewDelegate> originDelegate;
|
||||
@property(nonatomic, strong) AlibcURLBusContext *context;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* AlibcWebViewEventListener.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "AlibcMultiDelegates.h"
|
||||
|
||||
#ifndef AlibcWebViewEventListener_h
|
||||
#define AlibcWebViewEventListener_h
|
||||
|
||||
/**
|
||||
AlibcWebViewEventListener 协议, 添加到 AlibcWebViewEventListenerCenter 的实例需要服从这个协议
|
||||
*/
|
||||
@protocol AlibcWebViewEventListener <NSObject>
|
||||
|
||||
@optional
|
||||
|
||||
/**
|
||||
前面的参数同 - (void)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
|
||||
@param returnValue Delegate 响应时的返回值
|
||||
*/
|
||||
- (void)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType returnValue:(BOOL)returnValue;
|
||||
|
||||
/**
|
||||
WebView 开始加载
|
||||
*/
|
||||
- (void)webViewDidStartLoad:(UIWebView *)webView;
|
||||
|
||||
/**
|
||||
WebView 结束加载
|
||||
*/
|
||||
- (void)webViewDidFinishLoad:(UIWebView *)webView;
|
||||
|
||||
/**
|
||||
WebView 加载失败
|
||||
|
||||
@param error error instance
|
||||
*/
|
||||
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/**
|
||||
WebView 回调事件的监听中心
|
||||
*/
|
||||
@interface AlibcWebViewEventListenerCenter : AlibcMultiDelegates <AlibcWebViewEventListener>
|
||||
|
||||
|
||||
/**
|
||||
监听中心的默认实现
|
||||
*/
|
||||
@property(class, readonly, strong) AlibcWebViewEventListenerCenter *defaultCenter;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* AlibcWebViewService.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef AlibcWebViewService_h
|
||||
#define AlibcWebViewService_h
|
||||
|
||||
@class NSURLRequest;
|
||||
@class UIWebView;
|
||||
@class UIViewController;
|
||||
|
||||
@protocol AlibcWebViewService <NSObject>
|
||||
|
||||
- (BOOL)isAllowLoadURLRequest:(NSURLRequest *)request
|
||||
webview:(UIWebView *)webview
|
||||
sourceViewController:(UIViewController *)controller;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* AlibcWebViewServiceImpl.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "AlibcWebViewService.h"
|
||||
#import "AlibcURLBus.h"
|
||||
|
||||
#ifndef AlibcWebViewServiceImpl_h
|
||||
#define AlibcWebViewServiceImpl_h
|
||||
|
||||
@interface AlibcWebViewServiceImpl : NSObject <AlibcWebViewService>
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
- (void)bindWebviewService:(UIWebView *)webview sourceViewController:(UIViewController *)sourceViewController;
|
||||
|
||||
- (void)bindWebviewService:(UIWebView *)webview context:(AlibcURLBusContext *)context;
|
||||
|
||||
- (AlibcURLBusContext *)getContextByWebview:(UIWebView *)webview;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* AlibcWebviewHookHelp.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "AlibcURLBus.h"
|
||||
|
||||
#ifndef AlibcWebviewHookHelp_h
|
||||
#define AlibcWebviewHookHelp_h
|
||||
|
||||
@class NSURLRequest;
|
||||
@class UIViewController;
|
||||
@class UIWebView;
|
||||
@class NSURL;
|
||||
|
||||
@interface AlibcWebviewHookHelp : NSObject
|
||||
+ (nullable instancetype)sharedInstance;
|
||||
|
||||
|
||||
- (BOOL)webView:(nonnull UIWebView *)webView sourceViewController:(nonnull UIViewController *)vc shouldStartLoadWithRequest:(nonnull NSURLRequest *)request;
|
||||
|
||||
- (BOOL)webView:(nonnull UIWebView *)webView context:(nonnull AlibcURLBusContext *)context shouldStartLoadWithRequest:(nonnull NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;
|
||||
|
||||
|
||||
- (void)beforeWebViewStartLoad:(nullable NSURL *)url;
|
||||
@end
|
||||
|
||||
#endif
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* NSDictionary+TrimNSNull.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef NSDictionary_TrimNSNull_h
|
||||
#define NSDictionary_TrimNSNull_h
|
||||
|
||||
@interface NSDictionary (TrimNSNull)
|
||||
|
||||
- (id)aliObjectForKey:(id)aKey;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* NSString+AlibcURL.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef NSString_AlibcURL_h
|
||||
#define NSString_AlibcURL_h
|
||||
|
||||
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSString (AlibcURL)
|
||||
|
||||
/*!
|
||||
Parses a URL query string into a dictionary with auto encoding(UTF8 & GBK).
|
||||
@returns query dictionary
|
||||
*/
|
||||
- (NSDictionary *)aliQueryDictionaryByAutoDecoding;
|
||||
|
||||
/*!
|
||||
Parses a URL query string into a dictionary without encoding.
|
||||
@returns query dictionary
|
||||
*/
|
||||
- (NSDictionary *)aliQueryDictionary;
|
||||
|
||||
- (NSString *)aliStringByAddingURLEncodedQueryDictionary:(NSDictionary *)query;
|
||||
|
||||
// 对于 URL 中已有的 key, 保持URL中原有的 key, 不覆盖
|
||||
- (NSString *)aliStringByAddingQueryDictionary:(NSDictionary *)query;
|
||||
|
||||
- (id)aliUrlEncoded;
|
||||
|
||||
- (NSString *)aliURLDecoding;
|
||||
|
||||
- (NSString *)aliTrim;
|
||||
|
||||
/**
|
||||
* 将 k1=v1&k2=v2 形式的字符串 转换成 @{@"k1": @"v1", @"k2": @"v2"}
|
||||
* 注意: k1=&k2=%k3=v3 会生成 @{@"k1": @"", @"k2": @"", @"k3": @"v3"}
|
||||
*
|
||||
* @return query params dictionary
|
||||
*/
|
||||
- (NSMutableDictionary *)aliURLQueryStringToDictionary;
|
||||
|
||||
/**
|
||||
* 根据 Dictionary 中的内容, 生成 k1=v1&k2=v2 形式的字符串
|
||||
* 注意: 允许 k1=&k2=%k3=v3 这种有 key 无 value 的情况
|
||||
*
|
||||
* @param dictionary 如 @{@"k1": @"v1", @"k2": @"v2"}
|
||||
*
|
||||
* @return 转换生成的 dictionary 对象
|
||||
*/
|
||||
+ (instancetype)aliURLQueryStringWithDictionary:(NSDictionary *)dictionary;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* NSString_AlibcURL_h */
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* NSURL+ALIURL.h
|
||||
*
|
||||
* 阿里百川电商
|
||||
* 项目名称:阿里巴巴电商 AlibcTradeCommon
|
||||
* 版本号:3.1.1.93
|
||||
* 发布时间:2017-03-06
|
||||
* 开发团队:阿里巴巴百川商业化团队
|
||||
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
|
||||
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef NSURL_ALIURL_h
|
||||
#define NSURL_ALIURL_h
|
||||
|
||||
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSURL (ALIURL)
|
||||
|
||||
/*
|
||||
* 判断是否相同url,会比较host,path,query 以及hash参数
|
||||
*/
|
||||
- (BOOL)alibc_isSameUrl:(NSURL *)url;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* NSURL_ALIURL_h */
|
||||
@@ -0,0 +1,51 @@
|
||||
<?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>BuildMachineOSBuild</key>
|
||||
<string>16D32</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>AlibcTradeCommon</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.AlibcTradeCommon</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>AlibcTradeCommon</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.1.1.93-SNAPSHOT</string>
|
||||
<key>CFBundleSupportedPlatforms</key>
|
||||
<array>
|
||||
<string>iPhoneOS</string>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>14B72</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>iphoneos</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>10.1</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>14B72</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>iphoneos10.1</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0810</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>8B62</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>7.0</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
<array>
|
||||
<integer>1</integer>
|
||||
<integer>2</integer>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
framework module AlibcTradeCommon {
|
||||
umbrella header "AlibcTradeCommon.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
Reference in New Issue
Block a user