AgoraChatSDK 1.2.0
AgoraChatClient.h
1
8#import <Foundation/Foundation.h>
9
10#import "AgoraChatClientDelegate.h"
11#import "AgoraChatError.h"
12#import "AgoraChatMultiDevicesDelegate.h"
13#import "AgoraChatOptions.h"
14#import "AgoraChatPushOptions.h"
15
16#import "IAgoraChatManager.h"
17#import "IAgoraChatroomManager.h"
18#import "IAgoraChatContactManager.h"
19#import "IAgoraChatGroupManager.h"
20#import "IAgoraChatThreadManager.h"
21#import "IAgoraChatPushManager.h"
22#import "IAgoraChatUserInfoManager.h"
23#import "IAgoraChatTranslateManager.h"
24#import "IAgoraChatPresenceManager.h"
25#import "IAgoraChatStatisticsManager.h"
26
27#import "AgoraChatDeviceConfig.h"
28#import "AgoraChatLocalNotificationManager.h"
29#import "AgoraChatTranslationResult.h"
30#import "AgoraChatLogDelegate.h"
31
40typedef NS_ENUM(NSInteger, AgoraChatServerCheckType) {
41 AgoraChatServerCheckAccountValidation = 0,
42 AgoraChatServerCheckGetDNSListFromServer,
43 AgoraChatServerCheckGetTokenFromServer,
44 AgoraChatServerCheckDoLogin,
45 AgoraChatServerCheckDoLogout,
46};
47
55@interface AgoraChatClient : NSObject
56{
57 AgoraChatPushOptions *_pushOptions;
58}
59
64@property(nonatomic, strong, readonly) NSString * _Nonnull version;
65
70@property(nonatomic, strong, readonly) NSString * _Nullable currentUsername;
71
76@property(nonatomic, strong, readonly) AgoraChatOptions * _Nonnull options;
77
82@property(nonatomic, strong, readonly) id<IAgoraChatManager> _Nullable chatManager;
83
88@property(nonatomic, strong, readonly) id<IAgoraChatContactManager> _Nullable contactManager;
89
94@property(nonatomic, strong, readonly) id<IAgoraChatGroupManager> _Nullable groupManager;
95
100@property (nonatomic, strong, readonly) id<IAgoraChatThreadManager> _Nullable threadManager;
101
106@property(nonatomic, strong, readonly) id<IAgoraChatroomManager> _Nullable roomManager;
107
112@property (nonatomic, strong, readonly) id<IAgoraChatPushManager> _Nullable pushManager;
113
124@property(nonatomic, readonly) BOOL isAutoLogin;
125
134@property(nonatomic, readonly) BOOL isLoggedIn;
135
143@property(nonatomic, readonly) BOOL isConnected;
144
151@property(nonatomic, readonly) NSString * _Nullable accessUserToken;
152
157@property(nonatomic, strong, readonly) id<IAgoraChatUserInfoManager> _Nullable userInfoManager;
158
163@property (nonatomic, strong, readonly) id<IAgoraChatPresenceManager> _Nullable presenceManager;
164
169@property (nonatomic, strong, readonly) id<IAgoraChatStatisticsManager> _Nullable statisticsManager;
170
175+ (instancetype _Nonnull )sharedClient;
176
177
182- (NSString *)version;
183
184#pragma mark - Delegate
185
192- (void)addDelegate:(id<AgoraChatClientDelegate>_Nonnull)aDelegate
193 delegateQueue:(dispatch_queue_t _Nullable )aQueue;
194
201- (void)removeDelegate:(id _Nonnull )aDelegate;
202
210- (void)addMultiDevicesDelegate:(id<AgoraChatMultiDevicesDelegate>_Nonnull)aDelegate
211 delegateQueue:(dispatch_queue_t _Nullable )aQueue NS_SWIFT_NAME(addMultiDevices(delegate:queue:));
212
219- (void)removeMultiDevicesDelegate:(id<AgoraChatMultiDevicesDelegate>_Nonnull)aDelegate;
220
221#pragma mark - Initialize SDK
222
231- (AgoraChatError *_Nullable)initializeSDKWithOptions:(AgoraChatOptions * _Nonnull )aOptions;
232
233#pragma mark - Change AppKey
234
245- (AgoraChatError *_Nullable)changeAppkey:(NSString * _Nonnull)aAppkey;
246
247#pragma mark - User Registration
264- (AgoraChatError *_Nullable)registerWithUsername:(NSString * _Nonnull)aUsername
265 password:(NSString * _Nonnull)aPassword;
266
280- (void)registerWithUsername:(NSString *_Nonnull)aUsername
281 password:(NSString *_Nonnull)aPassword
282 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, AgoraChatError * _Nullable aError))aCompletionBlock;
283
284#pragma mark - Login
285
297- (void)fetchTokenWithUsername:(NSString *_Nonnull)aUsername
298 password:(NSString *_Nonnull)aPassword
299 completion:(void (^_Nullable)(NSString * _Nullable aToken, AgoraChatError * _Nullable aError))aCompletionBlock;
300
314- (AgoraChatError *_Nullable)loginWithUsername:(NSString *_Nonnull)aUsername
315 password:(NSString *_Nonnull)aPassword;
316
330- (void)loginWithUsername:(NSString *_Nonnull)aUsername
331 password:(NSString *_Nonnull)aPassword
332 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, AgoraChatError *_Nullable aError))aCompletionBlock;
333
347- (AgoraChatError *_Nullable)loginWithUsername:(NSString *_Nonnull)aUsername
348 token:(NSString *_Nonnull)aToken;
349
361- (void)loginWithUsername:(NSString *_Nonnull)aUsername
362 token:(NSString *_Nonnull)aToken
363 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, AgoraChatError *_Nullable aError))aCompletionBlock;
364
376- (AgoraChatError *_Nullable)loginWithUsername:(NSString *_Nonnull)aUsername
377 agoraToken:(NSString *_Nonnull)aAgoraToken;
378
391- (void)loginWithUsername:(NSString *_Nonnull)aUsername
392 agoraToken:(NSString *_Nonnull)aAgoraToken
393 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, AgoraChatError *_Nullable aError))aCompletionBlock;
394
407- (AgoraChatError *_Nullable)renewToken:(NSString *_Nonnull)newAgoraToken;
408
409#pragma mark - Logout
410
424- (AgoraChatError *_Nullable)logout:(BOOL)aIsUnbindDeviceToken;
425
439- (void)logout:(BOOL)aIsUnbindDeviceToken
440 completion:(void (^_Nullable)(AgoraChatError * _Nullable aError))aCompletionBlock;
441
442#pragma mark - PushKit
443
456- (AgoraChatError *_Nullable)bindPushKitToken:(NSData *_Nullable)aPushToken;
457
469- (void)registerPushKitToken:(NSData *_Nullable)aPushToken
470 completion:(void (^_Nullable)(AgoraChatError * _Nullable aError))aCompletionBlock;
471
484- (AgoraChatError *_Nullable)unBindPushKitToken;
485
498- (void)unRegisterPushKitTokenWithCompletion:(void (^_Nullable)(AgoraChatError * _Nullable aError))aCompletionBlock;
499
500#pragma mark - APNs
501
514- (AgoraChatError *_Nullable)bindDeviceToken:(NSData *_Nonnull)aDeviceToken;
515
527- (void)registerForRemoteNotificationsWithDeviceToken:(NSData *_Nonnull)aDeviceToken
528 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
529
541- (void)bindFCMToken:(NSString* _Nonnull)aFCMToken
542 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
543
544#pragma mark - Log
545
556- (AgoraChatError *_Nullable)uploadLogToServer;
557
564- (void)uploadDebugLogToServerWithCompletion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
565
578- (NSString *_Nullable)getLogFilesPath:(AgoraChatError **_Nullable)pError;
579
590- (void)getLogFilesPathWithCompletion:(void (^_Nullable)(NSString *_Nullable aPath, AgoraChatError * _Nullable aError))aCompletionBlock;
591
602- (void)log:(NSString *_Nonnull)aLog;
603
611- (void)addLogDelegate:(id<AgoraChatLogDelegate>_Nonnull)aDelegate
612 delegateQueue:(dispatch_queue_t _Nullable )aQueue NS_SWIFT_NAME(addLog(delegate:queue:));
613
620- (void)removeLogDelegate:(id<AgoraChatLogDelegate>_Nonnull)aDelegate NS_SWIFT_NAME(removeLog(delegate:));
621
622#pragma mark - Multi Devices
623
636- (NSArray<AgoraChatDeviceConfig*> *_Nullable)getLoggedInDevicesFromServerWithUsername:(NSString * _Nonnull)aUsername
637 password:(NSString * _Nonnull)aPassword
638 error:(AgoraChatError ** _Nullable)pError;
639
651- (void)getLoggedInDevicesFromServerWithUsername:(NSString *_Nonnull)aUsername
652 password:(NSString *_Nonnull)aPassword
653 completion:(void (^_Nullable)(NSArray<AgoraChatDeviceConfig*> * _Nullable aList, AgoraChatError *_Nullable aError))aCompletionBlock;
654
666- (void)getLoggedInDevicesFromServerWithUserId:(NSString *_Nonnull)aUserID
667 token:(NSString *_Nonnull)aToken
668 completion:(void (^_Nullable)(NSArray<AgoraChatDeviceConfig*> * _Nullable aList, AgoraChatError *_Nullable aError))aCompletionBlock;
669
684- (AgoraChatError *_Nullable)kickDeviceWithUsername:(NSString *_Nonnull)aUsername
685 password:(NSString *_Nonnull)aPassword
686 resource:(NSString *_Nonnull)aResource;
687
688
702- (void)kickDeviceWithUsername:(NSString *_Nonnull)aUsername
703 password:(NSString *_Nonnull)aPassword
704 resource:(NSString *_Nonnull)aResource
705 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
706
720- (void)kickDeviceWithUserId:(NSString *_Nonnull)aUserID
721 token:(NSString *_Nonnull)aToken
722 resource:(NSString *_Nonnull)aResource
723 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
724
735- (void)kickAllDevicesWithUserId:(NSString *_Nonnull)aUserID
736 token:(NSString *_Nonnull)aToken
737 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
738
750- (AgoraChatError *_Nullable)kickAllDevicesWithUsername:(NSString *_Nonnull)aUsername
751 password:(NSString *_Nonnull)aPassword;
752
763- (void)kickAllDevicesWithUsername:(NSString *_Nonnull)aUsername
764 password:(NSString *_Nonnull)aPassword
765 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
766
773- (AgoraChatDeviceConfig *)getDeviceConfig:(AgoraChatError **)pError;
774
775#pragma mark - iOS
776
777
786- (void)applicationDidEnterBackground:(id _Nonnull )aApplication;
787
796- (void)applicationWillEnterForeground:(id _Nonnull )aApplication;
797
807- (void)application:(id _Nonnull)application didReceiveRemoteNotification:(NSDictionary * _Nullable)userInfo;
808
809#pragma mark - Service Check
810
825- (void)serviceCheckWithUsername:(NSString *_Nonnull)aUsername
826 password:(NSString *_Nonnull)aPassword
827 completion:(void (^_Nullable)(AgoraChatServerCheckType aType, AgoraChatError *_Nullable aError))aCompletionBlock;
828
829@property (nonatomic, strong, readonly) id<IAgoraChatTranslateManager> _Nonnull translateManager EM_DEPRECATED_IOS(3_8_9, 3_9_5,"Use -IAgoraChatManager translateMessage: instead");
830@end
Definition: AgoraChatClient.h:56
Definition: AgoraChatDeviceConfig.h:16
Definition: AgoraChatError.h:18
Definition: AgoraChatOptions.h:40
Definition: AgoraChatPushOptions.h:40
Definition: AgoraChatClientDelegate.h:32
Definition: AgoraChatLogDelegate.h:15
Definition: AgoraChatMultiDevicesDelegate.h:67