HyphenateChatSDK 4.10.0
EMClient.h
1
8#import <Foundation/Foundation.h>
9
10#import "EMClientDelegate.h"
11#import "EMError.h"
12#import "EMMultiDevicesDelegate.h"
13#import "EMOptions.h"
14#import "EMPushOptions.h"
15
16#import "IEMChatManager.h"
17#import "IEMChatroomManager.h"
18#import "IEMContactManager.h"
19#import "IEMGroupManager.h"
20#import "IEMThreadManager.h"
21#import "IEMPushManager.h"
22#import "IEMUserInfoManager.h"
23#import "IEMTranslateManager.h"
24#import "IEMPresenceManager.h"
25#import "IEMStatisticsManager.h"
26
27#import "EMDeviceConfig.h"
28#import "EMLocalNotificationManager.h"
29#import "EMTranslationResult.h"
30#import "EMLogDelegate.h"
31
45typedef NS_ENUM(NSInteger, EMServerCheckType) {
46 EMServerCheckAccountValidation = 0,
47 EMServerCheckGetDNSListFromServer,
48 EMServerCheckGetTokenFromServer,
49 EMServerCheckDoLogin,
50 EMServerCheckDoLogout,
51};
52
63@interface EMClient : NSObject
64{
65 EMPushOptions *_pushOptions;
66}
67
75@property(nonatomic, strong, readonly) NSString * _Nonnull version;
76
84@property(nonatomic, strong, readonly) NSString * _Nullable currentUsername;
85
93@property(nonatomic, strong, readonly) EMOptions * _Nonnull options;
94
102@property(nonatomic, strong, readonly) id<IEMChatManager> _Nullable chatManager;
103
111@property(nonatomic, strong, readonly) id<IEMContactManager> _Nullable contactManager;
112
120@property(nonatomic, strong, readonly) id<IEMGroupManager> _Nullable groupManager;
121
129@property (nonatomic, strong, readonly) id<IEMThreadManager> _Nullable threadManager;
130
138@property(nonatomic, strong, readonly) id<IEMChatroomManager> _Nullable roomManager;
139
147@property (nonatomic, strong, readonly) id<IEMPushManager> _Nullable pushManager;
148
167@property(nonatomic, readonly) BOOL isAutoLogin;
168
180@property(nonatomic, readonly) BOOL isLoggedIn;
181
192@property(nonatomic, readonly) BOOL isConnected;
193
205@property(nonatomic, readonly) NSString * _Nullable accessUserToken;
206
214@property(nonatomic, strong, readonly) id<IEMUserInfoManager> _Nullable userInfoManager;
215
223@property (nonatomic, strong, readonly) id<IEMPresenceManager> _Nullable presenceManager;
224
232@property (nonatomic, strong, readonly) id<IEMStatisticsManager> _Nullable statisticsManager;
233
234-(instancetype _Nonnull ) init __attribute__((unavailable("call sharedClient instead")));
235-(instancetype _Nonnull ) copy __attribute__((unavailable("call sharedClient instead")));
236-(instancetype _Nonnull ) mutableCopy __attribute__((unavailable("call sharedClient instead")));
244+ (instancetype _Nonnull )sharedClient;
245
246
254- (NSString *)version;
255
256#pragma mark - Delegate
257
270- (void)addDelegate:(id<EMClientDelegate>_Nonnull)aDelegate
271 delegateQueue:(dispatch_queue_t _Nullable )aQueue;
272
284- (void)removeDelegate:(id _Nonnull )aDelegate;
285
299- (void)addMultiDevicesDelegate:(id<EMMultiDevicesDelegate>_Nonnull)aDelegate
300 delegateQueue:(dispatch_queue_t _Nullable )aQueue NS_SWIFT_NAME(addMultiDevices(delegate:queue:));
301
313- (void)removeMultiDevicesDelegate:(id<EMMultiDevicesDelegate>_Nonnull)aDelegate;
314
315#pragma mark - Initialize SDK
316
332- (EMError *_Nullable)initializeSDKWithOptions:(EMOptions * _Nonnull )aOptions;
333
334#pragma mark - Change AppKey
335
357- (EMError *_Nullable)changeAppkey:(NSString * _Nonnull)aAppkey;
358
359#pragma mark - User Registration
388- (EMError *_Nullable)registerWithUsername:(NSString * _Nonnull)aUsername
389 password:(NSString * _Nonnull)aPassword;
390
415- (void)registerWithUsername:(NSString *_Nonnull)aUsername
416 password:(NSString *_Nonnull)aPassword
417 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, EMError * _Nullable aError))aCompletionBlock;
418
419#pragma mark - Login
420
441- (void)fetchTokenWithUsername:(NSString *_Nonnull)aUsername
442 password:(NSString *_Nonnull)aPassword
443 completion:(void (^_Nullable)(NSString * _Nullable aToken, EMError * _Nullable aError))aCompletionBlock;
444
470- (EMError *_Nullable)loginWithUsername:(NSString *_Nonnull)aUsername
471 password:(NSString *_Nonnull)aPassword EM_DEPRECATED_IOS(3_0_0, 4_5_0,"Use -EMClient loginWithUsername:token:completion instead");
472
497- (void)loginWithUsername:(NSString *_Nonnull)aUsername
498 password:(NSString *_Nonnull)aPassword
499 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, EMError *_Nullable aError))aCompletionBlock EM_DEPRECATED_IOS(3_0_0, 4_5_0,"Use -EMClient loginWithUsername:token:completion instead");
500
526- (EMError *_Nullable)loginWithUsername:(NSString *_Nonnull)aUsername
527 token:(NSString *_Nonnull)aToken;
528
549- (void)loginWithUsername:(NSString *_Nonnull)aUsername
550 token:(NSString *_Nonnull)aToken
551 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, EMError *_Nullable aError))aCompletionBlock;
552
574- (EMError *_Nullable)loginWithUsername:(NSString *_Nonnull)aUsername
575 agoraToken:(NSString *_Nonnull)aAgoraToken EM_DEPRECATED_IOS(3_8_9, 4_2_0,"Use -EMClient loginWithUsername:token instead");
576
598- (void)loginWithUsername:(NSString *_Nonnull)aUsername
599 agoraToken:(NSString *_Nonnull)aAgoraToken
600 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, EMError *_Nullable aError))aCompletionBlock EM_DEPRECATED_IOS(3_8_9, 4_2_0,"Use -EMClient loginWithUsername:token:completion instead");
601
625- (EMError *_Nullable)renewToken:(NSString *_Nonnull)newToken;
626
650- (void)renewToken:(NSString *_Nonnull)newToken completion:(void (^_Nullable)(EMError* _Nullable aError))aCompletionBlock;
651
652#pragma mark - Logout
653
678- (EMError *_Nullable)logout:(BOOL)aIsUnbindDeviceToken;
679
703- (void)logout:(BOOL)aIsUnbindDeviceToken
704 completion:(void (^_Nullable)(EMError * _Nullable aError))aCompletionBlock;
705
706#pragma mark - PushKit
707
731- (EMError *_Nullable)bindPushKitToken:(NSData *_Nullable)aPushToken;
732
754- (void)registerPushKitToken:(NSData *_Nullable)aPushToken
755 completion:(void (^_Nullable)(EMError * _Nullable aError))aCompletionBlock;
756
780- (EMError *_Nullable)unBindPushKitToken;
781
803- (void)unRegisterPushKitTokenWithCompletion:(void (^_Nullable)(EMError * _Nullable aError))aCompletionBlock;
804
805#pragma mark - APNs
806
831- (EMError *_Nullable)bindDeviceToken:(NSData *_Nonnull)aDeviceToken;
832
854- (void)registerForRemoteNotificationsWithDeviceToken:(NSData *_Nonnull)aDeviceToken
855 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
856
880- (void)registerForRemoteNotificationsWithCertName:(NSString *_Nonnull)aCertName
881 deviceToken:(NSData *_Nonnull)aDeviceToken
882 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
883
906- (void)bindFCMToken:(NSString* _Nonnull)aFCMToken
907 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
908
909#pragma mark - Log
910
928- (EMError *_Nullable)uploadLogToServer;
929
941- (void)uploadDebugLogToServerWithCompletion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
942
966- (NSString *_Nullable)getLogFilesPath:(EMError **_Nullable)pError;
967
987- (void)getLogFilesPathWithCompletion:(void (^_Nullable)(NSString *_Nullable aPath, EMError * _Nullable aError))aCompletionBlock;
988
1008- (void)log:(NSString *_Nonnull)aLog;
1009
1023- (void)addLogDelegate:(id<EMLogDelegate>_Nonnull)aDelegate
1024 delegateQueue:(dispatch_queue_t _Nullable )aQueue NS_SWIFT_NAME(addLog(delegate:queue:));
1025
1037- (void)removeLogDelegate:(id<EMLogDelegate>_Nonnull)aDelegate NS_SWIFT_NAME(removeLog(delegate:));
1038
1039#pragma mark - Multi Devices
1040
1064- (NSArray<EMDeviceConfig*> *_Nullable)getLoggedInDevicesFromServerWithUsername:(NSString * _Nonnull)aUsername
1065 password:(NSString * _Nonnull)aPassword
1066 error:(EMError ** _Nullable)pError;
1067
1088- (void)getLoggedInDevicesFromServerWithUsername:(NSString *_Nonnull)aUsername
1089 password:(NSString *_Nonnull)aPassword
1090 completion:(void (^_Nullable)(NSArray<EMDeviceConfig*> * _Nullable aList, EMError *_Nullable aError))aCompletionBlock;
1091
1112- (void)getLoggedInDevicesFromServerWithUserId:(NSString *_Nonnull)aUserID
1113 token:(NSString *_Nonnull)aToken
1114 completion:(void (^_Nullable)(NSArray<EMDeviceConfig*> * _Nullable aList, EMError *_Nullable aError))aCompletionBlock;
1115
1143- (EMError *_Nullable)kickDeviceWithUsername:(NSString *_Nonnull)aUsername
1144 password:(NSString *_Nonnull)aPassword
1145 resource:(NSString *_Nonnull)aResource;
1146
1147
1173- (void)kickDeviceWithUsername:(NSString *_Nonnull)aUsername
1174 password:(NSString *_Nonnull)aPassword
1175 resource:(NSString *_Nonnull)aResource
1176 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
1177
1203- (void)kickDeviceWithUserId:(NSString *_Nonnull)aUserID
1204 token:(NSString *_Nonnull)aToken
1205 resource:(NSString *_Nonnull)aResource
1206 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
1207
1227- (void)kickAllDevicesWithUserId:(NSString *_Nonnull)aUserID
1228 token:(NSString *_Nonnull)aToken
1229 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
1230
1252- (EMError *_Nullable)kickAllDevicesWithUsername:(NSString *_Nonnull)aUsername
1253 password:(NSString *_Nonnull)aPassword;
1254
1275- (void)kickAllDevicesWithUsername:(NSString *_Nonnull)aUsername
1276 password:(NSString *_Nonnull)aPassword
1277 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
1278
1290- (EMDeviceConfig *)getDeviceConfig:(EMError **)pError;
1291
1292#pragma mark - iOS
1293
1294
1308- (void)applicationDidEnterBackground:(id _Nonnull )aApplication;
1309
1323- (void)applicationWillEnterForeground:(id _Nonnull )aApplication;
1324
1340- (void)application:(id _Nonnull)application didReceiveRemoteNotification:(NSDictionary * _Nullable)userInfo;
1341
1342#pragma mark - Service Check
1343
1371- (void)serviceCheckWithUsername:(NSString *_Nonnull)aUsername
1372 password:(NSString *_Nonnull)aPassword
1373 completion:(void (^_Nullable)(EMServerCheckType aType, EMError *_Nullable aError))aCompletionBlock __deprecated_msg("This method is deprecated");
1374
1375@property (nonatomic, strong, readonly) id<IEMTranslateManager> _Nonnull translateManager EM_DEPRECATED_IOS(3_8_9, 3_9_5,"Use -IEMChatManager translateMessage: instead");
1376@end
Definition: EMClient.h:64
Definition: EMDeviceConfig.h:25
Definition: EMError.h:27
Definition: EMOptions.h:52
Definition: EMPushOptions.h:58
Definition: EMClientDelegate.h:47
Definition: EMLogDelegate.h:18
Definition: EMMultiDevicesDelegate.h:80