AgoraChatSDK 1.3.1
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
171-(instancetype _Nonnull ) init __attribute__((unavailable("call sharedClient instead")));
172-(instancetype _Nonnull ) copy __attribute__((unavailable("call sharedClient instead")));
173-(instancetype _Nonnull ) mutableCopy __attribute__((unavailable("call sharedClient instead")));
178+ (instancetype _Nonnull )sharedClient;
179
180
185- (NSString *)version;
186
187#pragma mark - Delegate
188
195- (void)addDelegate:(id<AgoraChatClientDelegate>_Nonnull)aDelegate
196 delegateQueue:(dispatch_queue_t _Nullable )aQueue;
197
204- (void)removeDelegate:(id _Nonnull )aDelegate;
205
213- (void)addMultiDevicesDelegate:(id<AgoraChatMultiDevicesDelegate>_Nonnull)aDelegate
214 delegateQueue:(dispatch_queue_t _Nullable )aQueue NS_SWIFT_NAME(addMultiDevices(delegate:queue:));
215
222- (void)removeMultiDevicesDelegate:(id<AgoraChatMultiDevicesDelegate>_Nonnull)aDelegate;
223
224#pragma mark - Initialize SDK
225
234- (AgoraChatError *_Nullable)initializeSDKWithOptions:(AgoraChatOptions * _Nonnull )aOptions;
235
236#pragma mark - Change AppKey
237
248- (AgoraChatError *_Nullable)changeAppkey:(NSString * _Nonnull)aAppkey;
249
250#pragma mark - User Registration
267- (AgoraChatError *_Nullable)registerWithUsername:(NSString * _Nonnull)aUsername
268 password:(NSString * _Nonnull)aPassword;
269
283- (void)registerWithUsername:(NSString *_Nonnull)aUsername
284 password:(NSString *_Nonnull)aPassword
285 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, AgoraChatError * _Nullable aError))aCompletionBlock;
286
287#pragma mark - Login
288
300- (void)fetchTokenWithUsername:(NSString *_Nonnull)aUsername
301 password:(NSString *_Nonnull)aPassword
302 completion:(void (^_Nullable)(NSString * _Nullable aToken, AgoraChatError * _Nullable aError))aCompletionBlock;
303
317- (AgoraChatError *_Nullable)loginWithUsername:(NSString *_Nonnull)aUsername
318 password:(NSString *_Nonnull)aPassword EM_DEPRECATED_IOS(3_0_0, 4_5_0,"Use -AgoraChatClient loginWithUsername:token:completion instead");
319
333- (void)loginWithUsername:(NSString *_Nonnull)aUsername
334 password:(NSString *_Nonnull)aPassword
335 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, AgoraChatError *_Nullable aError))aCompletionBlock EM_DEPRECATED_IOS(3_0_0, 4_5_0,"Use -AgoraChatClient loginWithUsername:token:completion instead");
336
350- (AgoraChatError *_Nullable)loginWithUsername:(NSString *_Nonnull)aUsername
351 token:(NSString *_Nonnull)aToken;
352
364- (void)loginWithUsername:(NSString *_Nonnull)aUsername
365 token:(NSString *_Nonnull)aToken
366 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, AgoraChatError *_Nullable aError))aCompletionBlock;
367
379- (AgoraChatError *_Nullable)loginWithUsername:(NSString *_Nonnull)aUsername
380 agoraToken:(NSString *_Nonnull)aAgoraToken EM_DEPRECATED_IOS(3_8_9, 4_2_0,"Use -AgoraChatClient loginWithUsername:token instead");
381
394- (void)loginWithUsername:(NSString *_Nonnull)aUsername
395 agoraToken:(NSString *_Nonnull)aAgoraToken
396 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, AgoraChatError *_Nullable aError))aCompletionBlock EM_DEPRECATED_IOS(3_8_9, 4_2_0,"Use -AgoraChatClient loginWithUsername:token:completion instead");
397
410- (AgoraChatError *_Nullable)renewToken:(NSString *_Nonnull)newToken;
411
424- (void)renewToken:(NSString *_Nonnull)newToken completion:(void (^_Nullable)(AgoraChatError* _Nullable aError))aCompletionBlock;
425
426#pragma mark - Logout
427
441- (AgoraChatError *_Nullable)logout:(BOOL)aIsUnbindDeviceToken;
442
456- (void)logout:(BOOL)aIsUnbindDeviceToken
457 completion:(void (^_Nullable)(AgoraChatError * _Nullable aError))aCompletionBlock;
458
459#pragma mark - PushKit
460
473- (AgoraChatError *_Nullable)bindPushKitToken:(NSData *_Nullable)aPushToken;
474
486- (void)registerPushKitToken:(NSData *_Nullable)aPushToken
487 completion:(void (^_Nullable)(AgoraChatError * _Nullable aError))aCompletionBlock;
488
501- (AgoraChatError *_Nullable)unBindPushKitToken;
502
515- (void)unRegisterPushKitTokenWithCompletion:(void (^_Nullable)(AgoraChatError * _Nullable aError))aCompletionBlock;
516
517#pragma mark - APNs
518
531- (AgoraChatError *_Nullable)bindDeviceToken:(NSData *_Nonnull)aDeviceToken;
532
544- (void)registerForRemoteNotificationsWithDeviceToken:(NSData *_Nonnull)aDeviceToken
545 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
546
559- (void)registerForRemoteNotificationsWithCertName:(NSString *_Nonnull)aCertName
560 deviceToken:(NSData *_Nonnull)aDeviceToken
561 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
562
574- (void)bindFCMToken:(NSString* _Nonnull)aFCMToken
575 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
576
577#pragma mark - Log
578
589- (AgoraChatError *_Nullable)uploadLogToServer;
590
597- (void)uploadDebugLogToServerWithCompletion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
598
611- (NSString *_Nullable)getLogFilesPath:(AgoraChatError **_Nullable)pError;
612
623- (void)getLogFilesPathWithCompletion:(void (^_Nullable)(NSString *_Nullable aPath, AgoraChatError * _Nullable aError))aCompletionBlock;
624
635- (void)log:(NSString *_Nonnull)aLog;
636
644- (void)addLogDelegate:(id<AgoraChatLogDelegate>_Nonnull)aDelegate
645 delegateQueue:(dispatch_queue_t _Nullable )aQueue NS_SWIFT_NAME(addLog(delegate:queue:));
646
653- (void)removeLogDelegate:(id<AgoraChatLogDelegate>_Nonnull)aDelegate NS_SWIFT_NAME(removeLog(delegate:));
654
655#pragma mark - Multi Devices
656
669- (NSArray<AgoraChatDeviceConfig*> *_Nullable)getLoggedInDevicesFromServerWithUsername:(NSString * _Nonnull)aUsername
670 password:(NSString * _Nonnull)aPassword
671 error:(AgoraChatError ** _Nullable)pError;
672
684- (void)getLoggedInDevicesFromServerWithUsername:(NSString *_Nonnull)aUsername
685 password:(NSString *_Nonnull)aPassword
686 completion:(void (^_Nullable)(NSArray<AgoraChatDeviceConfig*> * _Nullable aList, AgoraChatError *_Nullable aError))aCompletionBlock;
687
699- (void)getLoggedInDevicesFromServerWithUserId:(NSString *_Nonnull)aUserID
700 token:(NSString *_Nonnull)aToken
701 completion:(void (^_Nullable)(NSArray<AgoraChatDeviceConfig*> * _Nullable aList, AgoraChatError *_Nullable aError))aCompletionBlock;
702
717- (AgoraChatError *_Nullable)kickDeviceWithUsername:(NSString *_Nonnull)aUsername
718 password:(NSString *_Nonnull)aPassword
719 resource:(NSString *_Nonnull)aResource;
720
721
735- (void)kickDeviceWithUsername:(NSString *_Nonnull)aUsername
736 password:(NSString *_Nonnull)aPassword
737 resource:(NSString *_Nonnull)aResource
738 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
739
753- (void)kickDeviceWithUserId:(NSString *_Nonnull)aUserID
754 token:(NSString *_Nonnull)aToken
755 resource:(NSString *_Nonnull)aResource
756 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
757
768- (void)kickAllDevicesWithUserId:(NSString *_Nonnull)aUserID
769 token:(NSString *_Nonnull)aToken
770 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
771
783- (AgoraChatError *_Nullable)kickAllDevicesWithUsername:(NSString *_Nonnull)aUsername
784 password:(NSString *_Nonnull)aPassword;
785
796- (void)kickAllDevicesWithUsername:(NSString *_Nonnull)aUsername
797 password:(NSString *_Nonnull)aPassword
798 completion:(void (^_Nullable)(AgoraChatError *_Nullable aError))aCompletionBlock;
799
806- (AgoraChatDeviceConfig *)getDeviceConfig:(AgoraChatError **)pError;
807
808#pragma mark - iOS
809
810
819- (void)applicationDidEnterBackground:(id _Nonnull )aApplication;
820
829- (void)applicationWillEnterForeground:(id _Nonnull )aApplication;
830
840- (void)application:(id _Nonnull)application didReceiveRemoteNotification:(NSDictionary * _Nullable)userInfo;
841
842#pragma mark - Service Check
843
858- (void)serviceCheckWithUsername:(NSString *_Nonnull)aUsername
859 password:(NSString *_Nonnull)aPassword
860 completion:(void (^_Nullable)(AgoraChatServerCheckType aType, AgoraChatError *_Nullable aError))aCompletionBlock __deprecated_msg("This method is deprecated");
861
862@property (nonatomic, strong, readonly) id<IAgoraChatTranslateManager> _Nonnull translateManager EM_DEPRECATED_IOS(3_8_9, 3_9_5,"Use -IAgoraChatManager translateMessage: instead");
863@end
Definition: AgoraChatClient.h:56
Definition: AgoraChatDeviceConfig.h:16
Definition: AgoraChatError.h:18
Definition: AgoraChatOptions.h:40
Definition: AgoraChatPushOptions.h:40
Definition: AgoraChatClientDelegate.h:33
Definition: AgoraChatLogDelegate.h:15
Definition: AgoraChatMultiDevicesDelegate.h:69