HyphenateChatSDK 4.4.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;
472
497- (void)loginWithUsername:(NSString *_Nonnull)aUsername
498 password:(NSString *_Nonnull)aPassword
499 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, EMError *_Nullable aError))aCompletionBlock;
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
879- (void)bindFCMToken:(NSString* _Nonnull)aFCMToken
880 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
881
882#pragma mark - Log
883
901- (EMError *_Nullable)uploadLogToServer;
902
914- (void)uploadDebugLogToServerWithCompletion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
915
939- (NSString *_Nullable)getLogFilesPath:(EMError **_Nullable)pError;
940
960- (void)getLogFilesPathWithCompletion:(void (^_Nullable)(NSString *_Nullable aPath, EMError * _Nullable aError))aCompletionBlock;
961
981- (void)log:(NSString *_Nonnull)aLog;
982
996- (void)addLogDelegate:(id<EMLogDelegate>_Nonnull)aDelegate
997 delegateQueue:(dispatch_queue_t _Nullable )aQueue NS_SWIFT_NAME(addLog(delegate:queue:));
998
1010- (void)removeLogDelegate:(id<EMLogDelegate>_Nonnull)aDelegate NS_SWIFT_NAME(removeLog(delegate:));
1011
1012#pragma mark - Multi Devices
1013
1037- (NSArray<EMDeviceConfig*> *_Nullable)getLoggedInDevicesFromServerWithUsername:(NSString * _Nonnull)aUsername
1038 password:(NSString * _Nonnull)aPassword
1039 error:(EMError ** _Nullable)pError;
1040
1061- (void)getLoggedInDevicesFromServerWithUsername:(NSString *_Nonnull)aUsername
1062 password:(NSString *_Nonnull)aPassword
1063 completion:(void (^_Nullable)(NSArray<EMDeviceConfig*> * _Nullable aList, EMError *_Nullable aError))aCompletionBlock;
1064
1085- (void)getLoggedInDevicesFromServerWithUserId:(NSString *_Nonnull)aUserID
1086 token:(NSString *_Nonnull)aToken
1087 completion:(void (^_Nullable)(NSArray<EMDeviceConfig*> * _Nullable aList, EMError *_Nullable aError))aCompletionBlock;
1088
1116- (EMError *_Nullable)kickDeviceWithUsername:(NSString *_Nonnull)aUsername
1117 password:(NSString *_Nonnull)aPassword
1118 resource:(NSString *_Nonnull)aResource;
1119
1120
1146- (void)kickDeviceWithUsername:(NSString *_Nonnull)aUsername
1147 password:(NSString *_Nonnull)aPassword
1148 resource:(NSString *_Nonnull)aResource
1149 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
1150
1176- (void)kickDeviceWithUserId:(NSString *_Nonnull)aUserID
1177 token:(NSString *_Nonnull)aToken
1178 resource:(NSString *_Nonnull)aResource
1179 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
1180
1200- (void)kickAllDevicesWithUserId:(NSString *_Nonnull)aUserID
1201 token:(NSString *_Nonnull)aToken
1202 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
1203
1225- (EMError *_Nullable)kickAllDevicesWithUsername:(NSString *_Nonnull)aUsername
1226 password:(NSString *_Nonnull)aPassword;
1227
1248- (void)kickAllDevicesWithUsername:(NSString *_Nonnull)aUsername
1249 password:(NSString *_Nonnull)aPassword
1250 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
1251
1263- (EMDeviceConfig *)getDeviceConfig:(EMError **)pError;
1264
1265#pragma mark - iOS
1266
1267
1281- (void)applicationDidEnterBackground:(id _Nonnull )aApplication;
1282
1296- (void)applicationWillEnterForeground:(id _Nonnull )aApplication;
1297
1313- (void)application:(id _Nonnull)application didReceiveRemoteNotification:(NSDictionary * _Nullable)userInfo;
1314
1315#pragma mark - Service Check
1316
1344- (void)serviceCheckWithUsername:(NSString *_Nonnull)aUsername
1345 password:(NSString *_Nonnull)aPassword
1346 completion:(void (^_Nullable)(EMServerCheckType aType, EMError *_Nullable aError))aCompletionBlock;
1347
1348@property (nonatomic, strong, readonly) id<IEMTranslateManager> _Nonnull translateManager EM_DEPRECATED_IOS(3_8_9, 3_9_5,"Use -IEMChatManager translateMessage: instead");
1349@end
Definition: EMClient.h:64
Definition: EMDeviceConfig.h:25
Definition: EMError.h:27
Definition: EMOptions.h:52
Definition: EMPushOptions.h:58
Definition: EMClientDelegate.h:46
Definition: EMLogDelegate.h:18
Definition: EMMultiDevicesDelegate.h:79