酷店

ALPTBLinkPartnerSDK.h 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. //
  2. // ALPTBLinkPartnerSDK.h
  3. // ALPLinkPartnerSDK
  4. //
  5. // Created by czp on 16/10/10.
  6. // Copyright © 2016年 czp. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. #import "ALPTBShopParam.h"
  11. #import "ALPTBDetailParam.h"
  12. #import "ALPTBAuthParam.h"
  13. #import "ALPTBURIParam.h"
  14. #import "ALPJumpFailedStrategy.h"
  15. #define ALPSDKVersion @"1.1.0.9"
  16. typedef NS_ENUM(NSInteger, ALPOpenType) {
  17. ALPOpenTypeNative, //跳转native打开
  18. ALPOpenTypeH5, //H5打开
  19. ALPOpenTypeBrowser //浏览器打开
  20. };
  21. typedef NS_ENUM(NSInteger, ALPConfigEnv) {
  22. ALPConfigEnvNone = -1,//未定义环境
  23. ALPConfigEnvRelease = 0,//线上环境
  24. ALPConfigEnvDaily, //测试环境
  25. ALPConfigEnvPreRelease, //预发环境
  26. };
  27. @interface ALPTBLinkPartnerSDK : NSObject
  28. /**
  29. * 初始化SDK,必须初始化SDK不然后续跳转操作将报错
  30. *
  31. * @param appKey 必传参数
  32. */
  33. + (void)initWithAppkey:(nonnull NSString *)appKey;
  34. /**
  35. * 设置debug模式打开,会有log输出
  36. *
  37. * @param on 是否打开
  38. */
  39. + (void)setDebugOn:(BOOL)on;
  40. /**
  41. * 设置开发环境,默认线上环境
  42. *
  43. * @param env 开发环境
  44. */
  45. + (void)setEnv:(ALPConfigEnv)env;
  46. /**
  47. * 设置打开页面的类型
  48. *
  49. * @param type 类型
  50. */
  51. + (void)setOpenType:(ALPOpenType)type;
  52. /**
  53. * 设置业务追踪id,仅供二方使用,其他接入无需关心
  54. *
  55. * @param ttid
  56. */
  57. + (void)setTTID:(nonnull NSString *)ttid;
  58. /**
  59. * 授权登录时必传
  60. *
  61. * @param authSecret 百川平台appSecret
  62. */
  63. + (void)setAuthSecret:(nonnull NSString *)authSecret;
  64. /**
  65. * 跳转到店铺页
  66. *
  67. * @param param 店铺的配置参数
  68. * @param strategy 跳转失败时处理策略,不传,默认h5页面打开
  69. *
  70. * @return 错误信息
  71. */
  72. + (nullable ALPError *)jumpShop:(nonnull ALPTBShopParam *)param
  73. failedStrategy:(nullable ALPJumpFailedStrategy *)strategy;
  74. /**
  75. * 跳转到商品详情页
  76. *
  77. * @param param 商品详情的配置参数
  78. * @param strategy 跳转失败时处理策略,不传,默认h5页面打开
  79. *
  80. * @return 错误信息
  81. */
  82. + (nullable ALPError *)jumpDetail:(nonnull ALPTBDetailParam *)param
  83. failedStrategy:(nullable ALPJumpFailedStrategy *)strategy;
  84. /**
  85. * 根据URI跳转,以webView的形式打开
  86. *
  87. * @param param URI的配置参数
  88. * @param strategy 跳转失败时处理策略,不传,默认h5页面打开
  89. *
  90. * @return 错误信息
  91. */
  92. + (nullable ALPError *)jumpURI:(nonnull ALPTBURIParam *)param
  93. failedStrategy:(nullable ALPJumpFailedStrategy *)strategy;
  94. /**
  95. * 授权
  96. *
  97. * @param param 授权参数,只支持淘宝授权登录,linkkey为kTaobaoLinkKey
  98. * 天猫不支持授权登录
  99. *
  100. * @return 错误信息
  101. */
  102. + (nullable ALPError *)doAuth:(nonnull ALPTBAuthParam *)param;
  103. /**
  104. * 跳转失败,是否支持默认打开手淘
  105. *
  106. * @param isSupport 是否支持
  107. */
  108. + (void)setSupportJumpFailedOpenTaobao:(BOOL)isSupport;
  109. /**
  110. * 处理linkPartner返回结果,需要在AppDelegate的[application:(UIApplication)app handleOpenURL:(NSURL*)url]中添加
  111. *
  112. * @param url 跳入打开APP的URL
  113. * @param sourceApplication 来源APP sourceApplication
  114. *
  115. * @return 是否处理该url
  116. */
  117. + (BOOL)handleOpenURL:(nonnull NSURL *)url sourceApplication:(nullable NSString *)sourceApplication;
  118. /**
  119. * 检查是否能打开指定APP
  120. *
  121. * @param linkKey 根据对应对应常量字符串来设定(kTaobaoLinkKey,kTmallLinkKey)
  122. *
  123. * @return 是否能打开APP
  124. */
  125. + (BOOL)canOpenApp:(nullable NSString*)linkKey;
  126. @end