开发版本-developer——01 first commit

This commit is contained in:
wbzhan
2019-07-08 18:24:03 +08:00
parent 5a10dfa182
commit 8693efe121
386 changed files with 7069 additions and 1951 deletions
@@ -0,0 +1,13 @@
//
// AlibabaAuthExt.h
// AlibabaAuthSDK
//
// Created by Bangzhe Liu on 9/9/16.
// Copyright © 2016 alibaba. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface AlibabaAuthExt : NSObject
@end
@@ -0,0 +1,52 @@
<?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>15G31</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>AlibabaAuthExt</string>
<key>CFBundleIdentifier</key>
<string>com.taobao.AlibabaAuthExt</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>AlibabaAuthExt</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.1.0.23-SNAPSHOT</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundleVersion</key>
<string></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>
</array>
</dict>
</plist>
@@ -0,0 +1,34 @@
//
// aluEnvConfig.h
// AliUniversalAccount
//
// Created by ethan on 12/14/15.
// Copyright © 2015 Alipay. All rights reserved.
//
#import <Foundation/Foundation.h>
/** 环境 */
typedef NS_ENUM (NSUInteger, ALBBEnvironment) {
/** 测试环境 */
ALBBEnvironmentDaily,
/** 预发环境 */
ALBBEnvironmentPreRelease,
/** 线上环境 */
ALBBEnvironmentRelease,
};
@interface ALBBEnvConfig : NSObject
@property (nonatomic, strong)NSString *additional;
+ (instancetype)shareInstance;
- (void) setGWServerSettings:(ALBBEnvironment) env;
- (BOOL) isDaily;
- (BOOL) isPre;
- (BOOL) isOnline;
- (void)setSecAdditional:(NSString *)additional;
@end
@@ -0,0 +1,99 @@
//
// AlibabaAuthSDK.h
// AlibabaAuthSDK
//
// Created by Bangzhe Liu on 6/15/16.
// Copyright © 2016 taobao. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "ALBBSession.h"
#ifndef ALBBNotificationUserLoggedIn
#define ALBBNotificationUserLoggedIn @"ALBB_NOTIFICATION_USER_LOGGED_IN"
#endif
#ifndef ALBBNotificationUserLoggedOut
#define ALBBNotificationUserLoggedOut @"ALBB_NOTIFICATION_USER_LOGGED_OUT"
#endif
#ifndef ALBBNotificationUserGiveUpLogin
#define ALBBNotificationUserGiveUpLogin @"ALBB_NOTIFICATION_USER_GIVE_UP_LOGIN"
#endif
#ifndef ALBBNotificationH5LoginDismiss
#define ALBBNotificationH5LoginDismiss @"ALBB_NOTIFICATION_H5_LOGIN_DISMISS"
#endif
#define ALBB_SDK_VERSION @"1.1.0.25"
/** 回调定义 */
typedef void (^loginSuccessCallback)(ALBBSession *session);
typedef void (^loginFailureCallback)(ALBBSession *session,NSError *error);
typedef void (^loginResultHandler)(ALBBSession *session);
/*
* 授权标记
*/
typedef enum {
H5Only = 1 ,//只拉起h5授权
NormalAuth ,//正常授权(淘宝+h5
} AuthOption;
@interface ALBBSDK : NSObject
+ (ALBBSDK *)sharedInstance;
//必须在主线程调用
- (void)ALBBSDKInit;
- (void)auth:(UIViewController *)parentController
successCallback:(loginSuccessCallback) onSuccess
failureCallback:(loginFailureCallback) onFailure;
/**
设置总的登录成功失败回调
@param handler 登录结果的处理handler,可以通过TaeSession isLogin判断当前登录态
*/
- (void)setLoginResultHandler:(void (^)(ALBBSession *session))loginResultHandler;
/**
退出登录
*/
- (void)logout;
/**
是否是登录URL
*/
- (BOOL)isLoginURL:(NSString *)url;
/**
是否是登出URL
*/
- (BOOL)isLogoutUrl:(NSString *)url;
/**
是否是手淘跳回url
*/
- (BOOL)isTBBackUrl:(NSString *)url;
/**
手淘跳转回来,拿到url调用
@return (BOOL) 调用是否成功
*/
- (void)loginByURL:(NSURL *)url;
//如果是接入的极简版本需要手动设置appkey
- (void)setAppkey : (NSString *)appKey;
- (void)openDebugLog;
- (void)setUUID:(NSString *)uuid;
//种本地cookie,初始化已经自动种过,目前供微博使用,微博有清除cookie逻辑,之后需要把登录cookie种回来
- (void)loadCookies;
- (void)setAuthOption:(AuthOption)authOption;
@end
@@ -0,0 +1,32 @@
//
// ALBBSession.h
// AlibabaAuthSDK
//
// Created by Bangzhe Liu on 6/17/16.
// Copyright © 2016 taobao. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ALBBUser.h"
@interface ALBBSession : NSObject
@property(nonatomic, assign)BOOL isCanceledByUser;
@property(nonatomic, copy)NSString* bindCode;
/**
@return 返回单例
*/
+ (ALBBSession *)sharedInstance;
/**
如果未登录或者登录态已经过期,返回NO
@return 当前会话是否登录有效
*/
- (BOOL)isLogin;
/**
@return 返回User对象
*/
- (ALBBUser *)getUser;
@end
@@ -0,0 +1,27 @@
//
// ALBBUser.h
// AlibabaAuthSDK
//
// Created by Bangzhe Liu on 6/17/16.
// Copyright © 2016 taobao. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ALBBUser : NSObject
/** 昵称 */
@property (nonatomic, copy, readonly) NSString *nick;
/** 头像地址 */
@property (nonatomic, copy, readonly) NSString *avatarUrl;
@property (nonatomic, copy, readonly) NSString *openId;
@property (nonatomic, copy, readonly) NSString *openSid;
@property (nonatomic, copy, readonly) NSString *topAccessToken;
@property (nonatomic, copy, readonly) NSString *topAuthCode;
- (instancetype)initWithNick:(NSString *)nick avatarUrl:(NSString *)avatarUrl openId:(NSString *)openId openSid:(NSString *)openSid topAccessToken:(NSString *)topAccessToken topAuthCode:(NSString*)authCode;
- (NSString *)ALBBUserDescription;
@end
@@ -0,0 +1,52 @@
<?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>15G31</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>AlibabaAuthSDK</string>
<key>CFBundleIdentifier</key>
<string>com.taobao.AlibabaAuthSDK</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>AlibabaAuthSDK</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.1.0.24-SNAPSHOT</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundleVersion</key>
<string></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>
</array>
</dict>
</plist>
Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

@@ -0,0 +1,23 @@
{
"iosAppLinkConfig": {
"exp" : 600,
"degradeType" : 0,
"canDeepLink" : 0,
"appScheme":{
"taobao" : "tbopen://m.taobao.com/tbopen/index.html",
"tmall" : "tmall://page.tm/appLink",
},
"h5Scheme":{
"detail":"https://h5.m.taobao.com/awp/core/detail.htm",
"shop":"https://shop.m.taobao.com/shop/shopIndex.htm",
"activity":"https://huodong.m.taobao.com/go/2085.html",
},
"dynamicParam":{
"k1":"v1"
},
"downloadUrl":{
"taobao":"https://itunes.apple.com/cn/app/tao-bao-sui-shi-sui-xiang/id387682726?mt=8",
"tmall":"https://itunes.apple.com/cn/app/tian-mao-zhi-bo-gou-wu-xin/id518966501?mt=8"
}
}
}
@@ -0,0 +1,14 @@
//
// ALPAuthPlugin.h
// ALPLinkPartnerSDK
//
// Created by czp on 16/10/26.
// Copyright © 2016年 czp. All rights reserved.
//
#import "ALPBasePlugin.h"
@interface ALPAuthPlugin : ALPBasePlugin
@end
@@ -0,0 +1,98 @@
//
// ALPBasePlugin.h
// ALPLinkPartnerSDK
//
// Created by czp on 16/9/26.
// Copyright © 2016年 czp. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ALPBasePluginParam.h"
@protocol ALPBasePluginProtocol <NSObject>
@required
/**
* 定义对应的匹配规则,与跳入或跳出的URL进行匹配,判断插件是否执行
*
* @return 匹配规则
*/
- (NSArray<NSString*> *)pluginRules;
/**
* 插件通用协议
*
* @param param 通用参数
* @param block 插件处理完回调
*/
- (void)pluginService:(ALPBasePluginParam *)param;
@end
typedef NS_ENUM(NSInteger, ALPLinkPartnerPrior) {
ALPLinkPartnerPriorLow = -2,
ALPLinkPartnerPriorDefault = 0,
ALPLinkPartnerPriorHigh = 2,
};
typedef NS_ENUM(NSInteger, ALPPluginEvent) {
//触发FC中页面分发插件
ALPPluginNav,
//触发FC中授权登录插件
ALPPluginAuth
};
//基础插件,即非自定义插件
//根据这个key可以从插件容器取出Auth 插件
FOUNDATION_EXTERN NSString *const kAuthPluginKey;
@interface ALPBasePlugin : NSObject<ALPBasePluginProtocol>
/**
* 是否是打断型插件(该插件执行,后面的插件不执行)
*/
@property (nonatomic, assign) BOOL isBreak;
/**
* 插件调用优先级,自定义插件可设置,非自定义(Auth 插件)插件已设置,无需再设置
*/
@property (nonatomic, assign) ALPLinkPartnerPrior prior;
/**
* 用于指定触发FC中页面分发还是授权登录时机的对应插件,非自定义(Auth 插件)插件已设置,无需再设置
*/
@property (nonatomic, assign) ALPPluginEvent event;
/**
* 插件对应的key,自定义插件可设置,非自定义(Auth 插件)插件已设置,无需再设置
*/
@property (nonatomic, copy) NSString *pluginKey;
/**
* 创建插件对象
*
* @param pluginKey 插件对应的key
*
* @return 插件对象
*/
+ (instancetype)initPluginWitKey:(NSString *)key;
/**
* 初始化插件,供提供的非自定义(Auth 插件)插件调用,key已经设定
*
* @return 插件
*/
+ (instancetype)initPlugin;
/**
* 根据APP被唤起的URL,判断是否匹配到插件来执行
*
* @param url APP被唤起的URL
*
* @return 是否匹配
*/
- (BOOL)isMatchInPluginWithURL:(NSURL *)url;
@end
@@ -0,0 +1,15 @@
//
// ALPBasePluginParam.h
// ALPLinkPartnerSDK
//
// Created by czp on 16/9/26.
// Copyright © 2016年 czp. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ALPBasePluginParam : NSObject
@property (nonatomic, strong) NSURL *url;
@end
@@ -0,0 +1,32 @@
//
// ALPError.h
// ALPLinkPartnerSDK
//
// Created by czp on 16/9/22.
// Copyright © 2016年 czp. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, LinkPartnerErrorType)
{
LINKPARTNER_ERROR_NOT_INIT = 1,//没有初始化
LINKPARTNER_ERROR_PARAM_MISSING = 2,//跳转参数缺失
LINKPARTNER_ERROR_LINKKEY_ERROR = 3,//错误的linkKey,没有关联对应的URL
LINKPARTNER_ERROR_ITEMID_ILLEGAL = 4,//参数非法,例如itemId为空或含有非数字字符
LINKPARTNER_ERROR_SHOPID_ILLEGAL = 5,//同上 shoopID非法
LINKPARTNER_ERROR_H5HURL_ILLEGAL = 6,//URL非法法, 必须为URL格式 例如http://www.taobao.com
LINKPARTNER_ERROR_SIGN_MISSING = 7,//sign缺失,未设置黑匣子,或者appSecret缺失
LINKPARTNER_ERROR_NOT_INSTALL = 8,//跳转APP未安装
LINKPARTNER_ERROR_DEGRADE_URL_NIL = 9,//降级地址为空,未配置降级地址
LINKPARTNER_ERROR_DOWNLOAD_URL_NIL = 10//下载页地址为空,未配置下载页地址
};
@interface ALPError : NSObject
@property (nonatomic, assign) LinkPartnerErrorType errorCode;
+ (instancetype)initWithErrorType:(LinkPartnerErrorType)errorType;
@end
@@ -0,0 +1,31 @@
//
// ALPJumpFailedStrategy.h
// AlibcLinkPartnerSDK
//
// Created by czp on 16/11/24.
// Copyright © 2016年 czp. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, ALPJumpFailedMode)
{
ALPJumpFailedModeOpenH5 = 0,//降级到h5(默认)
ALPJumpFailedModeOpenDownloadPage = 1,//跳转到下载页
ALPJumpFailedModeOpenBrowser = 2,//跳转到浏览器
ALPJumpFailedModeOpenNone = 3 //不处理返回错误信息
};
@interface ALPJumpFailedStrategy : NSObject
/**
* 跳转失败处理(可选),不设置默认跳转失败,H5页面打开
*/
@property (nonatomic, assign) ALPJumpFailedMode failedMode;
/**
* 跳转失败H5页面打开时,自定义webview,如果不设置,将用默认webview打开
*/
@property (nonatomic, strong) UIWebView *webview;
@end
@@ -0,0 +1,52 @@
//
// ALPJumpParam.h
// ALPLinkPartnerSDK
//
// Created by czp on 16/9/22.
// Copyright © 2016年 czp. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ALPError.h"
//对应的linkKey
FOUNDATION_EXTERN NSString *const kTaobaoLinkKey; //打开淘宝
FOUNDATION_EXTERN NSString *const kTmallLinkKey; //打开天猫
@interface ALPJumpParam : NSObject
/**
* 优先拉起的applink协议key,linkKey为空,默认是拉起手淘
*/
@property (nonatomic, copy) NSString *linkKey;
/**
* 返回的跳转地址(可选)
*/
@property (nonatomic, copy) NSString *backURL;
/**
* 跳转时当前页面,用于坑位统计
*/
@property (nonatomic, copy) NSString *currentViewName;
/**
* 额外参数(可选)
*/
@property (nonatomic, strong) NSMutableDictionary *extraParam;
- (ALPError *)isLegalParam;
/**
* 跳转是未安装跳转APP,对应的降级地址
*/
- (NSString *)degradeToH5Url;
@end
@@ -0,0 +1,58 @@
//
// ALPPluginManager.h
// ALPLinkPartnerSDK
//
// Created by czp on 16/9/26.
// Copyright © 2016年 czp. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ALPBasePlugin.h"
@interface ALPPluginManager : NSObject
+ (nonnull instancetype)shareInstance;
/**
* 添加插件,同一类型的插件只能添加一次
*
* @param plugin 插件
*
* @return 添加插件是否成功
*/
- (BOOL)addPlugin:(nonnull ALPBasePlugin *)plugin;
/**
* 根据插件类型移除插件
*
* @param key 插件类对应的key
*
* @return 是否移除插件成功
*/
- (BOOL)removePluginWithKey:(nonnull NSString *)key;
/**
* 根据插件类型查找插件
*
* @param key 插件类对应的key
*
* @return 对应插件
*/
- (nullable ALPBasePlugin *)searchPluginWithKey:(nonnull NSString *)key;
/**
* 删除所有插件
*
*/
- (void)clearPlugins;
/**
* 所有插件
*
* @return 所有插件
*/
- (nullable NSArray *)plugins;
@end
@@ -0,0 +1,14 @@
//
// ALPTBAuthParam.h
// ALPLinkPartnerSDK
//
// Created by czp on 16/9/22.
// Copyright © 2016年 czp. All rights reserved.
//
#import "ALPTBJumpParam.h"
@interface ALPTBAuthParam : ALPTBJumpParam
@end
@@ -0,0 +1,26 @@
//
// ALPTBDetailParam.h
// ALPLinkPartnerSDK
//
// Created by czp on 16/9/22.
// Copyright © 2016年 czp. All rights reserved.
//
#import "ALPTBJumpParam.h"
@interface ALPTBDetailParam : ALPTBJumpParam
/**
* itemId,要跳转到的商品
*/
@property (nonatomic, strong) NSString *itemId;
/**
* 初始化,itemId(必传)
*
* @param itemId
*/
-(instancetype)initWithItemId:(NSString *)itemId;
@end
@@ -0,0 +1,20 @@
//
// ALPTBJumpParam.h
// ALPLinkPartnerSDK
//
// Created by czp on 16/10/10.
// Copyright © 2016年 czp. All rights reserved.
//
#import "ALPJumpParam.h"
@interface ALPTBJumpParam : ALPJumpParam
/**
* 模块,h5detailshopauth;不需要改动
*/
@property (nonatomic, copy) NSString *module;
@end
@@ -0,0 +1,146 @@
//
// ALPTBLinkPartnerSDK.h
// ALPLinkPartnerSDK
//
// Created by czp on 16/10/10.
// Copyright © 2016年 czp. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "ALPTBShopParam.h"
#import "ALPTBDetailParam.h"
#import "ALPTBAuthParam.h"
#import "ALPTBURIParam.h"
#import "ALPJumpFailedStrategy.h"
#define ALPSDKVersion @"1.1.0.9"
typedef NS_ENUM(NSInteger, ALPOpenType) {
ALPOpenTypeNative, //跳转native打开
ALPOpenTypeH5, //H5打开
ALPOpenTypeBrowser //浏览器打开
};
typedef NS_ENUM(NSInteger, ALPConfigEnv) {
ALPConfigEnvNone = -1,//未定义环境
ALPConfigEnvRelease = 0,//线上环境
ALPConfigEnvDaily, //测试环境
ALPConfigEnvPreRelease, //预发环境
};
@interface ALPTBLinkPartnerSDK : NSObject
/**
* 初始化SDK,必须初始化SDK不然后续跳转操作将报错
*
* @param appKey 必传参数
*/
+ (void)initWithAppkey:(nonnull NSString *)appKey;
/**
* 设置debug模式打开,会有log输出
*
* @param on 是否打开
*/
+ (void)setDebugOn:(BOOL)on;
/**
* 设置开发环境,默认线上环境
*
* @param env 开发环境
*/
+ (void)setEnv:(ALPConfigEnv)env;
/**
* 设置打开页面的类型
*
* @param type 类型
*/
+ (void)setOpenType:(ALPOpenType)type;
/**
* 设置业务追踪id,仅供二方使用,其他接入无需关心
*
* @param ttid
*/
+ (void)setTTID:(nonnull NSString *)ttid;
/**
* 授权登录时必传
*
* @param authSecret 百川平台appSecret
*/
+ (void)setAuthSecret:(nonnull NSString *)authSecret;
/**
* 跳转到店铺页
*
* @param param 店铺的配置参数
* @param strategy 跳转失败时处理策略,不传,默认h5页面打开
*
* @return 错误信息
*/
+ (nullable ALPError *)jumpShop:(nonnull ALPTBShopParam *)param
failedStrategy:(nullable ALPJumpFailedStrategy *)strategy;
/**
* 跳转到商品详情页
*
* @param param 商品详情的配置参数
* @param strategy 跳转失败时处理策略,不传,默认h5页面打开
*
* @return 错误信息
*/
+ (nullable ALPError *)jumpDetail:(nonnull ALPTBDetailParam *)param
failedStrategy:(nullable ALPJumpFailedStrategy *)strategy;
/**
* 根据URI跳转,以webView的形式打开
*
* @param param URI的配置参数
* @param strategy 跳转失败时处理策略,不传,默认h5页面打开
*
* @return 错误信息
*/
+ (nullable ALPError *)jumpURI:(nonnull ALPTBURIParam *)param
failedStrategy:(nullable ALPJumpFailedStrategy *)strategy;
/**
* 授权
*
* @param param 授权参数,只支持淘宝授权登录,linkkey为kTaobaoLinkKey
* 天猫不支持授权登录
*
* @return 错误信息
*/
+ (nullable ALPError *)doAuth:(nonnull ALPTBAuthParam *)param;
/**
* 跳转失败,是否支持默认打开手淘
*
* @param isSupport 是否支持
*/
+ (void)setSupportJumpFailedOpenTaobao:(BOOL)isSupport;
/**
* 处理linkPartner返回结果,需要在AppDelegate的[application:(UIApplication)app handleOpenURL:(NSURL*)url]中添加
*
* @param url 跳入打开APP的URL
* @param sourceApplication 来源APP sourceApplication
*
* @return 是否处理该url
*/
+ (BOOL)handleOpenURL:(nonnull NSURL *)url sourceApplication:(nullable NSString *)sourceApplication;
/**
* 检查是否能打开指定APP
*
* @param linkKey 根据对应对应常量字符串来设定(kTaobaoLinkKey,kTmallLinkKey)
*
* @return 是否能打开APP
*/
+ (BOOL)canOpenApp:(nullable NSString*)linkKey;
@end
@@ -0,0 +1,26 @@
//
// ALPTBShopParam.h
// ALPLinkPartnerSDK
//
// Created by czp on 16/9/22.
// Copyright © 2016年 czp. All rights reserved.
//
#import "ALPTBJumpParam.h"
@interface ALPTBShopParam : ALPTBJumpParam
/**
* shopId,要跳转到的店铺
*/
@property (nonatomic, strong) NSString *shopId;
/**
* 初始化,shopId必传
*
* @param shopId
*/
-(instancetype)initWithShopId:(NSString *)shopId;
@end
@@ -0,0 +1,23 @@
//
// ALPTBURIParam.h
// ALPLinkPartnerSDK
//
// Created by czp on 16/9/22.
// Copyright © 2016年 czp. All rights reserved.
//
#import "ALPTBJumpParam.h"
@interface ALPTBURIParam : ALPTBJumpParam
/**
* 要跳转到的H5页面的url
*/
@property (nonatomic, strong) NSString *uri;
/**
* 初始化,传入h5URL
*/
- (instancetype)initWithURI:(NSString *)URI;
@end
@@ -0,0 +1,53 @@
<?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>14F27</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>AlibcLinkPartnerSDK</string>
<key>CFBundleIdentifier</key>
<string>com.alibaba.baichuan.linkPartner</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>AlibcLinkPartnerSDK</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.1.0.7-SNAPSHOT</string>
<key>CFBundleSignature</key>
<string>????</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>13C75</string>
<key>DTPlatformName</key>
<string>iphoneos</string>
<key>DTPlatformVersion</key>
<string>9.2</string>
<key>DTSDKBuild</key>
<string>13C75</string>
<key>DTSDKName</key>
<string>iphoneos9.2</string>
<key>DTXcode</key>
<string>0720</string>
<key>DTXcodeBuild</key>
<string>7C68</string>
<key>MinimumOSVersion</key>
<string>7.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
</dict>
</plist>
Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

@@ -0,0 +1,23 @@
{
"iosAppLinkConfig": {
"exp" : 600,
"degradeType" : 0,
"canDeepLink" : 0,
"appScheme":{
"taobao" : "tbopen://m.taobao.com/tbopen/index.html",
"tmall" : "tmall://page.tm/appLink",
},
"h5Scheme":{
"detail":"https://h5.m.taobao.com/awp/core/detail.htm",
"shop":"https://shop.m.taobao.com/shop/shopIndex.htm",
"activity":"https://huodong.m.taobao.com/go/2085.html",
},
"dynamicParam":{
"k1":"v1"
},
"downloadUrl":{
"taobao":"https://itunes.apple.com/cn/app/tao-bao-sui-shi-sui-xiang/id387682726?mt=8",
"tmall":"https://itunes.apple.com/cn/app/tian-mao-zhi-bo-gou-wu-xin/id518966501?mt=8"
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1011 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

@@ -0,0 +1,53 @@
/*
* AlibcAlipayBridge.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "UIKit/UIKit.h"
#ifndef AlibcAlipayBridge_h
#define AlibcAlipayBridge_h
/** 支付结果 */
@interface AlibcTradePayResult : NSObject
/** 支付成功订单 */
@property(nonatomic, copy, nullable, readonly) NSArray *paySuccessOrders;
/** 支付失败订单 */
@property(nonatomic, copy, nullable, readonly) NSArray *payFailedOrders;
@end
@interface AlibcAlipayBridge : NSObject
@property(nonatomic, copy, nullable) NSArray<NSString *> *orderIds;
+ (nonnull instancetype)sharedInstance;
+ (BOOL)isAlipayAvaleable;
+ (BOOL)isPaymentSuccess:(nullable NSDictionary *)payment;
/** 支付订单 */
- (void)payOrder:(nonnull NSString *)order scheme:(nonnull NSString *)scheme callback:(nullable void (^)(NSDictionary *__nullable result))callback;
/** 支付结果 */
- (void)receiptURL:(nullable NSURL *)url callback:(nullable void (^)(NSDictionary *__nullable result))callback;
/** 解析支付结果 */
- (void)processPayment:(NSDictionary *__nullable)payment callback:(nullable void (^)(AlibcTradePayResult *__nullable result, NSError *__nullable error))callback;
@end
#endif //AlibcAlipayBridge_h
@@ -0,0 +1,26 @@
/*
* AlibcAuthService.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AlibcHintProtocol.h"
#ifndef ALiAuthService_h
#define ALiAuthService_h
@interface AlibcAuthService : NSObject
+ (nonnull instancetype)sharedInstantce;
- (void)installHintService:(nonnull id <AlibcHintProtocol>)hint;
@end
#endif //ALiAuthService_h
@@ -0,0 +1,25 @@
/*
* AlibcChannelModule.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#ifndef ALiChannelModule_h
#define ALiChannelModule_h
#import <Foundation/Foundation.h>
//添加umpChannel u_channel isvCode,ybhpss,ttid参数
@interface AlibcChannelModule : NSObject
+ (void)addChannelParam:(NSMutableDictionary *)param;
@end
#endif /* ALiChannelModule_h */
@@ -0,0 +1,72 @@
/*
* AlibcConfigService.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import "AlibcTradeTaokeParams.h"
#ifndef AlibcConfigService_h
#define AlibcConfigService_h
#define YBHPSS @"ybhpss" //全链路打通数据参数
@interface AlibcConfigService : NSObject
+ (instancetype)sharedConfig;
- (void)updateConfig;
/*包含ttid的拼装规则*/
@property(nonatomic, readonly) NSString *ttid;
@property(nonatomic, strong) NSString *isvVersion;
@property(nonatomic, copy, readwrite) NSString *channelName;
@property(nonatomic, copy, readwrite) NSString *channelType;
@property(nonatomic, readonly) NSString *channel;
@property(nonatomic, assign) BOOL isForceH5;
// TODO:
@property(nonatomic, strong) NSString *alipayRequestSender;
//全局淘客参数
@property(nonatomic, strong) AlibcTradeTaokeParams *taokeParams;
/* isvCodetag*/
@property(atomic, strong) NSString *isvCode;
/** 系统版本信息,SDK版本 */
@property(atomic, copy) NSString *systemVersion;
//淘客打点是否使用同步换url的方式
- (BOOL)isSyncForTaoke;
//是否检测WebView支付. 如果安装了支付宝且检测支付, 使用支付宝应用完成支付; 否则, 使用WebView完成支付. 默认YES.
- (BOOL)isNeedAlipayNativeForPay;
//设置是否检测WebView支付
- (void)setNeedAlipayNativeForPay:(BOOL)need;
//是否登陆降级(不触发登陆了)
- (BOOL)isLoginDegarade;
//设置是否同步打点
- (void)setIsSyncForTaoke:(BOOL)isSync;
//双11强制降级配置
- (NSString *)double11OpenType;
//存储所有需要isv设置的配置
- (void)setIsvConfig:(id)value forKey:(NSString *)key;
- (NSString *)isvConfigForKey:(NSString *)key;
- (void)setExtUserAgent:(NSString *)extUserAgent;
- (NSString *)extUserAgent;
@end
#endif //AlibcConfigService_h
@@ -0,0 +1,25 @@
/*
* AlibcHintProtocol.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#ifndef ALiHintProtocal_h
#define ALiHintProtocal_h
@protocol AlibcHintProtocol <NSObject>
//根据bizid返回组件的全量权限点
- (NSArray<NSString *> *)getHintList:(NSString *)bizID;
//上报组件返回的权限点有缺失
- (void)reportHintLost:(NSString *)bizID hintId:(NSString *)hintId;
@end
#endif /* ALiMtopHintProtocol_h */
@@ -0,0 +1,123 @@
/*
* AlibcLinkPartnerBridge.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#import <Foundation/Foundation.h>
#ifndef AlibcNativeFailMode_Enum
#define AlibcNativeFailMode_Enum
/**
拉起手淘失败后的处理策略
- AlibcNativeFailModeJumpH5: 当拉起手淘/天猫失败, 则在 webview 中跳转对应 H5 页面; 默认选项
- AlibcNativeFailModeJumpDownloadPage: 当拉起手淘/天猫失败, 则跳转对应 App 下载页面
- AlibcNativeFailModeJumpBrowser: 当拉起手淘/天猫失败, 则在浏览器中跳转对应 H5 页面
- AlibcNativeFailModeNone: 当拉起手淘/天猫失败, 不做额外操作
*/
typedef NS_ENUM(NSInteger, AlibcNativeFailMode) {
AlibcNativeFailModeJumpH5 = 0,
AlibcNativeFailModeJumpDownloadPage = 1,
AlibcNativeFailModeJumpBrowser = 2,
AlibcNativeFailModeNone = 3,
};
#endif
#ifndef ALiApplinkBridge_h
#define ALiApplinkBridge_h
NS_ASSUME_NONNULL_BEGIN
@class AlibcError;
@class AlibcTradeTaokeParams;
@interface AlibcLinkPartnerBridge : NSObject
/**
* 初始化
@param appkey appkey
*/
+ (void)initWithAppkey:(nonnull NSString *)appkey;
/**
* 尝试跳转详情页
@param itemID Item ID
@param params 参数
@param failMode 跳转失败处理策略
@param taoKeParams 淘客参数
@return 跳转错误对象
*/
+ (nullable AlibcError *)tryJumpToDetail:(NSString *)itemID
params:(nullable NSDictionary *)params
failMode:(AlibcNativeFailMode)failMode
taokeParams:(nullable AlibcTradeTaokeParams *)taoKeParams;
/**
* 尝试跳转店铺页
@param shopID shopID
@param params 参数
@param failMode 跳转失败处理策略
@param taoKeParams 淘客参数
@return 跳转错误对象
*/
+ (nullable AlibcError *)tryJumpToShop:(NSString *)shopID
params:(nullable NSDictionary *)params
failMode:(AlibcNativeFailMode)failMode
taokeParams:(nullable AlibcTradeTaokeParams *)taoKeParams;
/**
* 尝试跳转指定网页
@param url URL String
@param params 参数
@param failMode 跳转失败处理策略
@param taoKeParams 淘客参数
@return 跳转错误对象
*/
+ (nullable AlibcError *)tryJumpToURL:(NSString *)url
params:(nullable NSDictionary *)params
failMode:(AlibcNativeFailMode)failMode
taokeParams:(nullable AlibcTradeTaokeParams *)taoKeParams;
/**
* 处理 URL 跳转
@param url url
@param sourceApplication sourceApplication
@param options options
@return handle or not
*/
+ (BOOL)handleOpenURL:(NSURL *)url
sourceApplication:(nullable NSString *)sourceApplication
options:(nullable NSDictionary<NSString *, id> *)options;
/**
* 在天猫未安装导致天猫打开失败时, 尝试打开手淘
@param enable enable
*/
+ (void)enableOpenTaobaoWhenTmallNotInstalled:(BOOL)enable;
@end
NS_ASSUME_NONNULL_END
#endif //ALiApplinkBridge_h
@@ -0,0 +1,69 @@
/*
* AlibcLoginBridge.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#ifndef AlibcLoginBridge_h
#define AlibcLoginBridge_h
@interface AlibcLoginBridge : NSObject
/**
登录模块标准初始化接口
*/
+ (void)initLogin;
/**
登录模块极简版初始化接口
@brief 极简版没有依赖安全模块, 需要手动传入 Appkey
@param appkey appkey
*/
+ (void)initLoginWithAppkey:(NSString *)appkey;
+ (BOOL)isLoginSvrAvaleable;
+ (void)showLogin:(UIViewController *)parentController
successCallback:(void (^)(NSString *userID))onSuccess
failedCallback:(void (^)(NSError *error))onFailure;
+ (void)logout;
+ (void)setEnvironment:(AlibcEnvironment)env;
/**
是否是登陆URL
*/
+ (BOOL)isLoginURL:(NSString *)url;
/**
是否是登出URL
*/
+ (BOOL)isLogoutUrl:(NSString *)url;
/**
是否是手淘跳回url
*/
+ (BOOL)isTBBackUrl:(NSString *)url;
/**
手淘跳转回来,拿到url调用
*/
+ (void)loginByURL:(NSURL *)url;
@end
#endif
@@ -0,0 +1,37 @@
/*
* AlibcTokenService.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#import <Foundation/Foundation.h>
#ifndef AlibcTokenService_h
#define AlibcTokenService_h
typedef void(^TokenRequestCallback)(NSError *_Nullable error, NSString *_Nullable dataObj);
@interface AlibcTokenService : NSObject
@property(nonatomic, strong) NSString *_Nullable token;
@property(nonatomic, strong) NSDate *_Nullable expire;
@property(nonatomic, strong) NSDate *_Nullable lastUpdate;
+ (nonnull instancetype)sharedInstantce;
- (nullable NSString *)getLocalToken;
- (void)setTokenInvalid;
- (void)getRemoteToken:(nonnull NSArray<NSString *> *)list callBack:(nonnull TokenRequestCallback)callBack;
@end
#endif
@@ -0,0 +1,47 @@
/*
* AlibcTrackParams.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#import <Foundation/Foundation.h>
#ifndef AlibcTrackParams_h
#define AlibcTrackParams_h
@interface AlibcTrackParams : NSObject
/**必填: 供计算效果用,由推荐模块输出内容后,曝光埋点使用 */
@property(nonatomic, strong) NSString *scm;
/**必填: 供计算效果用,由推荐模块输出内容后,曝光埋点使用 */
@property(nonatomic, strong) NSString *pvid;
/**必填: 三方app的用户识别id,用于百川识别该用户行为并对推荐效果进行优化 */
@property(nonatomic, strong) NSString *puid;
/** 三方app页面名称*/
@property(nonatomic, strong) NSString *page;
/** 三方app控件名称 */
@property(nonatomic, strong) NSString *label;
/*
* trackParam 参数key说明
*/
#define track_scm @"scm"
#define track_pvid @"pvid"
#define track_isv_code @"isv_code"
/**
* 生成Dictionary
*/
- (NSDictionary *)toDictionary;
+ (NSString *)ybhpssStringForDictionary:(NSDictionary *)params;
@end
#endif
@@ -0,0 +1,43 @@
/*
* AlibcTradeBiz.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#import <UIKit/UIKit.h>
//! Project version number for AlibcTradeBiz.
FOUNDATION_EXPORT double AlibcTradeBizVersionNumber;
//! Project version string for AlibcTradeBiz.
FOUNDATION_EXPORT const unsigned char AlibcTradeBizVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <AlibcTradeBiz/PublicHeader.h>
#ifndef AlibcTradeBiz_h
#define AlibcTradeBiz_h
#import "AlibcTradeEnv.h"
#import "AlibcHintProtocol.h"
#import "AlibcAuthService.h"
#import "AlibcTradeError.h"
#import "AlibcConfigService.h"
#import "AlibcAlipayBridge.h"
#import "AlibcTrackParams.h"
#import "AlibcTradeBizSDK.h"
#import "AlibcLinkPartnerBridge.h"
#import "AlibcTradeTaokeParams.h"
#import "AlibcChannelModule.h"
#import "AlibcTradeBizEvent.h"
#import "AlibcWebViewController.h"
#import "AlibcUserAgent.h"
#import "AlibcTokenService.h"
#import "AlibcLoginBridge.h"
#endif
@@ -0,0 +1,42 @@
/*
* AlibcTradeBizEvent.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#import <Foundation/Foundation.h>
#ifndef AlibcTradeBizEvent_h
#define AlibcTradeBizEvent_h
//核心事件监听类,事件的监听和上报都通过ALiMsgBus触发
//目前包含登陆,支付事件的触发上报,
//登陆成功
#define ALIBCBIZLOGINSUCCESS @"ALI.BC.Biz.LoginSuccess"
//-(void)alibcLoginSUccess:(ALBBSession *)session
//登陆失败
#define ALIBCBIZLOGINFAIL @"ALI.BC.Biz.LoginFail"
//-(void)alibcLoginFail:(NSError *)error
//支付成功
#define ALIBCBIZLPAYSUCCESS @"ALI.BC.Biz.PaySuccess"
//-(void)alibcPaySuccess:(AlibcTradePayResult *)result context:(ALiURLBusContext*)context
//支付失败
#define ALIBCBIZLPAYFAIL @"ALI.BC.Biz.PayFail"
//-(void)alibcPayFail:(NSError *)error context:(ALiURLBusContext*)context
//webview被关闭
#define ALIBCBIZWEBVIEWCLOSE @"ALI.BC.Biz.WebviewClose"
//-(void)alibcWebviewClose:(ALiURLBusContext*)context
#endif
@@ -0,0 +1,60 @@
/*
* AlibcTradeBizSDK.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <AlibcTradeCommon/AlibcTradeCommon.h>
#ifndef AlibcTradeBizSDK_h
#define AlibcTradeBizSDK_h
#define AlibcTradeBizSDKVersion @"3.1.1.96"
@interface AlibcTradeBizSDK : NSObject
/**
* 初始化函数,初始化成功后方可正常使用SDK中的功能
*
* @param onSuccess 初始化成功的回调
* @param onFailure 初始化失败的回调
*/
+ (void)asyncInitWithSuccess:(void (^)())onSuccess
failure:(void (^)(NSError *error))onFailure;
@end
@interface AlibcTradeBizSDK (Settings)
/**
* 设置环境
*/
+ (void)setEnv:(AlibcEnvironment)env;
/**
开启/关闭 Debug 模式日志
@param isDebugLogOpen 开启/关闭
*/
+ (void)setDebugLogOpen:(BOOL)isDebugLogOpen;
/**
上层需要运行时获取 SDK Version 时,可以使用这个接口获取
@return AlibcTradeBizSDKVersion
*/
+ (NSString *)getSDKVersion;
@end
#endif //AlibcTradeBizSDK_h
@@ -0,0 +1,49 @@
/*
* AlibcTradeEnv.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#import <Foundation/Foundation.h>
#ifndef ALiTradeEnv_h
#define ALiTradeEnv_h
NS_ASSUME_NONNULL_BEGIN
/** 地址 */
@interface AlibcTradeEnv : NSObject
/** 真实ID商品详情页地址 */
+ (nullable NSString *)itemURLWithItemType:(NSInteger)itemType itemID:(NSString *)itemID;
/** 迷你商品详情页地址 */
+ (nullable NSString *)miniItemURLWithItemID:(NSString *)itemID;
/** 直接加购页地址 */
+ (nullable NSString *)addCardURL:(NSString *)itemID;
/** 购物车地址 */
+ (nullable NSString *)cartURL;
/** 我的订单地址 */
+ (nullable NSString *)myOrdersURLWithTabCode:(NSString *)tabCode condition:(nullable NSString *)condition;
/** 店铺页地址 */
+ (nullable NSString *)shopURLWithShopID:(nonnull NSString *)shopID;
/** 淘宝首页 */
+ (nullable NSString *)taobaoHomeURL;
/** 配置服务端host地址(营造维护) */
+ (nullable NSString *)configServerHost;
@end
NS_ASSUME_NONNULL_END
#endif //ALiTradeEnv_h
@@ -0,0 +1,36 @@
/*
* AlibcTradeError.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#ifndef AlibcError_h
#define AlibcError_h
#import <Foundation/Foundation.h>
/** 交易错误码 */
typedef NS_ENUM (NSUInteger, AlibcTradeError) {
/** 交易链路失败 */
AlibcErrorProcessFailed = 3001,
/** 交易链路中用户取消了操作 */
AlibcErrorCancelled = 3002,
/** 交易链路中发生支付但是支付失败 */
AlibcErrorPaymentFailed = 3003,
/** itemId无效 */
AlibcErrorInvalidItemID = 3004,
/** page url为空 */
AlibcErrorNullPageURL = 3005,
/** shopId无效 */
AlibcErrorInvalidShopID = 3006,
};
extern NSString *const AlibcTradeErrorDomain;
#endif /* AlibcError_h */
@@ -0,0 +1,36 @@
/*
* AlibcTradeTaokeParams.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#import <Foundation/Foundation.h>
#ifndef AlibcTradeTaokeParams_h
#define AlibcTradeTaokeParams_h
/**
* 统一的 key 写法
*/
static NSString *const AlibcTradeTaokeParamsPid = @"pid";
static NSString *const AlibcTradeTaokeParamsUnionID = @"unionId";
static NSString *const AlibcTradeTaokeParamsSubPid = @"subpid";
/** 淘客参数 */
@interface AlibcTradeTaokeParams : NSObject
/** 淘客ID */
@property(nonatomic, copy) NSString *pid;
/** */
@property(nonatomic, copy) NSString *unionId;
/** */
@property(nonatomic, copy) NSString *subPid;
@end
#endif
@@ -0,0 +1,31 @@
/*
* AlibcUserAgent.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#import <Foundation/Foundation.h>
#ifndef AlibcUserAgent_h
#define AlibcUserAgent_h
FOUNDATION_EXPORT NSString *AlibcUserAgentContextKeyWebView;
@interface AlibcUserAgent : NSObject
/** 装载
* !!!: 需要主线程调用
* */
+ (void)install:(NSDictionary *)context;
/** 卸载 */
+ (void)uninstall:(NSDictionary *)context;
@end
#endif
@@ -0,0 +1,23 @@
/*
* AlibcWebViewController.h
*
* 阿里百川电商
* 项目名称:阿里巴巴电商 AlibcTradeBiz
* 版本号:3.1.1.96
* 发布时间:2017-03-24
* 开发团队:阿里巴巴百川商业化团队
* 阿里巴巴电商SDK答疑群号:1229144682(阿里旺旺)
* Copyright (c) 2016-2019 阿里巴巴-移动事业群-百川. All rights reserved.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#ifndef AlibcWebViewController_h
#define AlibcWebViewController_h
@interface AlibcWebViewController : UIViewController <UIWebViewDelegate>
@property(strong, nonatomic) UIWebView *webView;
@end
#endif
@@ -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>AlibcTradeBiz</string>
<key>CFBundleIdentifier</key>
<string>com.AlibcTradeBiz</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>AlibcTradeBiz</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.1.1.96-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>
@@ -0,0 +1,6 @@
framework module AlibcTradeBiz {
umbrella header "AlibcTradeBiz.h"
export *
module * { export * }
}
@@ -0,0 +1,61 @@
<?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>StringsTable</key>
<string>Root</string>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>Group</string>
</dict>
<dict>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>Title</key>
<string>Name</string>
<key>Key</key>
<string>name_preference</string>
<key>DefaultValue</key>
<string></string>
<key>IsSecure</key>
<false/>
<key>KeyboardType</key>
<string>Alphabet</string>
<key>AutocapitalizationType</key>
<string>None</string>
<key>AutocorrectionType</key>
<string>No</string>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Enabled</string>
<key>Key</key>
<string>enabled_preference</string>
<key>DefaultValue</key>
<true/>
</dict>
<dict>
<key>Type</key>
<string>PSSliderSpecifier</string>
<key>Key</key>
<string>slider_preference</string>
<key>DefaultValue</key>
<real>0.5</real>
<key>MinimumValue</key>
<integer>0</integer>
<key>MaximumValue</key>
<integer>1</integer>
<key>MinimumValueImage</key>
<string></string>
<key>MaximumValueImage</key>
<string></string>
</dict>
</array>
</dict>
</plist>
Binary file not shown.

After

Width:  |  Height:  |  Size: 765 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

@@ -0,0 +1,22 @@
{
"group0": {
"dataId": "com.alibaba.baichuan.nbcp.meta.default",
"group": "1.0.0",
"lastUpdate": "Jun 14, 2016 2:12:22 PM",
"sign": ""
},
"albbTradeConfig": {
"isSyncForTaoke": "YES",
"isForceH5": "NO",
"isNeedAlipay": "YES",
"loginDegarade": "NO",
"double11OpenType":"0",
"sampling":"10000"
},
"group2": {
"abc1": "agc1",
"abc2": "agc2",
"abc3": "agc3",
"11111":"11111"
}
}
@@ -0,0 +1,16 @@
{
"Release": {
"trade.tmallTradeItemUrlHost": "https://detail.m.tmall.com/item.htm",
"trade.taobaoMobileTradeItemUrlHost": "https://h5.m.taobao.com/awp/core/detail.htm",
"trade.myOrdersUrl": "https://h5.m.taobao.com/mlapp/olist.html",
"trade.shopUrlHost": "https://shop.m.taobao.com/shop/shop_index.htm",
"trade.cartUrl": "https://h5.m.taobao.com/mlapp/cart.html",
"trade.taobaoHomeUrl": "https://h5.m.taobao.com",
"trade.taobaoTradeItemMiniUrlHost": "https://h5.m.taobao.com/trade/detail.html",
"trade.taobaoTradeItemUrlHost": "https://h5.m.taobao.com/cm/snap/index.html"
},
"PreRelease": {
},
"Daily": {
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -0,0 +1,33 @@
Pod::Spec.new do |s|
s.platform = :ios
s.ios.deployment_target = '5.0'
s.name = 'OpenMtopSDK'
s.version = "1.6.1.17-SNAPSHOT"
s.summary = '淘宝MTOPSDK'
s.description = 'MTOP SDK for IOS'
s.homepage = 'http://gitlab.alibaba-inc.com/wireless/mtopsdk'
s.license = {
:type => 'Copyright',
:text => <<-LICENSE
Alibaba-Inc copyright
LICENSE
}
s.requires_arc = true
s.authors = {'苍至'=>'silu.msl@taobao.com'}
s.frameworks = 'UIKit', 'Foundation'
s.dependency 'UTDID'
s.dependency 'UTDID'
s.dependency 'SecurityGuardSDK'
s.dependency 'SGMain'
s.dependency 'SGSecurityBody'
s.dependency 'SGNoCaptcha'
s.source = { :git=>"git@gitlab.alibaba-inc.com:wireless/opensdk.git", :commit=> "d81fd09" }
#s.exclude_files = exclude_files+networksdk_no_arc_files
s.source_files = 'MtopSDK/*.{h,m,c,mm}'
end
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 */
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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

Some files were not shown because too many files have changed in this diff Show More