开发版本-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
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>