86 lines
2.2 KiB
Objective-C
86 lines
2.2 KiB
Objective-C
//
|
|
// 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>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
typedef NS_ENUM (NSInteger, TapBootstrapLoginType) {
|
|
TapBootstrapLoginTypeTapTap = 0,
|
|
TapBootstrapLoginTypeApple,
|
|
TapBootstrapLoginTypeGuest
|
|
};
|
|
|
|
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;
|
|
|
|
/// 登录
|
|
/// @param type 登录类型
|
|
/// @param permissions 权限列表 (仅在taptap登录时需要)
|
|
+ (void)login:(TapBootstrapLoginType)type permissions:(NSArray *_Nullable)permissions;
|
|
|
|
/// 绑定 TapTap 账号
|
|
/// @param permissions TapTap 授权权限
|
|
+ (void)bind:(TapBootstrapBindType)type permissions:(NSArray *)permissions;
|
|
|
|
/// 获取用户基本信息
|
|
+ (void)getUser:(TapUserHandler)handler;
|
|
|
|
/// 获取用户详细信息
|
|
+ (void)getUserDetails:(TapUserDetailsHandler)handler;
|
|
|
|
/// 获取当前 token
|
|
+ (AccessToken *)getCurrentToken;
|
|
|
|
/// 退出登录
|
|
+ (void)logout;
|
|
|
|
/// 打开用户中心
|
|
+ (void)openUserCenter;
|
|
|
|
/// 设定游戏倾向语言
|
|
/// @param lang TapLanguageType 0-自动 1-简中 2-英文
|
|
+ (void)setPreferredLanguage:(TapLanguageType)lang;
|
|
|
|
/// 处理系统协议
|
|
/// @param url url
|
|
+ (BOOL)handleOpenURL:(NSURL *)url;
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|