2021-04-07 16:20:41 +08:00
|
|
|
//
|
|
|
|
// TapBootstrap.h
|
|
|
|
// TapBootstrapSDK
|
|
|
|
//
|
|
|
|
// Created by Bottle K on 2021/2/18.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#import <TapBootstrapSDK/TapLoginResultDelegate.h>
|
|
|
|
#import <TapBootstrapSDK/TapUserStatusChangedDelegate.h>
|
|
|
|
#import <TapBootstrapSDK/TapUser.h>
|
|
|
|
#import <TapBootstrapSDK/TapUserDetails.h>
|
|
|
|
#import <TapBootstrapSDK/AccessToken.h>
|
|
|
|
|
|
|
|
#import <TapCommonSDK/TapCommonSDK.h>
|
|
|
|
|
2021-04-25 13:55:07 +08:00
|
|
|
#define TapSDK @"TapSDK"
|
2021-05-14 11:21:50 +08:00
|
|
|
#define TapSDK_VERSION_NUMBER @"20101003"
|
2021-05-10 17:18:07 +08:00
|
|
|
#define TapSDK_VERSION @"2.1.1"
|
2021-04-25 13:55:07 +08:00
|
|
|
|
2021-04-07 16:20:41 +08:00
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
typedef NS_ENUM (NSInteger, TapBootstrapLoginType) {
|
|
|
|
TapBootstrapLoginTypeTapTap = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef NS_ENUM (NSInteger, TapBootstrapBindType) {
|
|
|
|
TapBootstrapBindTypeTapTap
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef void (^TapUserHandler)(TapUser *_Nullable userInfo, NSError *_Nullable error);
|
|
|
|
typedef void (^TapUserDetailsHandler)(TapUserDetails *_Nullable userDetail, NSError *_Nullable error);
|
|
|
|
|
|
|
|
@interface TapBootstrap : NSObject
|
|
|
|
|
|
|
|
+ (instancetype)new NS_UNAVAILABLE;
|
|
|
|
- (instancetype)init NS_UNAVAILABLE;
|
|
|
|
|
|
|
|
/// 初始化
|
|
|
|
/// @param config 配置项
|
|
|
|
+ (void)initWithConfig:(TapConfig *)config;
|
|
|
|
|
|
|
|
/// 当前是否初始化
|
|
|
|
+ (BOOL)isInitialized;
|
|
|
|
|
|
|
|
/// 注册登录回调
|
|
|
|
/// @param delegate 回调
|
|
|
|
+ (void)registerLoginResultDelegate:(id <TapLoginResultDelegate>)delegate;
|
|
|
|
|
|
|
|
/// 注册用户状态变化回调
|
|
|
|
/// @param delegate 回调
|
|
|
|
+ (void)registerUserStatusChangedDelegate:(id <TapUserStatusChangedDelegate>)delegate;
|
|
|
|
|
2021-04-25 13:55:07 +08:00
|
|
|
/// TapTap 登录
|
|
|
|
/// @param permissions 权限列表
|
|
|
|
+ (void)loginWithPermissions:(NSArray *_Nullable)permissions;
|
|
|
|
|
2021-04-07 16:20:41 +08:00
|
|
|
/// 登录
|
|
|
|
/// @param type 登录类型
|
|
|
|
/// @param permissions 权限列表 (仅在taptap登录时需要)
|
|
|
|
+ (void)login:(TapBootstrapLoginType)type permissions:(NSArray *_Nullable)permissions;
|
|
|
|
|
|
|
|
/// 获取用户基本信息
|
|
|
|
+ (void)getUser:(TapUserHandler)handler;
|
|
|
|
|
|
|
|
/// 获取用户详细信息
|
|
|
|
+ (void)getUserDetails:(TapUserDetailsHandler)handler;
|
|
|
|
|
|
|
|
/// 获取当前 token
|
|
|
|
+ (AccessToken *)getCurrentToken;
|
|
|
|
|
|
|
|
/// 退出登录
|
|
|
|
+ (void)logout;
|
|
|
|
|
|
|
|
/// 打开用户中心
|
|
|
|
+ (void)openUserCenter;
|
|
|
|
|
2021-04-25 13:55:07 +08:00
|
|
|
/// 获取用户是否有测试资格
|
|
|
|
/// @param handler 回调
|
|
|
|
+ (void)getTestQualification:(void (^)(BOOL isQualified, NSError *_Nullable error))handler;
|
|
|
|
|
2021-04-07 16:20:41 +08:00
|
|
|
/// 设定游戏倾向语言
|
|
|
|
/// @param lang TapLanguageType 0-自动 1-简中 2-英文
|
|
|
|
+ (void)setPreferredLanguage:(TapLanguageType)lang;
|
|
|
|
|
|
|
|
/// 处理系统协议
|
|
|
|
/// @param url url
|
|
|
|
+ (BOOL)handleOpenURL:(NSURL *)url;
|
|
|
|
@end
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|