HyphenateChatSDK 3.9.9.1
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 "IEMCircleManager.h"
26#import "IEMStatisticsManager.h"
27
28#import "EMDeviceConfig.h"
29#import "EMLocalNotificationManager.h"
30#import "EMTranslationResult.h"
31#import "EMLogDelegate.h"
32
41typedef NS_ENUM(NSInteger, EMServerCheckType) {
42 EMServerCheckAccountValidation = 0,
43 EMServerCheckGetDNSListFromServer,
44 EMServerCheckGetTokenFromServer,
45 EMServerCheckDoLogin,
46 EMServerCheckDoLogout,
47};
48
58@interface EMClient : NSObject
59{
60 EMPushOptions *_pushOptions;
61}
62
70@property(nonatomic, strong, readonly) NSString * _Nonnull version;
71
79@property(nonatomic, strong, readonly) NSString * _Nullable currentUsername;
80
88@property(nonatomic, strong, readonly) EMOptions * _Nonnull options;
89
97@property(nonatomic, strong, readonly) id<IEMChatManager> _Nullable chatManager;
98
106@property(nonatomic, strong, readonly) id<IEMContactManager> _Nullable contactManager;
107
115@property(nonatomic, strong, readonly) id<IEMGroupManager> _Nullable groupManager;
116
125@property (nonatomic, strong, readonly) id<IEMThreadManager> _Nullable threadManager;
126
134@property(nonatomic, strong, readonly) id<IEMChatroomManager> _Nullable roomManager;
135
143@property (nonatomic, strong, readonly) id<IEMPushManager> _Nullable pushManager;
144
152@property (nonatomic, strong, readonly) id<IEMCircleManager> _Nullable circleManager;
153
162@property(nonatomic, readonly) BOOL isAutoLogin;
163
171@property(nonatomic, readonly) BOOL isLoggedIn;
172
180@property(nonatomic, readonly) BOOL isConnected;
181
189@property(nonatomic, readonly) NSString * _Nullable accessUserToken;
190
198@property(nonatomic, strong, readonly) id<IEMUserInfoManager> _Nullable userInfoManager;
199
207@property (nonatomic, strong, readonly) id<IEMPresenceManager> _Nullable presenceManager;
208
216@property (nonatomic, strong, readonly) id<IEMStatisticsManager> _Nullable statisticsManager;
217
225+ (instancetype _Nonnull )sharedClient;
226
227
235- (NSString *)version;
236
237#pragma mark - Delegate
238
251- (void)addDelegate:(id<EMClientDelegate>_Nonnull)aDelegate
252 delegateQueue:(dispatch_queue_t _Nullable )aQueue;
253
265- (void)removeDelegate:(id _Nonnull )aDelegate;
266
280- (void)addMultiDevicesDelegate:(id<EMMultiDevicesDelegate>_Nonnull)aDelegate
281 delegateQueue:(dispatch_queue_t _Nullable )aQueue NS_SWIFT_NAME(addMultiDevices(delegate:queue:));
282
294- (void)removeMultiDevicesDelegate:(id<EMMultiDevicesDelegate>_Nonnull)aDelegate;
295
296#pragma mark - Initialize SDK
297
313- (EMError *_Nullable)initializeSDKWithOptions:(EMOptions * _Nonnull )aOptions;
314
315#pragma mark - Change AppKey
316
334- (EMError *_Nullable)changeAppkey:(NSString * _Nonnull)aAppkey;
335
336#pragma mark - User Registeration
337
363- (EMError *_Nullable)registerWithUsername:(NSString * _Nonnull)aUsername
364 password:(NSString * _Nonnull)aPassword;
365
394- (void)registerWithUsername:(NSString *_Nonnull)aUsername
395 password:(NSString *_Nonnull)aPassword
396 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, EMError * _Nullable aError))aCompletionBlock;
397
398#pragma mark - Login
399
420- (void)fetchTokenWithUsername:(NSString *_Nonnull)aUsername
421 password:(NSString *_Nonnull)aPassword
422 completion:(void (^_Nullable)(NSString * _Nullable aToken, EMError * _Nullable aError))aCompletionBlock;
423
449- (EMError *_Nullable)loginWithUsername:(NSString *_Nonnull)aUsername
450 password:(NSString *_Nonnull)aPassword;
451
476- (void)loginWithUsername:(NSString *_Nonnull)aUsername
477 password:(NSString *_Nonnull)aPassword
478 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, EMError *_Nullable aError))aCompletionBlock;
479
501- (EMError *_Nullable)loginWithUsername:(NSString *_Nonnull)aUsername
502 token:(NSString *_Nonnull)aToken;
503
524- (void)loginWithUsername:(NSString *_Nonnull)aUsername
525 token:(NSString *_Nonnull)aToken
526 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, EMError *_Nullable aError))aCompletionBlock;
527
549- (EMError *_Nullable)loginWithUsername:(NSString *_Nonnull)aUsername
550 agoraToken:(NSString *_Nonnull)aAgoraToken;
551
569- (void)loginWithUsername:(NSString *_Nonnull)aUsername
570 agoraToken:(NSString *_Nonnull)aAgoraToken
571 completion:(void (^_Nullable)(NSString * _Nonnull aUsername, EMError *_Nullable aError))aCompletionBlock;
572
598- (EMError *_Nullable)renewToken:(NSString *_Nonnull)newAgoraToken;
599
600#pragma mark - Logout
601
621- (EMError *_Nullable)logout:(BOOL)aIsUnbindDeviceToken;
622
641- (void)logout:(BOOL)aIsUnbindDeviceToken
642 completion:(void (^_Nullable)(EMError * _Nullable aError))aCompletionBlock;
643
644#pragma mark - PushKit
645
667- (EMError *_Nullable)bindPushKitToken:(NSData *_Nullable)aPushToken;
668
688- (void)registerPushKitToken:(NSData *_Nullable)aPushToken
689 completion:(void (^_Nullable)(EMError * _Nullable aError))aCompletionBlock;
690
708- (EMError *_Nullable)unBindPushKitToken;
709
723- (void)unRegisterPushKitTokenWithCompletion:(void (^_Nullable)(EMError * _Nullable aError))aCompletionBlock;
724
725#pragma mark - APNs
726
748- (EMError *_Nullable)bindDeviceToken:(NSData *_Nonnull)aDeviceToken;
749
767- (void)registerForRemoteNotificationsWithDeviceToken:(NSData *_Nonnull)aDeviceToken
768 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
769
770#pragma mark - Log
771
789- (EMError *_Nullable)uploadLogToServer;
790
802- (void)uploadDebugLogToServerWithCompletion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
803
824- (NSString *_Nullable)getLogFilesPath:(EMError **_Nullable)pError;
825
841- (void)getLogFilesPathWithCompletion:(void (^_Nullable)(NSString *_Nullable aPath, EMError * _Nullable aError))aCompletionBlock;
842
858- (void)log:(NSString *_Nonnull)aLog;
859
873- (void)addLogDelegate:(id<EMLogDelegate>_Nonnull)aDelegate
874 delegateQueue:(dispatch_queue_t _Nullable )aQueue NS_SWIFT_NAME(addLog(delegate:queue:));
875
887- (void)removeLogDelegate:(id<EMLogDelegate>_Nonnull)aDelegate NS_SWIFT_NAME(removeLog(delegate:));
888
889#pragma mark - Multi Devices
890
914- (NSArray<EMDeviceConfig*> *_Nullable)getLoggedInDevicesFromServerWithUsername:(NSString * _Nonnull)aUsername
915 password:(NSString * _Nonnull)aPassword
916 error:(EMError ** _Nullable)pError;
917
938- (void)getLoggedInDevicesFromServerWithUsername:(NSString *_Nonnull)aUsername
939 password:(NSString *_Nonnull)aPassword
940 completion:(void (^_Nullable)(NSArray<EMDeviceConfig*> * _Nullable aList, EMError *_Nullable aError))aCompletionBlock;
941
965- (EMError *_Nullable)kickDeviceWithUsername:(NSString *_Nonnull)aUsername
966 password:(NSString *_Nonnull)aPassword
967 resource:(NSString *_Nonnull)aResource;
968
992- (void)kickDeviceWithUsername:(NSString *_Nonnull)aUsername
993 password:(NSString *_Nonnull)aPassword
994 resource:(NSString *_Nonnull)aResource
995 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
996
1018- (EMError *_Nullable)kickAllDevicesWithUsername:(NSString *_Nonnull)aUsername
1019 password:(NSString *_Nonnull)aPassword;
1020
1040- (void)kickAllDevicesWithUsername:(NSString *_Nonnull)aUsername
1041 password:(NSString *_Nonnull)aPassword
1042 completion:(void (^_Nullable)(EMError *_Nullable aError))aCompletionBlock;
1043
1055- (EMDeviceConfig *)getDeviceConfig:(EMError **)pError;
1056
1057#pragma mark - iOS
1058
1076- (BOOL)migrateDatabaseToLatestSDK;
1077
1089- (void)applicationDidEnterBackground:(id _Nonnull )aApplication;
1090
1102- (void)applicationWillEnterForeground:(id _Nonnull )aApplication;
1103
1117- (void)application:(id _Nonnull)application didReceiveRemoteNotification:(NSDictionary * _Nullable)userInfo;
1118
1119#pragma mark - Service Check
1120
1143- (void)serviceCheckWithUsername:(NSString *_Nonnull)aUsername
1144 password:(NSString *_Nonnull)aPassword
1145 completion:(void (^_Nullable)(EMServerCheckType aType, EMError *_Nullable aError))aCompletionBlock;
1146
1147@property (nonatomic, strong, readonly) id<IEMTranslateManager> _Nonnull translateManager EM_DEPRECATED_IOS(3_8_9, 3_9_5,"Use -IEMChatManager translateMessage: instead");
1148@end
Definition: EMClient.h:59
Definition: EMDeviceConfig.h:25
Definition: EMError.h:27
Definition: EMOptions.h:52
Definition: EMPushOptions.h:58
Definition: EMClientDelegate.h:45
Definition: EMLogDelegate.h:18
Definition: EMMultiDevicesDelegate.h:84