/
TUILogin.h
153 lines (120 loc) · 3.64 KB
/
TUILogin.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// Created by Tencent on 2023/06/09.
// Copyright © 2023 Tencent. All rights reserved.
/**
* TUILogin
* This module is mainly responsible for the login logic of IM and TRTC
*/
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
typedef void (^TFail)(int code, NSString * __nullable msg);
typedef void (^TSucc)(void);
typedef NS_ENUM(NSInteger, TUILogLevel) {
/**
* < Do not output any SDK logs
*/
TUI_LOG_NONE = 0,
/**
* < Output logs at the DEBUG, INFO, WARNING, and ERROR levels
*/
TUI_LOG_DEBUG = 3,
/**
* < Output logs at the INFO, WARNING, and ERROR levels
*/
TUI_LOG_INFO = 4,
/**
* < Output logs at the WARNING and ERROR levels
*/
TUI_LOG_WARN = 5,
/**
* < Output logs at the ERROR level
*/
TUI_LOG_ERROR = 6,
};
/**
* Status in different kinds of business scene
*/
typedef NS_ENUM(NSInteger, TUIBusinessScene) {
None = 0,
InRecording = 1,
InCallingRoom = 2,
InMeetingRoom = 3,
InLivingRoom = 4,
};
/**
* Notification for log-in succeed
*/
FOUNDATION_EXTERN NSString *const TUILoginSuccessNotification;
/**
* Notification for log-in failed
*/
FOUNDATION_EXTERN NSString *const TUILoginFailNotification;
/**
* Notification for log-out succeed
*/
FOUNDATION_EXTERN NSString *const TUILogoutSuccessNotification;
/**
* Notification for log-out failed
*/
FOUNDATION_EXTERN NSString *const TUILogoutFailNotification;
@protocol TUILoginListener <NSObject>
/**
* Callback that the SDK is connecting to the server
*/
- (void)onConnecting;
/**
* Callback that the SDK has successfully connected to the server
*/
- (void)onConnectSuccess;
/**
* Callback for SDK connection to server failure
*/
- (void)onConnectFailed:(int)code err:(NSString * __nullable)err;
/**
* The callback of the current user being kicked off, the user can be prompted on the UI at this time, and the login() function of V2TIMManager can be called
* again to log in again.
*/
- (void)onKickedOffline;
/**
* The callback of the login credentials expired when online, you need to generate a new userSig and call the login() function of V2TIMManager again to log in
* again.
*/
- (void)onUserSigExpired;
@end
@interface TUILoginConfig : NSObject
@property(nonatomic, assign) TUILogLevel logLevel;
@property(nonatomic, copy, nullable) void (^onLog)(NSInteger logLevel, NSString * __nullable logContent);
@end
@interface TUILogin : NSObject
+ (void)initWithSdkAppID:(int)sdkAppID __attribute__((deprecated("use login:userID:userSig:succ:fail:")));
+ (void)login:(NSString *)userID
userSig:(NSString *)userSig
succ:(__nullable TSucc)succ
fail:(__nullable TFail)fail __attribute__((deprecated("use login:userID:userSig:succ:fail:")));
+ (void)login:(int)sdkAppID
userID:(NSString *)userID
userSig:(NSString *)userSig
succ:(__nullable TSucc)succ
fail:(__nullable TFail)fail;
+ (void)login:(int)sdkAppID
userID:(NSString *)userID
userSig:(NSString *)userSig
config:(TUILoginConfig * __nullable)config
succ:(__nullable TSucc)succ
fail:(__nullable TFail)fail;
+ (void)logout:(__nullable TSucc)succ
fail:(__nullable TFail)fail;
+ (void)addLoginListener:(id<TUILoginListener>)listener;
+ (void)removeLoginListener:(id<TUILoginListener>)listener;
+ (int)getSdkAppID;
+ (BOOL)isUserLogined;
+ (NSString * __nullable)getUserID;
+ (NSString * __nullable)getUserSig;
+ (NSString * __nullable)getNickName;
+ (NSString * __nullable)getFaceUrl;
/**
* No-thread-safe
*/
+ (void)setCurrentBusinessScene:(TUIBusinessScene)scene;
+ (TUIBusinessScene)getCurrentBusinessScene;
@end
NS_ASSUME_NONNULL_END